summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/config/IceGridAdmin.py62
-rw-r--r--cpp/src/IceGrid/AdminI.cpp1
-rw-r--r--cpp/src/IceGrid/Database.cpp6
-rw-r--r--cpp/src/IceGrid/Database.h2
-rw-r--r--cpp/src/IceGrid/DescriptorBuilder.cpp5
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.cpp18
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.h8
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp3
-rw-r--r--cpp/src/IceGrid/NodeCache.cpp9
-rw-r--r--cpp/src/IceGrid/NodeCache.h2
-rw-r--r--cpp/src/IceGrid/NodeI.cpp2
-rw-r--r--cpp/src/IceGrid/Parser.cpp11
-rw-r--r--cpp/src/IceGrid/RegistryI.cpp6
-rw-r--r--cpp/src/IceGrid/ServerAdapterI.cpp6
-rw-r--r--cpp/src/IceGrid/ServerCache.h2
-rw-r--r--cpp/src/IceGrid/ServerI.cpp450
-rw-r--r--cpp/src/IceGrid/ServerI.h10
-rw-r--r--cpp/src/IceGrid/WaitQueue.cpp34
-rw-r--r--cpp/test/IceGrid/Makefile2
-rw-r--r--cpp/test/IceGrid/activation/.depend6
-rw-r--r--cpp/test/IceGrid/activation/AllTests.cpp405
-rw-r--r--cpp/test/IceGrid/activation/Client.cpp56
-rw-r--r--cpp/test/IceGrid/activation/Makefile46
-rw-r--r--cpp/test/IceGrid/activation/Server.cpp68
-rw-r--r--cpp/test/IceGrid/activation/Test.ice25
-rw-r--r--cpp/test/IceGrid/activation/TestI.cpp38
-rw-r--r--cpp/test/IceGrid/activation/TestI.h32
-rw-r--r--cpp/test/IceGrid/activation/application.xml61
-rw-r--r--cpp/test/IceGrid/activation/db/.dummy0
-rw-r--r--cpp/test/IceGrid/activation/icegridactivationC.dsp157
-rw-r--r--cpp/test/IceGrid/activation/icegridactivationS.dsp161
-rwxr-xr-xcpp/test/IceGrid/activation/run.py77
32 files changed, 1555 insertions, 216 deletions
diff --git a/cpp/config/IceGridAdmin.py b/cpp/config/IceGridAdmin.py
index 9c428f6d6b8..160fc72218b 100644
--- a/cpp/config/IceGridAdmin.py
+++ b/cpp/config/IceGridAdmin.py
@@ -21,6 +21,24 @@ else:
iceGridPort = "0";
+nodeOptions = r' --Ice.Warn.Connections=0' + \
+ r' --IceGrid.Node.Endpoints=default' + \
+ r' --IceGrid.Node.WaitTime=30' + \
+ r' --Ice.ProgramName=icegridnode' + \
+ r' --IceGrid.Node.Trace.Activator=0' + \
+ r' --IceGrid.Node.Trace.Adapter=0' + \
+ r' --IceGrid.Node.Trace.Server=0' + \
+ r' --IceGrid.Node.PrintServersReady=node' + \
+ r' --Ice.NullHandleAbort';
+
+registryOptions = r' --Ice.Warn.Connections=0' + \
+ r' --IceGrid.Registry.Server.Endpoints=default' + \
+ r' --IceGrid.Registry.Internal.Endpoints=default' + \
+ r' --IceGrid.Registry.Admin.Endpoints=default' + \
+ r' --IceGrid.Registry.Server.Endpoints=default' + \
+ r' --IceGrid.Registry.Internal.Endpoints=default' + \
+ r' --IceGrid.Registry.Admin.Endpoints=default';
+
class ReaderThread(Thread):
def __init__(self, pipe, token):
self.pipe = pipe
@@ -55,20 +73,10 @@ def startIceGridRegistry(port, testdir, dynamicRegistration):
os.mkdir(dataDir)
print "starting icegrid registry...",
- command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + \
+ command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + registryOptions + \
r' --IceGrid.Registry.Client.Endpoints="default -p ' + iceGridPort + ' -t 30000" ' + \
- r' --Ice.Warn.Connections=0' + \
- r' --IceGrid.Registry.Server.Endpoints=default' + \
- r' --IceGrid.Registry.Internal.Endpoints=default' + \
- r' --IceGrid.Registry.Admin.Endpoints=default' + \
r' --IceGrid.Registry.Data=' + dataDir + \
- r' --IceGrid.Registry.DefaultTemplates=' + os.path.join(toplevel, "config", "templates.xml") + \
- r' --IceGrid.Registry.Trace.Server=0' + \
- r' --IceGrid.Registry.Trace.Adapter=0' + \
- r' --IceGrid.Registry.Trace.Object=0' + \
- r' --IceGrid.Registry.Trace.Node=0' + \
- r' --Ice.ProgramName=icegridregistry' + \
- r' --Ice.NullHandleAbort'
+ r' --IceGrid.Registry.DefaultTemplates=' + os.path.join(toplevel, "config", "templates.xml")
if dynamicRegistration:
command += ' --IceGrid.Registry.DynamicRegistration'
@@ -97,20 +105,11 @@ def startIceGridNode(testdir):
' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"'
print "starting icegrid node...",
- command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + \
+ command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + nodeOptions + \
r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \
- r' --Ice.Warn.Connections=0' + \
- r' --IceGrid.Node.Endpoints=default' + \
- r' --IceGrid.Node.WaitTime=30' + \
r' --IceGrid.Node.Data=' + dataDir + \
r' --IceGrid.Node.Name=localnode' + \
- r' --IceGrid.Node.PropertiesOverride=' + overrideOptions + \
- r' --Ice.ProgramName=icegridnode' + \
- r' --IceGrid.Node.Trace.Activator=0' + \
- r' --IceGrid.Node.Trace.Adapter=0' + \
- r' --IceGrid.Node.Trace.Server=0' + \
- r' --IceGrid.Node.PrintServersReady=node' + \
- r' --Ice.NullHandleAbort'
+ r' --IceGrid.Node.PropertiesOverride=' + overrideOptions
(stdin, iceGridPipe) = os.popen4(command)
TestUtil.getServerPid(iceGridPipe)
@@ -202,6 +201,23 @@ def startServer(name):
r' -e "server start \"' + name + '\\""' + " 2>&1"
iceGridAdminPipe = os.popen(command)
+ TestUtil.printOutputFromPipe(iceGridAdminPipe)
+ iceGridAdminStatus = iceGridAdminPipe.close()
+ if iceGridAdminStatus:
+ TestUtil.killServers()
+ sys.exit(1)
+
+def stopServer(name):
+
+ global iceGridPort
+ iceGridAdmin = os.path.join(toplevel, "bin", "icegridadmin")
+
+ command = iceGridAdmin + TestUtil.clientOptions + \
+ r' "--Ice.Default.Locator=IceGrid/Locator:default -p ' + iceGridPort + '" ' + \
+ r' -e "server stop \"' + name + '\\""' + " 2>&1"
+
+ iceGridAdminPipe = os.popen(command)
+ TestUtil.printOutputFromPipe(iceGridAdminPipe)
iceGridAdminStatus = iceGridAdminPipe.close()
if iceGridAdminStatus:
TestUtil.killServers()
diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp
index 13f10e87769..8ac5c45f1a8 100644
--- a/cpp/src/IceGrid/AdminI.cpp
+++ b/cpp/src/IceGrid/AdminI.cpp
@@ -711,6 +711,7 @@ AdminI::getNodeLoad(const string& name, const Current&) const
os << ex;
throw NodeUnreachableException(name, os.str());
}
+ return LoadInfo(); // Keep the compiler happy.
}
void
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index f88f4b139b2..9ba16639f8f 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -163,6 +163,12 @@ Database::~Database()
{
}
+void
+Database::destroy()
+{
+ _nodeCache.destroy(); // Break cyclic reference count.
+}
+
std::string
Database::getInstanceName() const
{
diff --git a/cpp/src/IceGrid/Database.h b/cpp/src/IceGrid/Database.h
index 3c778b976b7..9cf856d2c90 100644
--- a/cpp/src/IceGrid/Database.h
+++ b/cpp/src/IceGrid/Database.h
@@ -46,6 +46,8 @@ public:
Database(const Ice::ObjectAdapterPtr&, const std::string&, const std::string&, int, const TraceLevelsPtr&);
virtual ~Database();
+
+ void destroy();
std::string getInstanceName() const;
diff --git a/cpp/src/IceGrid/DescriptorBuilder.cpp b/cpp/src/IceGrid/DescriptorBuilder.cpp
index 18c959b7a8f..0608a9c5399 100644
--- a/cpp/src/IceGrid/DescriptorBuilder.cpp
+++ b/cpp/src/IceGrid/DescriptorBuilder.cpp
@@ -102,7 +102,8 @@ XmlAttributesHelper::asBool(const string& name) const
IceXML::Attributes::const_iterator p = _attributes.find(name);
if(p == _attributes.end())
{
- throw "missing attribute '" + name + "'";
+ throw "missing attribute '" + name + "'";
+ return true; // Keep the compiler happy.
}
else if(p->second == "true")
{
@@ -115,6 +116,7 @@ XmlAttributesHelper::asBool(const string& name) const
else
{
throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
+ return true; // Keep the compiler happy.
}
}
@@ -138,6 +140,7 @@ XmlAttributesHelper::asBool(const string& name, bool def) const
else
{
throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
+ return true; // Keep the compiler happy.
}
}
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp
index a85d3fbe3ec..f4c6393c583 100644
--- a/cpp/src/IceGrid/DescriptorHelper.cpp
+++ b/cpp/src/IceGrid/DescriptorHelper.cpp
@@ -526,6 +526,7 @@ Resolver::getVariable(const string& name, bool checkParams, bool& param) const
}
throw "undefined variable `" + name + "'";
+ return ""; // To keep the compiler happy.
}
map<string, string>
@@ -938,7 +939,8 @@ ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance, const Resolve
instance->pwd = resolve(_desc->pwd, "working directory path");
instance->activation = resolve(_desc->activation, "activation");
instance->applicationDistrib = _desc->applicationDistrib;
- if(!instance->activation.empty() && instance->activation != "manual" && instance->activation != "on-demand")
+ if(!instance->activation.empty() &&
+ instance->activation != "manual" && instance->activation != "on-demand" && instance->activation != "always")
{
resolve.exception("unknown activation `" + instance->activation + "'");
}
@@ -975,6 +977,12 @@ ServerHelper::instantiate(const Resolver& resolver) const
}
void
+ServerHelper::print(Output& out) const
+{
+ print(out, "", "");
+}
+
+void
ServerHelper::print(Output& out, const string& application, const string& node) const
{
out << "server `" + _desc->id + "'";
@@ -1099,6 +1107,12 @@ IceBoxHelper::instantiateImpl(const IceBoxDescriptorPtr& instance, const Resolve
}
void
+IceBoxHelper::print(Output& out) const
+{
+ print(out, "", "");
+}
+
+void
IceBoxHelper::print(Output& out, const string& application, const string& node) const
{
out << "icebox `" + _desc->id + "'";
@@ -1252,7 +1266,7 @@ ServiceInstanceHelper::print(Output& out) const
else
{
assert(!_template.empty());
- out << nl << "service instance";
+ out << "service instance";
out << sb;
out << nl << "template = `" << _template << "'";
out << nl << "parameters";
diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h
index 85043c40de7..610a20b7989 100644
--- a/cpp/src/IceGrid/DescriptorHelper.h
+++ b/cpp/src/IceGrid/DescriptorHelper.h
@@ -67,7 +67,7 @@ public:
virtual void getIds(std::multiset<std::string>&, std::multiset<Ice::Identity>&) const;
- virtual void print(IceUtil::Output&) const;
+ void print(IceUtil::Output&) const;
protected:
@@ -120,7 +120,8 @@ public:
ServerDescriptorPtr getDescriptor() const;
virtual ServerDescriptorPtr instantiate(const Resolver&) const;
- void print(IceUtil::Output&, const std::string& = std::string(), const std::string& = std::string()) const;
+ void print(IceUtil::Output&) const;
+ void print(IceUtil::Output&, const std::string&, const std::string&) const;
protected:
@@ -149,7 +150,8 @@ public:
virtual void getIds(std::multiset<std::string>&, std::multiset<Ice::Identity>&) const;
- void print(IceUtil::Output&, const std::string& = std::string(), const std::string& = std::string()) const;
+ void print(IceUtil::Output&) const;
+ void print(IceUtil::Output&, const std::string&, const std::string&) const;
protected:
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index 3535cf3ab4c..ceaf2ed94e5 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -518,6 +518,7 @@ NodeService::stop()
}
catch(...)
{
+ assert(false);
}
//
@@ -531,6 +532,7 @@ NodeService::stop()
}
catch(...)
{
+ assert(false);
}
//
@@ -553,6 +555,7 @@ NodeService::stop()
}
catch(...)
{
+ assert(false);
}
_activator = 0;
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp
index 584efdc9e19..c3022bf0c9a 100644
--- a/cpp/src/IceGrid/NodeCache.cpp
+++ b/cpp/src/IceGrid/NodeCache.cpp
@@ -159,6 +159,15 @@ NodeCache::NodeCache(int sessionTimeout) : _sessionTimeout(sessionTimeout)
{
}
+void
+NodeCache::destroy()
+{
+ for(map<string, NodeEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
+ {
+ p->second->setSession(0); // Break cyclic reference count.
+ }
+}
+
NodeEntryPtr
NodeCache::get(const string& name, bool create) const
{
diff --git a/cpp/src/IceGrid/NodeCache.h b/cpp/src/IceGrid/NodeCache.h
index d9ce180440b..72cfab6ef31 100644
--- a/cpp/src/IceGrid/NodeCache.h
+++ b/cpp/src/IceGrid/NodeCache.h
@@ -68,6 +68,8 @@ public:
NodeCache(int);
+ void destroy();
+
NodeEntryPtr get(const std::string&, bool = false) const;
int getSessionTimeout() { return _sessionTimeout; }
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp
index 6a548afddcf..4484eea004d 100644
--- a/cpp/src/IceGrid/NodeI.cpp
+++ b/cpp/src/IceGrid/NodeI.cpp
@@ -797,7 +797,7 @@ NodeI::initObserver(const Ice::StringSeq& servers)
{
try
{
- server->addDynamicInfo(serverInfos, adapterInfos);
+ server->getDynamicInfo(serverInfos, adapterInfos);
}
catch(const Ice::ObjectNotExistException&)
{
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp
index 4a48c07a0f9..4630a64d351 100644
--- a/cpp/src/IceGrid/Parser.cpp
+++ b/cpp/src/IceGrid/Parser.cpp
@@ -512,16 +512,7 @@ Parser::describeServiceTemplate(const list<string>& args)
out << nl << "parameters = `" << toString(q->second.parameters) << "'";
}
out << nl;
- ServiceDescriptorPtr service = ServiceDescriptorPtr::dynamicCast(q->second.descriptor);
- IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(service);
- if(iceBox)
- {
- IceBoxHelper(iceBox).print(out);
- }
- else
- {
- ServiceHelper(service).print(out);
- }
+ ServiceHelper(ServiceDescriptorPtr::dynamicCast(q->second.descriptor)).print(out);
out << eb;
out << nl;
}
diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp
index 0871e62844b..6c2e55efe18 100644
--- a/cpp/src/IceGrid/RegistryI.cpp
+++ b/cpp/src/IceGrid/RegistryI.cpp
@@ -401,14 +401,20 @@ RegistryI::stop()
{
_reaper->terminate();
_reaper->getThreadControl().join();
+ _reaper = 0;
if(_adminReaper)
{
_adminReaper->terminate();
_adminReaper->getThreadControl().join();
+ _adminReaper = 0;
}
_iceStorm->stop();
+ _iceStorm = 0;
+
+ _database->destroy();
+ _database = 0;
}
NodeSessionPrx
diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp
index f016b95aa0e..e884d9cf0cc 100644
--- a/cpp/src/IceGrid/ServerAdapterI.cpp
+++ b/cpp/src/IceGrid/ServerAdapterI.cpp
@@ -69,7 +69,7 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur
//
try
{
- _server->start_async(0);
+ _server->start(ServerI::OnDemand);
return;
}
catch(const ServerStartException&)
@@ -189,7 +189,7 @@ ServerAdapterI::clear()
}
void
-ServerAdapterI::activationFailed(bool destroyed)
+ServerAdapterI::activationFailed(bool timeout)
{
//
@@ -198,7 +198,7 @@ ServerAdapterI::activationFailed(bool destroyed)
if(_node->getTraceLevels()->adapter > 1)
{
Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
- if(!destroyed)
+ if(timeout)
{
out << "server `" + _serverId + "' adapter `" << _id << "' activation timed out";
}
diff --git a/cpp/src/IceGrid/ServerCache.h b/cpp/src/IceGrid/ServerCache.h
index a04c2f97807..80716aadfba 100644
--- a/cpp/src/IceGrid/ServerCache.h
+++ b/cpp/src/IceGrid/ServerCache.h
@@ -32,7 +32,7 @@ class ServerEntry : public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mut
public:
ServerEntry(Cache<std::string, ServerEntry>&, const std::string&);
-
+
void sync();
void update(const ServerInfo&);
void destroy();
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp
index f70f76636f1..20c50f79d23 100644
--- a/cpp/src/IceGrid/ServerI.cpp
+++ b/cpp/src/IceGrid/ServerI.cpp
@@ -278,7 +278,8 @@ public:
{
}
- static bool isStarted(ServerI::InternalServerState state)
+ static bool
+ isStarted(ServerI::InternalServerState state)
{
return state == ServerI::ActivationTimeout || state == ServerI::Active;
}
@@ -351,7 +352,8 @@ public:
{
}
- static bool isStopped(ServerI::InternalServerState state)
+ static bool
+ isStopped(ServerI::InternalServerState state)
{
return state == ServerI::Inactive || state == ServerI::Patching || state == ServerI::Loading;
}
@@ -403,6 +405,36 @@ private:
vector<AMD_Server_stopPtr> _stopCB;
};
+class DelayedStart : public WaitItem
+{
+public:
+
+ DelayedStart(const ServerIPtr& server) :
+ _server(server)
+ {
+ }
+
+ virtual void expired(bool destroyed)
+ {
+ if(!destroyed)
+ {
+ try
+ {
+ _server->start(ServerI::Always);
+ }
+ catch(const ServerStartException& ex)
+ {
+ cerr << ex.reason << endl;
+ // TODO: Log?
+ }
+ }
+ }
+
+private:
+
+ const ServerIPtr _server;
+};
+
struct EnvironmentEval : std::unary_function<string, string>
{
string
@@ -513,66 +545,7 @@ ServerI::~ServerI()
void
ServerI::start_async(const AMD_Server_startPtr& amdCB, const Ice::Current&)
{
- ServerCommandPtr command;
- {
- Lock sync(*this);
- checkDestroyed();
- if(_state == Destroying)
- {
- throw ServerStartException(_id, "The server is being destroyed.");
- }
-
- //
- // The server is disabled because it failed and if the time of
- // the failure is now past the configured duration or if the
- // server is manualy started, we re-enable the server.
- //
- if(_activation == Disabled &&
- _failureTime != IceUtil::Time() &&
- (amdCB ||
- (_disableOnFailure > 0 &&
- (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now()))))
- {
- _failureTime = IceUtil::Time();
- _activation = _previousActivation;
- }
-
- //
- // If the amd callback is set, it's a remote start call to
- // manually activate the server. Otherwise it's a call to
- // activate the server on demand (called from ServerAdapterI).
- //
- if(_activation == Disabled)
- {
- throw ServerStartException(_id, "The server is disabled.");
- }
- else if(_activation == Manual && !amdCB)
- {
- throw ServerStartException(_id, "The server activation doesn't allow this activation mode.");
- }
- else if(_state == ActivationTimeout)
- {
- throw ServerStartException(_id, "The server activation timed out.");
- }
- else if(_state == Active)
- {
- throw ServerStartException(_id, "The server is already active.");
- }
-
- if(!_start)
- {
- _start = new StartCommand(this, _node->getWaitQueue(), _activationTimeout);
- }
- if(amdCB)
- {
- _start->addCallback(amdCB);
- }
- command = nextCommand();
- }
- if(command)
- {
- command->execute();
- }
+ start(Manual, amdCB);
}
void
@@ -615,7 +588,7 @@ ServerI::sendSignal(const string& signal, const Ice::Current& current)
void
ServerI::writeMessage(const string& message, Ice::Int fd, const Ice::Current& current)
{
- IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
+ Lock sync(*this);
if(_process != 0)
{
try
@@ -644,17 +617,32 @@ ServerI::getPid(const Ice::Current&) const
void
ServerI::setEnabled(bool enabled, const ::Ice::Current&)
{
+ bool activate = false;
{
Lock sync(*this);
- if(enabled && _activation < Disabled || !enabled && _activation == Disabled)
+ if(enabled && _activation < Disabled ||
+ !enabled && _activation == Disabled && _failureTime == IceUtil::Time())
{
return;
}
_failureTime = IceUtil::Time();
- _activation = enabled ? (_desc->activation == "on-demand" ? OnDemand : Manual) : Disabled;
+ _activation = enabled ? toServerActivation(_desc->activation) : Disabled;
+ activate = _state == Inactive && _activation == Always;
}
-
+
+ if(activate)
+ {
+ try
+ {
+ start(Always);
+ }
+ catch(const ServerStartException&)
+ {
+ // TODO: Log?
+ }
+ }
+
NodeObserverPrx observer = _node->getObserver();
if(observer)
{
@@ -728,10 +716,110 @@ ServerI::getDistribution() const
}
void
+ServerI::getDynamicInfo(ServerDynamicInfoSeq& serverInfos, AdapterDynamicInfoSeq& adapterInfos) const
+{
+ //
+ // Add server info if it's not inactive.
+ //
+ ServerAdapterDict adapters;
+ {
+ Lock sync(*this);
+ if(_state == ServerI::Inactive && _activation != Disabled)
+ {
+ return;
+ }
+ adapters = _adapters;
+ serverInfos.push_back(getDynamicInfo());
+ }
+
+ //
+ // Add adapters info.
+ //
+ for(ServerAdapterDict::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
+ {
+ try
+ {
+ AdapterDynamicInfo adapter;
+ adapter.id = p->first;
+ adapter.proxy = p->second->getDirectProxy();
+ adapterInfos.push_back(adapter);
+ }
+ catch(const AdapterNotActiveException&)
+ {
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ }
+}
+
+void
+ServerI::start(ServerActivation activation, const AMD_Server_startPtr& amdCB)
+{
+ ServerCommandPtr command;
+ {
+ Lock sync(*this);
+ checkDestroyed();
+
+ //
+ // Re-enable the server if disabled because of a failure and if
+ // activated manually.
+ //
+ enableAfterFailure(activation == Manual);
+
+ //
+ // Check the current activation mode and the requested activation.
+ //
+ if(_activation == Disabled)
+ {
+ throw ServerStartException(_id, "The server is disabled.");
+ }
+ else if(_activation == Manual && activation != Manual)
+ {
+ throw ServerStartException(_id, "The server activation doesn't allow this activation mode.");
+ }
+ else if(_activation != Always && activation == Always)
+ {
+ assert(!amdCB);
+ return; // Nothing to do.
+ }
+
+ //
+ // Check the current state.
+ //
+ if(_state == ActivationTimeout)
+ {
+ throw ServerStartException(_id, "The server activation timed out.");
+ }
+ else if(_state == Active)
+ {
+ throw ServerStartException(_id, "The server is already active.");
+ }
+ else if(_state == Destroying)
+ {
+ throw ServerStartException(_id, "The server is being destroyed.");
+ }
+
+ if(!_start)
+ {
+ _start = new StartCommand(this, _node->getWaitQueue(), _activationTimeout);
+ }
+ if(amdCB)
+ {
+ _start->addCallback(amdCB);
+ }
+ command = nextCommand();
+ }
+ if(command)
+ {
+ command->execute();
+ }
+}
+
+void
ServerI::load(const AMD_Node_loadServerPtr& amdCB, const string& application, const ServerDescriptorPtr& desc)
{
stop_async(0);
-
ServerCommandPtr command;
{
Lock sync(*this);
@@ -770,6 +858,28 @@ ServerI::load(const AMD_Node_loadServerPtr& amdCB, const string& application, co
}
}
+void
+ServerI::destroy(const AMD_Node_destroyServerPtr& amdCB)
+{
+ ServerCommandPtr command;
+ {
+ Lock sync(*this);
+ if(!_destroy)
+ {
+ _destroy = new DestroyCommand(this, _state != Inactive && _state != Loading && _state != Patching);
+ }
+ if(amdCB)
+ {
+ _destroy->addCallback(amdCB);
+ }
+ command = nextCommand();
+ }
+ if(command)
+ {
+ command->execute();
+ }
+}
+
bool
ServerI::startPatch(bool shutdown)
{
@@ -821,28 +931,6 @@ ServerI::finishPatch()
}
void
-ServerI::destroy(const AMD_Node_destroyServerPtr& amdCB)
-{
- ServerCommandPtr command;
- {
- Lock sync(*this);
- if(!_destroy)
- {
- _destroy = new DestroyCommand(this, _state != Inactive && _state != Loading && _state != Patching);
- }
- if(amdCB)
- {
- _destroy->addCallback(amdCB);
- }
- command = nextCommand();
- }
- if(command)
- {
- command->execute();
- }
-}
-
-void
ServerI::adapterActivated(const string& id)
{
ServerCommandPtr command;
@@ -870,6 +958,39 @@ ServerI::checkDestroyed()
}
void
+ServerI::disableOnFailure()
+{
+ if(_disableOnFailure != 0 && _activation != Disabled)
+ {
+ _previousActivation = _activation;
+ _activation = Disabled;
+ _failureTime = IceUtil::Time::now();
+ }
+}
+
+void
+ServerI::enableAfterFailure(bool force)
+{
+ if(_disableOnFailure == 0 || _failureTime == IceUtil::Time())
+ {
+ return;
+ }
+
+ if(force ||
+ _disableOnFailure > 0 && (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now()))
+ {
+ _activation = _previousActivation;
+ _failureTime = IceUtil::Time();
+ }
+
+ if(_timer)
+ {
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
+ }
+}
+
+void
ServerI::adapterDeactivated(const string& id)
{
Lock sync(*this);
@@ -917,7 +1038,7 @@ ServerI::activationFailed(bool destroyed)
{
try
{
- p->second->activationFailed(destroyed);
+ p->second->activationFailed(!destroyed);
}
catch(const Ice::ObjectNotExistException&)
{
@@ -930,44 +1051,6 @@ ServerI::activationFailed(bool destroyed)
}
void
-ServerI::addDynamicInfo(ServerDynamicInfoSeq& serverInfos, AdapterDynamicInfoSeq& adapterInfos) const
-{
- //
- // Add server info if it's not inactive.
- //
- ServerAdapterDict adapters;
- {
- Lock sync(*this);
- if(_state == ServerI::Inactive && _activation != Disabled)
- {
- return;
- }
- adapters = _adapters;
- serverInfos.push_back(getDynamicInfo());
- }
-
- //
- // Add adapters info.
- //
- for(ServerAdapterDict::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
- {
- try
- {
- AdapterDynamicInfo adapter;
- adapter.id = p->first;
- adapter.proxy = p->second->getDirectProxy();
- adapterInfos.push_back(adapter);
- }
- catch(const AdapterNotActiveException&)
- {
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- }
-}
-
-void
ServerI::activate()
{
ServerDescriptorPtr desc;
@@ -1012,7 +1095,13 @@ ServerI::activate()
ServerCommandPtr command;
{
Lock sync(*this);
- assert(_state == Activating);
+ if(_state != Activating)
+ {
+ //
+ // It's possible that the server has already terminated.
+ //
+ return;
+ }
_pid = pid;
setStateNoSync(ServerI::WaitForActivation);
checkActivation();
@@ -1038,17 +1127,29 @@ ServerI::activate()
os << ex;
failure = os.str();
}
+
for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r)
{
try
{
- r->second->activationFailed(true);
+ r->second->activationFailed(false);
}
catch(const Ice::ObjectNotExistException&)
{
}
- }
- setState(ServerI::Inactive, failure);
+ }
+
+ ServerCommandPtr command;
+ {
+ Lock sync(*this);
+ disableOnFailure();
+ setStateNoSync(ServerI::Inactive, failure);
+ command = nextCommand();
+ }
+ if(command)
+ {
+ command->execute();
+ }
}
void
@@ -1198,25 +1299,20 @@ ServerI::terminated(const string& msg, int status)
_process = 0;
_pid = 0;
- if(_disableOnFailure != 0 && _activation != Disabled)
- {
- bool failed = false;
+ bool failed = false;
#ifndef _WIN32
- failed = WIFEXITED(status) && WEXITSTATUS(status) != 0;
- if(WIFSIGNALED(status))
- {
- int s = WTERMSIG(status);
- failed = s == SIGABRT || s == SIGILL || s == SIGBUS || s == SIGFPE || s == SIGSEGV;
- }
+ failed = WIFEXITED(status) && WEXITSTATUS(status) != 0;
+ if(WIFSIGNALED(status))
+ {
+ int s = WTERMSIG(status);
+ failed = s == SIGABRT || s == SIGILL || s == SIGBUS || s == SIGFPE || s == SIGSEGV;
+ }
#else
- failed = status != 0;
+ failed = status != 0;
#endif
- if(failed)
- {
- _previousActivation = _activation;
- _activation = Disabled;
- _failureTime = IceUtil::Time::now();
- }
+ if(failed)
+ {
+ disableOnFailure();
}
if(_state != ServerI::Destroying)
@@ -1317,9 +1413,16 @@ ServerI::updateImpl()
}
}
- if(_activation < Disabled)
+ if(_activation != Disabled || _failureTime != IceUtil::Time())
+ {
+ _activation = toServerActivation(_desc->activation);
+ _failureTime = IceUtil::Time();
+ }
+
+ if(_timer)
{
- _activation = _desc->activation == "on-demand" ? OnDemand : Manual;
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
}
istringstream at(_desc->activationTimeout);
@@ -1700,6 +1803,10 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason)
if(_state == Destroyed && !_load)
{
+ //
+ // If the server is destroyed and there's no load command, we
+ // remove the servant from the ASM.
+ //
try
{
_node->getAdapter()->remove(_this->ice_getIdentity());
@@ -1708,6 +1815,24 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason)
{
}
}
+ else if(_state == Inactive && _activation == Disabled &&
+ _disableOnFailure > 0 && _failureTime != IceUtil::Time() && _previousActivation == Always)
+ {
+ //
+ // If the server was disabled because it failed, we schedule a
+ // callback to re-enable it.
+ //
+ _timer = new DelayedStart(this);
+ _node->getWaitQueue()->add(_timer, IceUtil::Time::seconds(_disableOnFailure));
+ }
+ else if(_state == Inactive && _activation == Always && previous != Activating && previous != ActivationTimeout)
+ {
+ if(!_start)
+ {
+ _start = new StartCommand(this, _node->getWaitQueue(), _activationTimeout);
+ }
+ }
+
if(toServerState(previous) != toServerState(_state))
{
@@ -1840,7 +1965,7 @@ ServerI::updateConfigFile(const string& serverDir, const CommunicatorDescriptorP
ServiceDescriptorPtr s = ServiceDescriptorPtr::dynamicCast(p->descriptor);
const string path = serverDir + "/config/config_" + s->name;
props.push_back(createProperty("IceBox.Service." + s->name,
- s->entry + " --Ice.Config=\"" + path + "\""));
+ s->entry + " --Ice.Config=" + path));
servicesStr += s->name + " ";
}
props.push_back(createProperty("IceBox.LoadOrder", servicesStr));
@@ -1990,6 +2115,29 @@ ServerI::toServerState(InternalServerState st) const
}
}
+ServerI::ServerActivation
+ServerI::toServerActivation(const string& activation) const
+{
+ if(activation == "on-demand")
+ {
+ return OnDemand;
+ }
+ else if(activation == "always")
+ {
+ return Always;
+ }
+ else if(activation == "manual" || activation.empty())
+ {
+ return Manual;
+ }
+ else
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "unknown activation mode `" << activation << "' for server `" << _id << "'";
+ return Manual;
+ }
+}
+
ServerDynamicInfo
ServerI::getDynamicInfo() const
{
diff --git a/cpp/src/IceGrid/ServerI.h b/cpp/src/IceGrid/ServerI.h
index 5d50ad740c5..db0e53bd557 100644
--- a/cpp/src/IceGrid/ServerI.h
+++ b/cpp/src/IceGrid/ServerI.h
@@ -57,6 +57,7 @@ public:
enum ServerActivation
{
+ Always,
OnDemand,
Manual,
Disabled
@@ -82,18 +83,19 @@ public:
ServerActivation getActivationMode() const;
const std::string& getId() const;
DistributionDescriptor getDistribution() const;
+ void getDynamicInfo(ServerDynamicInfoSeq&, AdapterDynamicInfoSeq&) const;
+ void start(ServerActivation, const AMD_Server_startPtr& = AMD_Server_startPtr());
void load(const AMD_Node_loadServerPtr&, const std::string&, const ServerDescriptorPtr&);
+ void destroy(const AMD_Node_destroyServerPtr&);
bool startPatch(bool);
bool waitForPatch();
void finishPatch();
- void destroy(const AMD_Node_destroyServerPtr&);
void adapterActivated(const std::string&);
void adapterDeactivated(const std::string&);
void activationFailed(bool);
void deactivationFailed();
- void addDynamicInfo(ServerDynamicInfoSeq&, AdapterDynamicInfoSeq&) const;
void activate();
void kill();
@@ -107,6 +109,8 @@ private:
void updateImpl();
void checkActivation();
void checkDestroyed();
+ void disableOnFailure();
+ void enableAfterFailure(bool);
void setState(InternalServerState, const std::string& = std::string());
ServerCommandPtr nextCommand();
@@ -117,6 +121,7 @@ private:
void updateDbEnv(const std::string&, const DbEnvDescriptor&);
PropertyDescriptor createProperty(const std::string&, const std::string& = std::string());
ServerState toServerState(InternalServerState) const;
+ ServerActivation toServerActivation(const std::string&) const;
ServerDynamicInfo getDynamicInfo() const;
const NodeIPtr _node;
@@ -140,6 +145,7 @@ private:
std::set<std::string> _activeAdapters;
IceUtil::Time _failureTime;
ServerActivation _previousActivation;
+ WaitItemPtr _timer;
DestroyCommandPtr _destroy;
StopCommandPtr _stop;
diff --git a/cpp/src/IceGrid/WaitQueue.cpp b/cpp/src/IceGrid/WaitQueue.cpp
index 6d7b058e6a4..7e8c9969155 100644
--- a/cpp/src/IceGrid/WaitQueue.cpp
+++ b/cpp/src/IceGrid/WaitQueue.cpp
@@ -58,7 +58,7 @@ WaitQueue::run()
//
// Notify expired items.
//
- while(!_waitQueue.empty())
+ while(!_waitQueue.empty() && !_destroyed)
{
WaitItemPtr item = _waitQueue.front();
if(item->getExpirationTime() <= IceUtil::Time::now())
@@ -76,7 +76,7 @@ WaitQueue::run()
// Wait until the next item expire or a notification. Note: in any case we
// get out of this loop to get a chance to execute the work queue.
//
- timedWait(item->getExpirationTime() - IceUtil::Time::now());
+ timedWait(item->getExpirationTime() - IceUtil::Time::now());
}
}
}
@@ -97,6 +97,11 @@ WaitQueue::run()
}
}
}
+
+ if(_destroyed)
+ {
+ break;
+ }
}
if(!_waitQueue.empty())
@@ -134,26 +139,19 @@ WaitQueue::add(const WaitItemPtr& item, const IceUtil::Time& wait)
//
bool notifyThread = _waitQueue.empty();
- if(wait == IceUtil::Time::seconds(0))
- {
- item->setExpirationTime(IceUtil::Time::now());
- }
- else
+ IceUtil::Time expire = IceUtil::Time::now() + wait;
+ item->setExpirationTime(expire);
+
+ list<WaitItemPtr>::iterator p = _waitQueue.begin();
+ while(p != _waitQueue.end())
{
- IceUtil::Time expire = IceUtil::Time::now() + wait;
- item->setExpirationTime(expire);
-
- list<WaitItemPtr>::iterator p = _waitQueue.begin();
- while(p != _waitQueue.end())
+ if((*p)->getExpirationTime() >= expire)
{
- if((*p)->getExpirationTime() >= expire)
- {
- break;
- }
- ++p;
+ break;
}
- _waitQueue.insert(p, item);
+ ++p;
}
+ _waitQueue.insert(p, item);
if(notifyThread)
{
diff --git a/cpp/test/IceGrid/Makefile b/cpp/test/IceGrid/Makefile
index ace4cf6b599..e3faf8b11e0 100644
--- a/cpp/test/IceGrid/Makefile
+++ b/cpp/test/IceGrid/Makefile
@@ -12,7 +12,7 @@ top_srcdir = ../..
include $(top_srcdir)/config/Make.rules
-SUBDIRS = simple deployer session update replication
+SUBDIRS = simple deployer session update activation replication
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/test/IceGrid/activation/.depend b/cpp/test/IceGrid/activation/.depend
new file mode 100644
index 00000000000..96ec4d18d62
--- /dev/null
+++ b/cpp/test/IceGrid/activation/.depend
@@ -0,0 +1,6 @@
+Test.o: Test.cpp ./Test.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/StreamF.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/Object.h ../../../include/Ice/GCShared.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/ObjectFactory.h
+Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ../../include/TestCommon.h ./Test.h
+AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ../../../include/IceGrid/Admin.h ../../../include/Ice/SliceChecksumDict.h ../../../include/IceGrid/Exception.h ../../../include/IceGrid/Descriptor.h ../../include/TestCommon.h ./Test.h
+TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ./TestI.h ./Test.h
+Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ./TestI.h ./Test.h
+Test.cpp: Test.ice
diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp
new file mode 100644
index 00000000000..55e1b2d23bc
--- /dev/null
+++ b/cpp/test/IceGrid/activation/AllTests.cpp
@@ -0,0 +1,405 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IceGrid/Admin.h>
+#include <TestCommon.h>
+#include <Test.h>
+
+using namespace std;
+using namespace Test;
+
+void
+allTests(const Ice::CommunicatorPtr& communicator)
+{
+ IceGrid::AdminPrx admin = IceGrid::AdminPrx::checkedCast(communicator->stringToProxy("IceGrid/Admin"));
+
+ cout << "testing on-demand activation... " << flush;
+ try
+ {
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
+ test(admin->getServerState("server") == IceGrid::Active);
+ obj->shutdown();
+ int nRetry = 0;
+ while(admin->getServerState("server") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ 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"));
+ }
+ 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();
+ int nRetry = 0;
+ while(admin->getServerState("server-manual") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing always activation... " << flush;
+ try
+ {
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
+ admin->stopServer("server-always");
+ int nRetry = 0;
+ while(admin->getServerState("server-always") != IceGrid::Active && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ admin->stopServer("server-always");
+ nRetry = 0;
+ while(admin->getServerState("server-always") != IceGrid::Active && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ 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();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server");
+ }
+ 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();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-manual");
+ }
+ 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();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-always");
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ 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();
+ }
+ 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);
+ int nRetry = 0;
+ while(admin->getServerState("server-always") != IceGrid::Active && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ admin->stopServer("server-always");
+ try
+ {
+ admin->startServer("server-always");
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing activation timeout... " << flush;
+ try
+ {
+ test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive);
+ try
+ {
+ communicator->stringToProxy("server-activation-timeout")->ice_ping();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ admin->stopServer("server-activation-timeout");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ 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");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing permanent disable on failure... " << flush;
+ try
+ {
+ test(admin->getServerState("server1") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1"));
+ test(admin->getServerState("server1") == IceGrid::Active);
+ obj->fail();
+ int nRetry = 0;
+ while(admin->getServerState("server1") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server1") == IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ }
+ 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();
+ nRetry = 0;
+ while(admin->getServerState("server1-manual") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("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();
+ nRetry = 0;
+ while(admin->getServerState("server1-always") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server1-always") == IceGrid::Inactive);
+ test(!admin->isServerEnabled("server1-always"));
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+
+ cout << "testing temporary disable on failure... " << flush;
+ try
+ {
+ test(admin->getServerState("server2") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2"));
+ test(admin->getServerState("server2") == IceGrid::Active);
+ obj->fail();
+ int nRetry = 0;
+ while(admin->getServerState("server2") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("server2") == IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ }
+ 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") && admin->getServerState("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();
+ nRetry = 0;
+ while(admin->getServerState("server2-manual") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("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();
+ nRetry = 0;
+ while(admin->getServerState("server2-always") != IceGrid::Inactive && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->getServerState("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);
+ }
+ cout << "ok" << endl;
+}
+
diff --git a/cpp/test/IceGrid/activation/Client.cpp b/cpp/test/IceGrid/activation/Client.cpp
new file mode 100644
index 00000000000..3517d43ca34
--- /dev/null
+++ b/cpp/test/IceGrid/activation/Client.cpp
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestCommon.h>
+#include <Test.h>
+
+using namespace std;
+using namespace Test;
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ void allTests(const Ice::CommunicatorPtr&);
+ allTests(communicator);
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/test/IceGrid/activation/Makefile b/cpp/test/IceGrid/activation/Makefile
new file mode 100644
index 00000000000..8b74a9acb9e
--- /dev/null
+++ b/cpp/test/IceGrid/activation/Makefile
@@ -0,0 +1,46 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+CLIENT = client
+SERVER = server
+
+TARGETS = $(CLIENT) $(SERVER)
+
+OBJS = Test.o \
+
+COBJS = Client.o \
+ AllTests.o
+
+SOBJS = TestI.o \
+ Server.o
+
+SRCS = $(OBJS:.o=.cpp) \
+ $(COBJS:.o=.cpp) \
+ $(SOBJS:.o=.cpp) \
+
+SLICE_SRCS = Test.ice
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I. -I../../include $(CPPFLAGS)
+
+$(CLIENT): $(OBJS) $(COBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) -lIceGrid -lGlacier2
+
+$(SERVER): $(OBJS) $(SOBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS)
+
+clean::
+ rm -rf db/node db/registry
+
+include .depend
diff --git a/cpp/test/IceGrid/activation/Server.cpp b/cpp/test/IceGrid/activation/Server.cpp
new file mode 100644
index 00000000000..6089d59186e
--- /dev/null
+++ b/cpp/test/IceGrid/activation/Server.cpp
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestI.h>
+
+using namespace std;
+
+class Server : public Ice::Application
+{
+public:
+
+ virtual int run(int argc, char* argv[]);
+
+};
+
+int
+Server::run(int argc, char* argv[])
+{
+ Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
+ Ice::PropertiesPtr properties = communicator()->getProperties();
+ args = properties->parseCommandLineOptions("", args);
+ Ice::stringSeqToArgs(args, argc, argv);
+
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
+ TestI* test = new TestI(adapter);
+ Ice::ObjectPtr obj = test;
+ adapter->add(test, Ice::stringToIdentity(properties->getProperty("Ice.ServerId")));
+
+ int delay = properties->getPropertyAsInt("ActivationDelay");
+ if(delay > 0)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ }
+
+ shutdownOnInterrupt();
+ try
+ {
+ adapter->activate();
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
+ communicator()->waitForShutdown();
+ ignoreInterrupt();
+
+ delay = properties->getPropertyAsInt("DeactivationDelay");
+ if(delay > 0)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ }
+
+ return test->isFailed() ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ Server app;
+ int rc = app.main(argc, argv);
+ return rc;
+}
diff --git a/cpp/test/IceGrid/activation/Test.ice b/cpp/test/IceGrid/activation/Test.ice
new file mode 100644
index 00000000000..d5d8c42f24f
--- /dev/null
+++ b/cpp/test/IceGrid/activation/Test.ice
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef TEST_ICE
+#define TEST_ICE
+
+module Test
+{
+
+interface TestIntf
+{
+ void fail();
+
+ void shutdown();
+};
+
+};
+
+#endif
diff --git a/cpp/test/IceGrid/activation/TestI.cpp b/cpp/test/IceGrid/activation/TestI.cpp
new file mode 100644
index 00000000000..f8b3f166945
--- /dev/null
+++ b/cpp/test/IceGrid/activation/TestI.cpp
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestI.h>
+
+using namespace Test;
+
+TestI::TestI(const Ice::ObjectAdapterPtr& adapter) :
+ _adapter(adapter),
+ _failed(false)
+{
+}
+
+void
+TestI::fail(const Ice::Current&)
+{
+ _failed = true;
+ _adapter->getCommunicator()->shutdown();
+}
+
+void
+TestI::shutdown(const Ice::Current&)
+{
+ _adapter->getCommunicator()->shutdown();
+}
+
+bool
+TestI::isFailed() const
+{
+ return _failed;
+}
diff --git a/cpp/test/IceGrid/activation/TestI.h b/cpp/test/IceGrid/activation/TestI.h
new file mode 100644
index 00000000000..1afe51b1527
--- /dev/null
+++ b/cpp/test/IceGrid/activation/TestI.h
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef TEST_I_H
+#define TEST_I_H
+
+#include <Test.h>
+
+class TestI : public ::Test::TestIntf
+{
+public:
+
+ TestI(const Ice::ObjectAdapterPtr&);
+
+ virtual void fail(const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+
+ bool isFailed() const;
+
+private:
+
+ Ice::ObjectAdapterPtr _adapter;
+ bool _failed;
+};
+
+#endif
diff --git a/cpp/test/IceGrid/activation/application.xml b/cpp/test/IceGrid/activation/application.xml
new file mode 100644
index 00000000000..b5436ae2e58
--- /dev/null
+++ b/cpp/test/IceGrid/activation/application.xml
@@ -0,0 +1,61 @@
+<icegrid>
+ <application name="Test">
+
+ <server-template id="Server">
+ <parameter name="id"/>
+ <parameter name="activation" default="on-demand"/>
+ <parameter name="activation-delay" default="0"/>
+ <parameter name="deactivation-delay" default="0"/>
+ <server id="${id}" exe="${test.dir}/server"
+ activation="${activation}" activation-timeout="4" deactivation-timeout="3">
+ <adapter name="TestAdapter" endpoints="default" register-process="true">
+ <object identity="${server}" type="Test"/>
+ </adapter>
+ <property name="ActivationDelay" value="${activation-delay}"/>
+ <property name="DeactivationDelay" value="${deactivation-delay}"/>
+ </server>
+ </server-template>
+
+ <server-template id="IceGridNode">
+ <parameter name="id"/>
+ <parameter name="disable-on-failure" default="0"/>
+ <server id="${id}" exe="${ice.dir}/bin/icegridnode" activation="manual">
+ <adapter name="IceGrid.Node" endpoints="default" register-process="true" wait-for-activation="false"/>
+ <dbenv name="data"/>
+ <property name="IceGrid.Node.Name" value="${server}"/>
+ <property name="IceGrid.Node.Data" value="${node.datadir}/servers/${server}/dbs/data"/>
+ <property name="IceGrid.Node.PropertiesOverride"
+ value="${properties-override} Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"/>
+ <property name="IceGrid.Node.DisableOnFailure" value="${disable-on-failure}"/>
+ </server>
+ </server-template>
+
+ <node name="localnode">
+ <server-instance template="IceGridNode" id="node-1" disable-on-failure="-1"/>
+ <server-instance template="IceGridNode" id="node-2" disable-on-failure="2"/>
+
+ <server-instance template="Server" id="server"/>
+ <server-instance template="Server" id="server-manual" activation="manual"/>
+ <server-instance template="Server" id="server-always" activation="always"/>
+ <server-instance template="Server" id="server-activation-timeout" activation-delay="5"/>
+ <server-instance template="Server" id="server-deactivation-timeout" deactivation-delay="60"/>
+ </node>
+
+ <node name="node-1">
+ <server-instance template="Server" id="server1"/>
+ <server-instance template="Server" id="server1-manual" activation="manual"/>
+ <server-instance template="Server" id="server1-always" activation="always"/>
+ <server-instance template="Server" id="server1-activation-timeout" activation-delay="5"/>
+ <server-instance template="Server" id="server1-deactivation-timeout" deactivation-delay="60"/>
+ </node>
+
+ <node name="node-2">
+ <server-instance template="Server" id="server2"/>
+ <server-instance template="Server" id="server2-manual" activation="manual"/>
+ <server-instance template="Server" id="server2-always" activation="always"/>
+ <server-instance template="Server" id="server2-activation-timeout" activation-delay="5"/>
+ <server-instance template="Server" id="server2-deactivation-timeout" deactivation-delay="60"/>
+ </node>
+
+ </application>
+</icegrid>
diff --git a/cpp/test/IceGrid/activation/db/.dummy b/cpp/test/IceGrid/activation/db/.dummy
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/cpp/test/IceGrid/activation/db/.dummy
diff --git a/cpp/test/IceGrid/activation/icegridactivationC.dsp b/cpp/test/IceGrid/activation/icegridactivationC.dsp
new file mode 100644
index 00000000000..a355cb0276a
--- /dev/null
+++ b/cpp/test/IceGrid/activation/icegridactivationC.dsp
@@ -0,0 +1,157 @@
+# Microsoft Developer Studio Project File - Name="icegridsimpleC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=icegridsimpleC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "icegridsimpleC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "icegridsimpleC.mak" CFG="icegridsimpleC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "icegridsimpleC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "icegridsimpleC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "icegridsimpleC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /Zi /O2 /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 /nologo /subsystem:console /incremental:yes /debug /machine:I386 /out:"client.exe" /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "icegridsimpleC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "icegridsimpleC - Win32 Release"
+# Name "icegridsimpleC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "icegridsimpleC - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "icegridsimpleC - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/IceGrid/activation/icegridactivationS.dsp b/cpp/test/IceGrid/activation/icegridactivationS.dsp
new file mode 100644
index 00000000000..7d3640d0422
--- /dev/null
+++ b/cpp/test/IceGrid/activation/icegridactivationS.dsp
@@ -0,0 +1,161 @@
+# Microsoft Developer Studio Project File - Name="icegridsimpleS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=icegridsimpleS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "icegridsimpleS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "icegridsimpleS.mak" CFG="icegridsimpleS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "icegridsimpleS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "icegridsimpleS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "icegridsimpleS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /Zi /O2 /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 /nologo /subsystem:console /incremental:yes /debug /machine:I386 /out:"server.exe" /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "icegridsimpleS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "icegridsimpleS - Win32 Release"
+# Name "icegridsimpleS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "icegridsimpleS - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "icegridsimpleS - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py
new file mode 100755
index 00000000000..20ed344d558
--- /dev/null
+++ b/cpp/test/IceGrid/activation/run.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.append(os.path.join(toplevel, "config"))
+import TestUtil
+import IceGridAdmin
+
+name = os.path.join("IceGrid", "activation")
+testdir = os.path.join(toplevel, "test", name)
+
+#
+# Add locator options for the client and server. Since the server
+# invokes on the locator it's also considered to be a client.
+#
+additionalOptions = " --Ice.Default.Locator=\"IceGrid/Locator:default -p 12345\""
+
+IceGridAdmin.cleanDbDir(os.path.join(testdir, "db"))
+
+#
+# Start IceGrid registry and a node.
+#
+iceGridRegistryThread = IceGridAdmin.startIceGridRegistry("12345", testdir, 0)
+iceGridNodeThread = IceGridAdmin.startIceGridNode(testdir)
+
+#
+# Test client/server with on demand activation.
+#
+server = os.path.join(testdir, "server")
+client = os.path.join(testdir, "client")
+
+print "registering server with icegrid...",
+IceGridAdmin.addApplication(os.path.join(testdir, "application.xml"),
+ "test.dir=" + testdir + " ice.dir=" + toplevel + \
+ " \\\"properties-override=" + TestUtil.clientServerOptions.replace("--", "") + "\\\"");
+IceGridAdmin.startServer("node-1");
+IceGridAdmin.startServer("node-2");
+print "ok"
+
+print "starting client...",
+clientPipe = os.popen(client + TestUtil.clientOptions + additionalOptions + " --with-deploy" + " 2>&1")
+print "ok"
+
+TestUtil.printOutputFromPipe(clientPipe)
+
+clientStatus = clientPipe.close()
+
+print "unregister server with icegrid...",
+IceGridAdmin.stopServer("node-1");
+IceGridAdmin.stopServer("node-2");
+IceGridAdmin.removeApplication("Test");
+print "ok"
+
+IceGridAdmin.shutdownIceGridNode()
+iceGridNodeThread.join()
+IceGridAdmin.shutdownIceGridRegistry()
+iceGridRegistryThread.join()
+
+if clientStatus:
+ sys.exit(1)
+else:
+ sys.exit(0)