From 2c578015edcb36cdc0acd0227295de1dcca1b995 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 23 Nov 2009 13:28:08 +0100 Subject: New AMI mapping --- cpp/src/slice2cpp/Gen.cpp | 1115 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 870 insertions(+), 245 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 18369db167e..83198bcdd8e 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -223,10 +223,7 @@ Slice::Gen::generate(const UnitPtr& p) { H << "\n#include "; H << "\n#include "; - if(p->hasContentsWithMetaData("ami")) - { - H << "\n#include "; - } + H << "\n#include "; H << "\n#include "; if(p->hasContentsWithMetaData("amd")) { @@ -247,6 +244,7 @@ Slice::Gen::generate(const UnitPtr& p) { H << "\n#include "; } + H << "\n#include "; if(p->usesNonLocals()) { @@ -277,7 +275,6 @@ Slice::Gen::generate(const UnitPtr& p) } C << "\n#include "; - C << "\n#include "; StringList includes = p->includeFiles(); @@ -347,6 +344,15 @@ Slice::Gen::generate(const UnitPtr& p) AsyncImplVisitor asyncImplVisitor(H, C, _dllExport); p->visit(&asyncImplVisitor, false); + // + // The templates are emitted before the proxy definition + // so the derivation hierarchy is known to the proxy: + // the proxy relies on knowing the hierarchy to make the begin_ + // methods type-safe. + // + AsyncCallbackVisitor asyncCallbackVisitor(H, C, _dllExport); + p->visit(&asyncCallbackVisitor, false); + ProxyVisitor proxyVisitor(H, C, _dllExport); p->visit(&proxyVisitor, false); @@ -367,6 +373,15 @@ Slice::Gen::generate(const UnitPtr& p) StreamVisitor streamVistor(H, C); p->visit(&streamVistor, false); } + + // + // We need to delay generating the template after the proxy + // definition, because __completed calls the begin_ method in the + // proxy. + // + AsyncCallbackTemplateVisitor asyncCallbackTemplateVisitor(H, C, _dllExport); + p->visit(&asyncCallbackTemplateVisitor, false); + if(_impl) { implH << "\n#include <"; @@ -514,7 +529,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q) { - string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); allTypes.push_back(typeName); allParamDecls.push_back(typeName + " __ice_" + fixKwd((*q)->name())); } @@ -765,8 +780,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__outS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", (*q)->getMetaData(), + _useWstring); } C << nl << "__outS->endSlice();"; if(base) @@ -785,8 +800,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__inS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", (*q)->getMetaData(), + _useWstring); } C << nl << "__inS->endSlice();"; if(base) @@ -911,7 +926,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) string name = fixKwd(p->name()); - if(findMetaData(p->getMetaData(), false) == "class") + if(findMetaData(p->getMetaData()) == "class") { H << sp << nl << "class " << _dllExport << name << " : public IceUtil::Shared"; H << sb; @@ -929,7 +944,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) vector types; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); types.push_back(typeName); paramDecls.push_back(typeName + " __ice_" + (*q)->name()); } @@ -988,7 +1003,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } string dllExport; - if(findMetaData(p->getMetaData(), false) != "class") + if(findMetaData(p->getMetaData()) != "class") { dllExport = _dllExport; } @@ -1099,8 +1114,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", (*q)->getMetaData(), + _useWstring); } C << eb; @@ -1108,8 +1123,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", (*q)->getMetaData(), + _useWstring); } C << eb; C.zeroIndent(); @@ -1119,7 +1134,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } H << eb << ';'; - if(findMetaData(p->getMetaData(), false) == "class") + if(findMetaData(p->getMetaData()) == "class") { H << sp << nl << "typedef ::IceUtil::Handle< " << scoped << "> " << p->name() + "Ptr;"; @@ -1222,7 +1237,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) { StringList metaData = s->getMetaData(); bool protobuf; - findMetaData(s, metaData, false, protobuf); + findMetaData(s, metaData, protobuf); if(protobuf) { emitWarning(p->file(), p->line(), string("protobuf cannot be used as a ") + @@ -1232,7 +1247,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) } } - string s = typeToString(p->type(), _useWstring, p->getMetaData()); + string s = typeToString(p->type(), p->getMetaData(), _useWstring); H << nl << s << ' ' << name << ';'; } @@ -1241,11 +1256,11 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) { string name = fixKwd(p->name()); TypePtr type = p->type(); - string s = typeToString(type, _useWstring, p->typeMetaData()); + string s = typeToString(type, p->typeMetaData(), _useWstring); StringList metaData = p->getMetaData(); bool protobuf; - string seqType = findMetaData(p, metaData, false, protobuf); + string seqType = findMetaData(p, metaData, protobuf); H << sp; if(!protobuf) { @@ -1412,7 +1427,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << scopedName << "::const_iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeStreamMarshalUnmarshalCode(C, type, "(*p)", true, "", _useWstring); + writeStreamMarshalUnmarshalCode(C, type, "(*p)", true, "", StringList(), _useWstring); C << eb; } C << eb; @@ -1436,7 +1451,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << scopedName << "::iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeStreamMarshalUnmarshalCode(C, type, "(*p)", false, "", _useWstring); + writeStreamMarshalUnmarshalCode(C, type, "(*p)", false, "", StringList(), _useWstring); C << eb; } C << eb; @@ -1543,7 +1558,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << scoped << "::const_iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeStreamMarshalUnmarshalCode(C, type, "(*p)", true, "", _useWstring); + writeStreamMarshalUnmarshalCode(C, type, "(*p)", true, "", StringList(), _useWstring); C << eb; C << eb; @@ -1554,7 +1569,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << nl << "v.resize(sz);"; C << nl << "for(int i = 0; i < sz; ++i)"; C << sb; - writeStreamMarshalUnmarshalCode(C, type, "v[i]", false, "", _useWstring); + writeStreamMarshalUnmarshalCode(C, type, "v[i]", false, "", StringList(), _useWstring); C << eb; C << eb; C.zeroIndent(); @@ -1578,7 +1593,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) { StringList metaData = s->getMetaData(); bool protobuf; - findMetaData(s, metaData, false, protobuf); + findMetaData(s, metaData, protobuf); if(protobuf) { emitWarning(p->file(), p->line(), "protobuf cannot be used as a dictionary key in C++"); @@ -1587,12 +1602,12 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) } TypePtr valueType = p->valueType(); - string ks = typeToString(keyType, _useWstring, p->keyMetaData()); + string ks = typeToString(keyType, p->keyMetaData(), _useWstring); if(ks[0] == ':') { ks.insert(0, " "); } - string vs = typeToString(valueType, _useWstring, p->valueMetaData()); + string vs = typeToString(valueType, p->valueMetaData(), _useWstring); H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';'; if(!p->isLocal()) @@ -1663,8 +1678,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << scoped << "::const_iterator p;"; C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; - writeStreamMarshalUnmarshalCode(C, keyType, "p->first", true, "", _useWstring, p->keyMetaData()); - writeStreamMarshalUnmarshalCode(C, valueType, "p->second", true, "", _useWstring, p->valueMetaData()); + writeStreamMarshalUnmarshalCode(C, keyType, "p->first", true, "", p->keyMetaData(), _useWstring); + writeStreamMarshalUnmarshalCode(C, valueType, "p->second", true, "", p->valueMetaData(), _useWstring); C << eb; C << eb; @@ -1675,9 +1690,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << "while(sz--)"; C << sb; C << nl << "::std::pair pair;"; - writeStreamMarshalUnmarshalCode(C, keyType, pf, false, "", _useWstring, p->keyMetaData()); + writeStreamMarshalUnmarshalCode(C, keyType, pf, false, "", p->keyMetaData(), _useWstring); C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);"; - writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false, "", _useWstring, p->valueMetaData()); + writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false, "", p->valueMetaData(), _useWstring); C << eb; C << eb; C.zeroIndent(); @@ -1841,7 +1856,7 @@ void Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) { H << sp; - H << nl << "const " << typeToString(p->type(), _useWstring, p->typeMetaData()) << " " << fixKwd(p->name()) + H << nl << "const " << typeToString(p->type(), p->typeMetaData(), _useWstring) << " " << fixKwd(p->name()) << " = "; BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type()); @@ -1857,7 +1872,7 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' "; static const set charSet(basicSourceChars.begin(), basicSourceChars.end()); - if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring") + if(_useWstring || findMetaData(p->typeMetaData()) == "wstring") { H << 'L'; } @@ -2441,10 +2456,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) string scope = fixKwd(p->scope()); TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, _useWstring, p->getMetaData()); + string retS = returnTypeToString(ret, p->getMetaData(), _useWstring | TypeContextAMIEnd); + string retSEndAMI = returnTypeToString(ret, p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd); ContainerPtr container = p->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); + string clScope = fixKwd(cl->scope()); + string delName = "Callback_" + cl->name() + "_" + name; + string delNameScoped = clScope + delName; vector params; vector paramsDecl; @@ -2453,30 +2472,29 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) vector paramsAMI; vector paramsDeclAMI; vector argsAMI; + vector outParamsAMI; + vector outParamsDeclAMI; + vector outParamsDeclEndAMI; ParamDeclList paramList = p->parameters(); + ParamDeclList inParams; + ParamDeclList outParams; for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { string paramName = fixKwd((*q)->name()); StringList metaData = (*q)->getMetaData(); -#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) - // - // Work around for Sun CC 5.5 bug #4853566 - // string typeString; + string typeStringEndAMI; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), _useWstring, metaData); + typeString = outputTypeToString((*q)->type(), metaData, _useWstring | TypeContextAMIEnd); + typeStringEndAMI = outputTypeToString((*q)->type(), metaData, _useWstring | TypeContextAMIPrivateEnd); } else { - typeString = inputTypeToString((*q)->type(), _useWstring, metaData); + typeString = inputTypeToString((*q)->type(), metaData, _useWstring); } -#else - string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData) - : inputTypeToString((*q)->type(), _useWstring, metaData); -#endif params.push_back(typeString); paramsDecl.push_back(typeString + ' ' + paramName); @@ -2484,12 +2502,35 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) if(!(*q)->isOutParam()) { - string inputTypeString = inputTypeToString((*q)->type(), _useWstring, metaData); - - paramsAMI.push_back(inputTypeString); - paramsDeclAMI.push_back(inputTypeString + ' ' + paramName); + paramsAMI.push_back(typeString); + paramsDeclAMI.push_back(typeString + ' ' + paramName); argsAMI.push_back(paramName); + inParams.push_back(*q); } + else + { + outParamsAMI.push_back(typeString); + outParamsDeclAMI.push_back(typeString + ' ' + paramName); + outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + paramName); + outParams.push_back(*q); + } + } + + // + // Check if we need to generate a private ___end_ method. This is the case if the + // when using certain mapping features such as cpp:array or cpp:range:array. While + // the regular end_ method can't return pair because the + // pointers would be invalid once end_ returns, we still want to allow using this + // alternate mapping with AMI response callbacks (to allow zero-copy for instance). + // For this purpose, we generate a special ___end method which is used by the + // __completed implementation of the generated Callback_Inft_opName operation + // delegate. + // + bool generatePrivateEnd = retS != retSEndAMI || outParamsDeclAMI != outParamsDeclEndAMI; + if(generatePrivateEnd) + { + string typeStringEndAMI = outputTypeToString(ret, p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd); + outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + "__ret"); } string thisPointer = fixKwd(scope.substr(0, scope.size() - 2)) + "*"; @@ -2515,12 +2556,67 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << fixKwd(name) << spar << args << "&__ctx" << epar << ';'; H << eb; + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "0" << "::IceInternal::__dummyCallback" << "0" + << epar << ';'; + H << eb; + + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI + << "const ::Ice::Context& __ctx" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "&__ctx" << "::IceInternal::__dummyCallback" << "__cookie" + << epar << ';'; + H << eb; + + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI + << "const ::Ice::CallbackPtr& __del" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "0" << "__del" << "__cookie" << epar << ';'; + H << eb; + + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI + << "const ::Ice::Context& __ctx" + << "const ::Ice::CallbackPtr& __del" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "&__ctx" << "__del" << "__cookie" << epar << ';'; + H << eb; + + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI + << "const " + delNameScoped + "Ptr& __del" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "0" << "__del" << "__cookie" << epar << ';'; + H << eb; + + H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI + << "const ::Ice::Context& __ctx" + << "const " + delNameScoped + "Ptr& __del" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + H << sb; + H << nl << "return begin_" << name << spar << argsAMI << "&__ctx" << "__del" << "__cookie" << epar << ';'; + H << eb; + + H << sp << nl << retS << " end_" << name << spar << outParamsDeclAMI + << "const ::Ice::AsyncResultPtr&" << epar << ';'; + if(generatePrivateEnd) + { + H << sp << nl << "void ___end_" << name << spar << outParamsDeclEndAMI; + H << "const ::Ice::AsyncResultPtr&" << epar << ';'; + } + H << nl; H.dec(); H << nl << "private:"; H.inc(); H << sp << nl << _dllExport << retS << ' ' << fixKwd(name) << spar << params << "const ::Ice::Context*" << epar << ';'; + H << nl << _dllExport << "::Ice::AsyncResultPtr begin_" << name << spar << paramsAMI << "const ::Ice::Context*" + << "const ::IceInternal::CallbackBasePtr&" + << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar << ';'; H << nl; H.dec(); H << nl << "public:"; @@ -2557,50 +2653,267 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sb; if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating) { - C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);"; + C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, true, __cnt);"; } else { - C << nl << "__handleExceptionWrapper(__delBase, __ex, 0);"; + C << nl << "__handleExceptionWrapper(__delBase, __ex);"; + } + C << eb; + C << nl << "catch(const ::Ice::LocalException& __ex)"; + C << sb; + C << nl << "__handleException(__delBase, __ex, true, __cnt);"; + C << eb; + C << eb; + C << eb; + + C << sp << nl << "::Ice::AsyncResultPtr" << nl << "IceProxy" << scope << "begin_" << name << spar << paramsDeclAMI + << "const ::Ice::Context* __ctx" << "const ::IceInternal::CallbackBasePtr& __del" + << "const ::Ice::LocalObjectPtr& __cookie" << epar; + C << sb; + string flatName = p->flattenedScope() + name + "_name"; + C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, "; + C << flatName << ", __del, __cookie);"; + C << nl << "try"; + C << sb; + if(p->returnsData()) + { + C << nl << "__checkTwowayOnly(" << flatName << ");"; + } + C << nl << "__result->__prepare(" << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; + C << nl << "::IceInternal::BasicStream* __os = __result->__getOs();"; + writeMarshalCode(C, inParams, 0, StringList(), true); + if(p->sendsClasses()) + { + C << nl << "__os->writePendingObjects();"; } + C << nl << "__os->endWriteEncaps();"; + C << nl << "__result->__send(true);"; C << eb; C << nl << "catch(const ::Ice::LocalException& __ex)"; C << sb; - C << nl << "__handleException(__delBase, __ex, 0, __cnt);"; + C << nl << "__result->__exceptionAsync(__ex);"; C << eb; + C << nl << "return __result;"; C << eb; + + C << sp << nl << retS << nl << "IceProxy" << scope << "end_" << name << spar << outParamsDeclAMI + << "const ::Ice::AsyncResultPtr& __result" << epar; + C << sb; + if(p->returnsData()) + { + C << nl << "::Ice::AsyncResult::__check(__result, this, " << flatName << ");"; + C << nl << "if(!__result->__wait())"; + C << sb; + C << nl << "try"; + C << sb; + C << nl << "__result->__throwUserException();"; + C << eb; + // + // Generate a catch block for each legal user exception. + // (See comment in DelegateMVisitor::visitOperation() for details.) + // + ExceptionList throws = p->throws(); + throws.sort(); + throws.unique(); +#if defined(__SUNPRO_CC) + throws.sort(derivedToBaseCompare); +#else + throws.sort(Slice::DerivedToBaseCompare()); +#endif + for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) + { + string scoped = (*i)->scoped(); + C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; + C << sb; + C << nl << "throw;"; + C << eb; + } + C << nl << "catch(const ::Ice::UserException& __ex)"; + C << sb; + C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());"; + C << eb; + C << eb; + writeAllocateCode(C, ParamDeclList(), ret, p->getMetaData(), _useWstring | TypeContextAMIEnd); + C << nl << "::IceInternal::BasicStream* __is = __result->__getIs();"; + if(ret || !outParams.empty()) + { + C << nl << "__is->startReadEncaps();"; + writeUnmarshalCode(C, outParams, ret, p->getMetaData(), _useWstring | TypeContextAMIEnd); + if(p->returnsClasses()) + { + C << nl << "__is->readPendingObjects();"; + } + C << nl << "__is->endReadEncaps();"; + } + else + { + C << nl << "__is->skipEmptyEncaps();"; + } + if(ret) + { + C << nl << "return __ret;"; + } + } + else + { + C << nl << "__end(__result, " << flatName << ");"; + } C << eb; + if(generatePrivateEnd) + { + assert(p->returnsData()); + + C << sp << nl << "void IceProxy" << scope << "___end_" << name << spar << outParamsDeclEndAMI + << "const ::Ice::AsyncResultPtr& __result" << epar; + C << sb; + C << nl << "::Ice::AsyncResult::__check(__result, this, " << flatName << ");"; + C << nl << "if(!__result->__wait())"; + C << sb; + C << nl << "try"; + C << sb; + C << nl << "__result->__throwUserException();"; + C << eb; + // + // Generate a catch block for each legal user exception. + // (See comment in DelegateMVisitor::visitOperation() for details.) + // + ExceptionList throws = p->throws(); + throws.sort(); + throws.unique(); +#if defined(__SUNPRO_CC) + throws.sort(derivedToBaseCompare); +#else + throws.sort(Slice::DerivedToBaseCompare()); +#endif + for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) + { + string scoped = (*i)->scoped(); + C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; + C << sb; + C << nl << "throw;"; + C << eb; + } + C << nl << "catch(const ::Ice::UserException& __ex)"; + C << sb; + C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());"; + C << eb; + C << eb; + C << nl << "::IceInternal::BasicStream* __is = __result->__getIs();"; + if(ret || !outParams.empty()) + { + C << nl << "__is->startReadEncaps();"; + writeUnmarshalCode(C, outParams, ret, p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd); + if(p->returnsClasses()) + { + C << nl << "__is->readPendingObjects();"; + } + C << nl << "__is->endReadEncaps();"; + } + else + { + C << nl << "__is->skipEmptyEncaps();"; + } + C << eb; + } + if(cl->hasMetaData("ami") || p->hasMetaData("ami")) { string classNameAMI = "AMI_" + cl->name(); string classScope = fixKwd(cl->scope()); string classScopedAMI = classScope + classNameAMI; + string opScopedAMI = classScopedAMI + "_" + name; - H << nl << _dllExport << "bool " << name << "_async" << spar - << ("const " + classScopedAMI + '_' + p->name() + "Ptr&") + H << nl << _dllExport << "bool " << name << "_async" << spar << ("const " + opScopedAMI + "Ptr&") << paramsAMI << epar << ';'; - H << nl << _dllExport << "bool " << name << "_async" << spar - << ("const " + classScopedAMI + '_' + p->name() + "Ptr&") + H << nl << _dllExport << "bool " << name << "_async" << spar << ("const " + opScopedAMI + "Ptr&") << paramsAMI << "const ::Ice::Context&" << epar << ';'; C << sp << nl << "bool" << nl << "IceProxy" << scope << name << "_async" << spar - << ("const " + classScopedAMI + '_' + p->name() + "Ptr& __cb") << paramsDeclAMI << epar; + << ("const " + opScopedAMI + "Ptr& __cb") << paramsDeclAMI << epar; C << sb; - C << nl << "return __cb->__invoke" << spar << "this" << argsAMI << "0" << epar << ';'; + if(p->returnsData()) + { + C << nl << delNameScoped << "Ptr __del;"; + C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception, &" << opScopedAMI << "::__sent);"; + C << eb; + C << nl << "else"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception);"; + C << eb; + } + else + { + C << nl << "::IceInternal::CallbackBasePtr __del;"; + C << nl << "if(ice_isTwoway())"; + C << sb; + C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception, &" << opScopedAMI << "::__sent);"; + C << eb; + C << nl << "else"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception);"; + C << eb; + C << eb; + C << nl << "else"; + C << sb; + C << nl << "__del = ::Ice::newCallback(__cb);"; + C << eb; + } + C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; + C << nl << "return __ar->sentSynchronously();"; C << eb; C << sp << nl << "bool" << nl << "IceProxy" << scope << name << "_async" << spar - << ("const " + classScopedAMI + '_' + p->name() + "Ptr& __cb") - << paramsDeclAMI << "const ::Ice::Context& __ctx" + << ("const " + opScopedAMI + "Ptr& __cb") << paramsDeclAMI << "const ::Ice::Context& __ctx" << epar; C << sb; - C << nl << "return __cb->__invoke" << spar << "this" << argsAMI << "&__ctx" << epar << ';'; + if(p->returnsData()) + { + C << nl << delNameScoped << "Ptr __del;"; + C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception, &" << opScopedAMI << "::__sent);"; + C << eb; + C << nl << "else"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception);"; + C << eb; + } + else + { + C << nl << "::IceInternal::CallbackBasePtr __del;"; + C << nl << "if(ice_isTwoway())"; + C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception, &" << opScopedAMI << "::__sent);"; + C << eb; + C << nl << "else"; + C << sb; + C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" + << opScopedAMI << "::__exception);"; + C << eb; + C << nl << "else"; + C << sb; + C << nl << "__del = ::Ice::newCallback(__cb);"; + C << eb; + } + C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar + << ';'; + C << nl << "return __ar->sentSynchronously();"; C << eb; } - - - } Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& dllExport) : @@ -2706,7 +3019,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) string name = fixKwd(p->name()); TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, _useWstring, p->getMetaData()); + string retS = returnTypeToString(ret, p->getMetaData(), _useWstring); vector params; @@ -2721,15 +3034,15 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) string typeString; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), _useWstring, metaData); + typeString = outputTypeToString((*q)->type(), metaData, _useWstring); } else { - typeString = inputTypeToString((*q)->type(), _useWstring, metaData); + typeString = inputTypeToString((*q)->type(), metaData, _useWstring); } #else - string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData) - : inputTypeToString((*q)->type(), _useWstring, metaData); + string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), metaData, _useWstring) + : inputTypeToString((*q)->type(), metaData, _useWstring); #endif params.push_back(typeString); @@ -2846,7 +3159,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) string scoped = fixKwd(p->scoped()); TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, _useWstring, p->getMetaData()); + string retS = returnTypeToString(ret, p->getMetaData(), _useWstring); vector params; vector paramsDecl; @@ -2864,12 +3177,12 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) if(isOutParam) { outParams.push_back(*q); - typeString = outputTypeToString(type, _useWstring, metaData); + typeString = outputTypeToString(type, metaData, _useWstring); } else { inParams.push_back(*q); - typeString = inputTypeToString(type, _useWstring, metaData); + typeString = inputTypeToString(type, metaData, _useWstring); } params.push_back(typeString); @@ -2976,7 +3289,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) for(ParamDeclList::const_iterator opi = outParams.begin(); opi != outParams.end(); ++opi) { StructPtr st = StructPtr::dynamicCast((*opi)->type()); - if(st && findMetaData(st->getMetaData(), false) == "class") + if(st && findMetaData(st->getMetaData()) == "class") { C << nl << fixKwd((*opi)->name()) << " = new " << fixKwd(st->scoped()) << ";"; } @@ -3120,7 +3433,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) string scoped = fixKwd(p->scoped()); TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, _useWstring, p->getMetaData()); + string retS = returnTypeToString(ret, p->getMetaData(), _useWstring); vector params; vector paramsDecl; @@ -3140,15 +3453,15 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) string typeString; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), _useWstring, metaData); + typeString = outputTypeToString((*q)->type(), metaData, _useWstring); } else { - typeString = inputTypeToString((*q)->type(), _useWstring, metaData); + typeString = inputTypeToString((*q)->type(), metaData, _useWstring); } #else - string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData) - : inputTypeToString((*q)->type(), _useWstring, metaData); + string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), metaData, _useWstring) + : inputTypeToString((*q)->type(), metaData, _useWstring); #endif params.push_back(typeString); @@ -3197,7 +3510,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << sp << nl << "_DirectI" << spar; if(ret) { - string resultRef = outputTypeToString(ret, _useWstring, p->getMetaData()); + string resultRef = outputTypeToString(ret, p->getMetaData(), _useWstring); C << resultRef + " __result"; } C << paramsDecl << "const ::Ice::Current& __current" << epar << " : "; @@ -3274,7 +3587,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << nl; if(ret) { - string resultRef= outputTypeToString(ret, _useWstring, p->getMetaData()); + string resultRef= outputTypeToString(ret, p->getMetaData(), _useWstring); C << nl << resultRef << " _result;"; } @@ -3511,7 +3824,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q) { - string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); allTypes.push_back(typeName); allParamDecls.push_back(typeName + " __ice_" + (*q)->name()); } @@ -3972,8 +4285,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "__outS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", (*q)->getMetaData(), + _useWstring); } C << nl << "__outS->endSlice();"; emitUpcall(base, "::__write(__outS);"); @@ -3988,8 +4301,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "__inS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring, - (*q)->getMetaData()); + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", (*q)->getMetaData(), + _useWstring); } C << nl << "__inS->endSlice();"; emitUpcall(base, "::__read(__inS, true);"); @@ -4122,7 +4435,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { StringList metaData = s->getMetaData(); bool protobuf; - findMetaData(s, metaData, false, protobuf); + findMetaData(s, metaData, protobuf); if(protobuf) { emitWarning((*q)->file(), (*q)->line(), "protobuf cannot be used as a class member in C++"); @@ -4152,7 +4465,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) } string name = fixKwd((*q)->name()); - string s = typeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + string s = typeToString((*q)->type(), (*q)->getMetaData(), _useWstring); H << sp << nl << s << ' ' << name << ';'; } @@ -4242,7 +4555,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) string scope = fixKwd(p->scope()); TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, _useWstring, p->getMetaData()); + string retS = returnTypeToString(ret, p->getMetaData(), _useWstring); string params = "("; string paramsDecl = "("; @@ -4270,12 +4583,12 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) if(isOutParam) { outParams.push_back(*q); - typeString = outputTypeToString(type, _useWstring, (*q)->getMetaData()); + typeString = outputTypeToString(type, (*q)->getMetaData(), _useWstring); } else { inParams.push_back(*q); - typeString = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + typeString = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); } if(q != paramList.begin()) @@ -4380,8 +4693,8 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) { C << nl << "::IceInternal::BasicStream* __is = __inS.is();"; C << nl << "__is->startReadEncaps();"; - writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true); - writeUnmarshalCode(C, inParams, 0, StringList(), true); + writeAllocateCode(C, inParams, 0, StringList(), _useWstring | TypeContextInParam); + writeUnmarshalCode(C, inParams, 0, StringList(), TypeContextInParam); if(p->sendsClasses()) { C << nl << "__is->readPendingObjects();"; @@ -4438,8 +4751,8 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) { C << nl << "::IceInternal::BasicStream* __is = __inS.is();"; C << nl << "__is->startReadEncaps();"; - writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true); - writeUnmarshalCode(C, inParams, 0, StringList(), true); + writeAllocateCode(C, inParams, 0, StringList(), _useWstring | TypeContextInParam); + writeUnmarshalCode(C, inParams, 0, StringList(), TypeContextInParam); if(p->sendsClasses()) { C << nl << "__is->readPendingObjects();"; @@ -4769,7 +5082,7 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p) for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q) { - string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); allParamDecls.push_back(typeName + " __ice_" + (*q)->name()); } @@ -4830,54 +5143,457 @@ Slice::Gen::ObjectVisitor::emitUpcall(const ClassDefPtr& base, const string& cal C.restoreIndent(); } -Slice::Gen::IceInternalVisitor::IceInternalVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllExport(dllExport) +Slice::Gen::AsyncCallbackVisitor::AsyncCallbackVisitor(Output& h, Output& c, const string& dllExport) : + H(h), C(c), _dllExport(dllExport), _useWstring(false) { } bool -Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p) +Slice::Gen::AsyncCallbackVisitor::visitUnitStart(const UnitPtr& p) { - if(!p->hasClassDecls()) + return p->hasNonLocalClassDefs(); +} + +void +Slice::Gen::AsyncCallbackVisitor::visitUnitEnd(const UnitPtr&) +{ +} + +bool +Slice::Gen::AsyncCallbackVisitor::visitModuleStart(const ModulePtr& p) +{ + if(!p->hasNonLocalClassDefs()) { return false; } - H << sp; - H << nl << "namespace IceInternal" << nl << '{'; + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + + H << sp << nl << "namespace " << fixKwd(p->name()) << nl << '{'; return true; } void -Slice::Gen::IceInternalVisitor::visitUnitEnd(const UnitPtr& p) +Slice::Gen::AsyncCallbackVisitor::visitModuleEnd(const ModulePtr& p) { - H << sp; - H << nl << '}'; + _useWstring = resetUseWstring(_useWstringHist); + + H << sp << nl << '}'; +} + +bool +Slice::Gen::AsyncCallbackVisitor::visitClassDefStart(const ClassDefPtr& p) +{ + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + return true; } void -Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p) +Slice::Gen::AsyncCallbackVisitor::visitClassDefEnd(const ClassDefPtr& p) { - string scoped = fixKwd(p->scoped()); + _useWstring = resetUseWstring(_useWstringHist); +} - H << sp; +void +Slice::Gen::AsyncCallbackVisitor::visitOperation(const OperationPtr& p) +{ + ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); - if(!p->isLocal()) + if(cl->isLocal() || cl->operations().empty()) { - H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);"; - H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);"; - } - else - { - H << nl << _dllExport << "::Ice::LocalObject* upCast(" << scoped << "*);"; + return; } + + // + // Write the callback base class and callback smart pointer. + // + string delName = "Callback_" + cl->name() + "_" + p->name(); + H << sp << nl << "class " << delName << "_Base : virtual public ::IceInternal::CallbackBase { };"; + H << nl << "typedef ::IceUtil::Handle< " << delName << "_Base> " << delName << "Ptr;"; +} + +Slice::Gen::AsyncCallbackTemplateVisitor::AsyncCallbackTemplateVisitor(Output& h, + Output& c, + const string& dllExport) + : H(h), C(c), _dllExport(dllExport), _useWstring(false) +{ } bool -Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) +Slice::Gen::AsyncCallbackTemplateVisitor::visitUnitStart(const UnitPtr& p) { - string scoped = fixKwd(p->scoped()); + return p->hasNonLocalClassDefs(); +} + +void +Slice::Gen::AsyncCallbackTemplateVisitor::visitUnitEnd(const UnitPtr&) +{ +} + +bool +Slice::Gen::AsyncCallbackTemplateVisitor::visitModuleStart(const ModulePtr& p) +{ + if(!p->hasNonLocalClassDefs()) + { + return false; + } + + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + + H << sp << nl << "namespace " << fixKwd(p->name()) << nl << '{'; + return true; +} + +void +Slice::Gen::AsyncCallbackTemplateVisitor::visitModuleEnd(const ModulePtr& p) +{ + _useWstring = resetUseWstring(_useWstringHist); + + H << sp << nl << '}'; +} + +bool +Slice::Gen::AsyncCallbackTemplateVisitor::visitClassDefStart(const ClassDefPtr& p) +{ + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + return true; +} + +void +Slice::Gen::AsyncCallbackTemplateVisitor::visitClassDefEnd(const ClassDefPtr& p) +{ + _useWstring = resetUseWstring(_useWstringHist); +} + +namespace +{ + +bool +usePrivateEnd(const OperationPtr& p) +{ + TypePtr ret = p->returnType(); + string retSEnd = returnTypeToString(ret, p->getMetaData(), TypeContextAMIEnd); + string retSPrivateEnd = returnTypeToString(ret, p->getMetaData(), TypeContextAMIPrivateEnd); + + ParamDeclList outParams; + vector outDeclsEnd; + vector outDeclsPrivateEnd; + + ParamDeclList paramList = p->parameters(); + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) + { + if((*q)->isOutParam()) + { + outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->getMetaData(), TypeContextAMIEnd)); + outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->getMetaData(), TypeContextAMIPrivateEnd)); + } + } + + return retSEnd != retSPrivateEnd || outDeclsEnd != outDeclsPrivateEnd; +} + +} + +void +Slice::Gen::AsyncCallbackTemplateVisitor::visitOperation(const OperationPtr& p) +{ + generateOperation(p, false); + generateOperation(p, true); +} + +void +Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& p, bool withCookie) +{ + ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); + if(cl->isLocal() || cl->operations().empty()) + { + return; + } + + string clName = cl->name(); + string clScope = fixKwd(cl->scope()); + string delName = "Callback_" + clName + "_" + p->name(); + string delTmplName = (withCookie ? "Callback_" : "CallbackNC_") + clName + "_" + p->name(); + + TypePtr ret = p->returnType(); + string retS = inputTypeToString(ret, p->getMetaData(), _useWstring); + string retEndArg = getEndArg(ret, p->getMetaData(), "__ret"); + + ParamDeclList outParams; + vector outArgs; + vector outDecls; + vector outDeclsEnd; + vector outEndArgs; + + ParamDeclList paramList = p->parameters(); + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) + { + if((*q)->isOutParam()) + { + outParams.push_back(*q); + outArgs.push_back(fixKwd((*q)->name())); + outEndArgs.push_back(getEndArg((*q)->type(), (*q)->getMetaData(), outArgs.back())); + outDecls.push_back(inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring)); + } + } + + string baseD; + string inheritD; + if(withCookie) + { + baseD = "::IceInternal::Callback"; + H << sp << nl << "template"; + inheritD = p->returnsData() ? "::IceInternal::TwowayCallback" : "::IceInternal::OnewayCallback"; + } + else + { + baseD = "::IceInternal::CallbackNC"; + H << sp << nl << "template"; + inheritD = p->returnsData() ? "::IceInternal::TwowayCallbackNC" : "::IceInternal::OnewayCallbackNC"; + } + + H << nl << "class " << delTmplName << " : public " << delName << "_Base, public " << inheritD; + H << sb; + H.dec(); + H << nl << "public:"; + H.inc(); + + H << sp << nl << "typedef IceUtil::Handle TPtr;"; + if(withCookie) + { + H << nl << "typedef IceUtil::Handle CTPtr;"; + } + + string cookieT; + string comCookieT; + if(withCookie) + { + cookieT = "const CTPtr&"; + comCookieT = " , const CTPtr&"; + } + + H << sp << nl << "typedef void (T::*Exception)(const ::Ice::Exception&" << comCookieT << ");"; + H << nl << "typedef void (T::*Sent)(" << cookieT << ");"; + if(p->returnsData()) + { + // + // typedefs for callbacks. + // + H << nl << "typedef void (T::*Response)" << spar; + if(ret) + { + H << retS; + } + H << outDecls; + if(withCookie) + { + H << cookieT; + } + H << epar << ';'; + } + else + { + H << nl << "typedef void (T::*Response)(" << cookieT << ");"; + } + + // + // constructor. + // + H << sp; + H << nl << delTmplName << spar << "const TPtr& obj"; + H << "Response cb"; + H << "Exception excb"; + H << "Sent sentcb" << epar; + H.inc(); + if(p->returnsData()) + { + H << nl << ": " << inheritD + "(obj, cb != 0, excb, sentcb), response(cb)"; + } + else + { + H << nl << ": " << inheritD + "(obj, cb, excb, sentcb)"; + } + H.dec(); + H << sb; + H << eb; + + if(p->returnsData()) + { + // + // completed. + // + H << sp << nl << "virtual void __completed(const ::Ice::AsyncResultPtr& __result) const"; + H << sb; + H << nl << clScope << clName << "Prx __proxy = " << clScope << clName + << "Prx::uncheckedCast(__result->getProxy());"; + writeAllocateCode(H, outParams, ret, p->getMetaData(), + _useWstring | TypeContextInParam | TypeContextAMICallPrivateEnd); + H << nl << "try"; + H << sb; + H << nl; + if(!usePrivateEnd(p)) + { + if(ret) + { + H << retEndArg << " = "; + } + H << "__proxy->end_" << p->name() << spar << outEndArgs << "__result" << epar << ';'; + } + else + { + H << "__proxy->___end_" << p->name() << spar << outEndArgs << retEndArg << "__result" << epar << ';'; + } + writeEndCode(H, outParams, ret, p->getMetaData()); + H << eb; + H << nl << "catch(::Ice::Exception& ex)"; + H << sb; + H.zeroIndent(); + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H.restoreIndent(); + H << nl << "__exception(__result, ex);"; + H.zeroIndent(); + H << nl << "#else"; + H.restoreIndent(); + H << nl << "" << baseD << "::__exception(__result, ex);"; + H.zeroIndent(); + H << nl << "#endif"; + H.restoreIndent(); + H << nl << "return;"; + H << eb; + H << nl << "if(response)"; + H << sb; + H.zeroIndent(); + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H.restoreIndent(); + H << nl << "(callback.get()->*response)" << spar; + if(ret) + { + H << "__ret"; + } + H << outArgs; + if(withCookie) + { + H << "CTPtr::dynamicCast(__result->getCookie())"; + } + H << epar << ';'; + H.zeroIndent(); + H << nl << "#else"; + H.restoreIndent(); + H << nl << "(" << baseD << "::callback.get()->*response)" << spar; + if(ret) + { + H << "__ret"; + } + H << outArgs; + if(withCookie) + { + H << "CTPtr::dynamicCast(__result->getCookie())"; + } + H << epar << ';'; + H.zeroIndent(); + H << nl << "#endif"; + H.restoreIndent(); + H << eb; + H << eb; + + H << sp << nl << "Response response;"; + } + H << eb << ';'; + + // Factory method + if(withCookie) + { + cookieT = "const ::IceUtil::Handle&"; + comCookieT = " , const ::IceUtil::Handle&"; + H << sp << nl << "template " << delName << "Ptr"; + } + else + { + H << sp << nl << "template " << delName << "Ptr"; + } + + H << nl << "new" << delName << "(const ::IceUtil::Handle& instance, "; + if(p->returnsData()) + { + H << "void (T::*cb)" << spar; + if(ret) + { + H << retS; + } + H << outDecls; + if(withCookie) + { + H << cookieT; + } + H << epar << ", "; + } + else + { + H << "void (T::*cb)(" << cookieT << "),"; + } + H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << ") = 0,"; + H << "void (T::*sentcb)(" << cookieT << ") = 0)"; + H << sb; + if(withCookie) + { + H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; + } + else + { + H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; + } + H << eb; +} + +Slice::Gen::IceInternalVisitor::IceInternalVisitor(Output& h, Output& c, const string& dllExport) : + H(h), C(c), _dllExport(dllExport) +{ +} + +bool +Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p) +{ + if(!p->hasClassDecls()) + { + return false; + } + + H << sp; + H << nl << "namespace IceInternal" << nl << '{'; + + return true; +} + +void +Slice::Gen::IceInternalVisitor::visitUnitEnd(const UnitPtr& p) +{ + H << sp; + H << nl << '}'; +} + +void +Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p) +{ + string scoped = fixKwd(p->scoped()); + + H << sp; + + if(!p->isLocal()) + { + H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);"; + H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);"; + } + else + { + H << nl << _dllExport << "::Ice::LocalObject* upCast(" << scoped << "*);"; + } +} + +bool +Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) +{ + string scoped = fixKwd(p->scoped()); C << sp; if(!p->isLocal()) @@ -5073,7 +5789,7 @@ Slice::Gen::ImplVisitor::ImplVisitor(Output& h, Output& c, void Slice::Gen::ImplVisitor::writeDecl(Output& out, const string& name, const TypePtr& type, const StringList& metaData) { - out << nl << typeToString(type, _useWstring, metaData) << ' ' << name; + out << nl << typeToString(type, metaData, _useWstring) << ' ' << name; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) @@ -5194,7 +5910,7 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const Str SequencePtr seq = SequencePtr::dynamicCast(type); if(seq) { - out << nl << "return " << typeToString(seq, _useWstring, metaData) << "();"; + out << nl << "return " << typeToString(seq, metaData, _useWstring) << "();"; } else { @@ -5302,7 +6018,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) string opName = op->name(); TypePtr ret = op->returnType(); - string retS = returnTypeToString(ret, _useWstring, op->getMetaData()); + string retS = returnTypeToString(ret, op->getMetaData(), _useWstring); if(!p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"))) { @@ -5315,7 +6031,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { if(!(*q)->isOutParam()) { - H << ',' << nl << inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()); + H << ',' << nl << inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring); } } H << ',' << nl << "const Ice::Current&"; @@ -5332,7 +6048,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { if(!(*q)->isOutParam()) { - C << ',' << nl << inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()) << ' ' + C << ',' << nl << inputTypeToString((*q)->type(), (*q)->getMetaData(), _useWstring) << ' ' << fixKwd((*q)->name()); } } @@ -5402,15 +6118,15 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) string typeString; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), _useWstring, metaData); + typeString = outputTypeToString((*q)->type(), metaData, _useWstring); } else { - typeString = inputTypeToString((*q)->type(), _useWstring, metaData); + typeString = inputTypeToString((*q)->type(), metaData, _useWstring); } #else - string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData) - : inputTypeToString((*q)->type(), _useWstring, metaData); + string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), metaData, _useWstring) + : inputTypeToString((*q)->type(), metaData, _useWstring); #endif H << typeString; } @@ -5452,8 +6168,8 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) typeString = inputTypeToString((*q)->type(), _useWstring, metaData); } #else - string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData) - : inputTypeToString((*q)->type(), _useWstring, metaData); + string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), metaData, _useWstring) + : inputTypeToString((*q)->type(), metaData, _useWstring); #endif C << typeString << ' ' << fixKwd((*q)->name()); } @@ -5563,12 +6279,12 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) paramsDeclInvoke.push_back("const " + proxyName + "& __prx"); TypePtr ret = p->returnType(); - string retS = inputTypeToString(ret, _useWstring, p->getMetaData()); + string retS = inputTypeToString(ret, p->getMetaData(), _useWstring); if(ret) { params.push_back(retS); - paramsAMD.push_back(inputTypeToString(ret, _useWstring, p->getMetaData())); + paramsAMD.push_back(inputTypeToString(ret, p->getMetaData(), _useWstring)); paramsDecl.push_back(retS + " __ret"); args.push_back("__ret"); } @@ -5580,12 +6296,12 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) { string paramName = fixKwd((*q)->name()); TypePtr type = (*q)->type(); - string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData()); + string typeString = inputTypeToString(type, (*q)->getMetaData(), _useWstring); if((*q)->isOutParam()) { params.push_back(typeString); - paramsAMD.push_back(inputTypeToString(type, _useWstring, (*q)->getMetaData())); + paramsAMD.push_back(inputTypeToString(type, (*q)->getMetaData(), _useWstring)); paramsDecl.push_back(typeString + ' ' + paramName); args.push_back(paramName); @@ -5605,120 +6321,29 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) if(cl->hasMetaData("ami") || p->hasMetaData("ami")) { - H << sp << nl << "class " << _dllExport << classNameAMI << '_' << name - << " : public ::IceInternal::OutgoingAsync"; + H << sp << nl << "class " << _dllExport << classNameAMI << '_' << name <<" : public ::Ice::AMICallbackBase"; H << sb; H.dec(); H << nl << "public:"; H.inc(); H << sp; H << nl << "virtual void ice_response" << spar << params << epar << " = 0;"; - H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;"; H << sp; - H << nl << "bool __invoke" << spar << paramsInvoke << epar << ';'; - H << sp; - H.dec(); - H << nl << "protected:"; - H.inc(); - H << sp; - H << nl << "virtual void __response(bool);"; + H << nl << "void __response" << spar << paramsDecl << epar; + H << sb; + H << nl << "ice_response" << spar << args << epar << ';'; + H << eb; + H << nl << "void __exception(const ::Ice::Exception& ex)"; + H << sb; + H << nl << "ice_exception(ex);"; + H << eb; + H << nl << "void __sent()"; + H << sb; + H << nl << "AMICallbackBase::__sent();"; + H << eb; H << eb << ';'; H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI << '_' << name << "Ptr;"; - - string flatName = p->flattenedScope() + name + "_name"; - - C << sp << nl << "bool" << nl << classScopedAMI.substr(2) << '_' << name << "::__invoke" << spar - << paramsDeclInvoke << epar; - C << sb; - C << nl << "__acquireCallback(__prx);"; - C << nl << "try"; - C << sb; - if(p->returnsData()) - { - C << nl << "__prx->__checkTwowayOnly(" << flatName << ");"; - } - C << nl << "__prepare(__prx, " << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; - writeMarshalCode(C, inParams, 0, StringList(), true); - if(p->sendsClasses()) - { - C << nl << "__os->writePendingObjects();"; - } - C << nl << "__os->endWriteEncaps();"; - C << nl << "return __send();"; - C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; - C << sb; - C << nl << "__releaseCallback(__ex);"; - C << nl << "return false;"; - C << eb; - C << eb; - - C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__response(bool __ok)"; - C << sb; - writeAllocateCode(C, outParams, ret, p->getMetaData(), _useWstring, true); - C << nl << "try"; - C << sb; - C << nl << "if(!__ok)"; - C << sb; - C << nl << "try"; - C << sb; - C << nl << "__throwUserException();"; - C << eb; - // - // Generate a catch block for each legal user exception. - // (See comment in DelegateMVisitor::visitOperation() for details.) - // - ExceptionList throws = p->throws(); - throws.sort(); - throws.unique(); -#if defined(__SUNPRO_CC) - throws.sort(derivedToBaseCompare); -#else - throws.sort(Slice::DerivedToBaseCompare()); -#endif - for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) - { - string scoped = (*i)->scoped(); - C << nl << "catch(const " << fixKwd((*i)->scoped()) << "& __ex)"; - C << sb; - C << nl << "__exception(__ex);"; - C << eb; - } - C << nl << "catch(const ::Ice::UserException& __ex)"; - C << sb; - C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());"; - C << eb; - C << nl << "return;"; - C << eb; - - if(ret || !outParams.empty()) - { - C << nl << "__is->startReadEncaps();"; - writeUnmarshalCode(C, outParams, 0, StringList(), true); - if(ret) - { - writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true); - } - if(p->returnsClasses()) - { - C << nl << "__is->readPendingObjects();"; - } - C << nl << "__is->endReadEncaps();"; - } - else - { - C << nl << "__is->skipEmptyEncaps();"; - } - C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; - C << sb; - C << nl << "__finished(__ex);"; - C << nl << "return;"; - C << eb; - C << nl << "ice_response" << spar << args << epar << ';'; - C << nl << "__releaseCallback();"; - C << eb; } if(cl->hasMetaData("amd") || p->hasMetaData("amd")) @@ -5837,7 +6462,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) #endif TypePtr ret = p->returnType(); - string retS = inputTypeToString(ret, _useWstring, p->getMetaData()); + string retS = inputTypeToString(ret, p->getMetaData(), _useWstring); if(ret) { @@ -5856,7 +6481,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) { string paramName = fixKwd((*q)->name()); TypePtr type = (*q)->type(); - string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData()); + string typeString = inputTypeToString(type, (*q)->getMetaData(), _useWstring); if(ret || !outParams.empty()) { @@ -6353,26 +6978,26 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin } } -bool -Slice::Gen::setUseWstring(ContainedPtr p, list& hist, bool use) +int +Slice::Gen::setUseWstring(ContainedPtr p, list& hist, int use) { hist.push_back(use); StringList metaData = p->getMetaData(); if(find(metaData.begin(), metaData.end(), "cpp:type:wstring") != metaData.end()) { - use = true; + use = TypeContextUseWstring; } else if(find(metaData.begin(), metaData.end(), "cpp:type:string") != metaData.end()) { - use = false; + use = 0; } return use; } -bool -Slice::Gen::resetUseWstring(list& hist) +int +Slice::Gen::resetUseWstring(list& hist) { - bool use = hist.back(); + int use = hist.back(); hist.pop_back(); return use; } -- cgit v1.2.3 From 2fca2c1309c4991b21ff956709068122f19eef4a Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 25 Nov 2009 15:05:41 +0100 Subject: - Cleaned up test/Ice/operations test - Added test/Ice/ami test - sent callback is now always called --- cpp/allTests.py | 1 + cpp/demo/Ice/Makefile | 2 +- cpp/demo/Ice/Makefile.mak | 1 + cpp/include/Ice/ConnectionIF.h | 7 + cpp/include/Ice/OutgoingAsync.h | 124 +- cpp/include/Ice/OutgoingAsyncF.h | 4 + cpp/include/Ice/Proxy.h | 94 +- cpp/src/Ice/ConnectRequestHandler.cpp | 12 +- cpp/src/Ice/ConnectRequestHandler.h | 4 +- cpp/src/Ice/ConnectionI.cpp | 52 +- cpp/src/Ice/ConnectionI.h | 6 +- cpp/src/Ice/ConnectionRequestHandler.cpp | 4 +- cpp/src/Ice/ConnectionRequestHandler.h | 4 +- cpp/src/Ice/OutgoingAsync.cpp | 101 +- cpp/src/Ice/Proxy.cpp | 20 +- cpp/src/Ice/RequestHandler.h | 4 +- cpp/src/slice2cpp/Gen.cpp | 17 +- cpp/src/slice2cs/Gen.cpp | 20 +- cpp/src/slice2java/Gen.cpp | 4 +- cpp/test/Ice/Makefile | 1 + cpp/test/Ice/Makefile.mak | 1 + cpp/test/Ice/ami/.depend | 7 + cpp/test/Ice/ami/.gitignore | 7 + cpp/test/Ice/ami/AllTests.cpp | 1302 ++++++++++++++++ cpp/test/Ice/ami/Client.cpp | 59 + cpp/test/Ice/ami/Makefile | 43 + cpp/test/Ice/ami/Makefile.mak | 50 + cpp/test/Ice/ami/Server.cpp | 76 + cpp/test/Ice/ami/Test.ice | 41 + cpp/test/Ice/ami/TestI.cpp | 58 + cpp/test/Ice/ami/TestI.h | 44 + cpp/test/Ice/ami/run.py | 24 + cpp/test/Ice/background/AllTests.cpp | 2 +- cpp/test/Ice/operations/.depend | 21 +- cpp/test/Ice/operations/Makefile | 15 +- cpp/test/Ice/operations/Makefile.mak | 12 +- cpp/test/Ice/operations/Oneways.cpp | 37 + cpp/test/Ice/operations/OnewaysNewAMI.cpp | 516 +------ cpp/test/Ice/operations/Server.cpp | 6 - cpp/test/Ice/operations/ServerAMD.cpp | 6 - cpp/test/Ice/operations/StateChanger.ice | 24 - cpp/test/Ice/operations/StateChangerI.cpp | 75 - cpp/test/Ice/operations/StateChangerI.h | 35 - cpp/test/Ice/operations/Twoways.cpp | 20 + cpp/test/Ice/operations/TwowaysNewAMI.cpp | 1197 +-------------- cs/allTests.py | 3 +- cs/src/Ice/ConnectRequestHandler.cs | 18 +- cs/src/Ice/ConnectionRequestHandler.cs | 6 +- cs/src/Ice/OutgoingAsync.cs | 160 +- cs/src/Ice/Proxy.cs | 18 +- cs/src/Ice/RequestHandler.cs | 5 +- cs/test/Ice/Makefile | 1 + cs/test/Ice/Makefile.mak | 1 + cs/test/Ice/ami/.depend | 1 + cs/test/Ice/ami/AllTests.cs | 968 ++++++++++++ cs/test/Ice/ami/Client.cs | 67 + cs/test/Ice/ami/Makefile | 35 + cs/test/Ice/ami/Makefile.mak | 35 + cs/test/Ice/ami/Server.cs | 79 + cs/test/Ice/ami/Test.ice | 40 + cs/test/Ice/ami/TestI.cs | 68 + cs/test/Ice/ami/client.exe.config | 6 + cs/test/Ice/ami/generated/.gitignore | 1 + cs/test/Ice/ami/run.py | 24 + cs/test/Ice/ami/server.exe.config | 6 + cs/test/Ice/background/AllTests.cs | 2 +- cs/test/Ice/operations/Makefile | 8 +- cs/test/Ice/operations/Makefile.mak | 8 +- cs/test/Ice/operations/OnewaysNewAMI.cs | 442 +----- cs/test/Ice/operations/Server.cs | 5 - cs/test/Ice/operations/StateChanger.ice | 24 - cs/test/Ice/operations/StateChangerI.cs | 62 - cs/test/Ice/operations/TwowaysNewAMI.cs | 769 +--------- java/allTests.py | 1 + java/build.xml | 4 +- java/demo/Ice/applet/HelloApplet.java | 11 +- java/demo/Ice/swing/Client.java | 11 +- .../src/Ice/AMI_Object_ice_flushBatchRequests.java | 5 +- java/src/Ice/AMI_Object_ice_invoke.java | 5 +- java/src/Ice/AsyncResult.java | 108 +- java/src/Ice/ConnectionI.java | 45 +- java/src/Ice/ExceptionCallback.java | 4 +- java/src/Ice/ObjectPrxHelperBase.java | 18 +- java/src/Ice/OnewayCallback.java | 4 +- java/src/Ice/SentCallback.java | 33 - java/src/Ice/TwowayCallback.java | 4 +- java/src/IceInternal/AsyncStatus.java | 17 + java/src/IceInternal/ConnectRequestHandler.java | 14 +- java/src/IceInternal/ConnectionRequestHandler.java | 4 +- java/src/IceInternal/OutgoingAsync.java | 20 +- java/src/IceInternal/ProxyBatchOutgoingAsync.java | 28 + java/src/IceInternal/RequestHandler.java | 4 +- java/test/Ice/ami/AllTests.java | 1551 ++++++++++++++++++++ java/test/Ice/ami/Client.java | 36 + java/test/Ice/ami/Server.java | 49 + java/test/Ice/ami/Test.ice | 42 + java/test/Ice/ami/TestControllerI.java | 34 + java/test/Ice/ami/TestI.java | 49 + java/test/Ice/ami/run.py | 24 + java/test/Ice/background/AllTests.java | 4 +- java/test/Ice/operations/AMDServer.java | 6 - java/test/Ice/operations/OnewaysNewAMI.java | 545 ++----- java/test/Ice/operations/Server.java | 6 - java/test/Ice/operations/StateChanger.ice | 25 - java/test/Ice/operations/StateChangerI.java | 63 - java/test/Ice/operations/TwowaysNewAMI.java | 990 ++----------- 106 files changed, 5856 insertions(+), 4930 deletions(-) create mode 100644 cpp/test/Ice/ami/.depend create mode 100644 cpp/test/Ice/ami/.gitignore create mode 100644 cpp/test/Ice/ami/AllTests.cpp create mode 100644 cpp/test/Ice/ami/Client.cpp create mode 100644 cpp/test/Ice/ami/Makefile create mode 100644 cpp/test/Ice/ami/Makefile.mak create mode 100644 cpp/test/Ice/ami/Server.cpp create mode 100644 cpp/test/Ice/ami/Test.ice create mode 100644 cpp/test/Ice/ami/TestI.cpp create mode 100644 cpp/test/Ice/ami/TestI.h create mode 100755 cpp/test/Ice/ami/run.py delete mode 100644 cpp/test/Ice/operations/StateChanger.ice delete mode 100644 cpp/test/Ice/operations/StateChangerI.cpp delete mode 100644 cpp/test/Ice/operations/StateChangerI.h create mode 100644 cs/test/Ice/ami/.depend create mode 100644 cs/test/Ice/ami/AllTests.cs create mode 100644 cs/test/Ice/ami/Client.cs create mode 100644 cs/test/Ice/ami/Makefile create mode 100644 cs/test/Ice/ami/Makefile.mak create mode 100644 cs/test/Ice/ami/Server.cs create mode 100644 cs/test/Ice/ami/Test.ice create mode 100644 cs/test/Ice/ami/TestI.cs create mode 100755 cs/test/Ice/ami/client.exe.config create mode 100644 cs/test/Ice/ami/generated/.gitignore create mode 100755 cs/test/Ice/ami/run.py create mode 100755 cs/test/Ice/ami/server.exe.config delete mode 100644 cs/test/Ice/operations/StateChanger.ice delete mode 100644 cs/test/Ice/operations/StateChangerI.cs delete mode 100644 java/src/Ice/SentCallback.java create mode 100644 java/src/IceInternal/AsyncStatus.java create mode 100644 java/test/Ice/ami/AllTests.java create mode 100644 java/test/Ice/ami/Client.java create mode 100644 java/test/Ice/ami/Server.java create mode 100644 java/test/Ice/ami/Test.ice create mode 100644 java/test/Ice/ami/TestControllerI.java create mode 100644 java/test/Ice/ami/TestI.java create mode 100755 java/test/Ice/ami/run.py delete mode 100644 java/test/Ice/operations/StateChanger.ice delete mode 100644 java/test/Ice/operations/StateChangerI.java (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/allTests.py b/cpp/allTests.py index 79d6acfc4ec..c713bb80dcb 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -35,6 +35,7 @@ tests = [ ("Ice/proxy", ["core"]), ("Ice/operations", ["core"]), ("Ice/exceptions", ["core"]), + ("Ice/ami", ["core"]), ("Ice/info", ["core", "noipv6", "nocompress"]), ("Ice/inheritance", ["core"]), ("Ice/facets", ["core"]), diff --git a/cpp/demo/Ice/Makefile b/cpp/demo/Ice/Makefile index 2bc638d7ca1..9f0d25cce8d 100644 --- a/cpp/demo/Ice/Makefile +++ b/cpp/demo/Ice/Makefile @@ -14,7 +14,7 @@ include $(top_srcdir)/config/Make.rules SUBDIRS = minimal \ hello \ latency \ - #throughput \ + throughput \ value \ callback \ nested \ diff --git a/cpp/demo/Ice/Makefile.mak b/cpp/demo/Ice/Makefile.mak index d6a2c704f21..ade9f14aef5 100644 --- a/cpp/demo/Ice/Makefile.mak +++ b/cpp/demo/Ice/Makefile.mak @@ -18,6 +18,7 @@ SUBDIRS = minimal \ value \ callback \ nested \ + invoke \ bidir \ session \ converter \ diff --git a/cpp/include/Ice/ConnectionIF.h b/cpp/include/Ice/ConnectionIF.h index 8d7f8dfd316..085c47603ff 100644 --- a/cpp/include/Ice/ConnectionIF.h +++ b/cpp/include/Ice/ConnectionIF.h @@ -25,6 +25,13 @@ namespace IceInternal ICE_API Ice::LocalObject* upCast(Ice::ConnectionI*); +enum AsyncStatus +{ + AsyncStatusQueued = 0, + AsyncStatusSent = 1, + AsyncStatusInvokeSentCallback = 2 +}; + } namespace Ice diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 0ffbdebc174..f5df28f04a8 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -1,4 +1,3 @@ - // ********************************************************************** // // Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. @@ -41,7 +40,6 @@ class ICE_API AsyncResult : virtual public IceUtil::Shared, private IceUtil::non public: virtual bool operator==(const AsyncResult&) const; - virtual bool operator!=(const AsyncResult&) const; virtual bool operator<(const AsyncResult&) const; virtual Int getHash() const; @@ -107,6 +105,7 @@ public: static void __check(const AsyncResultPtr&, const ::Ice::Communicator*, const ::std::string&); void __exception(const Ice::Exception&); // Required to be public for AsynchronousException + void __sent(); // Required to be public for AsynchronousSent protected: @@ -115,7 +114,7 @@ protected: AsyncResult(const IceInternal::InstancePtr&, const std::string&, const IceInternal::CallbackBasePtr&, const LocalObjectPtr&); - void __sent(); + void __sentAsync(); void __response(); void __warning(const std::exception&) const; @@ -246,6 +245,8 @@ public: ProxyBatchOutgoingAsync(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&); + void __send(); + virtual Ice::ObjectPrx getProxy() const { @@ -351,7 +352,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); ExceptionCallbackNC(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) @@ -384,7 +385,7 @@ public: { if(sent) { - (callback.get()->*sent)(); + (callback.get()->*sent)(result->sentSynchronously()); } } @@ -410,7 +411,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); ExceptionCallback(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) @@ -443,7 +444,7 @@ public: { if(sent) { - (callback.get()->*sent)(CTPtr::dynamicCast(result->getCookie())); + (callback.get()->*sent)(result->sentSynchronously(), CTPtr::dynamicCast(result->getCookie())); } } @@ -457,95 +458,6 @@ public: Sent sent; }; -template -class SentCallbackNC : public GenericCallbackBase -{ -public: - - typedef T callback_type; - typedef IceUtil::Handle TPtr; - - typedef void (T::*Sent)(); - - SentCallbackNC(const TPtr& instance, Sent sentcb) : - callback(instance), sent(sentcb) - { - checkCallback(instance, sentcb != 0); - } - - virtual void __completed(const ::Ice::AsyncResultPtr& result) const - { - } - - virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& __cookie) - { - if(__cookie) // Makes sure begin_ was called without a cookie - { - throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "cookie specified for callback without cookie"); - } - return this; - } - - virtual void __sent(const ::Ice::AsyncResultPtr& result) const - { - (callback.get()->*sent)(); - } - - virtual bool __hasSentCallback() const - { - return true; - } - - TPtr callback; - Sent sent; -}; - -template -class SentCallback : public GenericCallbackBase -{ -public: - - typedef T callback_type; - typedef CT cookie_type; - - typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - - typedef void (T::*Sent)(const CTPtr&); - - SentCallback(const TPtr& instance, Sent sentcb) : - callback(instance), sent(sentcb) - { - checkCallback(instance, sentcb != 0); - } - - virtual void __completed(const ::Ice::AsyncResultPtr& result) const - { - } - - virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& __cookie) - { - if(__cookie && !CTPtr::dynamicCast(__cookie)) - { - throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "unexpected cookie type"); - } - return this; - } - - virtual void __sent(const ::Ice::AsyncResultPtr& result) const - { - (callback.get()->*sent)(CTPtr::dynamicCast(result->getCookie())); - } - - virtual bool __hasSentCallback() const - { - return true; - } - - TPtr callback; - Sent sent; -}; - } namespace Ice @@ -564,7 +476,7 @@ newCallback(const IceUtil::Handle& instance, template CallbackPtr newCallback(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&), - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new ::IceInternal::ExceptionCallbackNC(instance, excb, sentcb); } @@ -572,23 +484,11 @@ newCallback(const IceUtil::Handle& instance, template CallbackPtr newCallback(const IceUtil::Handle& instance, void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&), - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new ::IceInternal::ExceptionCallback(instance, excb, sentcb); } -template CallbackPtr -newCallback(const IceUtil::Handle& instance, void (T::*sentcb)()) -{ - return new ::IceInternal::SentCallbackNC(instance, sentcb); -} - -template CallbackPtr -newCallback(const IceUtil::Handle& instance, void (T::*sentcb)(const IceUtil::Handle&)) -{ - return new ::IceInternal::SentCallback(instance, sentcb); -} - // // Operation callbacks are specified in Proxy.h // @@ -613,11 +513,11 @@ public: virtual void ice_exception(const Exception&) = 0; void __exception(const Exception&); - void __sent(); + void __sent(bool); }; inline CallbackPtr -newCallback(const IceUtil::Handle< ::Ice::AMICallbackBase>& instance) +newAMICallback(const IceUtil::Handle< ::Ice::AMICallbackBase>& instance) { if(dynamic_cast(instance.get())) { diff --git a/cpp/include/Ice/OutgoingAsyncF.h b/cpp/include/Ice/OutgoingAsyncF.h index c9c7ea15b62..5efa8b3b16e 100644 --- a/cpp/include/Ice/OutgoingAsyncF.h +++ b/cpp/include/Ice/OutgoingAsyncF.h @@ -39,6 +39,10 @@ class BatchOutgoingAsync; ICE_API IceUtil::Shared* upCast(BatchOutgoingAsync*); typedef IceInternal::Handle BatchOutgoingAsyncPtr; +class ProxyBatchOutgoingAsync; +ICE_API IceUtil::Shared* upCast(ProxyBatchOutgoingAsync*); +typedef IceInternal::Handle ProxyBatchOutgoingAsyncPtr; + } #endif diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 33c770897f2..0fd5603a2d1 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -99,9 +99,9 @@ public: ice_exception(ex); } - void __sent() + void __sent(bool sentSynchronously) { - AMICallbackBase::__sent(); + AMICallbackBase::__sent(sentSynchronously); } }; typedef IceUtil::Handle AMI_Object_ice_invokePtr; @@ -122,9 +122,9 @@ public: ice_exception(ex); } - void __sent() + void __sent(bool sentSynchronously) { - AMICallbackBase::__sent(); + AMICallbackBase::__sent(sentSynchronously); } }; typedef IceUtil::Handle AMI_Array_Object_ice_invokePtr; @@ -172,11 +172,9 @@ public: return begin_ice_isA(typeId, 0, ::IceInternal::__dummyCallback, 0); } - ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, - const ::Ice::Context& __ctx, - const ::Ice::LocalObjectPtr& __cookie = 0) + ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx) { - return begin_ice_isA(typeId, &__ctx, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_isA(typeId, &__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, @@ -225,10 +223,9 @@ public: return begin_ice_ping(0, ::IceInternal::__dummyCallback, 0); } - ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx, - const ::Ice::LocalObjectPtr& __cookie = 0) + ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx) { - return begin_ice_ping(&__ctx, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_ping(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::CallbackPtr& __del, @@ -272,10 +269,9 @@ public: return begin_ice_ids(0, ::IceInternal::__dummyCallback, 0); } - ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx, - const ::Ice::LocalObjectPtr& __cookie = 0) + ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx) { - return begin_ice_ids(&__ctx, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_ids(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::CallbackPtr& __del, @@ -320,10 +316,9 @@ public: return begin_ice_id(0, ::IceInternal::__dummyCallback, 0); } - ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx, - const ::Ice::LocalObjectPtr& __cookie = 0) + ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx) { - return begin_ice_id(&__ctx, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_id(&__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::CallbackPtr& __del, @@ -387,10 +382,9 @@ public: ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, ::Ice::OperationMode mode, const ::std::vector< ::Ice::Byte>& inParams, - const ::Ice::Context& __ctx, - const ::Ice::LocalObjectPtr& __cookie = 0) + const ::Ice::Context& __ctx) { - return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation, @@ -1046,7 +1040,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); CallbackNC(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) { @@ -1065,7 +1059,7 @@ public: { if(sent) { - (callback.get()->*sent)(); + (callback.get()->*sent)(result->sentSynchronously()); } } @@ -1101,7 +1095,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); Callback(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) { @@ -1120,7 +1114,7 @@ public: { if(sent) { - (callback.get()->*sent)(CTPtr::dynamicCast(result->getCookie())); + (callback.get()->*sent)(result->sentSynchronously(), CTPtr::dynamicCast(result->getCookie())); } } @@ -1155,7 +1149,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); TwowayCallbackNC(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : CallbackNC(instance, excb, sentcb) { @@ -1172,7 +1166,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); TwowayCallback(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : Callback(instance, excb, sentcb) { @@ -1191,7 +1185,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(); OnewayCallbackNC(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1234,7 +1228,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(const CTPtr&); OnewayCallback(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1281,7 +1275,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(bool); CallbackNC_Object_ice_isA(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1324,7 +1318,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(bool, const CTPtr&); Callback_Object_ice_isA(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1366,7 +1360,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(); CallbackNC_Object_ice_ping(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1384,7 +1378,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(const CTPtr&); Callback_Object_ice_ping(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1401,7 +1395,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(const ::std::vector< ::std::string>&); CallbackNC_Object_ice_ids(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1444,7 +1438,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(const ::std::vector< ::std::string>&, const CTPtr&); Callback_Object_ice_ids(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1486,7 +1480,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(const ::std::string&); CallbackNC_Object_ice_id(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1529,7 +1523,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(const ::std::string&, const CTPtr&); Callback_Object_ice_id(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : @@ -1574,7 +1568,7 @@ public: typedef IceUtil::Handle TPtr; typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(); + typedef void (T::*Sent)(bool); typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&); typedef void (T::*ResponseArray)(bool, const std::pair&); @@ -1654,7 +1648,7 @@ public: typedef IceUtil::Handle CTPtr; typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(const CTPtr&); + typedef void (T::*Sent)(bool, const CTPtr&); typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&, const CTPtr&); typedef void (T::*ResponseArray)(bool, const std::pair&, const CTPtr&); @@ -1733,7 +1727,7 @@ template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*cb)(bool), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, cb, excb, sentcb); } @@ -1742,7 +1736,7 @@ template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*cb)(bool, const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_isA(instance, cb, excb, sentcb); } @@ -1751,7 +1745,7 @@ template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, cb, excb, sentcb); } @@ -1760,7 +1754,7 @@ template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*cb)(const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_ping(instance, cb, excb, sentcb); } @@ -1769,7 +1763,7 @@ template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*cb)(const ::std::vector< ::std::string>&), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, cb, excb, sentcb); } @@ -1778,7 +1772,7 @@ template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*cb)(const ::std::vector< ::std::string>&, const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_ids(instance, cb, excb, sentcb); } @@ -1787,7 +1781,7 @@ template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, cb, excb, sentcb); } @@ -1796,7 +1790,7 @@ template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*cb)(const ::std::string&, const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_id(instance, cb, excb, sentcb); } @@ -1805,7 +1799,7 @@ template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::vector&), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } @@ -1814,7 +1808,7 @@ template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&), void (T::*excb)(const ::Ice::Exception&) = 0, - void (T::*sentcb)() = 0) + void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); } @@ -1823,7 +1817,7 @@ template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::vector&, const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } @@ -1833,7 +1827,7 @@ newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&, const IceUtil::Handle&), void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(const IceUtil::Handle&) = 0) + void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index a68c3c51efd..6786b1cd37a 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -226,7 +226,7 @@ ConnectRequestHandler::sendRequest(Outgoing* out) } } -bool +AsyncStatus ConnectRequestHandler::sendAsyncRequest(const OutgoingAsyncPtr& out) { { @@ -236,7 +236,7 @@ ConnectRequestHandler::sendAsyncRequest(const OutgoingAsyncPtr& out) Request req; req.out = out; _requests.push_back(req); - return false; + return AsyncStatusQueued; } } return _connection->sendAsyncRequest(out, _compress, _response); @@ -248,7 +248,7 @@ ConnectRequestHandler::flushBatchRequests(BatchOutgoing* out) return getConnection(true)->flushBatchRequests(out); } -bool +AsyncStatus ConnectRequestHandler::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& out) { { @@ -258,7 +258,7 @@ ConnectRequestHandler::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& out) Request req; req.batchOut = out; _requests.push_back(req); - return false; + return AsyncStatusQueued; } } return _connection->flushAsyncBatchRequests(out); @@ -410,14 +410,14 @@ ConnectRequestHandler::flushRequests() Request& req = _requests.front(); if(req.out) { - if(_connection->sendAsyncRequest(req.out, _compress, _response)) + if(_connection->sendAsyncRequest(req.out, _compress, _response) & AsyncStatusInvokeSentCallback) { sentCallbacks.push_back(req.out); } } else if(req.batchOut) { - if(_connection->flushAsyncBatchRequests(req.batchOut)) + if(_connection->flushAsyncBatchRequests(req.batchOut) & AsyncStatusInvokeSentCallback) { sentCallbacks.push_back(req.batchOut); } diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h index 59bd3599569..549e547a32e 100644 --- a/cpp/src/Ice/ConnectRequestHandler.h +++ b/cpp/src/Ice/ConnectRequestHandler.h @@ -42,10 +42,10 @@ public: virtual void abortBatchRequest(); virtual Ice::ConnectionI* sendRequest(Outgoing*); - virtual bool sendAsyncRequest(const OutgoingAsyncPtr&); + virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&); virtual bool flushBatchRequests(BatchOutgoing*); - virtual bool flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); + virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); virtual Ice::ConnectionIPtr getConnection(bool); diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 2d5157639e7..f380b94c348 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -460,7 +460,7 @@ Ice::ConnectionI::sendRequest(Outgoing* out, bool compress, bool response) try { OutgoingMessage message(out, os, compress, requestId); - sent = sendMessage(message); + sent = sendMessage(message) & AsyncStatusSent; } catch(const LocalException& ex) { @@ -480,7 +480,7 @@ Ice::ConnectionI::sendRequest(Outgoing* out, bool compress, bool response) return sent; } -bool +AsyncStatus Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncPtr& out, bool compress, bool response) { BasicStream* os = out->__getOs(); @@ -529,11 +529,11 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncPtr& out, bool compress, b #endif } - bool sent = false; + AsyncStatus status; try { OutgoingMessage message(out, os, compress, requestId); - sent = sendMessage(message); + status = sendMessage(message); } catch(const LocalException& ex) { @@ -550,7 +550,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncPtr& out, bool compress, b _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), pair(requestId, out)); } - return sent; + return status; } void @@ -798,7 +798,7 @@ Ice::ConnectionI::flushBatchRequests(BatchOutgoing* out) try { OutgoingMessage message(out, out->os(), _batchRequestCompress, 0); - sent = sendMessage(message); + sent = sendMessage(message) & AsyncStatusSent; } catch(const Ice::LocalException& ex) { @@ -818,7 +818,7 @@ Ice::ConnectionI::flushBatchRequests(BatchOutgoing* out) return sent; } -bool +AsyncStatus Ice::ConnectionI::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& outAsync) { IceUtil::Monitor::Lock sync(*this); @@ -834,8 +834,12 @@ Ice::ConnectionI::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& outAsync) if(_batchRequestNum == 0) { - outAsync->__sent(this); - return true; + AsyncStatus status = AsyncStatusSent; + if(outAsync->__sent(this)) + { + status = static_cast(status | AsyncStatusInvokeSentCallback); + } + return status; } // @@ -852,11 +856,11 @@ Ice::ConnectionI::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& outAsync) // // Send the batch stream. // - bool sent = false; + AsyncStatus status; try { OutgoingMessage message(outAsync, outAsync->__getOs(), _batchRequestCompress, 0); - sent = sendMessage(message); + status = sendMessage(message); } catch(const Ice::LocalException& ex) { @@ -873,7 +877,7 @@ Ice::ConnectionI::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& outAsync) _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; - return sent; + return status; } void @@ -1853,7 +1857,7 @@ Ice::ConnectionI::initiateShutdown() os.write(headerSize); // Message size. OutgoingMessage message(&os, false); - if(sendMessage(message)) + if(sendMessage(message) & AsyncStatusSent) { // // Schedule the close timeout to wait for the peer to close the connection. If @@ -2129,7 +2133,7 @@ Ice::ConnectionI::sendNextMessage(vector& callb } } -bool +AsyncStatus Ice::ConnectionI::sendMessage(OutgoingMessage& message) { assert(_state < StateClosed); @@ -2140,7 +2144,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message) { _sendStreams.push_back(message); _sendStreams.back().adopt(0); - return false; + return AsyncStatusQueued; } // @@ -2178,13 +2182,17 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message) // if(_transceiver->write(stream)) { - message.sent(this, false); + AsyncStatus status = AsyncStatusSent; + if(message.sent(this, false)) + { + status = static_cast(status | AsyncStatusInvokeSentCallback); + } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } - return true; + return status; } _sendStreams.push_back(message); @@ -2226,13 +2234,17 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message) // if(_transceiver->write(*message.stream)) { - message.sent(this, false); + AsyncStatus status = AsyncStatusSent; + if(message.sent(this, false)) + { + status = static_cast(status | AsyncStatusInvokeSentCallback); + } if(_acmTimeout > 0) { _acmAbsoluteTimeout = IceUtil::Time::now(IceUtil::Time::Monotonic) + IceUtil::Time::seconds(_acmTimeout); } - return true; + return status; } _sendStreams.push_back(message); @@ -2242,7 +2254,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message) _writeStream.swap(*_sendStreams.back().stream); scheduleTimeout(SocketOperationWrite, _endpoint->timeout()); _threadPool->_register(this, SocketOperationWrite); - return false; + return AsyncStatusQueued; } static string diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 24ef54448d5..2116ae507eb 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -95,7 +95,7 @@ public: void monitor(const IceUtil::Time&); bool sendRequest(IceInternal::Outgoing*, bool, bool); - bool sendAsyncRequest(const IceInternal::OutgoingAsyncPtr&, bool, bool); + IceInternal::AsyncStatus sendAsyncRequest(const IceInternal::OutgoingAsyncPtr&, bool, bool); void prepareBatchRequest(IceInternal::BasicStream*); void finishBatchRequest(IceInternal::BasicStream*, bool); @@ -104,7 +104,7 @@ public: virtual void flushBatchRequests(); // From Connection. bool flushBatchRequests(IceInternal::BatchOutgoing*); - bool flushAsyncBatchRequests(const IceInternal::BatchOutgoingAsyncPtr&); + IceInternal::AsyncStatus flushAsyncBatchRequests(const IceInternal::BatchOutgoingAsyncPtr&); void sendResponse(IceInternal::BasicStream*, Byte); void sendNoResponse(); @@ -198,7 +198,7 @@ private: bool initialize(IceInternal::SocketOperation = IceInternal::SocketOperationNone); bool validate(IceInternal::SocketOperation = IceInternal::SocketOperationNone); void sendNextMessage(std::vector&); - bool sendMessage(OutgoingMessage&); + IceInternal::AsyncStatus sendMessage(OutgoingMessage&); void doCompress(IceInternal::BasicStream&, IceInternal::BasicStream&); void doUncompress(IceInternal::BasicStream&, IceInternal::BasicStream&); diff --git a/cpp/src/Ice/ConnectionRequestHandler.cpp b/cpp/src/Ice/ConnectionRequestHandler.cpp index da688bf5aa8..62d81b2bf44 100644 --- a/cpp/src/Ice/ConnectionRequestHandler.cpp +++ b/cpp/src/Ice/ConnectionRequestHandler.cpp @@ -81,7 +81,7 @@ ConnectionRequestHandler::sendRequest(Outgoing* out) } } -bool +AsyncStatus ConnectionRequestHandler::sendAsyncRequest(const OutgoingAsyncPtr& out) { return _connection->sendAsyncRequest(out, _compress, _response); @@ -93,7 +93,7 @@ ConnectionRequestHandler::flushBatchRequests(BatchOutgoing* out) return _connection->flushBatchRequests(out); } -bool +AsyncStatus ConnectionRequestHandler::flushAsyncBatchRequests(const BatchOutgoingAsyncPtr& out) { return _connection->flushAsyncBatchRequests(out); diff --git a/cpp/src/Ice/ConnectionRequestHandler.h b/cpp/src/Ice/ConnectionRequestHandler.h index 7e1b4a2e12a..12029a6be18 100644 --- a/cpp/src/Ice/ConnectionRequestHandler.h +++ b/cpp/src/Ice/ConnectionRequestHandler.h @@ -29,10 +29,10 @@ public: virtual void abortBatchRequest(); virtual Ice::ConnectionI* sendRequest(Outgoing*); - virtual bool sendAsyncRequest(const OutgoingAsyncPtr&); + virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&); virtual bool flushBatchRequests(BatchOutgoing*); - virtual bool flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); + virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&); virtual Ice::ConnectionIPtr getConnection(bool); diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 7fc5b8a080a..1475e59b9ba 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -35,6 +35,7 @@ IceUtil::Shared* IceInternal::upCast(AsyncResult* p) { return p; } IceUtil::Shared* IceInternal::upCast(OutgoingAsyncMessageCallback* p) { return p; } IceUtil::Shared* IceInternal::upCast(OutgoingAsync* p) { return p; } IceUtil::Shared* IceInternal::upCast(BatchOutgoingAsync* p) { return p; } +IceUtil::Shared* IceInternal::upCast(ProxyBatchOutgoingAsync* p) { return p; } const unsigned char Ice::AsyncResult::OK = 0x1; const unsigned char Ice::AsyncResult::Done = 0x2; @@ -66,6 +67,26 @@ private: const auto_ptr _exception; }; +class AsynchronousSent : public ThreadPoolWorkItem +{ +public: + + AsynchronousSent(const Ice::AsyncResultPtr& result) : _result(result) + { + } + + virtual void + execute(ThreadPoolCurrent& current) + { + current.ioCompleted(); + _result->__sent(); + } + +private: + + const Ice::AsyncResultPtr _result; +}; + }; Ice::AsyncResult::AsyncResult(const IceInternal::InstancePtr& instance, @@ -98,12 +119,6 @@ Ice::AsyncResult::operator==(const AsyncResult& r) const return this == &r; } -bool -Ice::AsyncResult::operator!=(const AsyncResult& r) const -{ - return !operator==(r); -} - bool Ice::AsyncResult::operator<(const AsyncResult& r) const { @@ -211,6 +226,23 @@ Ice::AsyncResult::__sent() } } +void +Ice::AsyncResult::__sentAsync() +{ + // + // This is called when it's not safe to call the sent callback synchronously + // from this thread. Instead the exception callback is called asynchronously from + // the client thread pool. + // + try + { + _instance->clientThreadPool()->execute(new AsynchronousSent(this)); + } + catch(const Ice::CommunicatorDestroyedException&) + { + } +} + void Ice::AsyncResult::__exception(const Ice::Exception& ex) { @@ -465,7 +497,7 @@ IceInternal::OutgoingAsync::__sent(Ice::ConnectionI* connection) } } _monitor.notifyAll(); - return !alreadySent && _callback && _callback->__hasSentCallback(); // Don't call the sent call is already sent. + return !alreadySent && _callback && _callback->__hasSentCallback(); } void @@ -699,10 +731,24 @@ IceInternal::OutgoingAsync::__send(bool synchronous) try { _delegate = _proxy->__getDelegate(true); - bool sent = _delegate->__getRequestHandler()->sendAsyncRequest(this); - if(synchronous) + AsyncStatus status = _delegate->__getRequestHandler()->sendAsyncRequest(this); + if(status & AsyncStatusSent) { - _sentSynchronously = sent; + if(synchronous) + { + _sentSynchronously = true; + if(status & AsyncStatusInvokeSentCallback) + { + __sent(); // Call the sent callback from the user thread. + } + } + else + { + if(status & AsyncStatusInvokeSentCallback) + { + __sentAsync(); // Call the sent callback from a client thread pool thread. + } + } } break; } @@ -843,6 +889,34 @@ IceInternal::ProxyBatchOutgoingAsync::ProxyBatchOutgoingAsync(const Ice::ObjectP { } +void +IceInternal::ProxyBatchOutgoingAsync::__send() +{ + // + // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch + // requests were queued with the connection, they would be lost without being noticed. + // + Handle delegate; + int cnt = -1; // Don't retry. + try + { + delegate = _proxy->__getDelegate(true); + AsyncStatus status = delegate->__getRequestHandler()->flushAsyncBatchRequests(this); + if(status & AsyncStatusSent) + { + _sentSynchronously = true; + if(status & AsyncStatusInvokeSentCallback) + { + __sent(); + } + } + } + catch(const ::Ice::LocalException& ex) + { + _proxy->__handleException(delegate, ex, 0, cnt); + } +} + namespace { @@ -907,7 +981,10 @@ Ice::AMICallbackBase::__exception(const ::Ice::Exception& ex) } void -Ice::AMICallbackBase::__sent() +Ice::AMICallbackBase::__sent(bool sentSynchronously) { - dynamic_cast(this)->ice_sent(); + if(!sentSynchronously) + { + dynamic_cast(this)->ice_sent(); + } } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 893ae34fc39..e8e583cf78c 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -1118,7 +1118,7 @@ IceProxy::Ice::Object::ice_flushBatchRequests() bool IceProxy::Ice::Object::ice_flushBatchRequests_async(const AMI_Object_ice_flushBatchRequestsPtr& cb) { - ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequests(newCallback(cb)); + ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequests(newAMICallback(cb)); return result->sentSynchronously(); } @@ -1127,25 +1127,11 @@ IceProxy::Ice::Object::begin_ice_flushBatchRequests(const ::Ice::Context* /* unu const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie) { - ::IceInternal::BatchOutgoingAsyncPtr __result = + ::IceInternal::ProxyBatchOutgoingAsyncPtr __result = new ::IceInternal::ProxyBatchOutgoingAsync(this, ice_flushBatchRequests_name, del, cookie); try { - // - // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch - // requests were queued with the connection, they would be lost without being noticed. - // - Handle delegate; - int cnt = -1; // Don't retry. - try - { - delegate = __getDelegate(true); - delegate->__getRequestHandler()->flushAsyncBatchRequests(__result); - } - catch(const ::Ice::LocalException& ex) - { - __handleException(delegate, ex, 0, cnt); - } + __result->__send(); } catch(const LocalException& __ex) { diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h index 486445067d6..c1fb56a3a3d 100644 --- a/cpp/src/Ice/RequestHandler.h +++ b/cpp/src/Ice/RequestHandler.h @@ -35,10 +35,10 @@ public: virtual void abortBatchRequest() = 0; virtual Ice::ConnectionI* sendRequest(Outgoing*) = 0; - virtual bool sendAsyncRequest(const OutgoingAsyncPtr&) = 0; + virtual AsyncStatus sendAsyncRequest(const OutgoingAsyncPtr&) = 0; virtual bool flushBatchRequests(BatchOutgoing*) = 0; - virtual bool flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&) = 0; + virtual AsyncStatus flushAsyncBatchRequests(const BatchOutgoingAsyncPtr&) = 0; const ReferencePtr& getReference() const { return _reference; } // Inlined for performances. diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 83198bcdd8e..1b0dd3d0294 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2563,10 +2563,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << eb; H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI - << "const ::Ice::Context& __ctx" - << "const ::Ice::LocalObjectPtr& __cookie = 0" << epar; + << "const ::Ice::Context& __ctx" << epar; H << sb; - H << nl << "return begin_" << name << spar << argsAMI << "&__ctx" << "::IceInternal::__dummyCallback" << "__cookie" + H << nl << "return begin_" << name << spar << argsAMI << "&__ctx" << "::IceInternal::__dummyCallback" << "0" << epar << ';'; H << eb; @@ -2865,7 +2864,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << nl << "else"; C << sb; - C << nl << "__del = ::Ice::newCallback(__cb);"; + C << nl << "__del = ::Ice::newAMICallback(__cb);"; C << eb; } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; @@ -2906,7 +2905,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << nl << "else"; C << sb; - C << nl << "__del = ::Ice::newCallback(__cb);"; + C << nl << "__del = ::Ice::newAMICallback(__cb);"; C << eb; } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar @@ -5374,7 +5373,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& } H << sp << nl << "typedef void (T::*Exception)(const ::Ice::Exception&" << comCookieT << ");"; - H << nl << "typedef void (T::*Sent)(" << cookieT << ");"; + H << nl << "typedef void (T::*Sent)(bool" << comCookieT << ");"; if(p->returnsData()) { // @@ -5533,7 +5532,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << "void (T::*cb)(" << cookieT << "),"; } H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << ") = 0,"; - H << "void (T::*sentcb)(" << cookieT << ") = 0)"; + H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; H << sb; if(withCookie) { @@ -6337,9 +6336,9 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) H << sb; H << nl << "ice_exception(ex);"; H << eb; - H << nl << "void __sent()"; + H << nl << "void __sent(bool sentSynchronously)"; H << sb; - H << nl << "AMICallbackBase::__sent();"; + H << nl << "AMICallbackBase::__sent(sentSynchronously);"; H << eb; H << eb << ';'; H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 767fc87c647..1718b292191 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -5579,36 +5579,18 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) vector args = getArgsAsyncCB(p); writeDocCommentOp(p); - _out << sp << nl << "public abstract class AMI_" << cl->name() << '_' << name; + _out << sp << nl << "public abstract class AMI_" << cl->name() << '_' << name << " : Ice.AMICallbackBase"; _out << sb; _out << sp; writeDocCommentAsync(p, OutParam); _out << nl << "public abstract void ice_response" << spar << params << epar << ';'; - _out << sp; - _out << nl << "public abstract void ice_exception(Ice.Exception ex__);"; - _out << sp; _out << nl << "public void response__" << spar << params << epar; _out << sb; _out << nl << "ice_response" << spar << args << epar << ';'; _out << eb; - _out << sp; - _out << nl << "public void exception__(Ice.Exception ex__)"; - _out << sb; - _out << nl << "ice_exception(ex__);"; - _out << eb; - - _out << sp; - _out << nl << "public void sent__()"; - _out << sb; - _out << nl << "if(this is Ice.AMISentCallback)"; - _out << sb; - _out << nl << "((Ice.AMISentCallback)this).ice_sent();"; - _out << eb; - _out << eb; - _out << eb; } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 1c5aff7ea84..c5408af7582 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -5750,9 +5750,9 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) out << sb; out << nl << "ice_exception(__ex);"; out << eb; - out << sp << nl << "public final void sent()"; + out << sp << nl << "@Override public final void sent(boolean sentSynchronously)"; out << sb; - out << nl << "if(this instanceof Ice.AMISentCallback)"; + out << nl << "if(!sentSynchronously && this instanceof Ice.AMISentCallback)"; out << sb; out << nl << "((Ice.AMISentCallback)this).ice_sent();"; out << eb; diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile index 9c6489410b1..d4a2b82b556 100644 --- a/cpp/test/Ice/Makefile +++ b/cpp/test/Ice/Makefile @@ -14,6 +14,7 @@ include $(top_srcdir)/config/Make.rules SUBDIRS = proxy \ operations \ exceptions \ + ami \ info \ inheritance \ facets \ diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak index 5495641ecf2..fdeb3dfafd2 100644 --- a/cpp/test/Ice/Makefile.mak +++ b/cpp/test/Ice/Makefile.mak @@ -14,6 +14,7 @@ top_srcdir = ..\.. SUBDIRS = proxy \ operations \ exceptions \ + ami \ info \ inheritance \ facets \ diff --git a/cpp/test/Ice/ami/.depend b/cpp/test/Ice/ami/.depend new file mode 100644 index 00000000000..5ede195c17b --- /dev/null +++ b/cpp/test/Ice/ami/.depend @@ -0,0 +1,7 @@ +Test$(OBJEXT): Test.cpp Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h +AllTests$(OBJEXT): AllTests.cpp $(includedir)/IceUtil/Random.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h +TestI$(OBJEXT): TestI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestI.h Test.h +Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestI.h Test.h +Test.cpp: Test.ice +Test.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/test/Ice/ami/.gitignore b/cpp/test/Ice/ami/.gitignore new file mode 100644 index 00000000000..67872faa673 --- /dev/null +++ b/cpp/test/Ice/ami/.gitignore @@ -0,0 +1,7 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Test.cpp +Test.h diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp new file mode 100644 index 00000000000..040e2ef05d7 --- /dev/null +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -0,0 +1,1302 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 +#include +#include +#include + +using namespace std; + +namespace +{ + +struct Cookie : public Ice::LocalObject +{ + Cookie(int i) : val(i) + { + } + int val; +}; + +typedef IceUtil::Handle CookiePtr; + +class CallbackBase : public Ice::LocalObject +{ +public: + + CallbackBase() : + _called(false) + { + } + + virtual ~CallbackBase() + { + } + + void check() + { + IceUtil::Monitor::Lock sync(_m); + while(!_called) + { + _m.wait(); + } + _called = false; + } + +protected: + + void called() + { + IceUtil::Monitor::Lock sync(_m); + assert(!_called); + _called = true; + _m.notify(); + } + +private: + + IceUtil::Monitor _m; + bool _called; +}; + +typedef IceUtil::Handle CallbackBasePtr; + +class AsyncCallback : public CallbackBase +{ +public: + + AsyncCallback() + { + } + + AsyncCallback(const CookiePtr& cookie) : _cookie(cookie) + { + } + + void isA(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + test(result->getProxy()->end_ice_isA(result)); + called(); + } + + void ping(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + result->getProxy()->end_ice_ping(result); + called(); + } + + void id(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + test(result->getProxy()->end_ice_id(result) == Test::TestIntf::ice_staticId()); + called(); + } + + void ids(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + test(result->getProxy()->end_ice_ids(result).size() == 2); + called(); + } + + void op(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + Test::TestIntfPrx::uncheckedCast(result->getProxy())->end_op(result); + called(); + } + + void opWithResult(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + test(Test::TestIntfPrx::uncheckedCast(result->getProxy())->end_opWithResult(result) == 15); + called(); + } + + void opWithUE(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + Test::TestIntfPrx::uncheckedCast(result->getProxy())->end_opWithUE(result); + test(false); + } + catch(const Test::TestIntfException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + + void isAEx(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + result->getProxy()->end_ice_isA(result); + test(false); + } + catch(const Ice::NoEndpointException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + + void pingEx(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + result->getProxy()->end_ice_ping(result); + test(false); + } + catch(const Ice::NoEndpointException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + + void idEx(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + result->getProxy()->end_ice_id(result); + test(false); + } + catch(const Ice::NoEndpointException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + + void idsEx(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + result->getProxy()->end_ice_ids(result); + test(false); + } + catch(const Ice::NoEndpointException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + + void opEx(const Ice::AsyncResultPtr& result) + { + test(result->getCookie() == _cookie); + try + { + Test::TestIntfPrx::uncheckedCast(result->getProxy())->end_op(result); + test(false); + } + catch(const Ice::NoEndpointException&) + { + called(); + } + catch(const Ice::Exception&) + { + test(false); + } + } + +private: + + CookiePtr _cookie; +}; +typedef IceUtil::Handle AsyncCallbackPtr; + +class ResponseCallback : public CallbackBase +{ +public: + + ResponseCallback() + { + } + + void isA(bool r) + { + test(r); + called(); + } + + void ping() + { + called(); + } + + void id(const string& id) + { + test(id == Test::TestIntf::ice_staticId()); + called(); + } + + void ids(const Ice::StringSeq& ids) + { + test(ids.size() == 2); + called(); + } + + void op() + { + called(); + } + + void opWithResult(int r) + { + test(r == 15); + called(); + } + + void opWithUE(const Ice::Exception& ex) + { + try + { + ex.ice_throw(); + test(false); + } + catch(const Test::TestIntfException&) + { + called(); + } + } +}; +typedef IceUtil::Handle ResponseCallbackPtr; + +class ResponseCallbackWC : public CallbackBase +{ +public: + + ResponseCallbackWC(const CookiePtr& cookie) : _cookie(cookie) + { + } + + void isA(bool r, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(r); + called(); + } + + void ping(const CookiePtr& cookie) + { + test(cookie == _cookie); + called(); + } + + void id(const string& id, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(id == Test::TestIntf::ice_staticId()); + called(); + } + + void ids(const Ice::StringSeq& ids, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(ids.size() == 2); + called(); + } + + void op(const CookiePtr& cookie) + { + test(cookie == _cookie); + called(); + } + + void opWithResult(int r, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(r == 15); + called(); + } + + void opWithUE(const Ice::Exception& ex, const CookiePtr& cookie) + { + test(cookie == _cookie); + try + { + ex.ice_throw(); + test(false); + } + catch(const Test::TestIntfException&) + { + called(); + } + } + +private: + + CookiePtr _cookie; +}; +typedef IceUtil::Handle ResponseCallbackWCPtr; + +class ExceptionCallback : public CallbackBase +{ +public: + + ExceptionCallback() + { + } + + void isA(bool r) + { + test(false); + } + + void ping() + { + test(false); + } + + void id(const string& id) + { + test(false); + } + + void ids(const Ice::StringSeq& ids) + { + test(false); + } + + void op() + { + test(false); + } + + void ex(const Ice::Exception& ex) + { + test(dynamic_cast(&ex)); + called(); + } + + void noEx(const Ice::Exception& ex) + { + test(false); + } +}; +typedef IceUtil::Handle ExceptionCallbackPtr; + +class ExceptionCallbackWC : public CallbackBase +{ +public: + + ExceptionCallbackWC(const CookiePtr& cookie) : _cookie(cookie) + { + } + + void isA(bool r, const CookiePtr& cookie) + { + test(false); + } + + void ping(const CookiePtr& cookie) + { + test(false); + } + + void id(const string& id, const CookiePtr& cookie) + { + test(false); + } + + void ids(const Ice::StringSeq& ids, const CookiePtr& cookie) + { + test(false); + } + + void op(const CookiePtr& cookie) + { + test(false); + } + + void ex(const Ice::Exception& ex, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(dynamic_cast(&ex)); + called(); + } + + void noEx(const Ice::Exception& ex, const CookiePtr& cookie) + { + test(false); + } + +private: + + CookiePtr _cookie; +}; +typedef IceUtil::Handle ExceptionCallbackWCPtr; + +class SentCallback : public CallbackBase +{ +public: + + SentCallback() + { + } + + SentCallback(const CookiePtr& cookie) : _cookie(cookie) + { + } + + void isA(bool) + { + } + + void isAWC(bool, const CookiePtr&) + { + } + + void ping() + { + } + + void pingWC(const CookiePtr&) + { + } + + void id(const string&) + { + } + + void idWC(const string&, const CookiePtr&) + { + } + + void ids(const Ice::StringSeq&) + { + } + + void idsWC(const Ice::StringSeq&, const CookiePtr&) + { + } + + void opAsync(const Ice::AsyncResultPtr&) + { + } + + void op() + { + } + + void opWC(const CookiePtr&) + { + } + + void ex(const Ice::Exception& ex) + { + } + + void exWC(const Ice::Exception& ex, const CookiePtr&) + { + } + + void sentAsync(const Ice::AsyncResultPtr& result) + { + test(result->sentSynchronously() && _thread == IceUtil::ThreadControl() || + !result->sentSynchronously() && _thread != IceUtil::ThreadControl()); + called(); + } + + void sent(bool sentSynchronously) + { + test(sentSynchronously && _thread == IceUtil::ThreadControl() || + !sentSynchronously && _thread != IceUtil::ThreadControl()); + called(); + } + + void sentWC(bool sentSynchronously, const CookiePtr& cookie) + { + test(sentSynchronously && _thread == IceUtil::ThreadControl() || + !sentSynchronously && _thread != IceUtil::ThreadControl()); + test(cookie == _cookie); + called(); + } + +private: + + CookiePtr _cookie; + IceUtil::ThreadControl _thread; +}; +typedef IceUtil::Handle SentCallbackPtr; + +enum ThrowType { LocalException, UserException, StandardException, OtherException }; + +class Thrower : public CallbackBase +{ +public: + + Thrower(ThrowType t) + : _t(t) + { + } + + void opAsync(const Ice::AsyncResultPtr& r) + { + called(); + throwEx(); + } + + void op() + { + called(); + throwEx(); + } + + void opWC(const CookiePtr&) + { + called(); + throwEx(); + } + + void noOp() + { + } + + void noOpWC(const CookiePtr&) + { + } + + void ex(const Ice::Exception& ex) + { + called(); + throwEx(); + } + + void exWC(const Ice::Exception& ex, const CookiePtr&) + { + called(); + throwEx(); + } + + void sent(bool) + { + called(); + throwEx(); + } + + void sentWC(bool, const CookiePtr&) + { + called(); + throwEx(); + } + +private: + + void throwEx() + { + switch(_t) + { + case LocalException: + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + break; + } + case UserException: + { + throw Test::TestIntfException(); + break; + } + case StandardException: + { + throw ::std::bad_alloc(); + break; + } + case OtherException: + { + throw 99; + break; + } + default: + { + assert(false); + break; + } + } + } + + ThrowType _t; +}; + +typedef IceUtil::Handle ThrowerPtr; + +} + +void +allTests(const Ice::CommunicatorPtr& communicator) +{ + string sref = "test:default -p 12010"; + Ice::ObjectPrx obj = communicator->stringToProxy(sref); + test(obj); + + Test::TestIntfPrx p = Test::TestIntfPrx::uncheckedCast(obj); + + sref = "testController:tcp -p 12011"; + obj = communicator->stringToProxy(sref); + test(obj); + + Test::TestIntfControllerPrx testController = Test::TestIntfControllerPrx::uncheckedCast(obj); + + cout << "testing begin/end invocation... " << flush; + { + Ice::AsyncResultPtr result; + Ice::Context ctx; + + result = p->begin_ice_isA(Test::TestIntf::ice_staticId()); + test(p->end_ice_isA(result)); + result = p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx); + test(p->end_ice_isA(result)); + + result = p->begin_ice_ping(); + p->end_ice_ping(result); + result = p->begin_ice_ping(ctx); + p->end_ice_ping(result); + + result = p->begin_ice_id(); + test(p->end_ice_id(result) == Test::TestIntf::ice_staticId()); + result = p->begin_ice_id(ctx); + test(p->end_ice_id(result) == Test::TestIntf::ice_staticId()); + + result = p->begin_ice_ids(); + test(p->end_ice_ids(result).size() == 2); + result = p->begin_ice_ids(ctx); + test(p->end_ice_ids(result).size() == 2); + + result = p->begin_op(); + p->end_op(result); + result = p->begin_op(ctx); + p->end_op(result); + + result = p->begin_opWithResult(); + test(p->end_opWithResult(result) == 15); + result = p->begin_opWithResult(ctx); + test(p->end_opWithResult(result) == 15); + + result = p->begin_opWithUE(); + try + { + p->end_opWithUE(result); + test(false); + } + catch(const Test::TestIntfException&) + { + } + result = p->begin_opWithUE(ctx); + try + { + p->end_opWithUE(result); + test(false); + } + catch(const Test::TestIntfException&) + { + } + } + cout << "ok" << endl; + + cout << "testing async callback... " << flush; + { + AsyncCallbackPtr cb = new AsyncCallback(); + Ice::Context ctx; + CookiePtr cookie = new Cookie(5); + AsyncCallbackPtr cbWC = new AsyncCallback(cookie); + + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &AsyncCallback::isA)); + cb->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &AsyncCallback::isA), cookie); + cbWC->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, Ice::newCallback(cb, &AsyncCallback::isA)); + cb->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, Ice::newCallback(cbWC, &AsyncCallback::isA), cookie); + cbWC->check(); + + p->begin_ice_ping(Ice::newCallback(cb, &AsyncCallback::ping)); + cb->check(); + p->begin_ice_ping(Ice::newCallback(cbWC, &AsyncCallback::ping), cookie); + cbWC->check(); + p->begin_ice_ping(ctx, Ice::newCallback(cb, &AsyncCallback::ping)); + cb->check(); + p->begin_ice_ping(ctx, Ice::newCallback(cbWC, &AsyncCallback::ping), cookie); + cbWC->check(); + + p->begin_ice_id(Ice::newCallback(cb, &AsyncCallback::id)); + cb->check(); + p->begin_ice_id(Ice::newCallback(cbWC, &AsyncCallback::id), cookie); + cbWC->check(); + p->begin_ice_id(ctx, Ice::newCallback(cb, &AsyncCallback::id)); + cb->check(); + p->begin_ice_id(ctx, Ice::newCallback(cbWC, &AsyncCallback::id), cookie); + cbWC->check(); + + p->begin_ice_ids(Ice::newCallback(cb, &AsyncCallback::ids)); + cb->check(); + p->begin_ice_ids(Ice::newCallback(cbWC, &AsyncCallback::ids), cookie); + cbWC->check(); + p->begin_ice_ids(ctx, Ice::newCallback(cb, &AsyncCallback::ids)); + cb->check(); + p->begin_ice_ids(ctx, Ice::newCallback(cbWC, &AsyncCallback::ids), cookie); + cbWC->check(); + + p->begin_op(Ice::newCallback(cb, &AsyncCallback::op)); + cb->check(); + p->begin_op(Ice::newCallback(cbWC, &AsyncCallback::op), cookie); + cbWC->check(); + p->begin_op(ctx, Ice::newCallback(cb, &AsyncCallback::op)); + cb->check(); + p->begin_op(ctx, Ice::newCallback(cbWC, &AsyncCallback::op), cookie); + cbWC->check(); + + p->begin_opWithResult(Ice::newCallback(cb, &AsyncCallback::opWithResult)); + cb->check(); + p->begin_opWithResult(Ice::newCallback(cbWC, &AsyncCallback::opWithResult), cookie); + cbWC->check(); + p->begin_opWithResult(ctx, Ice::newCallback(cb, &AsyncCallback::opWithResult)); + cb->check(); + p->begin_opWithResult(ctx, Ice::newCallback(cbWC, &AsyncCallback::opWithResult), cookie); + cbWC->check(); + + p->begin_opWithUE(Ice::newCallback(cb, &AsyncCallback::opWithUE)); + cb->check(); + p->begin_opWithUE(Ice::newCallback(cbWC, &AsyncCallback::opWithUE), cookie); + cbWC->check(); + p->begin_opWithUE(ctx, Ice::newCallback(cb, &AsyncCallback::opWithUE)); + cb->check(); + p->begin_opWithUE(ctx, Ice::newCallback(cbWC, &AsyncCallback::opWithUE), cookie); + cbWC->check(); + } + cout << "ok" << endl; + + cout << "testing response callback... " << flush; + { + ResponseCallbackPtr cb = new ResponseCallback(); + Ice::Context ctx; + CookiePtr cookie = new Cookie(5); + ResponseCallbackWCPtr cbWC = new ResponseCallbackWC(cookie); + + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA)); + cb->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA), cookie); + cbWC->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, + Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA)); + cb->check(); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, + Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA), cookie); + cbWC->check(); + + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping)); + cb->check(); + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping), cookie); + cbWC->check(); + p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping)); + cb->check(); + p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping), cookie); + cbWC->check(); + + p->begin_ice_id(Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id)); + cb->check(); + p->begin_ice_id(Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id), cookie); + cbWC->check(); + p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id)); + cb->check(); + p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id), cookie); + cbWC->check(); + + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids)); + cb->check(); + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids), cookie); + cbWC->check(); + p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids)); + cb->check(); + p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids), cookie); + cbWC->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op)); + cb->check(); + p->begin_op(Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op), cookie); + cbWC->check(); + p->begin_op(ctx, Test::newCallback_TestIntf_op(cb, &ResponseCallback::op)); + cb->check(); + p->begin_op(ctx, Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op), cookie); + cbWC->check(); + + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult)); + cb->check(); + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult), cookie); + cbWC->check(); + p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult)); + cb->check(); + p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult), + cookie); + cbWC->check(); + + p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ResponseCallback::op, &ResponseCallback::opWithUE)); + cb->check(); + p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cbWC, &ResponseCallbackWC::op, + &ResponseCallbackWC::opWithUE), cookie); + cbWC->check(); + p->begin_opWithUE(ctx, Test::newCallback_TestIntf_opWithUE(cb, &ResponseCallback::op, + &ResponseCallback::opWithUE)); + cb->check(); + p->begin_opWithUE(ctx, Test::newCallback_TestIntf_opWithUE(cbWC, &ResponseCallbackWC::op, + &ResponseCallbackWC::opWithUE), cookie); + cbWC->check(); + } + cout << "ok" << endl; + + cout << "testing local exceptions... " << flush; + { + Test::TestIntfPrx indirect = Test::TestIntfPrx::uncheckedCast(p->ice_adapterId("dummy")); + Ice::AsyncResultPtr r; + + r = indirect->begin_op(); + try + { + indirect->end_op(r); + test(false); + } + catch(const Ice::NoEndpointException&) + { + } + + + r = p->ice_oneway()->begin_opWithResult(); + try + { + Test::TestIntfPrx::uncheckedCast(r->getProxy())->end_opWithResult(r); + test(false); + } + catch(const Ice::TwowayOnlyException&) + { + } + + // + // Check that CommunicatorDestroyedException is raised directly. + // + Ice::InitializationData initData; + initData.properties = communicator->getProperties()->clone(); + Ice::CommunicatorPtr ic = Ice::initialize(initData); + Ice::ObjectPrx obj = ic->stringToProxy(p->ice_toString()); + Test::TestIntfPrx p2 = Test::TestIntfPrx::checkedCast(obj); + ic->destroy(); + + try + { + p2->begin_op(); + test(false); + } + catch(const Ice::CommunicatorDestroyedException&) + { + // Expected. + } + } + cout << "ok" << endl; + + cout << "testing local exceptions with async callback... " << flush; + { + Test::TestIntfPrx i = Test::TestIntfPrx::uncheckedCast(p->ice_adapterId("dummy")); + AsyncCallbackPtr cb = new AsyncCallback(); + CookiePtr cookie = new Cookie(5); + AsyncCallbackPtr cbWC = new AsyncCallback(cookie); + + i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &AsyncCallback::isAEx)); + cb->check(); + i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &AsyncCallback::isAEx), cookie); + cbWC->check(); + + i->begin_ice_ping(Ice::newCallback(cb, &AsyncCallback::pingEx)); + cb->check(); + i->begin_ice_ping(Ice::newCallback(cbWC, &AsyncCallback::pingEx), cookie); + cbWC->check(); + + i->begin_ice_id(Ice::newCallback(cb, &AsyncCallback::idEx)); + cb->check(); + i->begin_ice_id(Ice::newCallback(cbWC, &AsyncCallback::idEx), cookie); + cbWC->check(); + + i->begin_ice_ids(Ice::newCallback(cb, &AsyncCallback::idsEx)); + cb->check(); + i->begin_ice_ids(Ice::newCallback(cbWC, &AsyncCallback::idsEx), cookie); + cbWC->check(); + + i->begin_op(Ice::newCallback(cb, &AsyncCallback::opEx)); + cb->check(); + i->begin_op(Ice::newCallback(cbWC, &AsyncCallback::opEx), cookie); + cbWC->check(); + } + cout << "ok" << endl; + + cout << "testing local exceptions with response callback... " << flush; + { + Test::TestIntfPrx i = Test::TestIntfPrx::uncheckedCast(p->ice_adapterId("dummy")); + ExceptionCallbackPtr cb = new ExceptionCallback(); + CookiePtr cookie = new Cookie(5); + ExceptionCallbackWCPtr cbWC = new ExceptionCallbackWC(cookie); + + i->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cb, &ExceptionCallback::isA, &ExceptionCallback::ex)); + cb->check(); + i->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cbWC, &ExceptionCallbackWC::isA, &ExceptionCallbackWC::ex), + cookie); + cbWC->check(); + + i->begin_ice_ping(Ice::newCallback_Object_ice_ping(cb, &ExceptionCallback::ping, &ExceptionCallback::ex)); + cb->check(); + i->begin_ice_ping(Ice::newCallback_Object_ice_ping(cbWC, &ExceptionCallbackWC::ping, + &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_ice_id(Ice::newCallback_Object_ice_id(cb, &ExceptionCallback::id, &ExceptionCallback::ex)); + cb->check(); + i->begin_ice_id(Ice::newCallback_Object_ice_id(cbWC, &ExceptionCallbackWC::id, + &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_ice_ids(Ice::newCallback_Object_ice_ids(cb, &ExceptionCallback::ids, &ExceptionCallback::ex)); + cb->check(); + i->begin_ice_ids(Ice::newCallback_Object_ice_ids(cbWC, &ExceptionCallbackWC::ids, + &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_op(Test::newCallback_TestIntf_op(cb, &ExceptionCallback::op, &ExceptionCallback::ex)); + cb->check(); + i->begin_op(Test::newCallback_TestIntf_op(cbWC, &ExceptionCallbackWC::op, &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + } + cout << "ok" << endl; + + cout << "testing exception callback... " << flush; + { + Test::TestIntfPrx i = Test::TestIntfPrx::uncheckedCast(p->ice_adapterId("dummy")); + ExceptionCallbackPtr cb = new ExceptionCallback(); + CookiePtr cookie = new Cookie(5); + ExceptionCallbackWCPtr cbWC = new ExceptionCallbackWC(cookie); + + i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &ExceptionCallback::ex)); + cb->check(); + i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_op(Ice::newCallback(cb, &ExceptionCallback::ex)); + cb->check(); + i->begin_op(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_opWithResult(Ice::newCallback(cb, &ExceptionCallback::ex)); + cb->check(); + i->begin_opWithResult(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + i->begin_opWithUE(Ice::newCallback(cb, &ExceptionCallback::ex)); + cb->check(); + i->begin_opWithUE(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + cbWC->check(); + + // Ensures no exception is called when response is received + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &ExceptionCallback::noEx)); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_op(Ice::newCallback(cb, &ExceptionCallback::noEx)); + p->begin_op(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_opWithResult(Ice::newCallback(cb, &ExceptionCallback::noEx)); + p->begin_opWithResult(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_opWithUE(Ice::newCallback(cb, &ExceptionCallback::noEx)); + p->begin_opWithUE(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); + } + cout << "ok" << endl; + + cout << "testing sent callback... " << flush; + { + SentCallbackPtr cb = new SentCallback; + CookiePtr cookie = new Cookie(4); + SentCallbackPtr cbWC = new SentCallback(cookie); + + p->begin_ice_isA("", Ice::newCallback_Object_ice_isA(cb, &SentCallback::isA, &SentCallback::ex, + &SentCallback::sent)); + cb->check(); + p->begin_ice_isA("", Ice::newCallback_Object_ice_isA(cbWC, &SentCallback::isAWC, &SentCallback::exWC, + &SentCallback::sentWC), cookie); + cbWC->check(); + + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cb, &SentCallback::ping, &SentCallback::ex, + &SentCallback::sent)); + cb->check(); + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cbWC, &SentCallback::pingWC, &SentCallback::exWC, + &SentCallback::sentWC), cookie); + cbWC->check(); + + p->begin_ice_id(Ice::newCallback_Object_ice_id(cb, &SentCallback::id, &SentCallback::ex, &SentCallback::sent)); + cb->check(); + p->begin_ice_id(Ice::newCallback_Object_ice_id(cbWC, &SentCallback::idWC, &SentCallback::exWC, + &SentCallback::sentWC), cookie); + cbWC->check(); + + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cb, &SentCallback::ids, &SentCallback::ex, + &SentCallback::sent)); + cb->check(); + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cbWC, &SentCallback::idsWC, &SentCallback::exWC, + &SentCallback::sentWC), cookie); + cbWC->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &SentCallback::op, &SentCallback::ex, &SentCallback::sent)); + cb->check(); + p->begin_op(Test::newCallback_TestIntf_op(cbWC, &SentCallback::opWC, &SentCallback::exWC, + &SentCallback::sentWC), cookie); + cbWC->check(); + + p->begin_op(Ice::newCallback(cb, &SentCallback::opAsync, &SentCallback::sentAsync)); + cb->check(); + p->begin_op(Ice::newCallback(cbWC, &SentCallback::opAsync, &SentCallback::sentAsync), cookie); + cbWC->check(); + + p->begin_op(Ice::newCallback(cb, &SentCallback::ex, &SentCallback::sent)); + cb->check(); + p->begin_op(Ice::newCallback(cbWC, &SentCallback::exWC, &SentCallback::sentWC), cookie); + cbWC->check(); + + vector cbs; + Ice::ByteSeq seq; + seq.resize(1024); // Make sure the request doesn't compress too well. + for(Ice::ByteSeq::iterator q = seq.begin(); q != seq.end(); ++q) + { + *q = static_cast(IceUtilInternal::random(255)); + } + testController->holdAdapter(); + cb = new SentCallback(); + while(p->begin_opWithPayload(seq, + Ice::newCallback(cb, &SentCallback::ex, &SentCallback::sent))->sentSynchronously()) + { + cbs.push_back(cb); + cb = new SentCallback(); + } + testController->resumeAdapter(); + for(vector::const_iterator r = cbs.begin(); r != cbs.end(); r++) + { + (*r)->check(); + } + } + cout << "ok" << endl; + + cout << "testing illegal arguments... " << flush; + { + Ice::AsyncResultPtr result; + + result = p->begin_op(); + p->end_op(result); + try + { + p->end_op(result); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + result = p->begin_op(); + try + { + p->end_opWithResult(result); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + p->end_op(0); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + p->begin_op(Ice::newCallback(AsyncCallbackPtr(), &AsyncCallback::op)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackPtr(), &ResponseCallback::op)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackWCPtr(), &ResponseCallbackWC::op)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + void (AsyncCallback::*nullCallback)(const Ice::AsyncResultPtr&) = 0; + p->begin_op(Ice::newCallback(AsyncCallbackPtr(new AsyncCallback), nullCallback)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + void (ResponseCallback::*nullCallback)() = 0; + p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackPtr(new ResponseCallback), nullCallback)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + ResponseCallbackPtr cb = new ResponseCallback(); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op), new Cookie(3)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + + try + { + ResponseCallbackWCPtr cb = new ResponseCallbackWC(new Cookie(3)); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallbackWC::op), new Ice::LocalObject()); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } + } + cout << "ok" << endl; + + cout << "testing unexpected exceptions from callback... " << flush; + { + Test::TestIntfPrx q = Test::TestIntfPrx::uncheckedCast(p->ice_adapterId("dummy")); + ThrowType throwEx[] = { LocalException, UserException, StandardException, OtherException }; + CookiePtr cookie = new Cookie(5); + + for(int i = 0; i < 4; ++i) + { + ThrowerPtr cb = new Thrower(throwEx[i]); + + p->begin_op(Ice::newCallback(cb, &Thrower::opAsync)); + cb->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::op)); + cb->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::opWC), cookie); + cb->check(); + + q->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::op, &Thrower::ex)); + cb->check(); + + q->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::opWC, &Thrower::exWC), cookie); + cb->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::noOp, &Thrower::ex, &Thrower::sent)); + cb->check(); + + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::noOpWC, &Thrower::exWC, &Thrower::sentWC), cookie); + cb->check(); + + q->begin_op(Ice::newCallback(cb, &Thrower::ex)); + cb->check(); + + q->begin_op(Ice::newCallback(cb, &Thrower::exWC), cookie); + cb->check(); + } + } + cout << "ok" << endl; + + cout << "testing AsyncResult operations... " << flush; + { + testController->holdAdapter(); + + Ice::AsyncResultPtr r1 = p->begin_op(); + Ice::ByteSeq seq; + seq.resize(1024); // Make sure the request doesn't compress too well. + for(Ice::ByteSeq::iterator q = seq.begin(); q != seq.end(); ++q) + { + *q = static_cast(IceUtilInternal::random(255)); + } + Ice::AsyncResultPtr r2; + while((r2 = p->begin_opWithPayload(seq))->sentSynchronously()); + + test(r1 == r1); + test(r1 != r2); + + test(r1->getHash() == r1->getHash()); + test(r1->getHash() != r2->getHash()); + test(r1->getHash() < r2->getHash() || r2->getHash() < r1->getHash()); + + test(r1->sentSynchronously() && r1->isSent() && !r1->isCompleted() || + !r1->sentSynchronously() && !r1->isCompleted()); + + test(!r2->sentSynchronously() && !r2->isCompleted()); + + testController->resumeAdapter(); + + r1->waitForSent(); + test(r1->isSent()); + + r2->waitForSent(); + test(r2->isSent()); + + r1->waitForCompleted(); + test(r1->isCompleted()); + + r2->waitForCompleted(); + test(r2->isCompleted()); + + test(r1->getOperation() == "op"); + test(r2->getOperation() == "opWithPayload"); + } + cout << "ok" << endl; + + p->shutdown(); +} + + diff --git a/cpp/test/Ice/ami/Client.cpp b/cpp/test/Ice/ami/Client.cpp new file mode 100644 index 00000000000..4ae846f0b3f --- /dev/null +++ b/cpp/test/Ice/ami/Client.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 +#include +#include + +using namespace std; + +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 + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + initData.properties->setProperty("Ice.Warn.AMICallback", "0"); + + communicator = Ice::initialize(argc, argv, initData); + 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/Ice/ami/Makefile b/cpp/test/Ice/ami/Makefile new file mode 100644 index 00000000000..bcb5eb4e8a4 --- /dev/null +++ b/cpp/test/Ice/ami/Makefile @@ -0,0 +1,43 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 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) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +include .depend diff --git a/cpp/test/Ice/ami/Makefile.mak b/cpp/test/Ice/ami/Makefile.mak new file mode 100644 index 00000000000..11a5b582373 --- /dev/null +++ b/cpp/test/Ice/ami/Makefile.mak @@ -0,0 +1,50 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 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.exe +SERVER = server.exe + +TARGETS = $(CLIENT) $(SERVER) + +COBJS = Test.obj \ + Client.obj \ + AllTests.obj + +SOBJS = Test.obj \ + TestI.obj \ + Server.obj + +SRCS = $(COBJS:.obj=.cpp) \ + $(SOBJS:.obj=.cpp) + +!include $(top_srcdir)/config/Make.rules.mak + +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN + +!if "$(GENERATE_PDB)" == "yes" +CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) +SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb) +!endif + +$(CLIENT): $(COBJS) + $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +$(SERVER): $(SOBJS) + $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +clean:: + del /q Test.cpp Test.h + +!include .depend diff --git a/cpp/test/Ice/ami/Server.cpp b/cpp/test/Ice/ami/Server.cpp new file mode 100644 index 00000000000..2b8b5cba674 --- /dev/null +++ b/cpp/test/Ice/ami/Server.cpp @@ -0,0 +1,76 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 +#include + +using namespace std; + +int +run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) +{ + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1"); + + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); + Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter"); + + TestIntfControllerIPtr testController = new TestIntfControllerI(adapter); + + adapter->add(new TestIntfI(), communicator->stringToIdentity("test")); + adapter->activate(); + + adapter2->add(testController, communicator->stringToIdentity("testController")); + adapter2->activate(); + + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + + // + // This test kills connections, so we don't want warnings. + // + initData.properties->setProperty("Ice.Warn.Connections", "0"); + + communicator = Ice::initialize(argc, argv, initData); + 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/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice new file mode 100644 index 00000000000..77a629e1f7d --- /dev/null +++ b/cpp/test/Ice/ami/Test.ice @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 + +#include +#include + +module Test +{ + +exception TestIntfException +{ +}; + +["ami"] interface TestIntf +{ + void op(); + void opWithPayload(Ice::ByteSeq seq); + int opWithResult(); + void opWithUE() + throws TestIntfException; + void shutdown(); +}; + +interface TestIntfController +{ + void holdAdapter(); + void resumeAdapter(); +}; + +}; + +#endif diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp new file mode 100644 index 00000000000..b2e42bee81d --- /dev/null +++ b/cpp/test/Ice/ami/TestI.cpp @@ -0,0 +1,58 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 +#include + +using namespace std; +using namespace Ice; + +void +TestIntfI::op(const Ice::Current& current) +{ +} + +int +TestIntfI::opWithResult(const Ice::Current& current) +{ + return 15; +} + +void +TestIntfI::opWithUE(const Ice::Current& current) +{ + throw Test::TestIntfException(); +} + +void +TestIntfI::opWithPayload(const Ice::ByteSeq&, const Ice::Current& current) +{ +} + +void +TestIntfI::shutdown(const Ice::Current& current) +{ + current.adapter->getCommunicator()->shutdown(); +} + +void +TestIntfControllerI::holdAdapter(const Ice::Current&) +{ + _adapter->hold(); +} + +void +TestIntfControllerI::resumeAdapter(const Ice::Current&) +{ + _adapter->activate(); +} + +TestIntfControllerI::TestIntfControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter) +{ +} diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h new file mode 100644 index 00000000000..d193f89d0bc --- /dev/null +++ b/cpp/test/Ice/ami/TestI.h @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 + +class TestIntfControllerI; +typedef IceUtil::Handle TestIntfControllerIPtr; + +class TestIntfI : virtual public Test::TestIntf +{ +public: + + virtual void op(const Ice::Current&); + virtual int opWithResult(const Ice::Current&); + virtual void opWithUE(const Ice::Current&); + virtual void opWithPayload(const Ice::ByteSeq&, const Ice::Current&); + virtual void shutdown(const Ice::Current&); +}; + +class TestIntfControllerI : public Test::TestIntfController, IceUtil::Monitor +{ +public: + + + virtual void holdAdapter(const Ice::Current&); + virtual void resumeAdapter(const Ice::Current&); + + TestIntfControllerI(const Ice::ObjectAdapterPtr&); + +private: + + Ice::ObjectAdapterPtr _adapter; +}; + +#endif diff --git a/cpp/test/Ice/ami/run.py b/cpp/test/Ice/ami/run.py new file mode 100755 index 00000000000..801c69ddd03 --- /dev/null +++ b/cpp/test/Ice/ami/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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 + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * + +TestUtil.clientServerTest() + diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 4092f34b3fa..9fab51ebd62 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -87,7 +87,7 @@ public: } void - sent() + sent(bool ss) { _sent.called(); } diff --git a/cpp/test/Ice/operations/.depend b/cpp/test/Ice/operations/.depend index e2f17e02786..700be756298 100644 --- a/cpp/test/Ice/operations/.depend +++ b/cpp/test/Ice/operations/.depend @@ -4,21 +4,16 @@ AllTests$(OBJEXT): AllTests.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initia Twoways$(OBJEXT): Twoways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h Oneways$(OBJEXT): Oneways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h TwowaysAMI$(OBJEXT): TwowaysAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -TwowaysNewAMI$(OBJEXT): TwowaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h StateChanger.h +TwowaysNewAMI$(OBJEXT): TwowaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h OnewaysAMI$(OBJEXT): OnewaysAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -OnewaysNewAMI$(OBJEXT): OnewaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h StateChanger.h +OnewaysNewAMI$(OBJEXT): OnewaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h BatchOneways$(OBJEXT): BatchOneways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -StateChanger$(OBJEXT): StateChanger.cpp StateChanger.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h Test$(OBJEXT): Test.cpp Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h TestI$(OBJEXT): TestI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h TestI.h Test.h ../../include/TestCommon.h -Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestI.h Test.h StateChangerI.h StateChanger.h -StateChanger$(OBJEXT): StateChanger.cpp StateChanger.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h -StateChangerI$(OBJEXT): StateChangerI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h StateChangerI.h StateChanger.h ../../include/TestCommon.h +Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestI.h Test.h TestAMD$(OBJEXT): TestAMD.cpp TestAMD.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h TestAMDI$(OBJEXT): TestAMDI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestAMDI.h TestAMD.h ../../include/TestCommon.h -ServerAMD$(OBJEXT): ServerAMD.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestAMDI.h TestAMD.h StateChangerI.h StateChanger.h -StateChanger$(OBJEXT): StateChanger.cpp StateChanger.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h -StateChangerI$(OBJEXT): StateChangerI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h StateChangerI.h StateChanger.h ../../include/TestCommon.h +ServerAMD$(OBJEXT): ServerAMD.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestAMDI.h TestAMD.h Test$(OBJEXT): Test.cpp Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h TestI$(OBJEXT): TestI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h TestI.h Test.h ../../include/TestCommon.h Collocated$(OBJEXT): Collocated.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h TestI.h Test.h @@ -26,15 +21,11 @@ AllTests$(OBJEXT): AllTests.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initia Twoways$(OBJEXT): Twoways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h Oneways$(OBJEXT): Oneways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h TwowaysAMI$(OBJEXT): TwowaysAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -TwowaysNewAMI$(OBJEXT): TwowaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h StateChanger.h +TwowaysNewAMI$(OBJEXT): TwowaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h OnewaysAMI$(OBJEXT): OnewaysAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -OnewaysNewAMI$(OBJEXT): OnewaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h StateChanger.h +OnewaysNewAMI$(OBJEXT): OnewaysNewAMI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h BatchOneways$(OBJEXT): BatchOneways.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ../../include/TestCommon.h Test.h -StateChanger$(OBJEXT): StateChanger.cpp StateChanger.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h -StateChangerI$(OBJEXT): StateChangerI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h StateChangerI.h StateChanger.h ../../include/TestCommon.h Test.cpp: Test.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice TestAMD.cpp: TestAMD.ice $(slicedir)/Ice/Current.ice $(slicedir)/Ice/ObjectAdapterF.ice $(slicedir)/Ice/ConnectionF.ice $(slicedir)/Ice/Identity.ice -StateChanger.cpp: StateChanger.ice Test.ice: $(SLICE2CPP) $(SLICEPARSERLIB) TestAMD.ice: $(SLICE2CPP) $(SLICEPARSERLIB) -StateChanger.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/test/Ice/operations/Makefile b/cpp/test/Ice/operations/Makefile index de89c619d87..9256aa58d9e 100644 --- a/cpp/test/Ice/operations/Makefile +++ b/cpp/test/Ice/operations/Makefile @@ -25,20 +25,15 @@ COBJS = Test.o \ TwowaysNewAMI.o \ OnewaysAMI.o \ OnewaysNewAMI.o \ - BatchOneways.o \ - StateChanger.o + BatchOneways.o SOBJS = Test.o \ TestI.o \ Server.o \ - StateChanger.o \ - StateChangerI.o SAMDOBJS = TestAMD.o \ TestAMDI.o \ - ServerAMD.o \ - StateChanger.o \ - StateChangerI.o + ServerAMD.o COLOBJS = Test.o \ TestI.o \ @@ -50,16 +45,14 @@ COLOBJS = Test.o \ TwowaysNewAMI.o \ OnewaysAMI.o \ OnewaysNewAMI.o \ - BatchOneways.o \ - StateChanger.o \ - StateChangerI.o + BatchOneways.o SRCS = $(COBJS:.o=.cpp) \ $(SOBJS:.o=.cpp) \ $(SAMDOBJS:.o=.cpp) \ $(COLOBJS:.o=.cpp) -SLICE_SRCS = Test.ice TestAMD.ice StateChanger.ice +SLICE_SRCS = Test.ice TestAMD.ice include $(top_srcdir)/config/Make.rules diff --git a/cpp/test/Ice/operations/Makefile.mak b/cpp/test/Ice/operations/Makefile.mak index a380b3cfa66..7f632140d41 100644 --- a/cpp/test/Ice/operations/Makefile.mak +++ b/cpp/test/Ice/operations/Makefile.mak @@ -25,20 +25,15 @@ COBJS = Test.obj \ OnewaysAMI.obj \ TwowaysNewAMI.obj \ OnewaysNewAMI.obj \ - BatchOneways.obj \ - StateChanger.obj + BatchOneways.obj SOBJS = Test.obj \ TestI.obj \ - Server.obj \ - StateChanger.obj \ - StateChangerI.obj + Server.obj SAMDOBJS = TestAMD.obj \ TestAMDI.obj \ - ServerAMD.obj \ - StateChanger.obj \ - StateChangerI.obj + ServerAMD.obj COLOBJS = Test.obj \ TestI.obj \ @@ -51,7 +46,6 @@ COLOBJS = Test.obj \ TwowaysNewAMI.obj \ OnewaysNewAMI.obj \ BatchOneways.obj \ - StateChanger.obj SRCS = $(COBJS:.obj=.cpp) \ $(SOBJS:.obj=.cpp) \ diff --git a/cpp/test/Ice/operations/Oneways.cpp b/cpp/test/Ice/operations/Oneways.cpp index 9e385e31ae6..c46620fba75 100644 --- a/cpp/test/Ice/operations/Oneways.cpp +++ b/cpp/test/Ice/operations/Oneways.cpp @@ -18,6 +18,43 @@ oneways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& proxy) { Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(proxy->ice_oneway()); + { + p->ice_ping(); + } + + { + try + { + p->ice_isA("dummy"); + test(false); + } + catch(const Ice::TwowayOnlyException&) + { + } + } + + { + try + { + p->ice_id(); + test(false); + } + catch(const Ice::TwowayOnlyException&) + { + } + } + + { + try + { + p->ice_ids(); + test(false); + } + catch(const Ice::TwowayOnlyException&) + { + } + } + { p->opVoid(); } diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp index 88830c8c954..79d9ee19bea 100644 --- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp @@ -10,7 +10,6 @@ #include #include #include -#include using namespace std; @@ -58,53 +57,6 @@ private: typedef IceUtil::Handle CallbackBasePtr; -class NoEndpointCallback : public CallbackBase -{ -public: - - void unsafe(const Ice::AsyncResultPtr& r) - { - try - { - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(r->getProxy()); - p->end_opVoid(r); - test(false); - } - catch(const Ice::NoEndpointException&) - { - called(); - } - } - - void success() - { - test(false); - } - - void exCB(const Ice::Exception& ex) - { - test(dynamic_cast(&ex)); - called(); - } - - void sentCB() - { - test(false); - } -}; - -typedef IceUtil::Handle NoEndpointCallbackPtr; - -struct Cookie : public Ice::LocalObject -{ - Cookie(int i) : val(i) - { - } - int val; -}; - -typedef IceUtil::Handle CookiePtr; - class Callback : public CallbackBase { public: @@ -113,124 +65,33 @@ public: { } - void opVoid(const CookiePtr& cookie) + void sent(bool) { - test(cookie->val == 99); called(); } - void exCBNC(const Ice::Exception& ex) + void noException(const Ice::Exception&) { test(false); } - void exCB(const Ice::Exception& ex, const CookiePtr& cookie) + void twowayOnlyException(const Ice::Exception& ex) { - test(cookie->val == 99); - called(); - } -}; - -typedef IceUtil::Handle CallbackPtr; - -enum ThrowType { LocalException, UserException, StandardException, OtherException }; - -class Thrower : public CallbackBase -{ -public: - - Thrower(ThrowType t) - : _t(t) - { - } - - void exCB(const Ice::Exception& ex) - { - called(); - throwEx(); - } - -private: - - void throwEx() - { - switch(_t) + try { - case LocalException: - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - break; - } - case UserException: - { - throw Test::SomeException(); - break; - } - case StandardException: - { - throw ::std::bad_alloc(); - break; - } - case OtherException: - { - throw 99; - break; - } - default: - { - assert(false); - break; - } + ex.ice_throw(); } - } - - ThrowType _t; -}; - -typedef IceUtil::Handle ThrowerPtr; - -class SentCounter : public CallbackBase -{ -public: - - SentCounter() : _queuedCount(0) - { - } - - void exCB(const Ice::Exception&) - { - test(false); - } - - void sentCB() - { - IceUtil::Monitor::Lock sync(_m); - ++_queuedCount; - } - - int queuedCount() - { - IceUtil::Monitor::Lock sync(_m); - return _queuedCount; - } - - void check(int size) - { - IceUtil::Monitor::Lock sync(_m); - while(_queuedCount != size) + catch(const Ice::TwowayOnlyException&) { - _m.wait(); + called(); + } + catch(const Ice::Exception&) + { + test(false); } } - -private: - - int _queuedCount; - IceUtil::ThreadControl::ID _id; - IceUtil::Monitor _m; }; - -typedef IceUtil::Handle SentCounterPtr; +typedef IceUtil::Handle CallbackPtr; } @@ -240,198 +101,39 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(proxy->ice_oneway()); { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")->ice_oneway()); - Ice::AsyncResultPtr r; - - r = indirect->begin_opVoid(); - try - { - indirect->end_opVoid(r); - test(false); - } - catch(const Ice::NoEndpointException&) - { - } - - // - // Check that a second call to the end_ method throws IllegalArgumentException. - // - try - { - indirect->end_opVoid(r); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that a call to a void operation raises NoEndpointException in the callback. - // Also test that the sent callback is not called in this case. - // - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")->ice_oneway()); - - NoEndpointCallbackPtr cb = new NoEndpointCallback; - - Ice::CallbackPtr callback = Ice::newCallback(cb, &NoEndpointCallback::exCB, &NoEndpointCallback::sentCB); - indirect->begin_opVoid(callback); + CallbackPtr cb = new Callback; + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::noException, &Callback::sent); + p->begin_ice_ping(callback); cb->check(); } { - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws IllegalArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - Test::MyClassPrx indirect1 = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")->ice_oneway()); - Test::MyClassPrx indirect2 = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy2"))->ice_oneway(); - - Ice::AsyncResultPtr r1 = indirect1->begin_opVoid(); - Ice::AsyncResultPtr r2 = indirect2->begin_opVoid(); - - try - { - indirect1->end_opVoid(r2); // Wrong proxy - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - indirect1->end_shutdown(r1); // Wrong operation - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws IllegalArgumentException. - // - try - { - p->end_opVoid(0); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that passing a null callback Instance throws IllegalArgumentException. - // - CallbackPtr cb; - try - { - Test::newCallback_MyClass_opVoid(cb, &Callback::opVoid, &Callback::exCB); - test(false); - } - catch(IceUtil::IllegalArgumentException&) - { - } + CallbackPtr cb = new Callback; + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); + cb->check(); } - + { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); - - { - ThrowerPtr cb = new Thrower(LocalException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::exCB); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(UserException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::exCB); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(StandardException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::exCB); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(OtherException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::exCB); - indirect->begin_opVoid(callback); - cb->check(); - } + CallbackPtr cb = new Callback; + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + p->begin_ice_id(callback); + cb->check(); } - + { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice::InitializationData initData; - initData.properties = communicator->getProperties()->clone(); - Ice::CommunicatorPtr ic = Ice::initialize(initData); - Ice::ObjectPrx obj = ic->stringToProxy(p->ice_toString())->ice_oneway(); - Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(obj); - - ic->destroy(); - - try - { - p2->begin_opVoid(); - test(false); - } - catch(const Ice::CommunicatorDestroyedException&) - { - // Expected. - } + CallbackPtr cb = new Callback; + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + p->begin_ice_ids(callback); + cb->check(); } { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice::AsyncResultPtr r = p->begin_ice_ping(); - try - { - p->end_ice_ping(r); - } - catch(...) - { - test(false); - } - } - { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::exCBNC); - p->begin_ice_ping(callback); - } - } - - // - // Test that marshaling works as expected, and that the callbacks for each type of callback work. - // - { - { - Ice::AsyncResultPtr r = p->begin_opVoid(); - p->end_opVoid(r); + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::noException, &Callback::sent); + p->begin_opVoid(callback); + cb->check(); } } @@ -439,159 +141,9 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. // { - Ice::AsyncResultPtr r = p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f)); - try - { - Ice::Byte p3; - p->end_opByte(p3, r); - test(false); - } - catch(const Ice::TwowayOnlyException&) - { - } - } - - { - Ice::Double d = 1278312346.0 / 13.0; - Test::DoubleS ds(5, d); CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::exCBNC); - p->begin_opDoubleMarshaling(d, ds, callback); - } - - { - Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::uncheckedCast(p); - test(derived); - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::exCBNC); - derived->begin_opDerived(callback); - } - - // - // Test that cookies work. Because the same generated template is instantiated each time, it is not necessary - // to test all possible operations. Instead, we only need to test once for each of the three begin_ methods - // that accept a cookie for a oneway and a twoway operation. - // - - { - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")->ice_oneway()); - CallbackPtr cb = new Callback; - CookiePtr cookie = new Cookie(99); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::exCB); - indirect->begin_opVoid(callback, cookie); + Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); cb->check(); } - - { - // - // Test that not passing a cookie when one is expected throws IlllegalArgumentException. - // (The opposite, passing a cookie when none is expected, causes a compile-time error.) - // -// CallbackPtr cb = new Callback; -// Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, -// &Callback::opVoid, -// &Callback::exCB); -// try -// { -// p->begin_opVoid(callback); -// test(false); -// } -// catch(const IceUtil::IllegalArgumentException&) -// { -// } - } - - // - // Test that queuing indication works. - // - { - Ice::AsyncResultPtr r = p->begin_delay(100); - r->waitForSent(); - test(r->isCompleted() && r->isSent()); - p->end_delay(r); - test(r->isCompleted()); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - const int contextSize = 10; // in Kilobytes - string s(1024, 'a'); // One kilobyte of a's - - Ice::Context ctx; - for(int i = 0; i < contextSize; ++i) - { - ostringstream ss; - ss << "i" << i; - ctx[ss.str()] = s; - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // - vector results; - - int queuedCount = 0; - - SentCounterPtr cb = new SentCounter; - Ice::CallbackPtr callback = Ice::newCallback(cb, &SentCounter::exCB, &SentCounter::sentCB); - Ice::AsyncResultPtr r; - - Test::StateChangerPrx state = Test::StateChangerPrx::checkedCast( - communicator->stringToProxy("hold:default -p 12011")); - state->hold(3); - - do - { - r = p->begin_opVoid(ctx, callback); - results.push_back(r); - if(!r->sentSynchronously()) - { - ++queuedCount; - } - } - while(r->sentSynchronously()); - - vector::size_type numRequests = results.size(); - test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - - // - // Re-enable the adapter. - // - state->activate(3); - - // - // Fire off a bunch more requests until we get one that wasn't queued. - // We sleep in between calls to allow the queued requests to drain. - // - do - { - r = p->begin_opVoid(callback); - results.push_back(r); - if(!r->sentSynchronously()) - { - ++queuedCount; - } - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); - } - while(!r->sentSynchronously()); - test(results.size() > numRequests); // Something is wrong if we didn't queue additional requests. - - // - // Now make all the outstanding calls to the end_ method. - // - for(vector::iterator q = results.begin(); q != results.end(); ++q) - { - p->end_opVoid(*q); - } - - // - // Check that that we got a sent callback for each queued request. - // - cb->check(queuedCount); - } } diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp index 16bb85f75da..af451ce4bbf 100644 --- a/cpp/test/Ice/operations/Server.cpp +++ b/cpp/test/Ice/operations/Server.cpp @@ -9,7 +9,6 @@ #include #include -#include using namespace std; @@ -21,11 +20,6 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test")); adapter->activate(); - communicator->getProperties()->setProperty("HoldAdapter.Endpoints", "default -p 12011:udp"); - Ice::ObjectAdapterPtr holdAdapter = communicator->createObjectAdapter("HoldAdapter"); - holdAdapter->add(new StateChangerI(new IceUtil::Timer(), adapter), communicator->stringToIdentity("hold")); - holdAdapter->activate(); - communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp index ea102675db6..253f0c2a801 100644 --- a/cpp/test/Ice/operations/ServerAMD.cpp +++ b/cpp/test/Ice/operations/ServerAMD.cpp @@ -9,7 +9,6 @@ #include #include -#include using namespace std; @@ -21,11 +20,6 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test")); adapter->activate(); - communicator->getProperties()->setProperty("HoldAdapter.Endpoints", "default -p 12011:udp"); - Ice::ObjectAdapterPtr holdAdapter = communicator->createObjectAdapter("HoldAdapter"); - holdAdapter->add(new StateChangerI(new IceUtil::Timer(), adapter), communicator->stringToIdentity("hold")); - holdAdapter->activate(); - communicator->waitForShutdown(); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/operations/StateChanger.ice b/cpp/test/Ice/operations/StateChanger.ice deleted file mode 100644 index 7160980ea23..00000000000 --- a/cpp/test/Ice/operations/StateChanger.ice +++ /dev/null @@ -1,24 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 STATECHANGER_ICE -#define STATECHANGER_ICE - -module Test -{ - -interface StateChanger -{ - void hold(int milliSeconds); - void activate(int milliSeconds); -}; - -}; - -#endif diff --git a/cpp/test/Ice/operations/StateChangerI.cpp b/cpp/test/Ice/operations/StateChangerI.cpp deleted file mode 100644 index 5762b007624..00000000000 --- a/cpp/test/Ice/operations/StateChangerI.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 -#include -#include -#include -#include -#ifdef __BCPLUSPLUS__ -# include -#endif - -StateChangerI::StateChangerI(const IceUtil::TimerPtr& timer, const Ice::ObjectAdapterPtr& adapter) - : _action(Hold), _timer(timer), _otherAdapter(adapter) -{ -} - -void -StateChangerI::hold(Ice::Int milliSeconds, const Ice::Current& current) -{ - if(milliSeconds <= 0) - { - _otherAdapter->hold(); - _otherAdapter->waitForHold(); - } - else - { - _action = Hold; - try - { - _timer->schedule(this, IceUtil::Time::milliSeconds(milliSeconds)); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } -} - -void -StateChangerI::activate(Ice::Int milliSeconds, const Ice::Current&) -{ - if(milliSeconds <= 0) - { - _otherAdapter->activate(); - } - else - { - _action = Activate; - try - { - _timer->schedule(this, IceUtil::Time::milliSeconds(milliSeconds)); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } -} - -void StateChangerI::runTimerTask() -{ - if(_action == Hold) - { - _otherAdapter->hold(); - } - else - { - _otherAdapter->activate(); - } -} diff --git a/cpp/test/Ice/operations/StateChangerI.h b/cpp/test/Ice/operations/StateChangerI.h deleted file mode 100644 index c69b282d3ad..00000000000 --- a/cpp/test/Ice/operations/StateChangerI.h +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 STATECHANGER_I_H -#define STATECHANGER_I_H - -#include - -class StateChangerI : public Test::StateChanger, public IceUtil::TimerTask -{ -public: - - StateChangerI(const IceUtil::TimerPtr&, const Ice::ObjectAdapterPtr&); - - virtual void hold(Ice::Int, const Ice::Current&); - virtual void activate(Ice::Int, const Ice::Current&); - - virtual void runTimerTask(); - -private: - - enum Action { Hold, Activate }; - - Action _action; - const IceUtil::TimerPtr _timer; - Ice::ObjectAdapterPtr _otherAdapter; -}; - -#endif diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 3cc97b68408..33cef500938 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -55,6 +55,26 @@ private: void twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) { + { + p->ice_ping(); + } + + { + test(p->ice_isA(Test::MyClass::ice_staticId())); + } + + { + test(p->ice_id() == Test::MyDerivedClass::ice_staticId()); + } + + { + Ice::StringSeq ids = p->ice_ids(); + test(ids.size() == 3); + test(ids[0] == "::Ice::Object"); + test(ids[1] == "::Test::MyClass"); + test(ids[2] == "::Test::MyDerivedClass"); + } + { p->opVoid(); } diff --git a/cpp/test/Ice/operations/TwowaysNewAMI.cpp b/cpp/test/Ice/operations/TwowaysNewAMI.cpp index 75fbce2b92c..b795fc512fa 100644 --- a/cpp/test/Ice/operations/TwowaysNewAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysNewAMI.cpp @@ -10,23 +10,12 @@ #include #include #include -#include using namespace std; namespace { -struct Cookie : public Ice::LocalObject -{ - Cookie(int i) : val(i) - { - } - int val; -}; - -typedef IceUtil::Handle CookiePtr; - class CallbackBase : public Ice::LocalObject { public: @@ -68,83 +57,11 @@ private: typedef IceUtil::Handle CallbackBasePtr; -class NoEndpointCallback : public CallbackBase -{ -public: - - NoEndpointCallback() - { - } - - void completed(const Ice::AsyncResultPtr& r) - { - try - { - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(r->getProxy()); - p->end_opVoid(r); - called(); - } - catch(const Ice::NoEndpointException&) - { - test(false); - } - } - - void completedEx(const Ice::AsyncResultPtr& r) - { - try - { - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(r->getProxy()); - p->end_opVoid(r); - test(false); - } - catch(const Ice::NoEndpointException&) - { - called(); - } - } - - void successNC() - { - test(false); - } - - void success(const CookiePtr&) - { - test(false); - } - - void exCBNC(const Ice::Exception& ex) - { - test(dynamic_cast(&ex)); - called(); - } - - void exCB(const Ice::Exception& ex, const CookiePtr&) - { - test(dynamic_cast(&ex)); - called(); - } - - void sentCB(const Ice::AsyncResultPtr&) - { - test(false); - } - - void sentCBNC() - { - test(false); - } -}; - -typedef IceUtil::Handle NoEndpointCallbackPtr; - class Callback : public CallbackBase { public: Callback() - : _communicator(0) { } @@ -153,76 +70,44 @@ public: { } - Callback(int l) - : _l(l) - { - } - - Callback(const vector& ids) - : _ids(ids) - { - } - - Callback(const string& id) - : _id(id) - { - } - - void opVoid(const Ice::AsyncResultPtr& result) - { - CookiePtr cookie = CookiePtr::dynamicCast(result->getCookie()); - if(cookie) - { - test(cookie->val == 99); - } - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - p->end_opVoid(result); - called(); - } - - void opVoidNC() + void ping() { called(); } - void opVoidWC(const CookiePtr& cookie) + void isA(bool result) { - test(cookie->val == 99); + test(result); called(); } - void opContextNC(const Ice::Context&) + void id(const string& id) { + test(id == Test::MyDerivedClass::ice_staticId()); called(); } - void opContext(const Ice::Context&, const CookiePtr&) + void ids(const Ice::StringSeq& ids) { + test(ids.size() == 3); + test(ids[0] == "::Ice::Object"); + test(ids[1] == "::Test::MyClass"); + test(ids[2] == "::Test::MyDerivedClass"); called(); } - - void opByteAsync(const Ice::AsyncResultPtr& result) + + void opVoid() { - CookiePtr c = CookiePtr::dynamicCast(result->getCookie()); - test(c->val == 78); - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - Ice::Byte b; - Ice::Byte r = p->end_opByte(b, result); - test(b == Ice::Byte(0xf0)); - test(r == Ice::Byte(0xff)); called(); } - void opByteNC(Ice::Byte r, Ice::Byte b) + void opContext(const Ice::Context&) { - test(b == Ice::Byte(0xf0)); - test(r == Ice::Byte(0xff)); called(); } - void opByte(Ice::Byte r, Ice::Byte b, const CookiePtr& cookie) + void opByte(Ice::Byte r, Ice::Byte b) { - test(cookie->val == 78); test(b == Ice::Byte(0xf0)); test(r == Ice::Byte(0xff)); called(); @@ -235,100 +120,6 @@ public: called(); } - void ice_isAAsync(const Ice::AsyncResultPtr& result) - { - CookiePtr cookie = CookiePtr::dynamicCast(result->getCookie()); - if(cookie) - { - test(cookie->val == 99); - } - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - test(p->end_ice_isA(result)); - called(); - } - - void ice_isANC(bool r) - { - test(r); - called(); - } - - void ice_isA(bool r, const CookiePtr&) - { - test(r); - called(); - } - - void ice_pingAsync(const Ice::AsyncResultPtr& result) - { - CookiePtr cookie = CookiePtr::dynamicCast(result->getCookie()); - if(cookie) - { - test(cookie->val == 99); - } - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - p->end_ice_ping(result); - called(); - } - - void ice_pingNC() - { - called(); - } - - void ice_ping(const CookiePtr&) - { - called(); - } - - void ice_idsAsync(const Ice::AsyncResultPtr& result) - { - CookiePtr cookie = CookiePtr::dynamicCast(result->getCookie()); - if(cookie) - { - test(cookie->val == 99); - } - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - test(p->end_ice_ids(result) == p->ice_ids()); - called(); - } - - void ice_idsNC(const vector& ids) - { - test(ids == _ids); - called(); - } - - void ice_ids(const vector& ids, const CookiePtr&) - { - test(ids == _ids); - called(); - } - - void ice_idAsync(const Ice::AsyncResultPtr& result) - { - CookiePtr cookie = CookiePtr::dynamicCast(result->getCookie()); - if(cookie) - { - test(cookie->val == 99); - } - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(result->getProxy()); - test(p->end_ice_id(result) == p->ice_id()); - called(); - } - - void ice_idNC(const string& id) - { - test(id == _id); - called(); - } - - void ice_id(const string& id, const CookiePtr&) - { - test(id == _id); - called(); - } - void opShortIntLong(Ice::Long r, Ice::Short s, Ice::Int i, Ice::Long l) { test(s == 10); @@ -676,8 +467,7 @@ public: void opIntS(const Test::IntS& r) { - test(r.size() == static_cast(_l)); - for(int j = 0; j < _l; ++j) + for(int j = 0; j < static_cast(r.size()); ++j) { test(r[j] == -j); } @@ -694,12 +484,7 @@ public: called(); } - void exCBNC(const Ice::Exception& ex) - { - test(false); - } - - void exCB(const Ice::Exception& ex, const CookiePtr& cookie) + void exCB(const Ice::Exception& ex) { test(false); } @@ -707,554 +492,77 @@ public: private: Ice::CommunicatorPtr _communicator; - int _l; - vector _ids; - string _id; }; - typedef IceUtil::Handle CallbackPtr; -enum ThrowType { LocalException, UserException, StandardException, OtherException }; - -class Thrower : public CallbackBase -{ -public: - - Thrower(ThrowType t) - : _t(t) - { - } - - void opVoidNC() - { - // No call to called() here! - } - - void opVoidThrow(const Ice::AsyncResultPtr& r) - { - called(); - throwEx(); - } - - void opVoidThrowNC() - { - called(); - throwEx(); - } - - void exCBNC(const Ice::Exception& ex) - { - test(false); - } - - void exCBThrowNC(const Ice::Exception& ex) - { - called(); - throwEx(); - } - -private: - - void throwEx() - { - switch(_t) - { - case LocalException: - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - break; - } - case UserException: - { - throw Test::SomeException(); - break; - } - case StandardException: - { - throw ::std::bad_alloc(); - break; - } - case OtherException: - { - throw 99; - break; - } - default: - { - assert(false); - break; - } - } - } - - ThrowType _t; -}; - -typedef IceUtil::Handle ThrowerPtr; - -class SentCounter : public CallbackBase -{ -public: - - SentCounter() : _queuedCount(0), _completedCount(0) - { - } - - void opVoid(const Ice::AsyncResultPtr& r) - { - test(r->isCompleted()); - IceUtil::Monitor::Lock sync(_m); - ++_completedCount; - _m.notify(); - } - - void sentCB(const Ice::AsyncResultPtr& r) - { - IceUtil::Monitor::Lock sync(_m); - ++_queuedCount; - } - - int queuedCount() - { - IceUtil::Monitor::Lock sync(_m); - return _queuedCount; - } - - void check(int size) - { - IceUtil::Monitor::Lock sync(_m); - while(_completedCount != size) - { - _m.wait(); - } - } - -private: - - int _queuedCount; - int _completedCount; - IceUtil::ThreadControl::ID _id; - IceUtil::Monitor _m; -}; - -typedef IceUtil::Handle SentCounterPtr; - } void twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) { { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); - Ice::AsyncResultPtr r; - - r = indirect->begin_opVoid(); - try - { - indirect->end_opVoid(r); - test(false); - } - catch(const Ice::NoEndpointException&) - { - } - - // - // Check that a second call to the end_ method throws IllegalArgumentException. - // - try - { - indirect->end_opVoid(r); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - // - // Use type-unsafe and type-safe variations of the callback, and - // variations of the callback (with and without success callback). - // Also test that the sent callback is not called in this case. - // - NoEndpointCallbackPtr cb1 = new NoEndpointCallback; - NoEndpointCallbackPtr cb2 = new NoEndpointCallback; - NoEndpointCallbackPtr cb3 = new NoEndpointCallback; - - Ice::CallbackPtr callback = Ice::newCallback(cb1, - &NoEndpointCallback::completedEx, - &NoEndpointCallback::sentCB); - indirect->begin_opVoid(callback); - - Test::Callback_MyClass_opVoidPtr callback2 = Test::newCallback_MyClass_opVoid(cb2, - &NoEndpointCallback::successNC, - &NoEndpointCallback::exCBNC, - &NoEndpointCallback::sentCBNC); - indirect->begin_opVoid(callback2); - - Ice::CallbackPtr callback3 = Ice::newCallback(cb3, - &NoEndpointCallback::exCBNC, - &NoEndpointCallback::sentCBNC); - indirect->begin_opVoid(callback3); - - cb1->check(); - cb2->check(); - cb3->check(); - } - - { - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws IllegalArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - Test::MyClassPrx indirect1 = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); - Test::MyClassPrx indirect2 = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy2")); - - Ice::AsyncResultPtr r1 = indirect1->begin_opVoid(); - Ice::AsyncResultPtr r2 = indirect2->begin_opVoid(); - - try - { - indirect1->end_opVoid(r2); // Wrong proxy - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - indirect1->end_shutdown(r1); // Wrong operation - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws IllegalArgumentException. - // - try - { - p->end_opVoid(0); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that passing a null callback instance throws IllegalArgumentException. - // - CallbackPtr cb; - try - { - Ice::newCallback(cb, &Callback::exCBNC); - test(false); - } - catch(IceUtil::IllegalArgumentException&) - { - } - } - - // - // Check optional callbacks on callback creation. - // - { - NoEndpointCallbackPtr cb = new NoEndpointCallback; - - Ice::CallbackPtr del1 = Ice::newCallback(cb, &NoEndpointCallback::completed); - p->begin_opVoid(del1); - cb->check(); - - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); - - Ice::CallbackPtr del2 = Ice::newCallback(cb, &NoEndpointCallback::exCBNC); - indirect->begin_opVoid(del2); - cb->check(); - - Ice::CallbackPtr del3 = Ice::newCallback(cb, &NoEndpointCallback::exCB); - indirect->begin_opVoid(del3, 0); + CallbackPtr cb = new Callback; + Ice::Callback_Object_ice_pingPtr callback = Ice::newCallback_Object_ice_ping(cb, + &Callback::ping, + &Callback::exCB); + p->begin_ice_ping(callback); cb->check(); - - Ice::CallbackPtr del4 = Ice::newCallback(cb, &NoEndpointCallback::sentCBNC); - indirect->begin_opVoid(del4); - - try - { - void (NoEndpointCallback::*nullCallback)(const Ice::AsyncResultPtr&) = 0; - Ice::newCallback(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - void (NoEndpointCallback::*nullCallback)(const Ice::Exception&) = 0; - Ice::newCallback(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - void (NoEndpointCallback::*nullCallback)(const Ice::Exception&, const CookiePtr&) = 0; - Ice::newCallback(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } } - // - // Check optional exception and sent callbacks on delegation creation. - // { CallbackPtr cb = new Callback; - - Test::Callback_MyClass_opVoidPtr del1 = Test::newCallback_MyClass_opVoid(cb, &Callback::opVoidNC); - p->begin_opVoid(del1); - cb->check(); - - Test::Callback_MyClass_opVoidPtr del2 = Test::newCallback_MyClass_opVoid(cb, &Callback::opVoidWC); - p->begin_opVoid(del2, new Cookie(99)); - cb->check(); - - Test::Callback_MyClass_opContextPtr del3 = Test::newCallback_MyClass_opContext(cb, &Callback::opContextNC); - p->begin_opContext(del3); + Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, + &Callback::isA, + &Callback::exCB); + p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); cb->check(); - - Test::Callback_MyClass_opContextPtr del4 = Test::newCallback_MyClass_opContext(cb, &Callback::opContext); - p->begin_opContext(del4, 0); - cb->check(); - - try - { - void (Callback::*nullCallback)() = 0; - Test::newCallback_MyClass_opVoid(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - void (Callback::*nullCallback)(const CookiePtr&) = 0; - Test::newCallback_MyClass_opVoid(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - void (Callback::*nullCallback)(const Ice::Context&) = 0; - Test::newCallback_MyClass_opContext(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - - try - { - void (Callback::*nullCallback)(const Ice::Context&, const CookiePtr&) = 0; - Test::newCallback_MyClass_opContext(cb, nullCallback); - test(false); - } - catch(const IceUtil::IllegalArgumentException&) - { - } - } - - { - // - // Check that throwing an exception from the success callback doesn't cause problems. - // - { - ThrowerPtr cb = new Thrower(LocalException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::opVoidThrow); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(UserException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::opVoidThrow); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(StandardException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::opVoidThrow); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(OtherException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::opVoidThrow); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(LocalException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidThrowNC, - &Thrower::exCBNC); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(UserException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidThrowNC, - &Thrower::exCBNC); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(StandardException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidThrowNC, - &Thrower::exCBNC); - p->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(OtherException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidThrowNC, - &Thrower::exCBNC); - p->begin_opVoid(callback); - cb->check(); - } } - + { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); - - { - ThrowerPtr cb = new Thrower(LocalException); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Thrower::opVoidThrow); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(LocalException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidNC, - &Thrower::exCBThrowNC); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(UserException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidNC, - &Thrower::exCBThrowNC); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(StandardException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidNC, - &Thrower::exCBThrowNC); - indirect->begin_opVoid(callback); - cb->check(); - } - - { - ThrowerPtr cb = new Thrower(OtherException); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Thrower::opVoidNC, - &Thrower::exCBThrowNC); - indirect->begin_opVoid(callback); - cb->check(); - } + CallbackPtr cb = new Callback; + Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, + &Callback::id, + &Callback::exCB); + p->begin_ice_id(callback); + cb->check(); } - - { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice::InitializationData initData; - initData.properties = communicator->getProperties()->clone(); - Ice::CommunicatorPtr ic = Ice::initialize(initData); - Ice::ObjectPrx obj = ic->stringToProxy(p->ice_toString()); - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(obj); - - ic->destroy(); - try - { - p2->begin_opVoid(); - test(false); - } - catch(const Ice::CommunicatorDestroyedException&) - { - // Expected. - } - } - - // - // Test that marshaling works as expected, and that the callbacks for each type of callback work. - // - { - Ice::AsyncResultPtr r = p->begin_opVoid(); - p->end_opVoid(r); + CallbackPtr cb = new Callback; + Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, + &Callback::ids, + &Callback::exCB); + p->begin_ice_ids(callback); + cb->check(); } { CallbackPtr cb = new Callback; Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Callback::opVoidNC, - &Callback::exCBNC); + &Callback::opVoid, + &Callback::exCB); p->begin_opVoid(callback); cb->check(); } - + { - Ice::AsyncResultPtr r = p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f)); - Ice::Byte p3; - Ice::Byte ret = p->end_opByte(p3, r); - test(p3 == Ice::Byte(0xf0)); - test(ret == Ice::Byte(0xff)); + Ice::Double d = 1278312346.0 / 13.0; + Test::DoubleS ds(5, d); + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opBytePtr callback = Test::newCallback_MyClass_opByte(cb, + &Callback::opByte, + &Callback::exCB); + p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); + cb->check(); } + { CallbackPtr cb = new Callback; - Test::Callback_MyClass_opBytePtr callback = Test::newCallback_MyClass_opByte(cb, - &Callback::opByteNC, - &Callback::exCBNC); - p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); + Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, + &Callback::opVoid, + &Callback::exCB); + p->begin_opVoid(callback); cb->check(); } @@ -1262,7 +570,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opBoolPtr callback = Test::newCallback_MyClass_opBool(cb, &Callback::opBool, - &Callback::exCBNC); + &Callback::exCB); p->begin_opBool(true, false, callback); cb->check(); } @@ -1270,7 +578,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { CallbackPtr cb = new Callback; Test::Callback_MyClass_opShortIntLongPtr callback = - Test::newCallback_MyClass_opShortIntLong(cb, &Callback::opShortIntLong, &Callback::exCBNC); + Test::newCallback_MyClass_opShortIntLong(cb, &Callback::opShortIntLong, &Callback::exCB); p->begin_opShortIntLong(10, 11, 12, callback); cb->check(); } @@ -1278,7 +586,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { CallbackPtr cb = new Callback; Test::Callback_MyClass_opFloatDoublePtr callback = - Test::newCallback_MyClass_opFloatDouble(cb, &Callback::opFloatDouble, &Callback::exCBNC); + Test::newCallback_MyClass_opFloatDouble(cb, &Callback::opFloatDouble, &Callback::exCB); p->begin_opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), callback); cb->check(); } @@ -1287,7 +595,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opStringPtr callback = Test::newCallback_MyClass_opString(cb, &Callback::opString, - &Callback::exCBNC); + &Callback::exCB); p->begin_opString("hello", "world", callback); cb->check(); } @@ -1296,7 +604,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opMyEnumPtr callback = Test::newCallback_MyClass_opMyEnum(cb, &Callback::opMyEnum, - &Callback::exCBNC); + &Callback::exCB); p->begin_opMyEnum(Test::enum2, callback); cb->check(); } @@ -1305,7 +613,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback(communicator); Test::Callback_MyClass_opMyClassPtr callback = Test::newCallback_MyClass_opMyClass(cb, &Callback::opMyClass, - &Callback::exCBNC); + &Callback::exCB); p->begin_opMyClass(p, callback); cb->check(); } @@ -1323,7 +631,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback(communicator); Test::Callback_MyClass_opStructPtr callback = Test::newCallback_MyClass_opStruct(cb, &Callback::opStruct, - &Callback::exCBNC); + &Callback::exCB); p->begin_opStruct(si1, si2, callback); cb->check(); } @@ -1345,7 +653,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opByteSPtr callback = Test::newCallback_MyClass_opByteS(cb, &Callback::opByteS, - &Callback::exCBNC); + &Callback::exCB); p->begin_opByteS(bsi1, bsi2, callback); cb->check(); } @@ -1363,7 +671,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opBoolSPtr callback = Test::newCallback_MyClass_opBoolS(cb, &Callback::opBoolS, - &Callback::exCBNC); + &Callback::exCB); p->begin_opBoolS(bsi1, bsi2, callback); cb->check(); } @@ -1388,7 +696,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opShortIntLongSPtr callback = - Test::newCallback_MyClass_opShortIntLongS(cb, &Callback::opShortIntLongS, &Callback::exCBNC); + Test::newCallback_MyClass_opShortIntLongS(cb, &Callback::opShortIntLongS, &Callback::exCB); p->begin_opShortIntLongS(ssi, isi, lsi, callback); cb->check(); } @@ -1406,7 +714,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opFloatDoubleSPtr callback = - Test::newCallback_MyClass_opFloatDoubleS(cb, &Callback::opFloatDoubleS, &Callback::exCBNC); + Test::newCallback_MyClass_opFloatDoubleS(cb, &Callback::opFloatDoubleS, &Callback::exCB); p->begin_opFloatDoubleS(fsi, dsi, callback); cb->check(); } @@ -1424,7 +732,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opStringSPtr callback = Test::newCallback_MyClass_opStringS(cb, &Callback::opStringS, - &Callback::exCBNC); + &Callback::exCB); p->begin_opStringS(ssi1, ssi2, callback); cb->check(); } @@ -1447,7 +755,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opByteSSPtr callback = Test::newCallback_MyClass_opByteSS(cb, &Callback::opByteSS, - &Callback::exCBNC); + &Callback::exCB); p->begin_opByteSS(bsi1, bsi2, callback); cb->check(); } @@ -1467,7 +775,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opFloatDoubleSSPtr callback = - Test::newCallback_MyClass_opFloatDoubleSS(cb, &Callback::opFloatDoubleSS, &Callback::exCBNC); + Test::newCallback_MyClass_opFloatDoubleSS(cb, &Callback::opFloatDoubleSS, &Callback::exCB); p->begin_opFloatDoubleSS(fsi, dsi, callback); cb->check(); } @@ -1486,7 +794,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opStringSSPtr callback = - Test::newCallback_MyClass_opStringSS(cb, &Callback::opStringSS, &Callback::exCBNC); + Test::newCallback_MyClass_opStringSS(cb, &Callback::opStringSS, &Callback::exCB); p->begin_opStringSS(ssi1, ssi2, callback); cb->check(); } @@ -1502,7 +810,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opByteBoolDPtr callback = - Test::newCallback_MyClass_opByteBoolD(cb, &Callback::opByteBoolD, &Callback::exCBNC); + Test::newCallback_MyClass_opByteBoolD(cb, &Callback::opByteBoolD, &Callback::exCB); p->begin_opByteBoolD(di1, di2, callback); cb->check(); } @@ -1518,7 +826,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opShortIntDPtr callback = - Test::newCallback_MyClass_opShortIntD(cb, &Callback::opShortIntD, &Callback::exCBNC); + Test::newCallback_MyClass_opShortIntD(cb, &Callback::opShortIntD, &Callback::exCB); p->begin_opShortIntD(di1, di2, callback); cb->check(); } @@ -1534,7 +842,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opLongFloatDPtr callback = - Test::newCallback_MyClass_opLongFloatD(cb, &Callback::opLongFloatD, &Callback::exCBNC); + Test::newCallback_MyClass_opLongFloatD(cb, &Callback::opLongFloatD, &Callback::exCB); p->begin_opLongFloatD(di1, di2, callback); cb->check(); } @@ -1550,7 +858,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opStringStringDPtr callback = - Test::newCallback_MyClass_opStringStringD(cb, &Callback::opStringStringD, &Callback::exCBNC); + Test::newCallback_MyClass_opStringStringD(cb, &Callback::opStringStringD, &Callback::exCB); p->begin_opStringStringD(di1, di2, callback); cb->check(); } @@ -1566,7 +874,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opStringMyEnumDPtr callback = - Test::newCallback_MyClass_opStringMyEnumD(cb, &Callback::opStringMyEnumD, &Callback::exCBNC); + Test::newCallback_MyClass_opStringMyEnumD(cb, &Callback::opStringMyEnumD, &Callback::exCB); p->begin_opStringMyEnumD(di1, di2, callback); cb->check(); } @@ -1587,7 +895,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& CallbackPtr cb = new Callback; Test::Callback_MyClass_opMyStructMyEnumDPtr callback = - Test::newCallback_MyClass_opMyStructMyEnumD(cb, &Callback::opMyStructMyEnumD, &Callback::exCBNC); + Test::newCallback_MyClass_opMyStructMyEnumD(cb, &Callback::opMyStructMyEnumD, &Callback::exCB); p->begin_opMyStructMyEnumD(di1, di2, callback); cb->check(); } @@ -1602,9 +910,9 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { s.push_back(i); } - CallbackPtr cb = new Callback(lengths[l]); + CallbackPtr cb = new Callback; Test::Callback_MyClass_opIntSPtr callback = - Test::newCallback_MyClass_opIntS(cb, &Callback::opIntS, &Callback::exCBNC); + Test::newCallback_MyClass_opIntS(cb, &Callback::opIntS, &Callback::exCB); p->begin_opIntS(s, callback); cb->check(); } @@ -1662,7 +970,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast( - ic->stringToProxy("test:default -p 12010")); + ic->stringToProxy("test:default -p 12010")); ic->getImplicitContext()->setContext(ctx); @@ -1717,7 +1025,7 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& Test::DoubleS ds(5, d); CallbackPtr cb = new Callback; Test::Callback_MyClass_opDoubleMarshalingPtr callback = - Test::newCallback_MyClass_opDoubleMarshaling(cb, &Callback::opDoubleMarshaling, &Callback::exCBNC); + Test::newCallback_MyClass_opDoubleMarshaling(cb, &Callback::opDoubleMarshaling, &Callback::exCB); p->begin_opDoubleMarshaling(d, ds, callback); cb->check(); } @@ -1727,353 +1035,8 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& test(derived); CallbackPtr cb = new Callback; Test::Callback_MyDerivedClass_opDerivedPtr callback = - Test::newCallback_MyDerivedClass_opDerived(cb, &Callback::opDerived, &Callback::exCBNC); + Test::newCallback_MyDerivedClass_opDerived(cb, &Callback::opDerived, &Callback::exCB); derived->begin_opDerived(callback); cb->check(); } - - // - // Test that cookies work. Because the same generated template is - // instantiated each time, it is not necessary to test all - // possible operations. Instead, we only need to test once for - // each of the three begin_ methods that accept a cookie for a - // oneway and a twoway operation. - // - - { - CallbackPtr cb = new Callback; - CookiePtr cookie = new Cookie(99); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::opVoid); - p->begin_opVoid(callback, cookie); - } - - { - CallbackPtr cb = new Callback; - CookiePtr cookie = new Cookie(99); - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, - &Callback::opVoidWC, - &Callback::exCB); - p->begin_opVoid(callback, cookie); - } - - { - // - // Test that not passing a cookie when one is expected throws IlllegalArgumentException. - // (The opposite, passing a cookie when none is expected, causes a compile-time error.) - // -// CallbackPtr cb = new Callback; -// Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, -// &Callback::opVoidWC, -// &Callback::exCB); -// try -// { -// p->begin_opVoid(callback); -// test(false); -// } -// catch(const IceUtil::IllegalArgumentException&) -// { -// } - } - - { - CallbackPtr cb = new Callback; - CookiePtr cookie = new Cookie(78); - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::opByteAsync); - p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback, cookie); - } - - { - CallbackPtr cb = new Callback; - CookiePtr cookie = new Cookie(78); - Test::Callback_MyClass_opBytePtr callback = Test::newCallback_MyClass_opByte(cb, - &Callback::opByte, - &Callback::exCB); - p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback, cookie); - } - - { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice::AsyncResultPtr r = p->begin_ice_isA(p->ice_staticId()); - try - { - test(p->end_ice_isA(r)); - } - catch(...) - { - test(false); - } - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_isAAsync); - p->begin_ice_isA(p->ice_staticId(), callback); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, - &Callback::ice_isANC, - &Callback::exCBNC); - p->begin_ice_isA(p->ice_staticId(), callback); - cb->check(); - } - - { - Ice::AsyncResultPtr r = p->begin_ice_ping(); - try - { - p->end_ice_ping(r); - } - catch(...) - { - test(false); - } - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_pingAsync); - p->begin_ice_ping(callback); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_pingPtr callback = Ice::newCallback_Object_ice_ping(cb, - &Callback::ice_pingNC, - &Callback::exCBNC); - p->begin_ice_ping(callback); - cb->check(); - } - - { - Ice::AsyncResultPtr r = p->begin_ice_ids(); - try - { - test(p->end_ice_ids(r) == p->ice_ids()); - } - catch(...) - { - test(false); - } - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_idsAsync); - p->begin_ice_ids(callback); - cb->check(); - } - - { - CallbackPtr cb = new Callback(p->ice_ids()); - Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, - &Callback::ice_idsNC, - &Callback::exCBNC); - p->begin_ice_ids(callback); - cb->check(); - } - - { - Ice::AsyncResultPtr r = p->begin_ice_id(); - try - { - test(p->end_ice_id(r) == p->ice_id()); - } - catch(...) - { - test(false); - } - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_idAsync); - p->begin_ice_id(callback); - cb->check(); - } - - { - CallbackPtr cb = new Callback(p->ice_id()); - Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, - &Callback::ice_idNC, - &Callback::exCBNC); - p->begin_ice_id(callback); - cb->check(); - } - - // - // Check that we can call operations on Object asynchronously with a cookie. - // - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_isAAsync); - CookiePtr cookie = new Cookie(99); - p->begin_ice_isA(p->ice_staticId(), callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, - &Callback::ice_isA, - &Callback::exCB); - CookiePtr cookie = new Cookie(99); - p->begin_ice_isA(p->ice_staticId(), callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_pingAsync); - CookiePtr cookie = new Cookie(99); - p->begin_ice_ping(callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_pingPtr callback = Ice::newCallback_Object_ice_ping(cb, - &Callback::ice_ping, - &Callback::exCB); - CookiePtr cookie = new Cookie(99); - p->begin_ice_ping(callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_idsAsync); - CookiePtr cookie = new Cookie(99); - p->begin_ice_ids(callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback(p->ice_ids()); - Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, - &Callback::ice_ids, - &Callback::exCB); - CookiePtr cookie = new Cookie(99); - p->begin_ice_ids(callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::ice_idAsync); - CookiePtr cookie = new Cookie(99); - p->begin_ice_id(callback, cookie); - cb->check(); - } - - { - CallbackPtr cb = new Callback(p->ice_id()); - Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, - &Callback::ice_id, - &Callback::exCB); - CookiePtr cookie = new Cookie(99); - p->begin_ice_id(callback, cookie); - cb->check(); - } - } - - // - // Test that queuing indication works. - // - { - Ice::AsyncResultPtr r = p->begin_delay(100); - test(!r->isCompleted()); - p->end_delay(r); - test(r->isCompleted()); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - const int contextSize = 10; // Kilobytes - string s(1024, 'a'); - - Ice::Context ctx; - for(int i = 0; i < contextSize; ++i) - { - ostringstream ss; - ss << "i" << i; - ctx[ss.str()] = s; - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // - vector results; - - int queuedCount = 0; - - SentCounterPtr cb = new SentCounter; - Ice::CallbackPtr callback = Ice::newCallback(cb, &SentCounter::opVoid, &SentCounter::sentCB); - Ice::AsyncResultPtr r; - - Test::StateChangerPrx state = Test::StateChangerPrx::checkedCast( - communicator->stringToProxy("hold:default -p 12011")); - state->hold(3); - - do - { - r = p->begin_opVoid(ctx, callback); - results.push_back(r); - if(!r->sentSynchronously()) - { - ++queuedCount; - } - } - while(r->sentSynchronously()); - - vector::size_type numRequests = results.size(); - test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - - // - // Re-enable the adapter. - // - state->activate(3); - - // - // Fire off a bunch more requests until we get one that wasn't queued. - // We sleep in between calls to allow the queued requests to drain. - // - do - { - r = p->begin_opVoid(callback); - results.push_back(r); - if(!r->sentSynchronously()) - { - ++queuedCount; - } - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); - } - while(!r->sentSynchronously()); - test(results.size() > numRequests); // Something is wrong if we didn't queue additional requests. - - // - // Now make all the outstanding calls to the end_ method. - // - for(vector::iterator q = results.begin(); q != results.end(); ++q) - { - p->end_opVoid(*q); - } - - // - // Check that all the callbacks have arrived and that we got a sent callback for each queued request. - // - cb->check(static_cast(results.size())); - test(cb->queuedCount() == queuedCount); - } } diff --git a/cs/allTests.py b/cs/allTests.py index 67d29be522f..4d6cc0fa444 100755 --- a/cs/allTests.py +++ b/cs/allTests.py @@ -29,10 +29,11 @@ tests = [ ("Ice/proxy", ["core"]), ("Ice/operations", ["core"]), ("Ice/exceptions", ["core"]), + ("Ice/ami", ["core"]), ("Ice/info", ["core", "noipv6", "nocompress"]), ("Ice/inheritance", ["core"]), ("Ice/facets", ["core"]), - #("Ice/hold", ["core"]), + ("Ice/hold", ["core"]), ("Ice/objects", ["core"]), ("Ice/binding", ["core"]), ("Ice/faultTolerance", ["core"]), diff --git a/cs/src/Ice/ConnectRequestHandler.cs b/cs/src/Ice/ConnectRequestHandler.cs index 76cc62c7bca..2efe88087cf 100644 --- a/cs/src/Ice/ConnectRequestHandler.cs +++ b/cs/src/Ice/ConnectRequestHandler.cs @@ -139,17 +139,17 @@ namespace IceInternal } } - public bool sendAsyncRequest(OutgoingAsync @out) + public bool sendAsyncRequest(OutgoingAsync @out, out Ice.AsyncCallback sentCallback) { lock(this) { if(!initialized()) { _requests.AddLast(new Request(@out)); + sentCallback = null; return false; } } - Ice.AsyncCallback sentCallback; return _connection.sendAsyncRequest(@out, _compress, _response, out sentCallback); } @@ -158,17 +158,17 @@ namespace IceInternal return getConnection(true).flushBatchRequests(@out); } - public bool flushAsyncBatchRequests(BatchOutgoingAsync @out) + public bool flushAsyncBatchRequests(BatchOutgoingAsync @out, out Ice.AsyncCallback sentCallback) { lock(this) { if(!initialized()) { _requests.AddLast(new Request(@out)); + sentCallback = null; return false; } } - Ice.AsyncCallback sentCallback; return _connection.flushAsyncBatchRequests(@out, out sentCallback); } @@ -372,14 +372,20 @@ namespace IceInternal { if(_connection.sendAsyncRequest(request.@out, _compress, _response, out request.sentCallback)) { - sentCallbacks.AddLast(request); + if(request.sentCallback != null) + { + sentCallbacks.AddLast(request); + } } } else if(request.batchOut != null) { if(_connection.flushAsyncBatchRequests(request.batchOut, out request.sentCallback)) { - sentCallbacks.AddLast(request); + if(request.sentCallback != null) + { + sentCallbacks.AddLast(request); + } } } else diff --git a/cs/src/Ice/ConnectionRequestHandler.cs b/cs/src/Ice/ConnectionRequestHandler.cs index 5b4c7100903..27d621a8096 100644 --- a/cs/src/Ice/ConnectionRequestHandler.cs +++ b/cs/src/Ice/ConnectionRequestHandler.cs @@ -41,9 +41,8 @@ namespace IceInternal } } - public bool sendAsyncRequest(OutgoingAsync @out) + public bool sendAsyncRequest(OutgoingAsync @out, out Ice.AsyncCallback sentCallback) { - Ice.AsyncCallback sentCallback; return _connection.sendAsyncRequest(@out, _compress, _response, out sentCallback); } @@ -52,9 +51,8 @@ namespace IceInternal return _connection.flushBatchRequests(@out); } - public bool flushAsyncBatchRequests(BatchOutgoingAsync @out) + public bool flushAsyncBatchRequests(BatchOutgoingAsync @out, out Ice.AsyncCallback sentCallback) { - Ice.AsyncCallback sentCallback; return _connection.flushAsyncBatchRequests(@out, out sentCallback); } diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index 52ae004f2e6..1cbaedbdc55 100644 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -34,7 +34,7 @@ namespace Ice /// that returns no data. /// /// - public delegate void SentCallback(); + public delegate void SentCallback(bool sentSynchronously); /// /// @@ -63,6 +63,7 @@ namespace Ice bool sentSynchronously(); + object getCookie(); string getOperation(); AsyncResult whenSent(Ice.AsyncCallback cb); @@ -242,23 +243,37 @@ namespace IceInternal throw new System.ArgumentException("sent callback already set"); } sentCallback_ = cb; - if((state_ & Sent) == 0 || sentSynchronously_) + if((state_ & Sent) == 0) { return this; } } - instance_.clientThreadPool().execute(delegate() - { - try - { - sentCallback_(this); - } - catch(System.Exception ex) + if(sentSynchronously_) + { + try + { + sentCallback_(this); + } + catch(System.Exception ex) + { + warning__(ex); + } + } + else + { + instance_.clientThreadPool().execute(delegate() { - warning__(ex); - } - }); + try + { + sentCallback_(this); + } + catch(System.Exception ex) + { + warning__(ex); + } + }); + } return this; } @@ -299,24 +314,41 @@ namespace IceInternal { throw new System.ArgumentException("sent callback already set"); } - sentCallback_ = r => cb(); - if((state_ & Sent) == 0 || sentSynchronously_) + sentCallback_ = delegate(Ice.AsyncResult result) + { + cb(result.sentSynchronously()); + }; + if((state_ & Sent) == 0) { return this; } } - instance_.clientThreadPool().execute(delegate() - { - try - { - cb(); - } - catch(System.Exception ex) + if(sentSynchronously_) + { + try + { + cb(true); + } + catch(System.Exception ex) + { + warning__(ex); + } + } + else + { + instance_.clientThreadPool().execute(delegate() { - warning__(ex); - } - }); + try + { + cb(false); + } + catch(System.Exception ex) + { + warning__(ex); + } + }); + } return this; } @@ -421,6 +453,25 @@ namespace IceInternal } } + public void sentAsync__(Ice.AsyncCallback callback) + { + // + // This is called when it's not safe to call the exception callback synchronously + // from this thread. Instead the exception callback is called asynchronously from + // the client thread pool. + // + try + { + instance_.clientThreadPool().execute(delegate() + { + sent__(callback); + }); + } + catch(Ice.CommunicatorDestroyedException) + { + } + } + public static void check__(OutgoingAsyncBase r, Ice.ObjectPrx prx, string operation) { check__(r, operation); @@ -498,11 +549,6 @@ namespace IceInternal // changing the state. // - if(sentSynchronously_) - { - return; - } - if(cb != null) { try @@ -569,7 +615,7 @@ namespace IceInternal Debug.Assert(exceptionCallback_ != null); try { - ((Ice.ObjectPrxHelperBase)result.getProxy()).end__(result, result.getOperation()); + ((OutgoingAsyncBase)result).wait__(); } catch(Ice.Exception ex) { @@ -962,10 +1008,24 @@ namespace IceInternal try { _delegate = proxy_.getDelegate__(true); - bool sent = _delegate.getRequestHandler__().sendAsyncRequest(this); - if(synchronous) // Only set sentSynchronously_ If called synchronously by the user thread. + Ice.AsyncCallback sentCallback; + if(_delegate.getRequestHandler__().sendAsyncRequest(this, out sentCallback)) { - sentSynchronously_ = sent; + if(synchronous) // Only set sentSynchronously_ If called synchronously by the user thread. + { + sentSynchronously_ = true; + if(sentCallback != null) + { + sent__(sentCallback); + } + } + else + { + if(sentCallback != null) + { + sentAsync__(sentCallback); + } + } } break; } @@ -1246,6 +1306,33 @@ namespace IceInternal _proxy = proxy; } + public void send__() + { + // + // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch + // requests were queued with the connection, they would be lost without being noticed. + // + Ice.ObjectDel_ @delegate = null; + int cnt = -1; // Don't retry. + try + { + @delegate = ((Ice.ObjectPrxHelperBase)_proxy).getDelegate__(false); + Ice.AsyncCallback sentCallback; + if(@delegate.getRequestHandler__().flushAsyncBatchRequests(this, out sentCallback)) + { + sentSynchronously_ = true; + if(sentCallback != null) + { + sent__(sentCallback); + } + } + } + catch(Ice.LocalException __ex) + { + ((Ice.ObjectPrxHelperBase)_proxy).handleException__(@delegate, __ex, false, ref cnt); + } + } + public override Ice.ObjectPrx getProxy() { return _proxy; @@ -1292,9 +1379,12 @@ namespace Ice ice_exception(ex); } - public void sent__() + public void sent__(bool sentSynchronously) { - ((AMISentCallback)this).ice_sent(); + if(!sentSynchronously) + { + ((AMISentCallback)this).ice_sent(); + } } } } diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 8e1954507da..8cd286eb0a1 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -1986,7 +1986,7 @@ namespace Ice public AsyncResult begin_ice_flushBatchRequests(Ice.AsyncCallback cb__, object cookie__) { - IceInternal.BatchOutgoingAsync result__ = + IceInternal.ProxyBatchOutgoingAsync result__ = new IceInternal.ProxyBatchOutgoingAsync(this, __ice_flushBatchRequests_name, cookie__); if(cb__ != null) { @@ -1994,21 +1994,7 @@ namespace Ice } try { - // - // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch - // requests were queued with the connection, they would be lost without being noticed. - // - Ice.ObjectDel_ @delegate = null; - int cnt = -1; // Don't retry. - try - { - @delegate = getDelegate__(true); - @delegate.getRequestHandler__().flushAsyncBatchRequests(result__); - } - catch(Ice.LocalException ex) - { - handleException__(@delegate, ex, true, ref cnt); - } + result__.send__(); } catch(Ice.LocalException ex__) { diff --git a/cs/src/Ice/RequestHandler.cs b/cs/src/Ice/RequestHandler.cs index f2b89c246e7..92981df2f3f 100644 --- a/cs/src/Ice/RequestHandler.cs +++ b/cs/src/Ice/RequestHandler.cs @@ -18,11 +18,10 @@ namespace IceInternal void abortBatchRequest(); Ice.ConnectionI sendRequest(Outgoing @out); - - bool sendAsyncRequest(OutgoingAsync @out); + bool sendAsyncRequest(OutgoingAsync @out, out Ice.AsyncCallback cb); bool flushBatchRequests(BatchOutgoing @out); - bool flushAsyncBatchRequests(BatchOutgoingAsync @out); + bool flushAsyncBatchRequests(BatchOutgoingAsync @out, out Ice.AsyncCallback cb); Reference getReference(); diff --git a/cs/test/Ice/Makefile b/cs/test/Ice/Makefile index b107871678c..86878b4ef44 100644 --- a/cs/test/Ice/Makefile +++ b/cs/test/Ice/Makefile @@ -24,6 +24,7 @@ SUBDIRS = application \ binding \ proxy \ operations \ + ami \ slicing \ checksum \ stream \ diff --git a/cs/test/Ice/Makefile.mak b/cs/test/Ice/Makefile.mak index 6f7bc5006da..261671a6293 100644 --- a/cs/test/Ice/Makefile.mak +++ b/cs/test/Ice/Makefile.mak @@ -24,6 +24,7 @@ SUBDIRS = application \ binding \ proxy \ operations \ + ami \ slicing \ checksum \ stream \ diff --git a/cs/test/Ice/ami/.depend b/cs/test/Ice/ami/.depend new file mode 100644 index 00000000000..e452bf88cbb --- /dev/null +++ b/cs/test/Ice/ami/.depend @@ -0,0 +1 @@ +generated/Test.cs: ./Test.ice $(SLICE2CS) $(SLICEPARSERLIB) diff --git a/cs/test/Ice/ami/AllTests.cs b/cs/test/Ice/ami/AllTests.cs new file mode 100644 index 00000000000..b4c1c863bec --- /dev/null +++ b/cs/test/Ice/ami/AllTests.cs @@ -0,0 +1,968 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using Test; + +public class AllTests +{ + private static void test(bool b) + { + if(!b) + { + throw new System.Exception(); + } + } + + private class Cookie + { + public Cookie(int i) + { + val = i; + } + + public int val; + } + + private class CallbackBase + { + internal CallbackBase() + { + _called = false; + } + + public virtual void check() + { + lock(this) + { + while(!_called) + { + Monitor.Wait(this); + } + _called = false; + } + } + + public virtual void called() + { + lock(this) + { + Debug.Assert(!_called); + _called = true; + Monitor.Pulse(this); + } + } + + private bool _called; + } + + private class AsyncCallback : CallbackBase + { + public AsyncCallback() + { + } + + public AsyncCallback(Cookie cookie) + { + _cookie = cookie; + } + + public void + isA(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + test(result.getProxy().end_ice_isA(result)); + called(); + } + + public void + ping(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + result.getProxy().end_ice_ping(result); + called(); + } + + public void + id(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + test(result.getProxy().end_ice_id(result).Equals("::Test::TestIntf")); + called(); + } + + public void + ids(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + test(result.getProxy().end_ice_ids(result).Length == 2); + called(); + } + + public void + op(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result); + called(); + } + + public void + opWithResult(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + test(TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithResult(result) == 15); + called(); + } + + public void + opWithUE(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithUE(result); + test(false); + } + catch(TestIntfException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + public void + isAEx(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + result.getProxy().end_ice_isA(result); + test(false); + } + catch(Ice.NoEndpointException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + public void + pingEx(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + result.getProxy().end_ice_ping(result); + test(false); + } + catch(Ice.NoEndpointException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + public void + idEx(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + result.getProxy().end_ice_id(result); + test(false); + } + catch(Ice.NoEndpointException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + public void + idsEx(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + result.getProxy().end_ice_ids(result); + test(false); + } + catch(Ice.NoEndpointException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + public void + opEx(Ice.AsyncResult result) + { + test(result.getCookie() == _cookie); + try + { + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result); + test(false); + } + catch(Ice.NoEndpointException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + private Cookie _cookie; + }; + + private class ResponseCallback : CallbackBase + { + public ResponseCallback() + { + } + + public void + isA(bool r) + { + test(r); + called(); + } + + public void + ping() + { + called(); + } + + public void + id(string id) + { + test(id.Equals("::Test::TestIntf")); + called(); + } + + public void + ids(string[] ids) + { + test(ids.Length == 2); + called(); + } + + public void + op() + { + called(); + } + + public void + opWithResult(int r) + { + test(r == 15); + called(); + } + + public void + opWithUE(Ice.Exception e) + { + try + { + throw e; + } + catch(TestIntfException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + + }; + + private class ExceptionCallback : CallbackBase + { + public ExceptionCallback() + { + } + + public void + isA(bool r) + { + test(false); + } + + public void + ping() + { + test(false); + } + + public void + id(string id) + { + test(false); + } + + public void + ids(string[] ids) + { + test(false); + } + + public void + op() + { + test(false); + } + + public void + ex(Ice.Exception ex) + { + test(ex is Ice.NoEndpointException); + called(); + } + + public void + noEx(Ice.Exception ex) + { + test(false); + } + }; + + private class SentCallback : CallbackBase + { + public SentCallback() + { + _thread = Thread.CurrentThread; + } + + public void + isA(bool r) + { + } + + public void + ping() + { + } + + public void + id(string s) + { + } + + public void + ids(string[] s) + { + } + + public void + opAsync(Ice.AsyncResult r) + { + } + + public void + op() + { + } + + public void + ex(Ice.Exception ex) + { + } + + public void + sentAsync(Ice.AsyncResult r) + { + test(r.sentSynchronously() && _thread == Thread.CurrentThread || + !r.sentSynchronously() && _thread != Thread.CurrentThread); + called(); + } + + public void + sent(bool ss) + { + test(ss && _thread == Thread.CurrentThread || !ss && _thread != Thread.CurrentThread); + + called(); + } + + Thread _thread; + }; + + enum ThrowType { LocalException, UserException, OtherException }; + + private class Thrower : CallbackBase + { + public Thrower(ThrowType t) + { + _t = t; + } + + public void + opAsync(Ice.AsyncResult r) + { + called(); + throwEx(); + } + + public void + op() + { + called(); + throwEx(); + } + + public void + noOp() + { + } + + public void + ex(Ice.Exception ex) + { + called(); + throwEx(); + } + + public void + sent(bool ss) + { + called(); + throwEx(); + } + + private void + throwEx() + { + switch(_t) + { + case ThrowType.LocalException: + { + throw new Ice.ObjectNotExistException(); + } + case ThrowType.UserException: + { + throw new TestIntfException(); + } + case ThrowType.OtherException: + { + throw new Exception(); + } + default: + { + Debug.Assert(false); + break; + } + } + } + + ThrowType _t; + }; + + public static void allTests(Ice.Communicator communicator) + { + string sref = "test:default -p 12010"; + Ice.ObjectPrx obj = communicator.stringToProxy(sref); + test(obj != null); + + Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj); + + sref = "testController:tcp -p 12011"; + obj = communicator.stringToProxy(sref); + test(obj != null); + + Test.TestIntfControllerPrx testController = Test.TestIntfControllerPrxHelper.uncheckedCast(obj); + + Console.Out.Write("testing begin/end invocation... "); + Console.Out.Flush(); + { + Ice.AsyncResult result; + Dictionary ctx = new Dictionary(); + + result = p.begin_ice_isA("::Test::TestIntf"); + test(p.end_ice_isA(result)); + result = p.begin_ice_isA("::Test::TestIntf", ctx); + test(p.end_ice_isA(result)); + + result = p.begin_ice_ping(); + p.end_ice_ping(result); + result = p.begin_ice_ping(ctx); + p.end_ice_ping(result); + + result = p.begin_ice_id(); + test(p.end_ice_id(result).Equals("::Test::TestIntf")); + result = p.begin_ice_id(ctx); + test(p.end_ice_id(result).Equals("::Test::TestIntf")); + + result = p.begin_ice_ids(); + test(p.end_ice_ids(result).Length == 2); + result = p.begin_ice_ids(ctx); + test(p.end_ice_ids(result).Length == 2); + + result = p.begin_op(); + p.end_op(result); + result = p.begin_op(ctx); + p.end_op(result); + + result = p.begin_opWithResult(); + test(p.end_opWithResult(result) == 15); + result = p.begin_opWithResult(ctx); + test(p.end_opWithResult(result) == 15); + + result = p.begin_opWithUE(); + try + { + p.end_opWithUE(result); + test(false); + } + catch(Test.TestIntfException) + { + } + result = p.begin_opWithUE(ctx); + try + { + p.end_opWithUE(result); + test(false); + } + catch(Test.TestIntfException) + { + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing async callback... "); + Console.Out.Flush(); + { + AsyncCallback cb = new AsyncCallback(); + Dictionary ctx = new Dictionary(); + Cookie cookie = new Cookie(5); + AsyncCallback cbWC = new AsyncCallback(cookie); + + p.begin_ice_isA("::Test::TestIntf", cb.isA, null); + cb.check(); + p.begin_ice_isA("::Test::TestIntf", cbWC.isA, cookie); + cbWC.check(); + p.begin_ice_isA("::Test::TestIntf", ctx, cb.isA, null); + cb.check(); + p.begin_ice_isA("::Test::TestIntf", ctx, cbWC.isA, cookie); + cbWC.check(); + + p.begin_ice_ping(cb.ping, null); + cb.check(); + p.begin_ice_ping(cbWC.ping, cookie); + cbWC.check(); + p.begin_ice_ping(ctx, cb.ping, null); + cb.check(); + p.begin_ice_ping(ctx, cbWC.ping, cookie); + cbWC.check(); + + p.begin_ice_id(cb.id, null); + cb.check(); + p.begin_ice_id(cbWC.id, cookie); + cbWC.check(); + p.begin_ice_id(ctx, cb.id, null); + cb.check(); + p.begin_ice_id(ctx, cbWC.id, cookie); + cbWC.check(); + + p.begin_ice_ids(cb.ids, null); + cb.check(); + p.begin_ice_ids(cbWC.ids, cookie); + cbWC.check(); + p.begin_ice_ids(ctx, cb.ids, null); + cb.check(); + p.begin_ice_ids(ctx, cbWC.ids, cookie); + cbWC.check(); + + p.begin_op(cb.op, null); + cb.check(); + p.begin_op(cbWC.op, cookie); + cbWC.check(); + p.begin_op(ctx, cb.op, null); + cb.check(); + p.begin_op(ctx, cbWC.op, cookie); + cbWC.check(); + + p.begin_opWithResult(cb.opWithResult, null); + cb.check(); + p.begin_opWithResult(cbWC.opWithResult, cookie); + cbWC.check(); + p.begin_opWithResult(ctx, cb.opWithResult, null); + cb.check(); + p.begin_opWithResult(ctx, cbWC.opWithResult, cookie); + cbWC.check(); + + p.begin_opWithUE(cb.opWithUE, null); + cb.check(); + p.begin_opWithUE(cbWC.opWithUE, cookie); + cbWC.check(); + p.begin_opWithUE(ctx, cb.opWithUE, null); + cb.check(); + p.begin_opWithUE(ctx, cbWC.opWithUE, cookie); + cbWC.check(); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing response callback... "); + Console.Out.Flush(); + { + ResponseCallback cb = new ResponseCallback(); + Dictionary ctx = new Dictionary(); + + p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA); + cb.check(); + p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted(cb.isA); + cb.check(); + + p.begin_ice_ping().whenCompleted(cb.ping); + cb.check(); + p.begin_ice_ping(ctx).whenCompleted(cb.ping); + cb.check(); + + p.begin_ice_id().whenCompleted(cb.id); + cb.check(); + p.begin_ice_id(ctx).whenCompleted(cb.id); + cb.check(); + + p.begin_ice_ids().whenCompleted(cb.ids); + cb.check(); + p.begin_ice_ids(ctx).whenCompleted(cb.ids); + cb.check(); + + p.begin_op().whenCompleted(cb.op); + cb.check(); + p.begin_op(ctx).whenCompleted(cb.op); + cb.check(); + + p.begin_opWithResult().whenCompleted(cb.opWithResult); + cb.check(); + p.begin_opWithResult(ctx).whenCompleted(cb.opWithResult); + cb.check(); + + p.begin_opWithUE().whenCompleted(cb.op, cb.opWithUE); + cb.check(); + p.begin_opWithUE(ctx).whenCompleted(cb.op, cb.opWithUE); + cb.check(); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing local exceptions... "); + Console.Out.Flush(); + { + Test.TestIntfPrx indirect = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + Ice.AsyncResult r; + + r = indirect.begin_op(); + try + { + indirect.end_op(r); + test(false); + } + catch(Ice.NoEndpointException) + { + } + + + r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult(); + try + { + Test.TestIntfPrxHelper.uncheckedCast(r.getProxy()).end_opWithResult(r); + test(false); + } + catch(Ice.TwowayOnlyException) + { + } + + // + // Check that CommunicatorDestroyedException is raised directly. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().ice_clone_(); + Ice.Communicator ic = Ice.Util.initialize(initData); + Ice.ObjectPrx o = ic.stringToProxy(p.ToString()); + Test.TestIntfPrx p2 = Test.TestIntfPrxHelper.checkedCast(o); + ic.destroy(); + + try + { + p2.begin_op(); + test(false); + } + catch(Ice.CommunicatorDestroyedException) + { + // Expected. + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing local exceptions with async callback... "); + Console.Out.Flush(); + { + Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + AsyncCallback cb = new AsyncCallback(); + Cookie cookie = new Cookie(5); + AsyncCallback cbWC = new AsyncCallback(cookie); + + i.begin_ice_isA("::Test::TestIntf", cb.isAEx, null); + cb.check(); + i.begin_ice_isA("::Test::TestIntf", cbWC.isAEx, cookie); + cbWC.check(); + + i.begin_ice_ping(cb.pingEx, null); + cb.check(); + i.begin_ice_ping(cbWC.pingEx, cookie); + cbWC.check(); + + i.begin_ice_id(cb.idEx, null); + cb.check(); + i.begin_ice_id(cbWC.idEx, cookie); + cbWC.check(); + + i.begin_ice_ids(cb.idsEx, null); + cb.check(); + i.begin_ice_ids(cbWC.idsEx, cookie); + cbWC.check(); + + i.begin_op(cb.opEx, null); + cb.check(); + i.begin_op(cbWC.opEx, cookie); + cbWC.check(); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing local exceptions with response callback... "); + Console.Out.Flush(); + { + Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + ExceptionCallback cb = new ExceptionCallback(); + + i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, cb.ex); + cb.check(); + + i.begin_ice_ping().whenCompleted(cb.ping, cb.ex); + cb.check(); + + i.begin_ice_id().whenCompleted(cb.id, cb.ex); + cb.check(); + + i.begin_ice_ids().whenCompleted(cb.ids, cb.ex); + cb.check(); + + i.begin_op().whenCompleted(cb.op, cb.ex); + cb.check(); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing exception callback... "); + Console.Out.Flush(); + { + Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + ExceptionCallback cb = new ExceptionCallback(); + + i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.ex); + cb.check(); + + i.begin_op().whenCompleted(cb.ex); + cb.check(); + + i.begin_opWithResult().whenCompleted(cb.ex); + cb.check(); + + i.begin_opWithUE().whenCompleted(cb.ex); + cb.check(); + + // Ensures no exception is called when response is received + p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.noEx); + p.begin_op().whenCompleted(cb.noEx); + p.begin_opWithResult().whenCompleted(cb.noEx); + p.begin_opWithUE().whenCompleted(cb.noEx); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing sent callback... "); + Console.Out.Flush(); + { + SentCallback cb = new SentCallback(); + + p.begin_ice_isA("").whenCompleted(cb.isA, cb.ex).whenSent(cb.sent); + cb.check(); + + p.begin_ice_ping().whenCompleted(cb.ping, cb.ex).whenSent(cb.sent); + cb.check(); + + p.begin_ice_id().whenCompleted(cb.id, cb.ex).whenSent(cb.sent); + cb.check(); + + p.begin_ice_ids().whenCompleted(cb.ids, cb.ex).whenSent(cb.sent); + cb.check(); + + p.begin_op().whenCompleted(cb.op, cb.ex).whenSent(cb.sent); + cb.check(); + + p.begin_op(cb.opAsync, null).whenSent(cb.sentAsync); + cb.check(); + + p.begin_op().whenCompleted(cb.ex).whenSent(cb.sent); + cb.check(); + + List cbs = new List(); + byte[] seq = new byte[10024]; + (new System.Random()).NextBytes(seq); + testController.holdAdapter(); + Ice.AsyncResult r; + do + { + SentCallback cb2 = new SentCallback(); + r = p.begin_opWithPayload(seq).whenCompleted(cb2.ex).whenSent(cb2.sent); + cbs.Add(cb2); + } + while(r.sentSynchronously()); + testController.resumeAdapter(); + foreach(SentCallback cb3 in cbs) + { + cb3.check(); + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing illegal arguments... "); + Console.Out.Flush(); + { + Ice.AsyncResult result; + + result = p.begin_op(); + p.end_op(result); + try + { + p.end_op(result); + test(false); + } + catch(System.ArgumentException) + { + } + + result = p.begin_op(); + try + { + p.end_opWithResult(result); + test(false); + } + catch(System.ArgumentException) + { + } + + try + { + p.end_op(null); + test(false); + } + catch(System.ArgumentException) + { + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing unexpected exceptions from callback... "); + Console.Out.Flush(); + { + Test.TestIntfPrx q = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + ThrowType[] throwEx = new ThrowType[]{ ThrowType.LocalException, ThrowType.UserException, + ThrowType.OtherException }; + + for(int i = 0; i < 3; ++i) + { + Thrower cb = new Thrower(throwEx[i]); + + p.begin_op(cb.opAsync, null); + cb.check(); + + p.begin_op().whenCompleted(cb.op); + cb.check(); + + q.begin_op().whenCompleted(cb.op, cb.ex); + cb.check(); + + p.begin_op().whenCompleted(cb.noOp, cb.ex).whenSent(cb.sent); + cb.check(); + + q.begin_op().whenCompleted(cb.ex); + cb.check(); + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing AsyncResult operations... "); + Console.Out.Flush(); + { + testController.holdAdapter(); + + Ice.AsyncResult r1 = p.begin_op(); + byte[] seq = new byte[10024]; + (new System.Random()).NextBytes(seq); + Ice.AsyncResult r2; + while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); + + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted_() || + !r1.sentSynchronously() && !r1.isCompleted_()); + + test(!r2.sentSynchronously() && !r2.isCompleted_()); + + test(!r1.IsCompleted && !r1.CompletedSynchronously); + test(!r2.IsCompleted && !r2.CompletedSynchronously); + + WaitHandle w1 = r1.AsyncWaitHandle; + WaitHandle w2 = r2.AsyncWaitHandle; + + testController.resumeAdapter(); + + r1.waitForSent(); + test(r1.isSent()); + + r2.waitForSent(); + test(r2.isSent()); + + r1.waitForCompleted(); + test(r1.isCompleted_()); + w1.WaitOne(); + + r2.waitForCompleted(); + test(r2.isCompleted_()); + w2.WaitOne(); + + test(r1.getOperation().Equals("op")); + test(r2.getOperation().Equals("opWithPayload")); + } + Console.Out.WriteLine("ok"); + + p.shutdown(); + } +} diff --git a/cs/test/Ice/ami/Client.cs b/cs/test/Ice/ami/Client.cs new file mode 100644 index 00000000000..a4ace08e357 --- /dev/null +++ b/cs/test/Ice/ami/Client.cs @@ -0,0 +1,67 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +using System; +using System.Diagnostics; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Client +{ + private static int run(string[] args, Ice.Communicator communicator) + { + AllTests.allTests(communicator); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + Debug.Listeners.Add(new ConsoleTraceListener()); + + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + communicator = Ice.Util.initialize(ref args, initData); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + } + + if(status != 0) + { + System.Environment.Exit(status); + } + } +} diff --git a/cs/test/Ice/ami/Makefile b/cs/test/Ice/ami/Makefile new file mode 100644 index 00000000000..927fc371bdc --- /dev/null +++ b/cs/test/Ice/ami/Makefile @@ -0,0 +1,35 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 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 = ../../.. + +TARGETS = client.exe server.exe + +C_SRCS = AllTests.cs Client.cs +S_SRCS = Server.cs TestI.cs + +SLICE_SRCS = $(SDIR)/Test.ice + +SDIR = . + +GDIR = generated + +include $(top_srcdir)/config/Make.rules.cs + +MCSFLAGS := $(MCSFLAGS) -target:exe + +SLICE2CSFLAGS := $(SLICE2CSFLAGS) -I. -I$(slicedir) + +client.exe: $(C_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +server.exe: $(S_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +include .depend diff --git a/cs/test/Ice/ami/Makefile.mak b/cs/test/Ice/ami/Makefile.mak new file mode 100644 index 00000000000..07b97f13729 --- /dev/null +++ b/cs/test/Ice/ami/Makefile.mak @@ -0,0 +1,35 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 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 = ..\..\.. + +TARGETS = client.exe server.exe + +C_SRCS = AllTests.cs Client.cs +S_SRCS = Server.cs TestI.cs + +GEN_SRCS = $(GDIR)\Test.cs + +SDIR = . + +GDIR = generated + +!include $(top_srcdir)\config\Make.rules.mak.cs + +MCSFLAGS = $(MCSFLAGS) -target:exe + +SLICE2CSFLAGS = $(SLICE2CSFLAGS) -I. -I$(slicedir) + +client.exe: $(C_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(C_SRCS) $(GEN_SRCS) + +server.exe: $(S_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(S_SRCS) $(GEN_SRCS) + +!include .depend diff --git a/cs/test/Ice/ami/Server.cs b/cs/test/Ice/ami/Server.cs new file mode 100644 index 00000000000..e2774e636b1 --- /dev/null +++ b/cs/test/Ice/ami/Server.cs @@ -0,0 +1,79 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +using System; +using System.Diagnostics; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + + adapter.add(new TestI(), communicator.stringToIdentity("test")); + adapter.activate(); + adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController")); + adapter2.activate(); + + communicator.waitForShutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + Debug.Listeners.Add(new ConsoleTraceListener()); + + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "30"); + communicator = Ice.Util.initialize(ref args, initData); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + } + + if(status != 0) + { + System.Environment.Exit(status); + } + } +} diff --git a/cs/test/Ice/ami/Test.ice b/cs/test/Ice/ami/Test.ice new file mode 100644 index 00000000000..ac5074873f4 --- /dev/null +++ b/cs/test/Ice/ami/Test.ice @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 + +#include + +module Test +{ + +exception TestIntfException +{ +}; + +["ami"] interface TestIntf +{ + void op(); + void opWithPayload(Ice::ByteSeq seq); + int opWithResult(); + void opWithUE() + throws TestIntfException; + void shutdown(); +}; + +interface TestIntfController +{ + void holdAdapter(); + void resumeAdapter(); +}; + +}; + +#endif diff --git a/cs/test/Ice/ami/TestI.cs b/cs/test/Ice/ami/TestI.cs new file mode 100644 index 00000000000..7d5fecdd9ce --- /dev/null +++ b/cs/test/Ice/ami/TestI.cs @@ -0,0 +1,68 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +using Test; + +public class TestI : TestIntfDisp_ +{ + public TestI() + { + } + + override public void + op(Ice.Current current) + { + } + + override public int + opWithResult(Ice.Current current) + { + return 15; + } + + override public void + opWithUE(Ice.Current current) + { + throw new TestIntfException(); + } + + override public void + opWithPayload(byte[] seq, Ice.Current current) + { + } + + override public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } +} + +public class TestControllerI : TestIntfControllerDisp_ +{ + override public void + holdAdapter(Ice.Current current) + { + _adapter.hold(); + } + + override public void + resumeAdapter(Ice.Current current) + { + _adapter.activate(); + } + + public + TestControllerI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + private Ice.ObjectAdapter _adapter; +}; \ No newline at end of file diff --git a/cs/test/Ice/ami/client.exe.config b/cs/test/Ice/ami/client.exe.config new file mode 100755 index 00000000000..cf795ac3756 --- /dev/null +++ b/cs/test/Ice/ami/client.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/cs/test/Ice/ami/generated/.gitignore b/cs/test/Ice/ami/generated/.gitignore new file mode 100644 index 00000000000..39af5887579 --- /dev/null +++ b/cs/test/Ice/ami/generated/.gitignore @@ -0,0 +1 @@ +# Dummy file, so that git retains this otherwise empty directory. diff --git a/cs/test/Ice/ami/run.py b/cs/test/Ice/ami/run.py new file mode 100755 index 00000000000..13b35ca9507 --- /dev/null +++ b/cs/test/Ice/ami/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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, getopt + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * + +TestUtil.clientServerTest() + diff --git a/cs/test/Ice/ami/server.exe.config b/cs/test/Ice/ami/server.exe.config new file mode 100755 index 00000000000..cf795ac3756 --- /dev/null +++ b/cs/test/Ice/ami/server.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/cs/test/Ice/background/AllTests.cs b/cs/test/Ice/background/AllTests.cs index 87eff98b844..12dff01afc9 100644 --- a/cs/test/Ice/background/AllTests.cs +++ b/cs/test/Ice/background/AllTests.cs @@ -86,7 +86,7 @@ public class AllTests test(false); } - public void sent() + public void sent(bool ss) { _sent.called(); } diff --git a/cs/test/Ice/operations/Makefile b/cs/test/Ice/operations/Makefile index b390820b67f..c753ad4c080 100644 --- a/cs/test/Ice/operations/Makefile +++ b/cs/test/Ice/operations/Makefile @@ -13,14 +13,14 @@ TARGETS = client.exe server.exe collocated.exe serveramd.exe C_SRCS = AllTests.cs Client.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs BatchOneways.cs \ Oneways.cs OnewaysAMI.cs OnewaysNewAMI.cs -S_SRCS = MyDerivedClassI.cs Server.cs StateChangerI.cs +S_SRCS = MyDerivedClassI.cs Server.cs COL_SRCS = AllTests.cs Collocated.cs MyDerivedClassI.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs \ BatchOneways.cs Oneways.cs \ OnewaysAMI.cs OnewaysNewAMI.cs -SAMD_SRCS = MyDerivedClassAMDI.cs Server.cs StateChangerI.cs +SAMD_SRCS = MyDerivedClassAMDI.cs Server.cs -SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/StateChanger.ice -SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice $(SDIR)/StateChanger.ice +SLICE_SRCS = $(SDIR)/Test.ice +SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice SDIR = . diff --git a/cs/test/Ice/operations/Makefile.mak b/cs/test/Ice/operations/Makefile.mak index fa4c76269d2..50ba8ec373a 100644 --- a/cs/test/Ice/operations/Makefile.mak +++ b/cs/test/Ice/operations/Makefile.mak @@ -13,13 +13,13 @@ TARGETS = client.exe server.exe collocated.exe serveramd.exe C_SRCS = AllTests.cs Client.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs BatchOneways.cs Oneways.cs \ OnewaysAMI.cs OnewaysNewAMI.cs -S_SRCS = MyDerivedClassI.cs Server.cs StateChangerI.cs +S_SRCS = MyDerivedClassI.cs Server.cs COL_SRCS = AllTests.cs Collocated.cs MyDerivedClassI.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs \ BatchOneways.cs Oneways.cs OnewaysAMI.cs OnewaysNewAMI.cs -SAMD_SRCS = MyDerivedClassAMDI.cs Server.cs StateChangerI.cs +SAMD_SRCS = MyDerivedClassAMDI.cs Server.cs -GEN_SRCS = $(GDIR)\Test.cs $(GDIR)\StateChanger.cs -GEN_AMD_SRCS = $(GDIR)\TestAMD.cs $(GDIR)\StateChanger.cs +GEN_SRCS = $(GDIR)\Test.cs +GEN_AMD_SRCS = $(GDIR)\TestAMD.cs SDIR = . diff --git a/cs/test/Ice/operations/OnewaysNewAMI.cs b/cs/test/Ice/operations/OnewaysNewAMI.cs index 8083191627f..b2adbb0dd7a 100644 --- a/cs/test/Ice/operations/OnewaysNewAMI.cs +++ b/cs/test/Ice/operations/OnewaysNewAMI.cs @@ -54,165 +54,38 @@ public class OnewaysNewAMI private bool _called; } - private class NoEndpointCallback : CallbackBase - { - public void @unsafe(Ice.AsyncResult r) - { - try - { - Test.MyClassPrx p = (Test.MyClassPrx)r.getProxy(); - p.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException) - { - called(); - } - } - - public void success() - { - test(false); - } - - public void exCB(Ice.Exception ex) - { - test(ex is Ice.NoEndpointException); - called(); - } - - public void sentCB() - { - test(false); - } - } - - private class Cookie - { - public Cookie(int i) - { - val = i; - } - - public int val; - } - private class Callback : CallbackBase { public Callback() { } - public void opVoid() - { - called(); - } - - public void opDoubleMarshaling() - { - called(); - } - - public void opDerived() + public void + sent(bool sentSynchronously) { called(); } - public void exCB(Ice.Exception ex) + public void noException(Ice.Exception ex) { test(false); } - - public void exCBCookie(Ice.AsyncResult result) - { - Cookie cookie = (Cookie)result.AsyncState; - test(cookie.val == 99); - called(); - } - } - - private enum ThrowType { LocalException, UserException, OtherException}; - - private class Thrower : CallbackBase - { - public Thrower(ThrowType t) - { - t_ = t; - } - - public void exCB(Ice.Exception ex) + + public void twowayOnlyException(Ice.Exception ex) { - called(); - throwEx(); - } - - private void throwEx() - { - switch(t_) - { - case ThrowType.LocalException: - { - throw new Ice.ObjectNotExistException(); - } - case ThrowType.UserException: - { - throw new Test.SomeException(); - } - case ThrowType.OtherException: - { - throw new System.ArgumentException(); - } - default: - { - Debug.Assert(false); - break; - } - } - } - - private ThrowType t_; - } - - private class SentCounter - { - public SentCounter() - { - _queuedCount = 0; - } - - public void exCB(Ice.Exception e) - { - test(false); - } - - public void sentCB() - { - lock(this) + try { - ++_queuedCount; + throw ex; } - } - - public int queuedCount() - { - lock(this) + catch(Ice.TwowayOnlyException) { - return _queuedCount; + called(); } - } - - public void check(int size) - { - lock(this) + catch(Ice.Exception) { - while(_queuedCount != size) - { - Monitor.Wait(this); - } + test(false); } } - - private int _queuedCount; } internal static void onewaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx proxy) @@ -220,170 +93,34 @@ public class OnewaysNewAMI Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(proxy.ice_oneway()); { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - Ice.AsyncResult r; - - r = indirect.begin_opVoid(); - try - { - indirect.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException) - { - } - - // - // Check that a second call to the end_ method throws ArgumentException. - // - try - { - indirect.end_opVoid(r); - test(false); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Check that a call to a void operation raises NoEndpointException in the callback. - // Also test that the sent callback is not called in this case. - // - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - - NoEndpointCallback cb = new NoEndpointCallback(); - indirect.begin_opVoid().whenCompleted(cb.exCB).whenSent(cb.sentCB); + Callback cb = new Callback(); + p.begin_ice_ping().whenCompleted(cb.noException).whenSent(cb.sent); cb.check(); } { - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws ArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - Test.MyClassPrx indirect1 = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - Test.MyClassPrx indirect2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy2").ice_oneway()); - - Ice.AsyncResult r1 = indirect1.begin_opVoid(); - Ice.AsyncResult r2 = indirect2.begin_opVoid(); - - try - { - indirect1.end_opVoid(r2); // Wrong proxy - test(false); - } - catch(System.ArgumentException) - { - } - - try - { - indirect1.end_shutdown(r1); // Wrong operation - test(false); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws ArgumentException. - // - try - { - p.end_opVoid(null); - test(false); - } - catch(System.ArgumentException) - { - } + Callback cb = new Callback(); + p.begin_ice_isA("::Test::MyClass").whenCompleted(cb.twowayOnlyException); + cb.check(); } - + { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - - { - Thrower cb = new Thrower(ThrowType.LocalException); - indirect.begin_opVoid().whenCompleted(cb.exCB); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.UserException); - indirect.begin_opVoid().whenCompleted(cb.exCB); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.OtherException); - indirect.begin_opVoid().whenCompleted(cb.exCB); - cb.check(); - } + Callback cb = new Callback(); + p.begin_ice_id().whenCompleted(cb.twowayOnlyException); + cb.check(); } - + { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - Ice.Communicator ic = Ice.Util.initialize(initData); - Ice.ObjectPrx obj = ic.stringToProxy(p.ToString()).ice_oneway(); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(obj); - - ic.destroy(); - - try - { - p2.begin_opVoid(); - test(false); - } - catch(Ice.CommunicatorDestroyedException) - { - // Expected. - } + Callback cb = new Callback(); + p.begin_ice_ids().whenCompleted(cb.twowayOnlyException); + cb.check(); } { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice.AsyncResult r = p.begin_ice_ping(); - try - { - p.end_ice_ping(r); - } - catch(Exception) - { - test(false); - } - } - { Callback cb = new Callback(); - p.begin_ice_ping().whenCompleted(cb.exCB); - } - } - - // - // Test that marshaling works as expected, and that the delegates for each type of callback work. - // - { - { - Ice.AsyncResult r = p.begin_opVoid(); - p.end_opVoid(r); + p.begin_opVoid().whenCompleted(cb.noException).whenSent(cb.sent); + cb.check(); } } @@ -391,134 +128,9 @@ public class OnewaysNewAMI // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. // { - Ice.AsyncResult r = p.begin_opByte(0xff, 0x0f); - try - { - byte p3; - p.end_opByte(out p3, r); - test(false); - } - catch(Ice.TwowayOnlyException) - { - } - } - - { - double d = 1278312346.0 / 13.0; - double[] tdsi = new double[] { 5, d }; - Test.DoubleS ds = new Test.DoubleS(tdsi); Callback cb = new Callback(); - p.begin_opDoubleMarshaling(d, ds).whenCompleted(cb.exCB); - } - - { - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.uncheckedCast(p); - test(derived != null); - Callback cb = new Callback(); - derived.begin_opDerived().whenCompleted(cb.exCB); - } - - // - // Test that cookies work. - // - { - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - indirect.begin_opVoid(cb.exCBCookie, cookie); + p.begin_opByte((byte)0xff, (byte)0x0f).whenCompleted(cb.twowayOnlyException); cb.check(); } - - // - // Test that queuing indication works. - // - { - Ice.AsyncResult r = p.begin_delay(100); - r.waitForSent(); - test(r.IsCompleted && r.isSent()); - p.end_delay(r); - test(r.IsCompleted); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - const int contextSize = 10; // Kilobytes - string s = new string('a', 1024); - - Dictionary ctx = new Dictionary(); - for(int i = 0; i < contextSize; ++i) - { - string label = "i" + i; - ctx[label] = s; - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // -// List results = new List(); - -// int queuedCount = 0; - -// SentCounter cb = new SentCounter(); -// Ice.AsyncResult r; - -// Test.StateChangerPrx state = Test.StateChangerPrxHelper.checkedCast( -// communicator.stringToProxy("hold:default -p 12011")); -// state.hold(3); - -// do -// { -// r = p.begin_opVoid(ctx).whenCompleted(cb.exCB).whenSent(cb.sentCB); -// results.Add(r); -// if(!r.SentSynchronously) -// { -// ++queuedCount; -// } -// } -// while(r.SentSynchronously); - -// int numRequests = results.Count; -// test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - -// // -// // Re-enable the adapter. -// // -// state.activate(3); - -// // -// // Fire off a bunch more requests until we get one that wasn't queued. -// // We sleep in between calls to allow the queued requests to drain. -// // -// do -// { -// r = p.begin_opVoid().whenCompleted(cb.exCB).whenSent(cb.sentCB); -// results.Add(r); -// if(!r.SentSynchronously) -// { -// ++queuedCount; -// } -// Thread.Sleep(1); -// } -// while(!r.SentSynchronously); -// test(results.Count > numRequests); // Something is wrong if we didn't queue additional requests. - -// // -// // Now make all the outstanding calls to the end_ method. -// // -// foreach(Ice.AsyncResult ar in results) -// { -// p.end_opVoid(ar); -// } - -// // -// // Check that we got a sent callback for each queued request. -// // -// cb.check(queuedCount); - } } } diff --git a/cs/test/Ice/operations/Server.cs b/cs/test/Ice/operations/Server.cs index 5743a38b394..ab425c24a27 100644 --- a/cs/test/Ice/operations/Server.cs +++ b/cs/test/Ice/operations/Server.cs @@ -31,11 +31,6 @@ public class Server adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); adapter.activate(); - communicator.getProperties().setProperty("HoldAdapter.Endpoints", "default -p 12011:udp"); - Ice.ObjectAdapter holdAdapter = communicator.createObjectAdapter("HoldAdapter"); - holdAdapter.add(new StateChangerI(adapter), communicator.stringToIdentity("hold")); - holdAdapter.activate(); - communicator.waitForShutdown(); return 0; } diff --git a/cs/test/Ice/operations/StateChanger.ice b/cs/test/Ice/operations/StateChanger.ice deleted file mode 100644 index 7160980ea23..00000000000 --- a/cs/test/Ice/operations/StateChanger.ice +++ /dev/null @@ -1,24 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 STATECHANGER_ICE -#define STATECHANGER_ICE - -module Test -{ - -interface StateChanger -{ - void hold(int milliSeconds); - void activate(int milliSeconds); -}; - -}; - -#endif diff --git a/cs/test/Ice/operations/StateChangerI.cs b/cs/test/Ice/operations/StateChangerI.cs deleted file mode 100644 index 7cecf3ece5b..00000000000 --- a/cs/test/Ice/operations/StateChangerI.cs +++ /dev/null @@ -1,62 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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. -// -// ********************************************************************** - -using System; -using System.Timers; - -public class StateChangerI : Test.StateChangerDisp_ -{ - public StateChangerI(Ice.ObjectAdapter adapter) - { - _otherAdapter = adapter; - } - - public override void hold(int milliSeconds, Ice.Current current) - { - if(milliSeconds <= 0) - { - _otherAdapter.hold(); - _otherAdapter.waitForHold(); - } - else - { - Timer timer = new Timer(); - timer.AutoReset = false; - timer.Enabled = true; - timer.Interval = milliSeconds; - timer.Elapsed += new ElapsedEventHandler( - delegate(object source, ElapsedEventArgs e) - { - _otherAdapter.hold(); - }); - } - } - - public override void activate(int milliSeconds, Ice.Current current) - { - if(milliSeconds <= 0) - { - _otherAdapter.activate(); - } - else - { - Timer timer = new Timer(); - timer.AutoReset = false; - timer.Enabled = true; - timer.Interval = milliSeconds; - timer.Elapsed += new ElapsedEventHandler( - delegate(object source, ElapsedEventArgs e) - { - _otherAdapter.activate(); - }); - } - } - - private Ice.ObjectAdapter _otherAdapter; -} diff --git a/cs/test/Ice/operations/TwowaysNewAMI.cs b/cs/test/Ice/operations/TwowaysNewAMI.cs index 33d246006d6..f039d37f5ed 100644 --- a/cs/test/Ice/operations/TwowaysNewAMI.cs +++ b/cs/test/Ice/operations/TwowaysNewAMI.cs @@ -22,16 +22,6 @@ public class TwowaysNewAMI } } - private class Cookie - { - public Cookie(int i) - { - val = i; - } - - public int val; - } - private class CallbackBase { internal CallbackBase() @@ -64,53 +54,6 @@ public class TwowaysNewAMI private bool _called; } - private class NoEndpointCallback : CallbackBase - { - public void completed(Ice.AsyncResult r) - { - try - { - Test.MyClassPrx p = (Test.MyClassPrx)r.getProxy(); - p.end_opVoid(r); - called(); - } - catch(Ice.NoEndpointException) - { - test(false); - } - } - - public void completedEx(Ice.AsyncResult r) - { - try - { - Test.MyClassPrx p = (Test.MyClassPrx)r.getProxy(); - p.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException) - { - called(); - } - } - - public void success() - { - test(false); - } - - public void exCB(Ice.Exception ex) - { - test(ex is Ice.NoEndpointException); - called(); - } - - public void sentCB() - { - test(false); - } - } - private class Callback : CallbackBase { public Callback() @@ -132,28 +75,6 @@ public class TwowaysNewAMI _d = d; } - public Callback(string[] ids) - { - _ids = ids; - } - - public Callback(string id) - { - _id = id; - } - - public void opVoid(Ice.AsyncResult result) - { - Cookie cookie = result.AsyncState as Cookie; - if(cookie != null) - { - test(cookie.val == 99); - } - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - p.end_opVoid(result); - called(); - } - public void opVoid() { called(); @@ -164,102 +85,20 @@ public class TwowaysNewAMI called(); } - public void opByte(Ice.AsyncResult result) - { - test(((Cookie)result.AsyncState).val == 78); - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - byte b; - byte r = p.end_opByte(out b, result); - test(b == 0xf0); - test(r == 0xff); - called(); - } - - public void opByteCookie(byte r, byte b) + public void opByte(byte r, byte b) { test(b == 0xf0); test(r == 0xff); called(); } - public void opBoolCookie(bool r, bool b) + public void opBool(bool r, bool b) { test(b); test(!r); called(); } - public void ice_isA(Ice.AsyncResult result) - { - Cookie cookie = (Cookie)result.AsyncState; - if(cookie != null) - { - test(cookie.val == 99); - } - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - test(p.end_ice_isA(result)); - called(); - } - - public void ice_isA(bool r) - { - test(r); - called(); - } - - public void ice_ping(Ice.AsyncResult result) - { - Cookie cookie = (Cookie)result.AsyncState; - if(cookie != null) - { - test(cookie.val == 99); - } - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - p.end_ice_ping(result); - called(); - } - - public void ice_ping() - { - called(); - } - - public void ice_ids(Ice.AsyncResult result) - { - Cookie cookie = (Cookie)result.AsyncState; - if(cookie != null) - { - test(cookie.val == 99); - } - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - test(Ice.CollectionComparer.Equals(p.end_ice_ids(result), p.ice_ids())); - called(); - } - - public void ice_ids(string[] ids) - { - test(Ice.CollectionComparer.Equals(ids, _ids)); - called(); - } - - public void ice_id(Ice.AsyncResult result) - { - Cookie cookie = (Cookie)result.AsyncState; - if(cookie != null) - { - test(cookie.val == 99); - } - Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(result.getProxy()); - test(p.end_ice_id(result).Equals(p.ice_id())); - called(); - } - - public void ice_id(string id) - { - test(id.Equals(_id)); - called(); - } - public void opShortIntLong(long r, short s, int i, long l) { test(s == 10); @@ -666,366 +505,10 @@ public class TwowaysNewAMI private Ice.Communicator _communicator; private int _l; private Dictionary _d; - private string[] _ids; - private string _id; - } - - private enum ThrowType { LocalException, UserException, OtherException}; - - private class Thrower : CallbackBase - { - public Thrower(ThrowType t) - { - t_ = t; - } - - public void opVoid() - { - // No call to called() here! - } - - public void opVoidThrowUnsafe(Ice.AsyncResult r) - { - called(); - throwEx(); - } - - public void opVoidThrowSafe() - { - called(); - throwEx(); - } - - public void opVoidThrow() - { - // No call to called() here! - throwEx(); - } - - public void exCB(Ice.Exception ex) - { - test(false); - } - - public void exCBThrow(Ice.Exception ex) - { - called(); - throwEx(); - } - - private void throwEx() - { - switch(t_) - { - case ThrowType.LocalException: - { - throw new Ice.ObjectNotExistException(); - } - case ThrowType.UserException: - { - throw new Test.SomeException(); - } - case ThrowType.OtherException: - { - throw new System.ArgumentException(); - } - default: - { - Debug.Assert(false); - break; - } - } - } - - private ThrowType t_; - } - - private class SentCounter - { - public SentCounter() - { - _queuedCount = 0; - _completedCount = 0; - } - - public void opVoid(Ice.AsyncResult r) - { - test(r.IsCompleted); - lock(this) - { - ++_completedCount; - Monitor.Pulse(this); - } - } - - public void sentCB(Ice.AsyncResult r) - { - lock(this) - { - ++_queuedCount; - } - } - - public int queuedCount() - { - lock(this) - { - return _queuedCount; - } - } - - public void check(int size) - { - lock(this) - { - while(_completedCount != size) - { - Monitor.Wait(this); - } - } - } - - int _queuedCount; - int _completedCount; } internal static void twowaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx p) { - { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - Ice.AsyncResult r; - - r = indirect.begin_opVoid(); - try - { - indirect.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException) - { - } - - // - // Check that a second call to the end_ method throws ArgumentException. - // - try - { - indirect.end_opVoid(r); - test(false); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Use type-unsafe and type-safe variations of the callback, and - // variations of the delegate (with and without success callback). - // Also test that the sent callback is not called in this case. - // - NoEndpointCallback cb1 = new NoEndpointCallback(); - NoEndpointCallback cb2 = new NoEndpointCallback(); - NoEndpointCallback cb3 = new NoEndpointCallback(); - - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - - indirect.begin_opVoid(cb1.completedEx, null).whenSent(cb1.sentCB); - indirect.begin_opVoid().whenCompleted(cb2.success, cb2.exCB).whenSent(cb2.sentCB); - indirect.begin_opVoid().whenCompleted(cb3.exCB).whenSent(cb3.sentCB); - - cb1.check(); - cb2.check(); - cb3.check(); - } - - { - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws ArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - Test.MyClassPrx indirect1 = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - Test.MyClassPrx indirect2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy2")); - - Ice.AsyncResult r1 = indirect1.begin_opVoid(); - Ice.AsyncResult r2 = indirect2.begin_opVoid(); - - try - { - indirect1.end_opVoid(r2); // Wrong proxy - test(false); - } - catch(System.ArgumentException) - { - } - - try - { - indirect1.end_shutdown(r1); // Wrong operation - test(false); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws ArgumentException. - // - try - { - p.end_opVoid(null); - test(false); - } - catch(System.ArgumentException) - { - } - } - - // - // Check optional callbacks on delegate creation. - // - // TBD - - // - // Check optional exception and sent callbacks on delegation creation. - // - // TBD - - { - // - // Check that it is OK to pass a null success callback for a void operation. - // - Callback cb = new Callback(); - try - { - - p.begin_opVoid().whenCompleted(null as Test.Callback_MyClass_opVoid, cb.exCB); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Check that passing a null success callback for a non-void operation throws IllegalArgumentException. - // - try - { - Callback cb = new Callback(); - p.begin_opByte(1, 2).whenCompleted(null, cb.exCB); - } - catch(System.ArgumentException) - { - } - } - - { - // - // Check that throwing an exception from the success callback doesn't cause problems. - // - { - Thrower cb = new Thrower(ThrowType.LocalException); - p.begin_opVoid(cb.opVoidThrowUnsafe, null); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.UserException); - p.begin_opVoid(cb.opVoidThrowUnsafe, null); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.OtherException); - p.begin_opVoid(cb.opVoidThrowUnsafe, null); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.LocalException); - p.begin_opVoid().whenCompleted(cb.opVoidThrowSafe, cb.exCB); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.UserException); - p.begin_opVoid().whenCompleted(cb.opVoidThrowSafe, cb.exCB); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.OtherException); - p.begin_opVoid().whenCompleted(cb.opVoidThrowSafe, cb.exCB); - cb.check(); - } - } - - { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - - { - Thrower cb = new Thrower(ThrowType.LocalException); - indirect.begin_opVoid(cb.opVoidThrowUnsafe, null); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.LocalException); - indirect.begin_opVoid().whenCompleted(cb.opVoid, cb.exCBThrow); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.UserException); - indirect.begin_opVoid().whenCompleted(cb.opVoid, cb.exCBThrow); - cb.check(); - } - - { - Thrower cb = new Thrower(ThrowType.OtherException); - indirect.begin_opVoid().whenCompleted(cb.opVoid, cb.exCBThrow); - cb.check(); - } - } - - { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - Ice.Communicator ic = Ice.Util.initialize(initData); - Ice.ObjectPrx obj = ic.stringToProxy(p.ToString()); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(obj); - - ic.destroy(); - - try - { - p2.begin_opVoid(); - test(false); - } - catch(Ice.CommunicatorDestroyedException) - { - // Expected. - } - } - - // - // Test that marshaling works as expected, and that the delegates for each type of callback work. - // - { Ice.AsyncResult r = p.begin_opVoid(); p.end_opVoid(r); @@ -1047,13 +530,13 @@ public class TwowaysNewAMI { Callback cb = new Callback(); - p.begin_opByte(0xff, 0x0f).whenCompleted(cb.opByteCookie, cb.exCB); + p.begin_opByte(0xff, 0x0f).whenCompleted(cb.opByte, cb.exCB); cb.check(); } { Callback cb = new Callback(); - p.begin_opBool(true, false).whenCompleted(cb.opBoolCookie, cb.exCB); + p.begin_opBool(true, false).whenCompleted(cb.opBool, cb.exCB); cb.check(); } @@ -1471,249 +954,5 @@ public class TwowaysNewAMI derived.begin_opDerived().whenCompleted(cb.opDerived, cb.exCB); cb.check(); } - - // - // Test that cookies work. - // - - { - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - p.begin_opVoid(cb.opVoid, cookie); - cb.check(); - } - - { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice.AsyncResult r = p.begin_ice_isA(Test.MyClass.ice_staticId()); - try - { - test(p.end_ice_isA(r)); - } - catch(Exception) - { - test(false); - } - } - - { - Callback cb = new Callback(); - p.begin_ice_isA(Test.MyClass.ice_staticId(), cb.ice_isA, null); - cb.check(); - } - - { - Callback cb = new Callback(); - p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(cb.ice_isA, cb.exCB); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_ping(); - try - { - p.end_ice_ping(r); - } - catch(Exception) - { - test(false); - } - } - - { - Callback cb = new Callback(); - p.begin_ice_ping(cb.ice_ping, null); - cb.check(); - } - - { - Callback cb = new Callback(); - p.begin_ice_ping().whenCompleted(cb.ice_ping, cb.exCB); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_ids(); - try - { - test(Ice.CollectionComparer.Equals(p.end_ice_ids(r), p.ice_ids())); - } - catch(Exception) - { - test(false); - } - } - - { - Callback cb = new Callback(); - p.begin_ice_ids(cb.ice_ids, null); - cb.check(); - } - - { - Callback cb = new Callback(p.ice_ids()); - p.begin_ice_ids().whenCompleted(cb.ice_ids, cb.exCB); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_id(); - try - { - test(p.end_ice_id(r).Equals(p.ice_id())); - } - catch(Exception) - { - test(false); - } - } - - { - Callback cb = new Callback(); - p.begin_ice_id(cb.ice_id, null); - cb.check(); - } - - { - Callback cb = new Callback(p.ice_id()); - p.begin_ice_id().whenCompleted(cb.ice_id, cb.exCB); - cb.check(); - } - - // - // Check that we can call operations on Object asynchronously with a cookie. - // - { - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - p.begin_ice_isA(Test.MyClass.ice_staticId(), cb.ice_isA, cookie); - cb.check(); - } - - { - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - p.begin_ice_ping(cb.ice_ping, cookie); - cb.check(); - } - - { - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - p.begin_ice_ids(cb.ice_ids, cookie); - cb.check(); - } - - { - Callback cb = new Callback(); - Cookie cookie = new Cookie(99); - p.begin_ice_id(cb.ice_id, cookie); - cb.check(); - } - } - - // - // Test that queuing indication works. - // - { - Ice.AsyncResult r = p.begin_delay(100); - test(!r.IsCompleted); - p.end_delay(r); - test(r.IsCompleted); - } - - // - // Test that the sent callback is called from the user's thread if the request wasn't queued. - // - { -// SentCallback cb = new SentCallback(Thread.CurrentThread.ManagedThreadId); -// p.begin_opVoid(cb.opVoid, cb.sentCB); -// cb.check(); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - const int contextSize = 10; // Kilobytes - string s = new string('a', 1024); - - Dictionary ctx = new Dictionary(); - for(int i = 0; i < contextSize; ++i) - { - string label = "i" + i; - ctx[label] = s; - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // -// List results = new List(); - -// int queuedCount = 0; - -// SentCounter cb = new SentCounter(); -// Ice.AsyncResult r; - -// Test.StateChangerPrx state = Test.StateChangerPrxHelper.checkedCast( -// communicator.stringToProxy("hold:default -p 12011")); -// state.hold(3); - -// do -// { -// r = p.begin_opVoid(ctx).whenCompleted(cb.opVoid).whenSent(cb.sentCB); -// results.Add(r); -// if(!r.SentSynchronously) -// { -// ++queuedCount; -// } -// } -// while(r.SentSynchronously); - -// int numRequests = results.Count; -// test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - -// // -// // Re-enable the adapter. -// // -// state.activate(3); - -// // -// // Fire off a bunch more requests until we get one that wasn't queued. -// // We sleep in between calls to allow the queued requests to drain. -// // -// do -// { -// r = p.begin_opVoid().whenCompleted(cb.opVoid).whenSent(cb.sentCB); -// results.Add(r); -// if(!r.SentSynchronously) -// { -// ++queuedCount; -// } -// Thread.Sleep(1); -// } -// while(!r.SentSynchronously); -// test(results.Count > numRequests); // Something is wrong if we didn't queue additional requests. - -// // -// // Now make all the outstanding calls to the end_ method. -// // -// foreach(Ice.AsyncResult ar in results) -// { -// p.end_opVoid(ar); -// } - -// // -// // Check that all the callbacks have arrived and that we got a sent callback for each queued request. -// // -// cb.check(results.Count); -// test(cb.queuedCount() == queuedCount); - } } } diff --git a/java/allTests.py b/java/allTests.py index 74ea22122e4..8b6874a4914 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -36,6 +36,7 @@ tests = [ ("Ice/operations", ["core"]), ("Ice/seqMapping", ["core"]), ("Ice/exceptions", ["core"]), + ("Ice/ami", ["core"]), ("Ice/info", ["core", "noipv6", "nocompress"]), ("Ice/inheritance", ["core"]), ("Ice/facets", ["core"]), diff --git a/java/build.xml b/java/build.xml index a3045c78b5d..56c8b93b054 100644 --- a/java/build.xml +++ b/java/build.xml @@ -251,6 +251,9 @@ + + + @@ -292,7 +295,6 @@ - diff --git a/java/demo/Ice/applet/HelloApplet.java b/java/demo/Ice/applet/HelloApplet.java index 21a936a1223..34f52fd23c9 100644 --- a/java/demo/Ice/applet/HelloApplet.java +++ b/java/demo/Ice/applet/HelloApplet.java @@ -377,7 +377,7 @@ public class HelloApplet extends JApplet } @Override - synchronized public void sent() + synchronized public void sent(boolean ss) { if(_response) { @@ -415,14 +415,7 @@ public class HelloApplet extends JApplet if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(r.sentSynchronously()) - { - if(_deliveryMode == DeliveryMode.TWOWAY || _deliveryMode == DeliveryMode.TWOWAY_SECURE) - { - _status.setText("Waiting for response"); - } - } - else + if(!r.sentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/demo/Ice/swing/Client.java b/java/demo/Ice/swing/Client.java index be30eba5629..1c758cb621d 100644 --- a/java/demo/Ice/swing/Client.java +++ b/java/demo/Ice/swing/Client.java @@ -424,7 +424,7 @@ public class Client extends JFrame } @Override - synchronized public void sent() + synchronized public void sent(boolean ss) { if(_response) { @@ -464,14 +464,7 @@ public class Client extends JFrame if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(r.sentSynchronously()) - { - if(_deliveryMode == DeliveryMode.TWOWAY || _deliveryMode == DeliveryMode.TWOWAY_SECURE) - { - _status.setText("Waiting for response"); - } - } - else + if(!r.sentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/src/Ice/AMI_Object_ice_flushBatchRequests.java b/java/src/Ice/AMI_Object_ice_flushBatchRequests.java index 5093553469b..e213ed22fe2 100644 --- a/java/src/Ice/AMI_Object_ice_flushBatchRequests.java +++ b/java/src/Ice/AMI_Object_ice_flushBatchRequests.java @@ -29,9 +29,10 @@ public abstract class AMI_Object_ice_flushBatchRequests extends Callback_Object_ ice_exception(ex); } - public final void sent() + @Override + public final void sent(boolean sentSynchronously) { - if(this instanceof AMISentCallback) + if(sentSynchronously && this instanceof AMISentCallback) { ((AMISentCallback)this).ice_sent(); } diff --git a/java/src/Ice/AMI_Object_ice_invoke.java b/java/src/Ice/AMI_Object_ice_invoke.java index 8b273f4caab..470d69fa1a3 100644 --- a/java/src/Ice/AMI_Object_ice_invoke.java +++ b/java/src/Ice/AMI_Object_ice_invoke.java @@ -42,9 +42,10 @@ public abstract class AMI_Object_ice_invoke extends Callback_Object_ice_invoke ice_exception(ex); } - public final void sent() + @Override + public final void sent(boolean sentSynchronously) { - if(this instanceof AMISentCallback) + if(!sentSynchronously && this instanceof AMISentCallback) { ((AMISentCallback)this).ice_sent(); } diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java index a006a83f511..67b3ecbe0b2 100644 --- a/java/src/Ice/AsyncResult.java +++ b/java/src/Ice/AsyncResult.java @@ -174,6 +174,72 @@ public class AsyncResult } } + public final void __exception(LocalException ex) + { + synchronized(_monitor) + { + _state |= Done; + _exception = ex; + _monitor.notifyAll(); + } + + if(_callback != null) + { + try + { + _callback.__completed(this); + } + catch(RuntimeException exc) + { + __warning(exc); + } + } + } + + protected final void __sentInternal() + { + // + // Note: no need to change the _state here, specializations are responsible for + // changing the state. + // + + if(_callback != null) + { + try + { + _callback.__sent(this); + } + catch(RuntimeException ex) + { + __warning(ex); + } + } + } + + public final void __sentAsync() + { + // + // This is called when it's not safe to call the sent callback synchronously + // from this thread. Instead the exception callback is called asynchronously from + // the client thread pool. + // + try + { + _instance.clientThreadPool().execute(new IceInternal.ThreadPoolWorkItem() + { + public void + execute(IceInternal.ThreadPoolCurrent current) + { + current.ioCompleted(); + __sentInternal(); + } + }); + } + catch(CommunicatorDestroyedException exc) + { + } + } + public static void __check(AsyncResult r, ObjectPrx prx, String operation) { __check(r, operation); @@ -207,28 +273,6 @@ public class AsyncResult } } - public final void __exception(LocalException ex) - { - synchronized(_monitor) - { - _state |= Done; - _exception = ex; - _monitor.notifyAll(); - } - - if(_callback != null) - { - try - { - _callback.__completed(this); - } - catch(RuntimeException exc) - { - __warning(exc); - } - } - } - protected static void __check(AsyncResult r, String operation) { if(r == null) @@ -242,26 +286,6 @@ public class AsyncResult } } - protected final void __sentInternal() - { - // - // Note: no need to change the _state here, specializations are responsible for - // changing the state. - // - - if(_callback != null) - { - try - { - _callback.__sent(this); - } - catch(RuntimeException ex) - { - __warning(ex); - } - } - } - protected final void __response() { // diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index f1cbcd0723d..eac4cb11e3b 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -324,7 +324,8 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne boolean sent = false; try { - sent = sendMessage(new OutgoingMessage(out, out.os(), compress, requestId)); + OutgoingMessage message = new OutgoingMessage(out, out.os(), compress, requestId); + sent = (sendMessage(message) & IceInternal.AsyncStatus.Sent) > 0; } catch(Ice.LocalException ex) { @@ -344,7 +345,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne return sent; // The request was sent. } - synchronized public boolean + synchronized public int sendAsyncRequest(IceInternal.OutgoingAsync out, boolean compress, boolean response) throws IceInternal.LocalExceptionWrapper { @@ -389,10 +390,10 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne os.writeInt(requestId); } - boolean sent; + int status; try { - sent = sendMessage(new OutgoingMessage(out, out.__os(), compress, requestId)); + status = sendMessage(new OutgoingMessage(out, out.__os(), compress, requestId)); } catch(Ice.LocalException ex) { @@ -408,7 +409,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne // _asyncRequests.put(requestId, out); } - return sent; + return status; } public synchronized void @@ -653,7 +654,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne try { OutgoingMessage message = new OutgoingMessage(out, out.os(), _batchRequestCompress, 0); - sent = sendMessage(message); + sent = (sendMessage(message) & IceInternal.AsyncStatus.Sent) > 0; } catch(Ice.LocalException ex) { @@ -672,7 +673,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne return sent; } - synchronized public boolean + synchronized public int flushAsyncBatchRequests(IceInternal.BatchOutgoingAsync outAsync) { while(_batchStreamInUse && _exception == null) @@ -693,8 +694,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne if(_batchRequestNum == 0) { - outAsync.__sent(this); - return true; + int status = IceInternal.AsyncStatus.Sent; + if(outAsync.__sent(this)) + { + status |= IceInternal.AsyncStatus.InvokeSentCallback; + } + return status; } // @@ -705,11 +710,11 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne _batchStream.swap(outAsync.__os()); - boolean sent; + int status; try { OutgoingMessage message = new OutgoingMessage(outAsync, outAsync.__os(), _batchRequestCompress, 0); - sent = sendMessage(message); + status = sendMessage(message); } catch(Ice.LocalException ex) { @@ -725,7 +730,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne _batchRequestNum = 0; _batchRequestCompress = false; _batchMarker = 0; - return sent; + return status; } synchronized public void @@ -1630,7 +1635,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne os.writeByte((byte)0); // compression status: always report 0 for CloseConnection in Java. os.writeInt(IceInternal.Protocol.headerSize); // Message size. - if(sendMessage(new OutgoingMessage(os, false, false))) + if((sendMessage(new OutgoingMessage(os, false, false)) & IceInternal.AsyncStatus.Sent) > 0) { // // Schedule the close timeout to wait for the peer to close the connection. If @@ -1854,7 +1859,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne return callbacks; } - private boolean + private int sendMessage(OutgoingMessage message) { assert(_state < StateClosed); @@ -1862,7 +1867,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne { message.adopt(); _sendStreams.addLast(message); - return false; + return IceInternal.AsyncStatus.Queued; } // @@ -1890,12 +1895,16 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne if(_transceiver.write(message.stream.getBuffer())) { - message.sent(this, false); + int status = IceInternal.AsyncStatus.Sent; + if(message.sent(this, false)) + { + status |= IceInternal.AsyncStatus.InvokeSentCallback; + } if(_acmTimeout > 0) { _acmAbsoluteTimeoutMillis = IceInternal.Time.currentMonotonicTimeMillis() + _acmTimeout * 1000; } - return true; + return status; } message.adopt(); @@ -1903,7 +1912,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne _sendStreams.addLast(message); scheduleTimeout(IceInternal.SocketOperation.Write, _endpoint.timeout()); _threadPool.register(this, IceInternal.SocketOperation.Write); - return false; + return IceInternal.AsyncStatus.Queued; } private IceInternal.BasicStream diff --git a/java/src/Ice/ExceptionCallback.java b/java/src/Ice/ExceptionCallback.java index 733542b213a..b213f639938 100644 --- a/java/src/Ice/ExceptionCallback.java +++ b/java/src/Ice/ExceptionCallback.java @@ -26,7 +26,7 @@ public abstract class ExceptionCallback extends Callback /** * Called when a queued invocation is sent successfully. **/ - public void sent() + public void sent(boolean sentSynchronously) { } @@ -45,6 +45,6 @@ public abstract class ExceptionCallback extends Callback public final void __sent(AsyncResult __result) { - sent(); + sent(__result.sentSynchronously()); } } diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 171abe39367..891fe6653e4 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -1832,25 +1832,11 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable private AsyncResult begin_ice_flushBatchRequestsInternal(IceInternal.CallbackBase __cb) { - IceInternal.BatchOutgoingAsync __result = + IceInternal.ProxyBatchOutgoingAsync __result = new IceInternal.ProxyBatchOutgoingAsync(this, __ice_flushBatchRequests_name, __cb); try { - // - // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch - // requests were queued with the connection, they would be lost without being noticed. - // - _ObjectDel delegate = null; - int cnt = -1; // Don't retry. - try - { - delegate = __getDelegate(false); - delegate.__getRequestHandler().flushAsyncBatchRequests(__result); - } - catch(LocalException __ex) - { - cnt = __handleException(delegate, __ex, null, cnt); - } + __result.__send(); } catch(LocalException __ex) { diff --git a/java/src/Ice/OnewayCallback.java b/java/src/Ice/OnewayCallback.java index c613a0fadae..7464e397911 100644 --- a/java/src/Ice/OnewayCallback.java +++ b/java/src/Ice/OnewayCallback.java @@ -29,13 +29,13 @@ public abstract class OnewayCallback extends IceInternal.CallbackBase /** * Called when a queued invocation is sent successfully. **/ - public void sent() + public void sent(boolean sentSynchronously) { } public final void __sent(AsyncResult __result) { - sent(); + sent(__result.sentSynchronously()); } public final void __completed(AsyncResult __result) diff --git a/java/src/Ice/SentCallback.java b/java/src/Ice/SentCallback.java deleted file mode 100644 index 1a2f8a08009..00000000000 --- a/java/src/Ice/SentCallback.java +++ /dev/null @@ -1,33 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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. -// -// ********************************************************************** - -package Ice; - -/** - * An application can optionally supply an instance of this class in an - * asynchronous invocation. The application must create a subclass and - * implement the sent method. - **/ -public abstract class SentCallback extends Callback -{ - /** - * Called when a queued invocation is sent successfully. - **/ - public abstract void sent(); - - public final void __completed(AsyncResult __result) - { - // Ignore. - } - - public final void __sent(AsyncResult __result) - { - sent(); - } -} diff --git a/java/src/Ice/TwowayCallback.java b/java/src/Ice/TwowayCallback.java index 0ebe4316ef8..78b022fd58a 100644 --- a/java/src/Ice/TwowayCallback.java +++ b/java/src/Ice/TwowayCallback.java @@ -24,12 +24,12 @@ public abstract class TwowayCallback extends IceInternal.CallbackBase /** * Called when a queued invocation is sent successfully. **/ - public void sent() + public void sent(boolean sentSynchronously) { } public final void __sent(AsyncResult __result) { - sent(); + sent(__result.sentSynchronously()); } } diff --git a/java/src/IceInternal/AsyncStatus.java b/java/src/IceInternal/AsyncStatus.java new file mode 100644 index 00000000000..6d62be78cb4 --- /dev/null +++ b/java/src/IceInternal/AsyncStatus.java @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +package IceInternal; + +public class AsyncStatus +{ + public static final int Queued = 0; + public static final int Sent = 1; + public static final int InvokeSentCallback = 2; +} diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java index 6b1a0a34d6b..8bd1ca9f085 100644 --- a/java/src/IceInternal/ConnectRequestHandler.java +++ b/java/src/IceInternal/ConnectRequestHandler.java @@ -145,7 +145,7 @@ public class ConnectRequestHandler } } - public boolean + public int sendAsyncRequest(OutgoingAsync out) throws LocalExceptionWrapper { @@ -154,7 +154,7 @@ public class ConnectRequestHandler if(!initialized()) { _requests.add(new Request(out)); - return false; + return AsyncStatus.Queued; } } return _connection.sendAsyncRequest(out, _compress, _response); @@ -166,7 +166,7 @@ public class ConnectRequestHandler return getConnection(true).flushBatchRequests(out); } - public boolean + public int flushAsyncBatchRequests(BatchOutgoingAsync out) { synchronized(this) @@ -174,7 +174,7 @@ public class ConnectRequestHandler if(!initialized()) { _requests.add(new Request(out)); - return false; + return AsyncStatus.Queued; } } return _connection.flushAsyncBatchRequests(out); @@ -409,14 +409,16 @@ public class ConnectRequestHandler Request request = p.next(); if(request.out != null) { - if(_connection.sendAsyncRequest(request.out, _compress, _response)) + if((_connection.sendAsyncRequest(request.out, _compress, _response) & + AsyncStatus.InvokeSentCallback) > 0) { sentCallbacks.add(request.out); } } else if(request.batchOut != null) { - if(_connection.flushAsyncBatchRequests(request.batchOut)) + if((_connection.flushAsyncBatchRequests(request.batchOut) & + AsyncStatus.InvokeSentCallback) > 0) { sentCallbacks.add(request.batchOut); } diff --git a/java/src/IceInternal/ConnectionRequestHandler.java b/java/src/IceInternal/ConnectionRequestHandler.java index 1f085f49dfb..61c6ee8daf3 100644 --- a/java/src/IceInternal/ConnectionRequestHandler.java +++ b/java/src/IceInternal/ConnectionRequestHandler.java @@ -44,7 +44,7 @@ public class ConnectionRequestHandler implements RequestHandler } } - public boolean + public int sendAsyncRequest(OutgoingAsync out) throws LocalExceptionWrapper { @@ -57,7 +57,7 @@ public class ConnectionRequestHandler implements RequestHandler return _connection.flushBatchRequests(out); } - public boolean + public int flushAsyncBatchRequests(BatchOutgoingAsync out) { return _connection.flushAsyncBatchRequests(out); diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index 75f52715837..65139041153 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -355,10 +355,24 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa try { _delegate = _proxy.__getDelegate(true); - boolean sent = _delegate.__getRequestHandler().sendAsyncRequest(this); - if(synchronous) // Only set sentSynchronously_ If called synchronously by the user thread. + int status = _delegate.__getRequestHandler().sendAsyncRequest(this); + if((status & AsyncStatus.Sent) > 0) { - _sentSynchronously = sent; + if(synchronous) + { + _sentSynchronously = true; + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + __sent(); // Call from the user thread. + } + } + else + { + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + __sentAsync(); // Call from a client thread pool thread. + } + } } break; } diff --git a/java/src/IceInternal/ProxyBatchOutgoingAsync.java b/java/src/IceInternal/ProxyBatchOutgoingAsync.java index c6f7efdbe5b..aa8d9133430 100644 --- a/java/src/IceInternal/ProxyBatchOutgoingAsync.java +++ b/java/src/IceInternal/ProxyBatchOutgoingAsync.java @@ -17,6 +17,34 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync _proxy = prx; } + public void + __send() + { + // + // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch + // requests were queued with the connection, they would be lost without being noticed. + // + Ice._ObjectDel delegate = null; + int cnt = -1; // Don't retry. + try + { + delegate = ((Ice.ObjectPrxHelperBase)_proxy).__getDelegate(false); + int status = delegate.__getRequestHandler().flushAsyncBatchRequests(this); + if((status & AsyncStatus.Sent) > 0) + { + _sentSynchronously = true; + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + __sent(); + } + } + } + catch(Ice.LocalException __ex) + { + cnt = ((Ice.ObjectPrxHelperBase)_proxy).__handleException(delegate, __ex, null, cnt); + } + } + public Ice.ObjectPrx getProxy() { return _proxy; diff --git a/java/src/IceInternal/RequestHandler.java b/java/src/IceInternal/RequestHandler.java index b5bf28c4d99..ac9b181fd11 100644 --- a/java/src/IceInternal/RequestHandler.java +++ b/java/src/IceInternal/RequestHandler.java @@ -19,11 +19,11 @@ public interface RequestHandler Ice.ConnectionI sendRequest(Outgoing out) throws LocalExceptionWrapper; - boolean sendAsyncRequest(OutgoingAsync out) + int sendAsyncRequest(OutgoingAsync out) throws LocalExceptionWrapper; boolean flushBatchRequests(BatchOutgoing out); - boolean flushAsyncBatchRequests(BatchOutgoingAsync out); + int flushAsyncBatchRequests(BatchOutgoingAsync out); Reference getReference(); diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java new file mode 100644 index 00000000000..b0882fc3c81 --- /dev/null +++ b/java/test/Ice/ami/AllTests.java @@ -0,0 +1,1551 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +package test.Ice.ami; + +import java.io.PrintWriter; + +import test.Ice.ami.Test.TestIntfPrx; +import test.Ice.ami.Test.TestIntfPrxHelper; +import test.Ice.ami.Test.TestIntfControllerPrx; +import test.Ice.ami.Test.TestIntfControllerPrxHelper; +import test.Ice.ami.Test.TestIntfException; +import test.Ice.ami.Test.Callback_TestIntf_op; +import test.Ice.ami.Test.Callback_TestIntf_opWithResult; +import test.Ice.ami.Test.Callback_TestIntf_opWithUE; + +public class AllTests +{ + private static void + test(boolean b) + { + if(!b) + { + throw new RuntimeException(); + } + } + + private static class CallbackBase + { + CallbackBase() + { + _called = false; + } + + public synchronized void check() + { + while(!_called) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + + _called = false; + } + + public synchronized void called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; + } + + static class AsyncCallback extends CallbackBase + { + public AsyncCallback() + { + } + + public void + isA(Ice.AsyncResult result) + { + test(result.getProxy().end_ice_isA(result)); + called(); + } + + public void + ping(Ice.AsyncResult result) + { + result.getProxy().end_ice_ping(result); + called(); + } + + public void + id(Ice.AsyncResult result) + { + test(result.getProxy().end_ice_id(result).equals("::Test::TestIntf")); + called(); + } + + public void + ids(Ice.AsyncResult result) + { + test(result.getProxy().end_ice_ids(result).length == 2); + called(); + } + + public void + op(Ice.AsyncResult result) + { + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result); + called(); + } + + public void + opWithResult(Ice.AsyncResult result) + { + test(TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithResult(result) == 15); + called(); + } + + public void + opWithUE(Ice.AsyncResult result) + { + try + { + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithUE(result); + test(false); + } + catch(TestIntfException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + public void + isAEx(Ice.AsyncResult result) + { + try + { + result.getProxy().end_ice_isA(result); + test(false); + } + catch(Ice.NoEndpointException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + public void + pingEx(Ice.AsyncResult result) + { + try + { + result.getProxy().end_ice_ping(result); + test(false); + } + catch(Ice.NoEndpointException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + public void + idEx(Ice.AsyncResult result) + { + try + { + result.getProxy().end_ice_id(result); + test(false); + } + catch(Ice.NoEndpointException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + public void + idsEx(Ice.AsyncResult result) + { + try + { + result.getProxy().end_ice_ids(result); + test(false); + } + catch(Ice.NoEndpointException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + public void + opEx(Ice.AsyncResult result) + { + try + { + TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result); + test(false); + } + catch(Ice.NoEndpointException ex) + { + called(); + } + catch(Ice.LocalException ex) + { + test(false); + } + } + + }; + + static class ResponseCallback extends CallbackBase + { + ResponseCallback() + { + } + + public void + isA(boolean r) + { + test(r); + called(); + } + + public void + ping() + { + called(); + } + + public void + id(String id) + { + test(id.equals("::Test::TestIntf")); + called(); + } + + public void + ids(String[] ids) + { + test(ids.length == 2); + called(); + } + + public void + op() + { + called(); + } + + public void + opWithResult(int r) + { + test(r == 15); + called(); + } + + public void + opWithUE(Ice.UserException e) + { + try + { + throw e; + } + catch(TestIntfException ex) + { + called(); + } + catch(Ice.UserException ex) + { + test(false); + } + } + + }; + + static class ExceptionCallback extends CallbackBase + { + public ExceptionCallback() + { + } + + public void + isA(boolean r) + { + test(false); + } + + public void + ping() + { + test(false); + } + + public void + id(String id) + { + test(false); + } + + public void + ids(String[] ids) + { + test(false); + } + + public void + op() + { + test(false); + } + + public void + ex(Ice.LocalException ex) + { + test(ex instanceof Ice.NoEndpointException); + called(); + } + + public void + noEx(Ice.LocalException ex) + { + test(false); + } + }; + + static class SentCallback extends CallbackBase + { + SentCallback() + { + _thread = Thread.currentThread().getId(); + } + + public void + isA(boolean r) + { + } + + public void + ping() + { + } + + public void + id(String s) + { + } + + public void + ids(String[] s) + { + } + + public void + opAsync(Ice.AsyncResult r) + { + } + + public void + op() + { + } + + public void + ex(Ice.LocalException ex) + { + } + + public void + sent(Ice.AsyncResult r) + { + test(r.sentSynchronously() && _thread == Thread.currentThread().getId() || + !r.sentSynchronously() && _thread != Thread.currentThread().getId()); + called(); + } + + public void + sent(boolean ss) + { + test(ss && _thread == Thread.currentThread().getId() || + !ss && _thread != Thread.currentThread().getId()); + called(); + } + + long _thread; + }; + + enum ThrowType { LocalException, OtherException }; + + static class Thrower extends CallbackBase + { + public Thrower(ThrowType t) + { + _t = t; + } + + public void + opAsync(Ice.AsyncResult r) + { + called(); + throwEx(); + } + + public void + op() + { + called(); + throwEx(); + } + + public void + noOp() + { + } + + public void + ex(Ice.LocalException ex) + { + called(); + throwEx(); + } + + public void + sent(boolean ss) + { + called(); + throwEx(); + } + + private void + throwEx() + { + switch(_t) + { + case LocalException: + { + throw new Ice.ObjectNotExistException(); + } + case OtherException: + { + throw new RuntimeException(); + } + default: + { + assert(false); + break; + } + } + } + + ThrowType _t; + }; + + public static void + allTests(Ice.Communicator communicator, PrintWriter out) + { + String sref = "test:default -p 12010"; + Ice.ObjectPrx obj = communicator.stringToProxy(sref); + test(obj != null); + + TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); + + sref = "testController:tcp -p 12011"; + obj = communicator.stringToProxy(sref); + test(obj != null); + + TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj); + + out.print("testing begin/end invocation... "); + out.flush(); + { + Ice.AsyncResult result; + java.util.Map ctx = new java.util.HashMap(); + + result = p.begin_ice_isA("::Test::TestIntf"); + test(p.end_ice_isA(result)); + result = p.begin_ice_isA("::Test::TestIntf", ctx); + test(p.end_ice_isA(result)); + + result = p.begin_ice_ping(); + p.end_ice_ping(result); + result = p.begin_ice_ping(ctx); + p.end_ice_ping(result); + + result = p.begin_ice_id(); + test(p.end_ice_id(result).equals("::Test::TestIntf")); + result = p.begin_ice_id(ctx); + test(p.end_ice_id(result).equals("::Test::TestIntf")); + + result = p.begin_ice_ids(); + test(p.end_ice_ids(result).length == 2); + result = p.begin_ice_ids(ctx); + test(p.end_ice_ids(result).length == 2); + + result = p.begin_op(); + p.end_op(result); + result = p.begin_op(ctx); + p.end_op(result); + + result = p.begin_opWithResult(); + test(p.end_opWithResult(result) == 15); + result = p.begin_opWithResult(ctx); + test(p.end_opWithResult(result) == 15); + + result = p.begin_opWithUE(); + try + { + p.end_opWithUE(result); + test(false); + } + catch(TestIntfException ex) + { + } + result = p.begin_opWithUE(ctx); + try + { + p.end_opWithUE(result); + test(false); + } + catch(TestIntfException ex) + { + } + } + out.println("ok"); + + out.print("testing async callback... "); + out.flush(); + { + final AsyncCallback cb = new AsyncCallback(); + java.util.Map ctx = new java.util.HashMap(); + + p.begin_ice_isA("::Test::TestIntf", new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.isA(r); + } + }); + cb.check(); + + p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.isA(r); + } + }); + cb.check(); + + p.begin_ice_ping(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.ping(r); + } + }); + cb.check(); + p.begin_ice_ping(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.ping(r); + } + }); + cb.check(); + + p.begin_ice_id(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.id(r); + } + }); + cb.check(); + p.begin_ice_id(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.id(r); + } + }); + cb.check(); + + p.begin_ice_ids(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.ids(r); + } + }); + cb.check(); + p.begin_ice_ids(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.ids(r); + } + }); + cb.check(); + + p.begin_op(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.op(r); + } + }); + cb.check(); + p.begin_op(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.op(r); + } + }); + cb.check(); + + p.begin_opWithResult(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.opWithResult(r); + } + }); + cb.check(); + p.begin_opWithResult(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.opWithResult(r); + } + }); + cb.check(); + + p.begin_opWithUE(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.opWithUE(r); + } + }); + cb.check(); + p.begin_opWithUE(ctx, new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.opWithUE(r); + } + }); + cb.check(); + } + out.println("ok"); + + out.print("testing response callback... "); + out.flush(); + { + final ResponseCallback cb = new ResponseCallback(); + java.util.Map ctx = new java.util.HashMap(); + + p.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA() + { + public void + response(boolean r) + { + cb.isA(r); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.Callback_Object_ice_isA() + { + public void + response(boolean r) + { + cb.isA(r); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_ice_ping(new Ice.Callback_Object_ice_ping() + { + public void + response() + { + cb.ping(); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_ice_ping(ctx, new Ice.Callback_Object_ice_ping() + { + public void + response() + { + cb.ping(); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_ice_id(new Ice.Callback_Object_ice_id() + { + public void + response(String id) + { + cb.id(id); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_ice_id(ctx, new Ice.Callback_Object_ice_id() + { + public void + response(String id) + { + cb.id(id); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_ice_ids(new Ice.Callback_Object_ice_ids() + { + public void + response(String[] ids) + { + cb.ids(ids); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_ice_ids(ctx, new Ice.Callback_Object_ice_ids() + { + public void + response(String[] ids) + { + cb.ids(ids); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + cb.op(); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_op(ctx, new Callback_TestIntf_op() + { + public void + response() + { + cb.op(); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_opWithResult(new Callback_TestIntf_opWithResult() + { + public void + response(int r) + { + cb.opWithResult(r); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_opWithResult(ctx, new Callback_TestIntf_opWithResult() + { + public void + response(int r) + { + cb.opWithResult(r); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + + p.begin_opWithUE(new Callback_TestIntf_opWithUE() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.UserException ex) + { + cb.opWithUE(ex); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + p.begin_opWithUE(ctx, new Callback_TestIntf_opWithUE() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.UserException ex) + { + cb.opWithUE(ex); + } + + public void + exception(Ice.LocalException ex) + { + test(false); + } + }); + cb.check(); + } + out.println("ok"); + + out.print("testing local exceptions... "); + out.flush(); + { + TestIntfPrx indirect = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + Ice.AsyncResult r; + + r = indirect.begin_op(); + try + { + indirect.end_op(r); + test(false); + } + catch(Ice.NoEndpointException ex) + { + } + + + r = ((TestIntfPrx)p.ice_oneway()).begin_opWithResult(); + try + { + TestIntfPrxHelper.uncheckedCast(r.getProxy()).end_opWithResult(r); + test(false); + } + catch(Ice.TwowayOnlyException ex) + { + } + + // + // Check that CommunicatorDestroyedException is raised directly. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties()._clone(); + Ice.Communicator ic = Ice.Util.initialize(initData); + Ice.ObjectPrx o = ic.stringToProxy(p.toString()); + TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o); + ic.destroy(); + + try + { + p2.begin_op(); + test(false); + } + catch(Ice.CommunicatorDestroyedException ex) + { + // Expected. + } + } + out.println("ok"); + + out.print("testing local exceptions with async callback... "); + out.flush(); + { + TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + final AsyncCallback cb = new AsyncCallback(); + + i.begin_ice_isA("::Test::TestIntf", new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.isAEx(r); + } + }); + cb.check(); + + i.begin_ice_ping(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.pingEx(r); + } + }); + cb.check(); + + i.begin_ice_id(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.idEx(r); + } + }); + cb.check(); + + i.begin_ice_ids(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.idsEx(r); + } + }); + cb.check(); + + i.begin_op(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult r) + { + cb.opEx(r); + } + }); + cb.check(); + } + out.println("ok"); + + out.print("testing local exceptions with response callback... "); + out.flush(); + { + TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + final ExceptionCallback cb = new ExceptionCallback(); + + i.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA() + { + public void + response(boolean r) + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_ice_ping(new Ice.Callback_Object_ice_ping() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_ice_id(new Ice.Callback_Object_ice_id() + { + public void + response(String id) + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_ice_ids(new Ice.Callback_Object_ice_ids() + { + public void + response(String[] ids) + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + } + out.println("ok"); + + out.print("testing exception callback... "); + out.flush(); + { + TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + final ExceptionCallback cb = new ExceptionCallback(); + + i.begin_ice_isA("::Test::TestIntf", new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_op(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_opWithResult(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + i.begin_opWithUE(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + // Ensures no exception is called when response is received + p.begin_ice_isA("::Test::TestIntf", new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.noEx(ex); + } + }); + p.begin_op(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.noEx(ex); + } + }); + p.begin_opWithResult(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.noEx(ex); + } + }); + p.begin_opWithUE(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.noEx(ex); + } + }); + } + out.println("ok"); + + out.print("testing sent callback... "); + out.flush(); + { + final SentCallback cb = new SentCallback(); + + p.begin_ice_isA("", new Ice.Callback_Object_ice_isA() + { + public void + response(boolean r) + { + cb.isA(r); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + p.begin_ice_ping(new Ice.Callback_Object_ice_ping() + { + public void + response() + { + cb.ping(); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + p.begin_ice_id(new Ice.Callback_Object_ice_id() + { + public void + response(String id) + { + cb.id(id); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + p.begin_ice_ids(new Ice.Callback_Object_ice_ids() + { + public void + response(String[] ids) + { + cb.ids(ids); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + p.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + cb.op(); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + p.begin_op(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult result) + { + cb.opAsync(result); + } + + public void + sent(Ice.AsyncResult result) + { + cb.sent(result); + } + }); + cb.check(); + + p.begin_op(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + java.util.List cbs = new java.util.ArrayList(); + byte[] seq = new byte[10024]; + new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. + Ice.AsyncResult r; + testController.holdAdapter(); + do + { + final SentCallback cb2 = new SentCallback(); + r = p.begin_opWithPayload(seq, new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb2.ex(ex); + } + + public void + sent(boolean ss) + { + cb2.sent(ss); + } + }); + cbs.add(cb2); + } + while(r.sentSynchronously()); + testController.resumeAdapter(); + for(SentCallback cb3 : cbs) + { + cb3.check(); + } + } + out.println("ok"); + + out.print("testing illegal arguments... "); + out.flush(); + { + Ice.AsyncResult result; + + result = p.begin_op(); + p.end_op(result); + try + { + p.end_op(result); + test(false); + } + catch(IllegalArgumentException ex) + { + } + + result = p.begin_op(); + try + { + p.end_opWithResult(result); + test(false); + } + catch(IllegalArgumentException ex) + { + } + + try + { + p.end_op(null); + test(false); + } + catch(IllegalArgumentException ex) + { + } + + // try +// { +// p.begin_op((Ice.Callback)null); +// test(false); +// } +// catch(IllegalArgumentException ex) +// { +// } + +// try +// { +// p.begin_op((Callback_TestIntf_op)null); +// test(false); +// } +// catch(IllegalArgumentException ex) +// { +// } + } + out.println("ok"); + + out.print("testing unexpected exceptions from callback... "); + out.flush(); + { + TestIntfPrx q = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + ThrowType throwEx[] = { ThrowType.LocalException, ThrowType.OtherException }; + + for(int i = 0; i < 2; ++i) + { + final Thrower cb = new Thrower(throwEx[i]); + + p.begin_op(new Ice.AsyncCallback() + { + public void + completed(Ice.AsyncResult result) + { + cb.opAsync(result); + } + }); + cb.check(); + + p.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + cb.op(); + } + + public void + exception(Ice.LocalException ex) + { + } + }); + cb.check(); + + q.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + cb.op(); + } + + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + + p.begin_op(new Callback_TestIntf_op() + { + public void + response() + { + } + + public void + exception(Ice.LocalException ex) + { + } + + public void + sent(boolean ss) + { + cb.sent(ss); + } + }); + cb.check(); + + q.begin_op(new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.ex(ex); + } + }); + cb.check(); + } + } + out.println("ok"); + + out.print("testing AsyncResult operations... "); + out.flush(); + { + testController.holdAdapter(); + + Ice.AsyncResult r1 = p.begin_op(); + byte[] seq = new byte[10024]; + new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. + Ice.AsyncResult r2; + while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); + + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || + !r1.sentSynchronously() && !r1.isCompleted()); + + test(!r2.sentSynchronously() && !r2.isCompleted()); + + testController.resumeAdapter(); + + r1.waitForSent(); + test(r1.isSent()); + + r2.waitForSent(); + test(r2.isSent()); + + r1.waitForCompleted(); + test(r1.isCompleted()); + + r2.waitForCompleted(); + test(r2.isCompleted()); + + test(r1.getOperation().equals("op")); + test(r2.getOperation().equals("opWithPayload")); + } + out.println("ok"); + + p.shutdown(); + } +} diff --git a/java/test/Ice/ami/Client.java b/java/test/Ice/ami/Client.java new file mode 100644 index 00000000000..3b4d1310135 --- /dev/null +++ b/java/test/Ice/ami/Client.java @@ -0,0 +1,36 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +package test.Ice.ami; + +public class Client extends test.Util.Application +{ + public int run(String[] args) + { + AllTests.allTests(communicator(), getWriter()); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + return initData; + } + + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/ami/Server.java b/java/test/Ice/ami/Server.java new file mode 100644 index 00000000000..cbcdd708fda --- /dev/null +++ b/java/test/Ice/ami/Server.java @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +package test.Ice.ami; + +public class Server extends test.Util.Application +{ + public int + run(String[] args) + { + Ice.Communicator communicator = communicator(); + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); + + adapter.add(new TestI(), communicator().stringToIdentity("test")); + adapter.activate(); + adapter2.add(new TestControllerI(adapter), communicator().stringToIdentity("testController")); + adapter2.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); + return initData; + } + + public static void + main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/ami/Test.ice b/java/test/Ice/ami/Test.ice new file mode 100644 index 00000000000..b012413fc91 --- /dev/null +++ b/java/test/Ice/ami/Test.ice @@ -0,0 +1,42 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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 + +#include +#include + +[["java:package:test.Ice.ami"]] +module Test +{ + +exception TestIntfException +{ +}; + +["ami"] interface TestIntf +{ + void op(); + void opWithPayload(Ice::ByteSeq seq); + int opWithResult(); + void opWithUE() + throws TestIntfException; + void shutdown(); +}; + +interface TestIntfController +{ + void holdAdapter(); + void resumeAdapter(); +}; + +}; + +#endif diff --git a/java/test/Ice/ami/TestControllerI.java b/java/test/Ice/ami/TestControllerI.java new file mode 100644 index 00000000000..1c18c58adae --- /dev/null +++ b/java/test/Ice/ami/TestControllerI.java @@ -0,0 +1,34 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** +package test.Ice.ami; + +import test.Ice.ami.Test._TestIntfControllerDisp; + +class TestControllerI extends _TestIntfControllerDisp +{ + public void + holdAdapter(Ice.Current current) + { + _adapter.hold(); + } + + public void + resumeAdapter(Ice.Current current) + { + _adapter.activate(); + } + + public + TestControllerI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + final private Ice.ObjectAdapter _adapter; +} diff --git a/java/test/Ice/ami/TestI.java b/java/test/Ice/ami/TestI.java new file mode 100644 index 00000000000..c737e85ea39 --- /dev/null +++ b/java/test/Ice/ami/TestI.java @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 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. +// +// ********************************************************************** + +package test.Ice.ami; + +import test.Ice.ami.Test._TestIntfDisp; +import test.Ice.ami.Test.TestIntfException; + +public class TestI extends _TestIntfDisp +{ + TestI() + { + } + + public void + op(Ice.Current current) + { + } + + public int + opWithResult(Ice.Current current) + { + return 15; + } + + public void + opWithUE(Ice.Current current) + throws TestIntfException + { + throw new TestIntfException(); + } + + public void + opWithPayload(byte[] seq, Ice.Current current) + { + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/java/test/Ice/ami/run.py b/java/test/Ice/ami/run.py new file mode 100755 index 00000000000..801c69ddd03 --- /dev/null +++ b/java/test/Ice/ami/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 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 + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * + +TestUtil.clientServerTest() + diff --git a/java/test/Ice/background/AllTests.java b/java/test/Ice/background/AllTests.java index b781a2afeb8..1d26846b671 100644 --- a/java/test/Ice/background/AllTests.java +++ b/java/test/Ice/background/AllTests.java @@ -81,7 +81,7 @@ public class AllTests } @Override - public void sent() + public void sent(boolean ss) { _sent.called(); } @@ -124,7 +124,7 @@ public class AllTests } @Override - public void sent() + public void sent(boolean ss) { _sent.called(); } diff --git a/java/test/Ice/operations/AMDServer.java b/java/test/Ice/operations/AMDServer.java index d55a28d226b..425a4293d30 100644 --- a/java/test/Ice/operations/AMDServer.java +++ b/java/test/Ice/operations/AMDServer.java @@ -17,12 +17,6 @@ public class AMDServer extends test.Util.Application Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), communicator().stringToIdentity("test")); adapter.activate(); - - communicator().getProperties().setProperty("HoldAdapter.Endpoints", "default -p 12011:udp"); - Ice.ObjectAdapter holdAdapter = communicator().createObjectAdapter("HoldAdapter"); - holdAdapter.add(new StateChangerI(new java.util.Timer(), adapter), communicator().stringToIdentity("hold")); - holdAdapter.activate(); - return WAIT; } diff --git a/java/test/Ice/operations/OnewaysNewAMI.java b/java/test/Ice/operations/OnewaysNewAMI.java index 3cc794a0747..b11ce8e3b37 100644 --- a/java/test/Ice/operations/OnewaysNewAMI.java +++ b/java/test/Ice/operations/OnewaysNewAMI.java @@ -13,8 +13,6 @@ import test.Ice.operations.Test.Callback_MyClass_opVoid; import test.Ice.operations.Test.MyClass; import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; -import test.Ice.operations.Test.StateChangerPrx; -import test.Ice.operations.Test.StateChangerPrxHelper; class OnewaysNewAMI { @@ -27,9 +25,9 @@ class OnewaysNewAMI } } - private static class Callback + private static class CallbackBase { - Callback() + CallbackBase() { _called = false; } @@ -60,193 +58,39 @@ class OnewaysNewAMI private boolean _called; } - private static class NoEndpointCallbackUnsafe extends Ice.AsyncCallback + static class Callback extends CallbackBase { - @Override - public void completed(Ice.AsyncResult r) + public Callback() { - try - { - MyClassPrx p = MyClassPrxHelper.uncheckedCast(r.getProxy()); - p.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException ex) - { - callback.called(); - } - } - - @Override - public void sent(Ice.AsyncResult r) - { - test(false); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class NoEndpointCallbackSafe extends Callback_MyClass_opVoid - { - @Override - public void response() - { - test(false); } - @Override - public void exception(Ice.LocalException ex) + public void + sent(boolean sentSynchronously) { - test(ex instanceof Ice.NoEndpointException); - callback.called(); + called(); } - @Override - public void sent() + void noException(Ice.LocalException ex) { test(false); } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - enum ThrowType { LocalException, OtherException }; - - private static void throwEx(ThrowType t) - { - switch(t) - { - case LocalException: - throw new Ice.ObjectNotExistException(); - - case OtherException: - throw new NullPointerException(); - } - } - - private static class ThrowerUnsafeEx extends Ice.AsyncCallback - { - ThrowerUnsafeEx(ThrowType t) - { - _t = t; - } - - @Override - public void completed(Ice.AsyncResult r) + + void twowayOnlyException(Ice.LocalException ex) { - MyClassPrx p = (MyClassPrx)r.getProxy(); try { - p.end_opVoid(r); - test(false); + throw ex; } - catch(Ice.LocalException ex) - { - callback.called(); - throwEx(_t); - } - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } - - private static class ThrowerSafeEx extends Callback_MyClass_opVoid - { - ThrowerSafeEx(ThrowType t) - { - _t = t; - } - - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException ex) - { - callback.called(); - throwEx(_t); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } - - private static class PingCallback extends Ice.AsyncCallback - { - @Override - public void completed(Ice.AsyncResult r) - { - test(false); - } - } - - private static class SentCounter extends Ice.AsyncCallback - { - SentCounter() - { - _queuedCount = 0; - } - - @Override - public void completed(Ice.AsyncResult r) - { - test(false); - } - - @Override - public void sent(Ice.AsyncResult r) - { - synchronized(this) + catch(Ice.TwowayOnlyException e) { - ++_queuedCount; + called(); } - } - - synchronized int queuedCount() - { - return _queuedCount; - } - - synchronized void check(int size) - { - while(_queuedCount != size) + catch(Ice.LocalException e) { - try - { - wait(); - } - catch(InterruptedException ex) - { - } + test(false); } } - - private int _queuedCount; - } + }; static void onewaysNewAMI(test.Util.Application app, MyClassPrx proxy) @@ -255,291 +99,102 @@ class OnewaysNewAMI MyClassPrx p = (MyClassPrx)proxy.ice_oneway(); { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - Ice.AsyncResult r; - - r = indirect.begin_opVoid(); - try - { - indirect.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException ex) - { - } - - // - // Check that a second call to the end_ method throws IllegalArgumentException. - // - try - { - indirect.end_opVoid(r); - test(false); - } - catch(IllegalArgumentException ex) - { - } - - // - // Check that a call to a void operation raises NoEndpointException in the callback. - // Use type-unsafe and type-safe variations of the callback. - // Also test that the sent callback is not called in this case. - // - NoEndpointCallbackUnsafe cb1 = new NoEndpointCallbackUnsafe(); - indirect.begin_opVoid(cb1); - cb1.check(); - - NoEndpointCallbackSafe cb2 = new NoEndpointCallbackSafe(); - indirect.begin_opVoid(cb2); - cb2.check(); - - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws IllegalArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - MyClassPrx indirect1 = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - MyClassPrx indirect2 = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy2").ice_oneway()); - - Ice.AsyncResult r1 = indirect1.begin_opVoid(); - Ice.AsyncResult r2 = indirect2.begin_opVoid(); - - try - { - indirect1.end_opVoid(r2); // Wrong proxy - test(false); - } - catch(IllegalArgumentException ex) - { - } - - try - { - indirect1.end_shutdown(r1); // Wrong operation - test(false); - } - catch(IllegalArgumentException ex) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws IllegalArgumentException. - // - try - { - p.end_opVoid(null); - test(false); - } - catch(IllegalArgumentException ex) - { - } - } - - { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy").ice_oneway()); - - { - ThrowerSafeEx cb = new ThrowerSafeEx(ThrowType.LocalException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerSafeEx cb = new ThrowerSafeEx(ThrowType.OtherException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafeEx cb = new ThrowerUnsafeEx(ThrowType.LocalException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafeEx cb = new ThrowerUnsafeEx(ThrowType.OtherException); - indirect.begin_opVoid(cb); - cb.check(); - } - } - - { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties()._clone(); - Ice.Communicator ic = app.initialize(initData); - Ice.ObjectPrx obj = ic.stringToProxy(p.toString()).ice_oneway(); - MyClassPrx p2 = MyClassPrxHelper.uncheckedCast(obj); - - ic.destroy(); - - try - { - p2.begin_opVoid(); - test(false); - } - catch(Ice.CommunicatorDestroyedException ex) - { - // Expected. - } - } - - { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice.AsyncResult r = p.begin_ice_ping(); - try + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() { - p.end_ice_ping(r); - } - catch(RuntimeException ex) + public void + exception(Ice.LocalException ex) + { + cb.noException(ex); + } + + public void + sent(boolean sentSynchronously) + { + cb.sent(sentSynchronously); + } + }; + p.begin_ice_ping(callback); + cb.check(); + } + + { + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() { - test(false); - } - } - - { - PingCallback cb = new PingCallback(); - p.begin_ice_ping(cb); - } + public void + exception(Ice.LocalException ex) + { + cb.twowayOnlyException(ex); + } + }; + p.begin_ice_isA("::Test::MyClass", callback); + cb.check(); + } + + { + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.twowayOnlyException(ex); + } + }; + p.begin_ice_id(callback); + cb.check(); + } + + { + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.twowayOnlyException(ex); + } + }; + p.begin_ice_ids(callback); + cb.check(); } - // - // Test that marshaling works as expected, and that the delegates for each type of callback work. - // - { - Ice.AsyncResult r = p.begin_opVoid(); - p.end_opVoid(r); + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + { + public void + exception(Ice.LocalException ex) + { + cb.noException(ex); + } + + public void + sent(boolean sentSynchronously) + { + cb.sent(sentSynchronously); + } + }; + p.begin_opVoid(callback); + cb.check(); } // // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. // { - Ice.AsyncResult r = p.begin_opByte((byte)0xff, (byte)0x0f); - try - { - p.end_opByte(null, r); - test(false); - } - catch(Ice.TwowayOnlyException ex) - { - } - } - - // - // Test that queuing indication works. - // - { - Ice.AsyncResult r = p.begin_delay(100); - r.waitForSent(); - test(r.isCompleted() && r.isSent()); - p.end_delay(r); - test(r.isCompleted()); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - final int contextSize = 10; // Kilobytes - StringBuilder s = new StringBuilder(); - for(int i = 0; i < 1024; ++i) - { - s.append('a'); - } - - java.util.Map ctx = new java.util.HashMap(); - for(int i = 0; i < contextSize; ++i) - { - ctx.put("i" + i, s.toString()); - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // - java.util.ArrayList results = new java.util.ArrayList(); - - int queuedCount = 0; - - SentCounter cb = new SentCounter(); - Ice.AsyncResult r; - - StateChangerPrx state = - StateChangerPrxHelper.checkedCast(communicator.stringToProxy("hold:default -p 12011")); - state.hold(3); - - do - { - r = p.begin_opVoid(ctx, cb); - results.add(r); - if(!r.sentSynchronously()) - { - ++queuedCount; - } - } - while(r.sentSynchronously()); - - int numRequests = results.size(); - test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - - // - // Re-enable the adapter. - // - state.activate(3); - - // - // Fire off a bunch more requests until we get one that wasn't queued. - // We sleep in between calls to allow the queued requests to drain. - // - do - { - r = p.begin_opVoid(cb); - results.add(r); - if(!r.sentSynchronously()) - { - ++queuedCount; - } - try - { - Thread.sleep(1); - } - catch(InterruptedException ex) + final Callback cb = new Callback(); + Ice.ExceptionCallback callback = new Ice.ExceptionCallback() { - } - } - while(!r.sentSynchronously()); - test(results.size() > numRequests); // Something is wrong if we didn't queue additional requests. - - // - // Now make all the outstanding calls to the end_ method. - // - for(Ice.AsyncResult ar : results) - { - p.end_opVoid(ar); - } - - // - // Check that we got a sent callback for each queued request. - // - cb.check(queuedCount); + public void + exception(Ice.LocalException ex) + { + cb.twowayOnlyException(ex); + } + }; + p.begin_opByte((byte)0xff, (byte)0x0f, callback); + cb.check(); } } } diff --git a/java/test/Ice/operations/Server.java b/java/test/Ice/operations/Server.java index cc07322246f..15ae2db8397 100644 --- a/java/test/Ice/operations/Server.java +++ b/java/test/Ice/operations/Server.java @@ -17,12 +17,6 @@ public class Server extends test.Util.Application Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test")); adapter.activate(); - - communicator().getProperties().setProperty("HoldAdapter.Endpoints", "default -p 12011:udp"); - Ice.ObjectAdapter holdAdapter = communicator().createObjectAdapter("HoldAdapter"); - holdAdapter.add(new StateChangerI(new java.util.Timer(), adapter), communicator().stringToIdentity("hold")); - holdAdapter.activate(); - return WAIT; } diff --git a/java/test/Ice/operations/StateChanger.ice b/java/test/Ice/operations/StateChanger.ice deleted file mode 100644 index 54f78ae8fd6..00000000000 --- a/java/test/Ice/operations/StateChanger.ice +++ /dev/null @@ -1,25 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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 STATECHANGER_ICE -#define STATECHANGER_ICE - -[["java:package:test.Ice.operations"]] -module Test -{ - -interface StateChanger -{ - void hold(int milliSeconds); - void activate(int milliSeconds); -}; - -}; - -#endif diff --git a/java/test/Ice/operations/StateChangerI.java b/java/test/Ice/operations/StateChangerI.java deleted file mode 100644 index 5053e0db5fd..00000000000 --- a/java/test/Ice/operations/StateChangerI.java +++ /dev/null @@ -1,63 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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. -// -// ********************************************************************** - -package test.Ice.operations; - -import test.Ice.operations.Test._StateChangerDisp; - -class StateChangerI extends _StateChangerDisp -{ - public StateChangerI(java.util.Timer timer, Ice.ObjectAdapter adapter) - { - _timer = timer; - _otherAdapter = adapter; - } - - public void hold(int milliSeconds, Ice.Current current) - { - if(milliSeconds <= 0) - { - _otherAdapter.hold(); - _otherAdapter.waitForHold(); - } - else - { - _timer.schedule(new java.util.TimerTask() - { - public void - run() - { - _otherAdapter.hold(); - } - }, milliSeconds); - } - } - - public void activate(int milliSeconds, Ice.Current current) - { - if(milliSeconds <= 0) - { - _otherAdapter.activate(); - } - else - { - _timer.schedule(new java.util.TimerTask() - { - public void - run() - { - _otherAdapter.activate(); - } - }, milliSeconds); - } - } - - private final java.util.Timer _timer; - private final Ice.ObjectAdapter _otherAdapter; -} diff --git a/java/test/Ice/operations/TwowaysNewAMI.java b/java/test/Ice/operations/TwowaysNewAMI.java index 60c444f3b62..e6805d85fbc 100644 --- a/java/test/Ice/operations/TwowaysNewAMI.java +++ b/java/test/Ice/operations/TwowaysNewAMI.java @@ -49,8 +49,6 @@ import test.Ice.operations.Test.MyDerivedClassPrxHelper; import test.Ice.operations.Test.MyEnum; import test.Ice.operations.Test.Structure; import test.Ice.operations.Test.MyStruct; -import test.Ice.operations.Test.StateChangerPrx; -import test.Ice.operations.Test.StateChangerPrxHelper; class TwowaysNewAMI { @@ -96,25 +94,16 @@ class TwowaysNewAMI private boolean _called; } - private static class NoEndpointCallbackUnsafe extends Ice.AsyncCallback + private static class pingI extends Ice.Callback_Object_ice_ping { @Override - public void completed(Ice.AsyncResult r) + public void response() { - try - { - MyClassPrx p = MyClassPrxHelper.uncheckedCast(r.getProxy()); - p.end_opVoid(r); - callback.called(); - } - catch(Ice.NoEndpointException ex) - { - test(false); - } + callback.called(); } @Override - public void sent(Ice.AsyncResult r) + public void exception(Ice.LocalException ex) { test(false); } @@ -127,25 +116,17 @@ class TwowaysNewAMI private Callback callback = new Callback(); } - private static class NoEndpointCallbackUnsafeEx extends Ice.AsyncCallback + private static class isAI extends Ice.Callback_Object_ice_isA { @Override - public void completed(Ice.AsyncResult r) + public void response(boolean r) { - try - { - MyClassPrx p = MyClassPrxHelper.uncheckedCast(r.getProxy()); - p.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException ex) - { - callback.called(); - } + test(r); + callback.called(); } @Override - public void sent(Ice.AsyncResult r) + public void exception(Ice.LocalException ex) { test(false); } @@ -158,23 +139,40 @@ class TwowaysNewAMI private Callback callback = new Callback(); } - private static class NoEndpointCallbackSafe extends Callback_MyClass_opVoid + private static class idI extends Ice.Callback_Object_ice_id { @Override - public void response() + public void response(String id) { - test(false); + test(id.equals("::Test::MyDerivedClass")); + callback.called(); } @Override public void exception(Ice.LocalException ex) { - test(ex instanceof Ice.NoEndpointException); + test(false); + } + + public void check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + private static class idsI extends Ice.Callback_Object_ice_ids + { + @Override + public void response(String[] ids) + { + test(ids.length == 3); callback.called(); } @Override - public void sent() + public void exception(Ice.LocalException ex) { test(false); } @@ -1241,686 +1239,186 @@ class TwowaysNewAMI private Callback callback = new Callback(); } - private static class IsACallbackUnsafe extends Ice.AsyncCallback + static void + twowaysNewAMI(test.Util.Application app, MyClassPrx p) { - @Override - public void completed(Ice.AsyncResult r) - { - test(r.getProxy().end_ice_isA(r)); - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } + Ice.Communicator communicator = app.communicator(); - private static class IsACallbackSafe extends Ice.Callback_Object_ice_isA - { - @Override - public void response(boolean ret) { - test(ret); - callback.called(); + pingI cb = new pingI(); + p.begin_ice_ping(cb); + cb.check(); } - @Override - public void exception(Ice.LocalException ex) { - test(false); + isAI cb = new isAI(); + p.begin_ice_isA("::Test::MyClass", cb); + cb.check(); } - - public void check() + { - callback.check(); + idI cb = new idI(); + p.begin_ice_id(cb); + cb.check(); } - - private Callback callback = new Callback(); - } - - private static class PingCallbackUnsafe extends Ice.AsyncCallback - { - @Override - public void completed(Ice.AsyncResult r) + { - r.getProxy().end_ice_ping(r); - callback.called(); + idsI cb = new idsI(); + p.begin_ice_ids(cb); + cb.check(); } - public void check() { - callback.check(); + Ice.AsyncResult r = p.begin_opVoid(); + p.end_opVoid(r); } - private Callback callback = new Callback(); - } - - private static class PingCallbackSafe extends Ice.Callback_Object_ice_ping - { - @Override - public void response() { - callback.called(); + opVoidI cb = new opVoidI(); + p.begin_opVoid(cb); + cb.check(); } - @Override - public void exception(Ice.LocalException ex) { - test(false); + Ice.AsyncResult r = p.begin_opByte((byte)0xff, (byte)0x0f); + Ice.ByteHolder p3 = new Ice.ByteHolder(); + byte ret = p.end_opByte(p3, r); + test(p3.value == (byte)0xf0); + test(ret == (byte)0xff); } - public void check() { - callback.check(); + opByteI cb = new opByteI(); + p.begin_opByte((byte)0xff, (byte)0x0f, cb); + cb.check(); } - private Callback callback = new Callback(); - } - - private static class IdsCallbackUnsafe extends Ice.AsyncCallback - { - @Override - public void completed(Ice.AsyncResult r) { - test(java.util.Arrays.equals(r.getProxy().end_ice_ids(r), r.getProxy().ice_ids())); - callback.called(); + opBoolI cb = new opBoolI(); + p.begin_opBool(true, false, cb); + cb.check(); } - public void check() { - callback.check(); + opShortIntLongI cb = new opShortIntLongI(); + p.begin_opShortIntLong((short)10, 11, 12L, cb); + cb.check(); } - private Callback callback = new Callback(); - } - - private static class IdsCallbackSafe extends Ice.Callback_Object_ice_ids - { - IdsCallbackSafe(String[] ids) { - _ids = ids; + opFloatDoubleI cb = new opFloatDoubleI(); + p.begin_opFloatDouble(3.14f, 1.1E10, cb); + cb.check(); } - @Override - public void response(String[] ids) { - test(java.util.Arrays.equals(ids, _ids)); - callback.called(); + opStringI cb = new opStringI(); + p.begin_opString("hello", "world", cb); + cb.check(); } - @Override - public void exception(Ice.LocalException ex) { - test(false); + opMyEnumI cb = new opMyEnumI(); + p.begin_opMyEnum(MyEnum.enum2, cb); + cb.check(); } - public void check() { - callback.check(); + opMyClassI cb = new opMyClassI(communicator); + p.begin_opMyClass(p, cb); + cb.check(); } - private String[] _ids; - private Callback callback = new Callback(); - } - - private static class IdCallbackUnsafe extends Ice.AsyncCallback - { - @Override - public void completed(Ice.AsyncResult r) { - test(r.getProxy().end_ice_id(r).equals(r.getProxy().ice_id())); - callback.called(); - } + Structure si1 = new Structure(); + si1.p = p; + si1.e = MyEnum.enum3; + si1.s = new AnotherStruct(); + si1.s.s = "abc"; + Structure si2 = new Structure(); + si2.p = null; + si2.e = MyEnum.enum2; + si2.s = new AnotherStruct(); + si2.s.s = "def"; - public void check() - { - callback.check(); + opStructI cb = new opStructI(communicator); + p.begin_opStruct(si1, si2, cb); + cb.check(); } - private Callback callback = new Callback(); - } - - private static class IdCallbackSafe extends Ice.Callback_Object_ice_id - { - IdCallbackSafe(String id) { - _id = id; - } + final byte[] bsi1 = + { + (byte)0x01, + (byte)0x11, + (byte)0x12, + (byte)0x22 + }; + final byte[] bsi2 = + { + (byte)0xf1, + (byte)0xf2, + (byte)0xf3, + (byte)0xf4 + }; - @Override - public void response(String id) - { - test(id.equals(_id)); - callback.called(); + opByteSI cb = new opByteSI(); + p.begin_opByteS(bsi1, bsi2, cb); + cb.check(); } - @Override - public void exception(Ice.LocalException ex) { - test(false); - } + final boolean[] bsi1 = { true, true, false }; + final boolean[] bsi2 = { false }; - public void check() - { - callback.check(); + opBoolSI cb = new opBoolSI(); + p.begin_opBoolS(bsi1, bsi2, cb); + cb.check(); } - private String _id; - private Callback callback = new Callback(); - } - - enum ThrowType { LocalException, OtherException }; - - private static void throwEx(ThrowType t) - { - switch(t) { - case LocalException: - throw new Ice.ObjectNotExistException(); + final short[] ssi = { 1, 2, 3 }; + final int[] isi = { 5, 6, 7, 8 }; + final long[] lsi = { 10, 30, 20 }; - case OtherException: - throw new NullPointerException(); + opShortIntLongSI cb = new opShortIntLongSI(); + p.begin_opShortIntLongS(ssi, isi, lsi, cb); + cb.check(); } - } - private static class ThrowerUnsafe extends Ice.AsyncCallback - { - ThrowerUnsafe(ThrowType t) { - _t = t; - } + final float[] fsi = { 3.14f, 1.11f }; + final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - @Override - public void completed(Ice.AsyncResult r) - { - MyClassPrx p = (MyClassPrx)r.getProxy(); - p.end_opVoid(r); - callback.called(); - throwEx(_t); + opFloatDoubleSI cb = new opFloatDoubleSI(); + p.begin_opFloatDoubleS(fsi, dsi, cb); + cb.check(); } - public void check() { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } + final String[] ssi1 = { "abc", "de", "fghi" }; + final String[] ssi2 = { "xyz" }; - private static class ThrowerSafe extends Callback_MyClass_opVoid - { - ThrowerSafe(ThrowType t) - { - _t = t; + opStringSI cb = new opStringSI(); + p.begin_opStringS(ssi1, ssi2, cb); + cb.check(); } - @Override - public void response() { - callback.called(); - throwEx(_t); - } + final byte[][] bsi1 = + { + { (byte)0x01, (byte)0x11, (byte)0x12 }, + { (byte)0xff } + }; + final byte[][] bsi2 = + { + { (byte)0x0e }, + { (byte)0xf2, (byte)0xf1 } + }; - @Override - public void exception(Ice.LocalException ex) - { - test(false); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } - - private static class ThrowerUnsafeEx extends Ice.AsyncCallback - { - ThrowerUnsafeEx(ThrowType t) - { - _t = t; - } - - @Override - public void completed(Ice.AsyncResult r) - { - MyClassPrx p = (MyClassPrx)r.getProxy(); - try - { - p.end_opVoid(r); - test(false); - } - catch(Ice.LocalException ex) - { - callback.called(); - throwEx(_t); - } - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } - - private static class ThrowerSafeEx extends Callback_MyClass_opVoid - { - ThrowerSafeEx(ThrowType t) - { - _t = t; - } - - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException ex) - { - callback.called(); - throwEx(_t); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private ThrowType _t; - } - - private static class SentCounter extends Ice.AsyncCallback - { - SentCounter() - { - _queuedCount = 0; - _completedCount = 0; - } - - @Override - public void completed(Ice.AsyncResult r) - { - test(r.isCompleted()); - synchronized(this) - { - ++_completedCount; - notify(); - } - } - - @Override - public void sent(Ice.AsyncResult r) - { - synchronized(this) - { - ++_queuedCount; - } - } - - synchronized int queuedCount() - { - return _queuedCount; - } - - synchronized void check(int size) - { - while(_completedCount != size) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - } - } - } - - private int _queuedCount; - private int _completedCount; - } - - static void - twowaysNewAMI(test.Util.Application app, MyClassPrx p) - { - Ice.Communicator communicator = app.communicator(); - - { - // - // Check that a call to a void operation raises NoEndpointException - // in the end_ method instead of at the point of call. - // - MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - Ice.AsyncResult r; - - r = indirect.begin_opVoid(); - try - { - indirect.end_opVoid(r); - test(false); - } - catch(Ice.NoEndpointException ex) - { - } - - // - // Check that a second call to the end_ method throws IllegalArgumentException. - // - try - { - indirect.end_opVoid(r); - test(false); - } - catch(IllegalArgumentException ex) - { - } - - // - // Use type-unsafe and type-safe variations of the callback. - // Also test that the sent callback is not called in this case. - // - NoEndpointCallbackUnsafeEx cb1 = new NoEndpointCallbackUnsafeEx(); - indirect.begin_opVoid(cb1); - cb1.check(); - - NoEndpointCallbackSafe cb2 = new NoEndpointCallbackSafe(); - indirect.begin_opVoid(cb2); - cb2.check(); - - // - // Check that calling the end_ method with a different proxy or for a different operation than the begin_ - // method throws IllegalArgumentException. If the test throws as expected, we never call the end_ method, - // so this also tests that it is safe to throw the AsyncResult away without calling the end_ method. - // - MyClassPrx indirect1 = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - MyClassPrx indirect2 = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy2")); - - Ice.AsyncResult r1 = indirect1.begin_opVoid(); - Ice.AsyncResult r2 = indirect2.begin_opVoid(); - - try - { - indirect1.end_opVoid(r2); // Wrong proxy - test(false); - } - catch(IllegalArgumentException ex) - { - } - - try - { - indirect1.end_shutdown(r1); // Wrong operation - test(false); - } - catch(IllegalArgumentException ex) - { - } - } - - { - // - // Check that calling the end_ method with a null result throws IllegalArgumentException. - // - try - { - p.end_opVoid(null); - test(false); - } - catch(IllegalArgumentException ex) - { - } - } - - { - // - // Check that throwing an exception from the success callback doesn't cause problems. - // - { - ThrowerSafe cb = new ThrowerSafe(ThrowType.LocalException); - p.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerSafe cb = new ThrowerSafe(ThrowType.OtherException); - p.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafe cb = new ThrowerUnsafe(ThrowType.LocalException); - p.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafe cb = new ThrowerUnsafe(ThrowType.OtherException); - p.begin_opVoid(cb); - cb.check(); - } - } - - { - // - // Check that throwing an exception from the exception callback doesn't cause problems. - // - MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - - { - ThrowerSafeEx cb = new ThrowerSafeEx(ThrowType.LocalException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerSafeEx cb = new ThrowerSafeEx(ThrowType.OtherException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafeEx cb = new ThrowerUnsafeEx(ThrowType.LocalException); - indirect.begin_opVoid(cb); - cb.check(); - } - - { - ThrowerUnsafeEx cb = new ThrowerUnsafeEx(ThrowType.OtherException); - indirect.begin_opVoid(cb); - cb.check(); - } - } - - { - // - // Check that CommunicatorDestroyedException is raised directly. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties()._clone(); - Ice.Communicator ic = app.initialize(initData); - Ice.ObjectPrx obj = ic.stringToProxy(p.toString()); - MyClassPrx p2 = MyClassPrxHelper.checkedCast(obj); - - ic.destroy(); - - try - { - p2.begin_opVoid(); - test(false); - } - catch(Ice.CommunicatorDestroyedException ex) - { - // Expected. - } - } - - // - // Test that marshaling works as expected, and that the delegates for each type of callback work. - // - - { - Ice.AsyncResult r = p.begin_opVoid(); - p.end_opVoid(r); - } - - { - opVoidI cb = new opVoidI(); - p.begin_opVoid(cb); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_opByte((byte)0xff, (byte)0x0f); - Ice.ByteHolder p3 = new Ice.ByteHolder(); - byte ret = p.end_opByte(p3, r); - test(p3.value == (byte)0xf0); - test(ret == (byte)0xff); - } - - { - opByteI cb = new opByteI(); - p.begin_opByte((byte)0xff, (byte)0x0f, cb); - cb.check(); - } - - { - opBoolI cb = new opBoolI(); - p.begin_opBool(true, false, cb); - cb.check(); - } - - { - opShortIntLongI cb = new opShortIntLongI(); - p.begin_opShortIntLong((short)10, 11, 12L, cb); - cb.check(); - } - - { - opFloatDoubleI cb = new opFloatDoubleI(); - p.begin_opFloatDouble(3.14f, 1.1E10, cb); - cb.check(); - } - - { - opStringI cb = new opStringI(); - p.begin_opString("hello", "world", cb); - cb.check(); - } - - { - opMyEnumI cb = new opMyEnumI(); - p.begin_opMyEnum(MyEnum.enum2, cb); - cb.check(); - } - - { - opMyClassI cb = new opMyClassI(communicator); - p.begin_opMyClass(p, cb); - cb.check(); - } - - { - Structure si1 = new Structure(); - si1.p = p; - si1.e = MyEnum.enum3; - si1.s = new AnotherStruct(); - si1.s.s = "abc"; - Structure si2 = new Structure(); - si2.p = null; - si2.e = MyEnum.enum2; - si2.s = new AnotherStruct(); - si2.s.s = "def"; - - opStructI cb = new opStructI(communicator); - p.begin_opStruct(si1, si2, cb); - cb.check(); - } - - { - final byte[] bsi1 = - { - (byte)0x01, - (byte)0x11, - (byte)0x12, - (byte)0x22 - }; - final byte[] bsi2 = - { - (byte)0xf1, - (byte)0xf2, - (byte)0xf3, - (byte)0xf4 - }; - - opByteSI cb = new opByteSI(); - p.begin_opByteS(bsi1, bsi2, cb); - cb.check(); - } - - { - final boolean[] bsi1 = { true, true, false }; - final boolean[] bsi2 = { false }; - - opBoolSI cb = new opBoolSI(); - p.begin_opBoolS(bsi1, bsi2, cb); - cb.check(); - } - - { - final short[] ssi = { 1, 2, 3 }; - final int[] isi = { 5, 6, 7, 8 }; - final long[] lsi = { 10, 30, 20 }; - - opShortIntLongSI cb = new opShortIntLongSI(); - p.begin_opShortIntLongS(ssi, isi, lsi, cb); - cb.check(); - } - - { - final float[] fsi = { 3.14f, 1.11f }; - final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - - opFloatDoubleSI cb = new opFloatDoubleSI(); - p.begin_opFloatDoubleS(fsi, dsi, cb); - cb.check(); - } - - { - final String[] ssi1 = { "abc", "de", "fghi" }; - final String[] ssi2 = { "xyz" }; - - opStringSI cb = new opStringSI(); - p.begin_opStringS(ssi1, ssi2, cb); - cb.check(); - } - - { - final byte[][] bsi1 = - { - { (byte)0x01, (byte)0x11, (byte)0x12 }, - { (byte)0xff } - }; - final byte[][] bsi2 = - { - { (byte)0x0e }, - { (byte)0xf2, (byte)0xf1 } - }; - - opByteSSI cb = new opByteSSI(); - p.begin_opByteSS(bsi1, bsi2, cb); - cb.check(); + opByteSSI cb = new opByteSSI(); + p.begin_opByteSS(bsi1, bsi2, cb); + cb.check(); } { @@ -2234,207 +1732,5 @@ class TwowaysNewAMI derived.begin_opDerived(cb); cb.check(); } - - { - // - // Check that we can call operations on Object asynchronously. - // - { - Ice.AsyncResult r = p.begin_ice_isA(MyClass.ice_staticId()); - try - { - test(p.end_ice_isA(r)); - } - catch(RuntimeException ex) - { - test(false); - } - } - - { - IsACallbackUnsafe cb = new IsACallbackUnsafe(); - p.begin_ice_isA(MyClass.ice_staticId(), cb); - cb.check(); - } - - { - IsACallbackSafe cb = new IsACallbackSafe(); - p.begin_ice_isA(MyClass.ice_staticId(), cb); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_ping(); - try - { - p.end_ice_ping(r); - } - catch(RuntimeException ex) - { - test(false); - } - } - - { - PingCallbackUnsafe cb = new PingCallbackUnsafe(); - p.begin_ice_ping(cb); - cb.check(); - } - - { - PingCallbackSafe cb = new PingCallbackSafe(); - p.begin_ice_ping(cb); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_ids(); - try - { - test(java.util.Arrays.equals(p.end_ice_ids(r), p.ice_ids())); - } - catch(RuntimeException ex) - { - test(false); - } - } - - { - IdsCallbackUnsafe cb = new IdsCallbackUnsafe(); - p.begin_ice_ids(cb); - cb.check(); - } - - { - IdsCallbackSafe cb = new IdsCallbackSafe(p.ice_ids()); - p.begin_ice_ids(cb); - cb.check(); - } - - { - Ice.AsyncResult r = p.begin_ice_id(); - try - { - test(p.end_ice_id(r).equals(p.ice_id())); - } - catch(RuntimeException ex) - { - test(false); - } - } - - { - IdCallbackUnsafe cb = new IdCallbackUnsafe(); - p.begin_ice_id(cb); - cb.check(); - } - - { - IdCallbackSafe cb = new IdCallbackSafe(p.ice_id()); - p.begin_ice_id(cb); - cb.check(); - } - } - - // - // Test that queuing indication works. - // - { - Ice.AsyncResult r = p.begin_delay(100); - test(!r.isCompleted()); - p.end_delay(r); - test(r.isCompleted()); - } - - // - // Put the server's adapter into the holding state and pump out requests until one is queued. - // Then activate the adapter again and pump out more until one isn't queued again. - // Check that all the callbacks arrive after calling the end_ method for each request. - // We fill a context with a few kB of data to make sure we don't queue up too many requests. - // - { - final int contextSize = 10; // Kilobytes - StringBuilder s = new StringBuilder(); - for(int i = 0; i < 1024; ++i) - { - s.append('a'); - } - - java.util.Map ctx = new java.util.HashMap(); - for(int i = 0; i < contextSize; ++i) - { - ctx.put("" + i, s.toString()); - } - - // - // Keep all the AsyncResults we get from the begin_ calls, so we can call end_ for each of them. - // - java.util.ArrayList results = new java.util.ArrayList(); - - int queuedCount = 0; - - SentCounter cb = new SentCounter(); - Ice.AsyncResult r; - - StateChangerPrx state = - StateChangerPrxHelper.checkedCast(communicator.stringToProxy("hold:default -p 12011")); - state.hold(3); - - do - { - r = p.begin_opVoid(ctx, cb); - results.add(r); - if(!r.sentSynchronously()) - { - ++queuedCount; - } - } - while(r.sentSynchronously()); - - int numRequests = results.size(); - test(numRequests > 1); // Something is wrong if we didn't get something out without queueing. - - // - // Re-enable the adapter. - // - state.activate(3); - - // - // Fire off a bunch more requests until we get one that wasn't queued. - // We sleep in between calls to allow the queued requests to drain. - // - do - { - r = p.begin_opVoid(cb); - results.add(r); - if(!r.sentSynchronously()) - { - ++queuedCount; - } - try - { - Thread.sleep(1); - } - catch(InterruptedException ex) - { - } - } - while(!r.sentSynchronously()); - test(results.size() > numRequests); // Something is wrong if we didn't queue additional requests. - - // - // Now make all the outstanding calls to the end_ method. - // - for(Ice.AsyncResult ar : results) - { - p.end_opVoid(ar); - } - - // - // Check that all the callbacks have arrived and that we got a sent callback for each queued request. - // - cb.check(results.size()); - test(cb.queuedCount() == queuedCount); - } } } -- cgit v1.2.3 From 9aef7822702155a4bd562765c672d73dcbe8b471 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 26 Nov 2009 22:58:16 +0100 Subject: 4385 - new StreamApi & UserExecption --- cpp/include/Ice/Stream.h | 19 ++++++++++ cpp/src/slice2cpp/Gen.cpp | 21 +++++++++++ cpp/src/slice2cpp/Gen.h | 2 ++ cpp/test/Ice/stream/Client.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++ cpp/test/Ice/stream/Test.ice | 23 ++++++++++++ 5 files changed, 144 insertions(+) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h index 658aee69cd2..20ce5481893 100644 --- a/cpp/include/Ice/Stream.h +++ b/cpp/include/Ice/Stream.h @@ -38,6 +38,7 @@ enum StreamTraitType StreamTraitTypeIntEnum, // Enums with more than 32767 enumerators StreamTraitTypeSequence, StreamTraitTypeDictionary, + StreamTraitTypeUserException, StreamTraitTypeUnknown }; @@ -68,6 +69,13 @@ struct StreamTrait< std::vector > static const int enumLimit = 0; // Used to implement enum range check }; +template<> +struct StreamTrait +{ + static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeUserException; + static const int enumLimit = 0; // Used to implement enum range check +}; + // // StreamTrait specialization for std::map. // @@ -691,6 +699,17 @@ struct StreamReader } } }; + +template<> // Writer specialization for UserExceptions. +struct StreamWriter +{ + template + static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + { + outS->writeException(v); + } +}; + #endif class ICE_API ObjectReader : public ::Ice::Object diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 1b0dd3d0294..fa2e480a625 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -6635,6 +6635,27 @@ Slice::Gen::StreamVisitor::visitModuleEnd(const ModulePtr&) H.restoreIndent(); } +bool +Slice::Gen::StreamVisitor::visitExceptionStart(const ExceptionPtr& p) +{ + if(!p->isLocal()) + { + string scoped = p->scoped(); + H << nl << sp << "template<>"; + H << nl << "struct StreamTrait< " << fixKwd(scoped) << " >" << nl; + H << sb; + H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeUserException;" << nl; + H << nl << "static const int enumLimit = 0;"; + H << eb << ";" << nl; + } + return true; +} + +void +Slice::Gen::StreamVisitor::visitExceptionEnd(const ExceptionPtr&) +{ +} + bool Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) { diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 5074240bc73..a7834e9c75e 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -448,6 +448,8 @@ private: virtual void visitModuleEnd(const ModulePtr&); virtual bool visitStructStart(const StructPtr&); virtual void visitStructEnd(const StructPtr&); + virtual bool visitExceptionStart(const ExceptionPtr&); + virtual void visitExceptionEnd(const ExceptionPtr&); virtual void visitEnum(const EnumPtr&); private: diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index 3e0e5f6b663..6b0c7cd1d7e 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -584,6 +584,85 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) test(reader->obj); test(reader->obj->s.e == Test::enum2); } + + { + out = Ice::createOutputStream(communicator); + Test::MyException ex; + Test::MyClassForExceptionPtr c = new Test::MyClassForException; + c->c = c; + c->o = c; + c->s.e = Test::enum2; + + c->seq1.push_back(true); + c->seq1.push_back(false); + c->seq1.push_back(true); + c->seq1.push_back(false); + + c->seq2.push_back(1); + c->seq2.push_back(2); + c->seq2.push_back(3); + c->seq2.push_back(4); + + c->seq3.push_back(1); + c->seq3.push_back(2); + c->seq3.push_back(3); + c->seq3.push_back(4); + + c->seq4.push_back(1); + c->seq4.push_back(2); + c->seq4.push_back(3); + c->seq4.push_back(4); + + c->seq5.push_back(1); + c->seq5.push_back(2); + c->seq5.push_back(3); + c->seq5.push_back(4); + + c->seq6.push_back(1); + c->seq6.push_back(2); + c->seq6.push_back(3); + c->seq6.push_back(4); + + c->seq7.push_back(1); + c->seq7.push_back(2); + c->seq7.push_back(3); + c->seq7.push_back(4); + + c->seq8.push_back("string1"); + c->seq8.push_back("string2"); + c->seq8.push_back("string3"); + c->seq8.push_back("string4"); + + c->seq9.push_back(Test::enum3); + c->seq9.push_back(Test::enum2); + c->seq9.push_back(Test::enum1); + + ex.c = c; + + out->write(ex); + out->writePendingObjects(); + out->finished(data); + + in = Ice::createInputStream(communicator, data); + try + { + in->throwException(); + test(false); + } + catch(const Test::MyException& ex1) + { + test(ex1.c->s.e == c->s.e); + test(ex1.c->seq1 == c->seq1); + test(ex1.c->seq2 == c->seq2); + test(ex1.c->seq3 == c->seq3); + test(ex1.c->seq4 == c->seq4); + test(ex1.c->seq5 == c->seq5); + test(ex1.c->seq6 == c->seq6); + test(ex1.c->seq7 == c->seq7); + test(ex1.c->seq8 == c->seq8); + test(ex1.c->seq9 == c->seq9); + } + } cout << "ok" << endl; diff --git a/cpp/test/Ice/stream/Test.ice b/cpp/test/Ice/stream/Test.ice index dafd2f02d41..6f7d4be6551 100644 --- a/cpp/test/Ice/stream/Test.ice +++ b/cpp/test/Ice/stream/Test.ice @@ -86,6 +86,29 @@ interface MyInterface { }; +class MyClassForException +{ + MyClassForException c; + Object o; + SmallStruct s; + BoolS seq1; + ByteS seq2; + ShortS seq3; + IntS seq4; + LongS seq5; + FloatS seq6; + DoubleS seq7; + StringS seq8; + MyEnumS seq9; +}; + + + +exception MyException +{ + MyClassForException c; +}; + }; #endif -- cgit v1.2.3 From 7da7bd6dfa7cf1d89afaab1e3e293891d881136b Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 2 Dec 2009 20:58:58 +0100 Subject: More AMI mapping improvements --- cpp/include/Ice/OutgoingAsync.h | 155 +----- cpp/include/Ice/Proxy.h | 536 +++++++++++++++--- cpp/src/Glacier2/SessionRouterI.cpp | 48 +- cpp/src/Glacier2/SessionRouterI.h | 6 +- cpp/src/Ice/Proxy.cpp | 25 +- cpp/src/slice2cpp/Gen.cpp | 123 ++-- cpp/src/slice2cs/Gen.cpp | 14 +- cpp/src/slice2java/Gen.cpp | 4 +- cpp/test/Ice/ami/AllTests.cpp | 187 ++++--- cpp/test/Ice/background/AllTests.cpp | 36 +- cpp/test/Ice/custom/AllTests.cpp | 72 +-- cpp/test/Ice/dispatcher/AllTests.cpp | 6 +- cpp/test/Ice/invoke/AllTests.cpp | 21 +- cpp/test/Ice/operations/OnewaysNewAMI.cpp | 15 +- cs/src/Ice/OutgoingAsync.cs | 199 ++++--- cs/src/Ice/Proxy.cs | 37 +- cs/test/Ice/ami/AllTests.cs | 72 ++- cs/test/Ice/background/AllTests.cs | 837 ++++++++++++++-------------- cs/test/Ice/dispatcher/AllTests.cs | 8 +- cs/test/Ice/invoke/AllTests.cs | 4 +- cs/test/Ice/invoke/client.exe.config | 6 + cs/test/Ice/invoke/server.exe.config | 6 + cs/test/Ice/operations/OnewaysNewAMI.cs | 4 +- java/demo/Ice/applet/HelloApplet.java | 2 +- java/demo/Ice/swing/Client.java | 2 +- java/src/Ice/AsyncResult.java | 2 +- java/src/Ice/ExceptionCallback.java | 50 -- java/src/Ice/ObjectPrxHelperBase.java | 6 +- java/src/Ice/OnewayCallback.java | 2 +- java/src/Ice/TwowayCallback.java | 2 +- java/test/Ice/ami/AllTests.java | 130 +---- java/test/Ice/background/AllTests.java | 32 +- java/test/Ice/dispatcher/AllTests.java | 6 +- java/test/Ice/operations/OnewaysNewAMI.java | 50 +- 34 files changed, 1473 insertions(+), 1232 deletions(-) create mode 100755 cs/test/Ice/invoke/client.exe.config create mode 100755 cs/test/Ice/invoke/server.exe.config delete mode 100644 java/src/Ice/ExceptionCallback.java (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index f5df28f04a8..194a83f895b 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -65,7 +65,7 @@ public: bool isSent() const; void waitForSent(); - bool sentSynchronously() const + bool isSentSynchronously() const { return _sentSynchronously; // No lock needed, immutable once __send() is called } @@ -338,126 +338,6 @@ public: Callback sent; }; -// -// Generic callback template that can be used when only the exception -// and sent callbacks are needed (even for twoway calls). -// -template -class ExceptionCallbackNC : public GenericCallbackBase -{ -public: - - typedef T callback_type; - - typedef IceUtil::Handle TPtr; - - typedef void (T::*Exception)(const ::Ice::Exception&); - typedef void (T::*Sent)(bool); - - ExceptionCallbackNC(const TPtr& instance, Exception excb, Sent sentcb) : - callback(instance), exception(excb), sent(sentcb) - { - checkCallback(instance, excb != 0); - } - - virtual void __completed(const ::Ice::AsyncResultPtr& result) const - { - try - { - result->__wait(); - } - catch(const ::Ice::Exception& ex) - { - (callback.get()->*exception)(ex); - } - } - - virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& __cookie) - { - if(__cookie) // Makes sure begin_ was called without a cookie - { - throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "cookie specified for callback without cookie"); - } - return this; - } - - virtual void __sent(const ::Ice::AsyncResultPtr& result) const - { - if(sent) - { - (callback.get()->*sent)(result->sentSynchronously()); - } - } - - virtual bool __hasSentCallback() const - { - return sent != 0; - } - - TPtr callback; - Exception exception; - Sent sent; -}; - -template -class ExceptionCallback : public GenericCallbackBase -{ -public: - - typedef T callback_type; - typedef CT cookie_type; - - typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - - ExceptionCallback(const TPtr& instance, Exception excb, Sent sentcb) : - callback(instance), exception(excb), sent(sentcb) - { - checkCallback(instance, excb != 0); - } - - virtual void __completed(const ::Ice::AsyncResultPtr& result) const - { - try - { - result->__wait(); - } - catch(const ::Ice::Exception& ex) - { - (callback.get()->*exception)(ex, CTPtr::dynamicCast(result->getCookie())); - } - } - - virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& __cookie) - { - if(__cookie && !CTPtr::dynamicCast(__cookie)) - { - throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "unexpected cookie type"); - } - return this; - } - - virtual void __sent(const ::Ice::AsyncResultPtr& result) const - { - if(sent) - { - (callback.get()->*sent)(result->sentSynchronously(), CTPtr::dynamicCast(result->getCookie())); - } - } - - virtual bool __hasSentCallback() const - { - return sent != 0; - } - - TPtr callback; - Exception exception; - Sent sent; -}; - } namespace Ice @@ -474,19 +354,11 @@ newCallback(const IceUtil::Handle& instance, } template CallbackPtr -newCallback(const IceUtil::Handle& instance, - void (T::*excb)(const ::Ice::Exception&), - void (T::*sentcb)(bool) = 0) -{ - return new ::IceInternal::ExceptionCallbackNC(instance, excb, sentcb); -} - -template CallbackPtr -newCallback(const IceUtil::Handle& instance, - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&), - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) +newCallback(T* instance, + void (T::*cb)(const ::Ice::AsyncResultPtr&), + void (T::*sentcb)(const ::Ice::AsyncResultPtr&) = 0) { - return new ::IceInternal::ExceptionCallback(instance, excb, sentcb); + return new ::IceInternal::AsyncCallback(instance, cb, sentcb); } // @@ -516,23 +388,6 @@ public: void __sent(bool); }; -inline CallbackPtr -newAMICallback(const IceUtil::Handle< ::Ice::AMICallbackBase>& instance) -{ - if(dynamic_cast(instance.get())) - { - return new ::IceInternal::ExceptionCallbackNC(instance, - &AMICallbackBase::__exception, - &AMICallbackBase::__sent); - } - else - { - return new ::IceInternal::ExceptionCallbackNC(instance, - &AMICallbackBase::__exception, - 0); - } -} - } #endif diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index c3729e4826c..3888c84b5e5 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -79,6 +79,9 @@ typedef ::IceUtil::Handle< Callback_Object_ice_id_Base> Callback_Object_ice_idPt class Callback_Object_ice_invoke_Base : virtual public ::IceInternal::CallbackBase { }; typedef ::IceUtil::Handle< Callback_Object_ice_invoke_Base> Callback_Object_ice_invokePtr; +class Callback_Object_ice_flushBatchRequests_Base : virtual public ::IceInternal::CallbackBase { }; +typedef ::IceUtil::Handle< Callback_Object_ice_flushBatchRequests_Base> Callback_Object_ice_flushBatchRequestsPtr; + // // Deprecated AMI callbacks // @@ -131,6 +134,17 @@ typedef IceUtil::Handle AMI_Array_Object_ice_invoke class ICE_API AMI_Object_ice_flushBatchRequests : public Ice::AMICallbackBase { +public: + + void __exception(const Ice::Exception& ex) + { + ice_exception(ex); + } + + void __sent(bool sentSynchronously) + { + AMICallbackBase::__sent(sentSynchronously); + } }; typedef IceUtil::Handle AMI_Object_ice_flushBatchRequestsPtr; @@ -503,7 +517,7 @@ public: return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie); } - bool end_ice_invoke(::std::pair&, const ::Ice::AsyncResultPtr&); + bool ___end_ice_invoke(::std::pair&, const ::Ice::AsyncResultPtr&); ::Ice::Identity ice_getIdentity() const; ::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const; @@ -566,9 +580,9 @@ public: void ice_flushBatchRequests(); bool ice_flushBatchRequests_async(const ::Ice::AMI_Object_ice_flushBatchRequestsPtr&); - ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::LocalObjectPtr& __cookie = 0) + ::Ice::AsyncResultPtr begin_ice_flushBatchRequests() { - return begin_ice_flushBatchRequests(0, ::IceInternal::__dummyCallback, __cookie); + return begin_ice_flushBatchRequests(0, ::IceInternal::__dummyCallback, 0); } ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::CallbackPtr& __del, @@ -1059,7 +1073,7 @@ public: { if(sent) { - (callback.get()->*sent)(result->sentSynchronously()); + (callback.get()->*sent)(result->isSentSynchronously()); } } @@ -1092,10 +1106,9 @@ public: typedef CT cookie_type; typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); Callback(const TPtr& instance, Exception excb, Sent sentcb) : callback(instance), exception(excb), sent(sentcb) { @@ -1103,7 +1116,7 @@ public: virtual CallbackBasePtr __verify(::Ice::LocalObjectPtr& cookie) { - if(cookie && !CTPtr::dynamicCast(cookie)) + if(cookie && !CT::dynamicCast(cookie)) { throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "unexpected cookie type"); } @@ -1114,7 +1127,7 @@ public: { if(sent) { - (callback.get()->*sent)(result->sentSynchronously(), CTPtr::dynamicCast(result->getCookie())); + (callback.get()->*sent)(result->isSentSynchronously(), CT::dynamicCast(result->getCookie())); } } @@ -1133,7 +1146,7 @@ protected: { if(exception) { - (callback.get()->*exception)(ex, CTPtr::dynamicCast(result->getCookie())); + (callback.get()->*exception)(ex, CT::dynamicCast(result->getCookie())); } } }; @@ -1153,7 +1166,7 @@ public: TwowayCallbackNC(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : CallbackNC(instance, excb, sentcb) { - checkCallback(instance, cb != 0); + checkCallback(instance, cb != 0 || excb != 0); } }; @@ -1163,14 +1176,13 @@ class TwowayCallback : public Callback public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); TwowayCallback(const TPtr& instance, bool cb, Exception excb, Sent sentcb) : Callback(instance, excb, sentcb) { - checkCallback(instance, cb != 0); + checkCallback(instance, cb != 0 || excb != 0); } }; @@ -1191,7 +1203,7 @@ public: OnewayCallbackNC(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : CallbackNC(instance, excb, sentcb), response(cb) { - checkCallback(instance, cb != 0); + checkCallback(instance, cb != 0 || excb != 0); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const @@ -1209,11 +1221,14 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(); + (callback.get()->*response)(); #else - (CallbackNC::callback.get()->*response)(); + (CallbackNC::callback.get()->*response)(); #endif + } } Response response; @@ -1225,16 +1240,15 @@ class OnewayCallback : public Callback public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(const CT&); OnewayCallback(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : Callback(instance, excb, sentcb), response(cb) { - checkCallback(instance, cb != 0); + checkCallback(instance, cb != 0 || excb != 0); } virtual void __completed(const ::Ice::AsyncResultPtr& result) const @@ -1252,10 +1266,13 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(CTPtr::dynamicCast(result->getCookie())); + (callback.get()->*response)(CT::dynamicCast(result->getCookie())); #else - (Callback::callback.get()->*response)(CTPtr::dynamicCast(result->getCookie())); + (Callback::callback.get()->*response)(CT::dynamicCast(result->getCookie())); + } #endif } @@ -1299,10 +1316,13 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret); + (callback.get()->*response)(__ret); #else - (::IceInternal::CallbackNC::callback.get()->*response)(__ret); + (::IceInternal::CallbackNC::callback.get()->*response)(__ret); + } #endif } @@ -1315,11 +1335,10 @@ class Callback_Object_ice_isA : public Callback_Object_ice_isA_Base, public ::Ic public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(bool, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(bool, const CT&); Callback_Object_ice_isA(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) @@ -1342,10 +1361,13 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); #else - (::IceInternal::Callback::callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); + } #endif } @@ -1375,11 +1397,10 @@ class Callback_Object_ice_ping : public Callback_Object_ice_ping_Base, public :: public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(const CT&); Callback_Object_ice_ping(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::OnewayCallback(instance, cb, excb, sentcb) @@ -1419,11 +1440,14 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret); + (callback.get()->*response)(__ret); #else - (::IceInternal::CallbackNC::callback.get()->*response)(__ret); + (::IceInternal::CallbackNC::callback.get()->*response)(__ret); #endif + } } Response response; @@ -1435,11 +1459,10 @@ class Callback_Object_ice_ids : public Callback_Object_ice_ids_Base, public ::Ic public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(const ::std::vector< ::std::string>&, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(const ::std::vector< ::std::string>&, const CT&); Callback_Object_ice_ids(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) @@ -1462,11 +1485,14 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); #else - (::IceInternal::Callback::callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); #endif + } } Response response; @@ -1504,11 +1530,14 @@ public: #endif return; } + if(response) + { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret); + (callback.get()->*response)(__ret); #else - (::IceInternal::CallbackNC::callback.get()->*response)(__ret); + (::IceInternal::CallbackNC::callback.get()->*response)(__ret); #endif + } } Response response; @@ -1520,11 +1549,10 @@ class Callback_Object_ice_id : public Callback_Object_ice_id_Base, public ::IceI public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(const ::std::string&, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(const ::std::string&, const CT&); Callback_Object_ice_id(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb) @@ -1550,9 +1578,9 @@ public: if(response) { #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); #else - (::IceInternal::Callback::callback.get()->*response)(__ret, CTPtr::dynamicCast(__result->getCookie())); + (::IceInternal::Callback::callback.get()->*response)(__ret, CT::dynamicCast(__result->getCookie())); #endif } } @@ -1615,7 +1643,7 @@ public: std::pair outParams; try { - __ok = __result->getProxy()->end_ice_invoke(outParams, __result); + __ok = __result->getProxy()->___end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { @@ -1645,12 +1673,11 @@ class Callback_Object_ice_invoke : public Callback_Object_ice_invoke_Base, publi public: typedef IceUtil::Handle TPtr; - typedef IceUtil::Handle CTPtr; - typedef void (T::*Exception)(const ::Ice::Exception&, const CTPtr&); - typedef void (T::*Sent)(bool, const CTPtr&); - typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&, const CTPtr&); - typedef void (T::*ResponseArray)(bool, const std::pair&, const CTPtr&); + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + typedef void (T::*Response)(bool, const std::vector< ::Ice::Byte>&, const CT&); + typedef void (T::*ResponseArray)(bool, const std::pair&, const CT&); Callback_Object_ice_invoke(const TPtr& instance, Response cb, Exception excb, Sent sentcb) : ::IceInternal::TwowayCallback(instance, cb != 0, excb, sentcb), response(cb), responseArray(0) @@ -1682,11 +1709,11 @@ public: return; } #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*response)(__ok, outParams, CTPtr::dynamicCast(__result->getCookie())); + (callback.get()->*response)(__ok, outParams, CT::dynamicCast(__result->getCookie())); #else (::IceInternal::Callback::callback.get()->*response)(__ok, outParams, - CTPtr::dynamicCast(__result->getCookie())); + CT::dynamicCast(__result->getCookie())); #endif return; } @@ -1697,7 +1724,7 @@ public: std::pair outParams; try { - __ok = __result->getProxy()->end_ice_invoke(outParams, __result); + __ok = __result->getProxy()->___end_ice_invoke(outParams, __result); } catch(const ::Ice::Exception& ex) { @@ -1709,11 +1736,11 @@ public: return; } #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug - (callback.get()->*responseArray)(__ok, outParams, CTPtr::dynamicCast(__result->getCookie())); + (callback.get()->*responseArray)(__ok, outParams, CT::dynamicCast(__result->getCookie())); #else (::IceInternal::Callback::callback.get()->*responseArray)(__ok, outParams, - CTPtr::dynamicCast(__result->getCookie())); + CT::dynamicCast(__result->getCookie())); #endif return; } @@ -1723,10 +1750,42 @@ public: ResponseArray responseArray; }; +template +class CallbackNC_Object_ice_flushBatchRequests : public Callback_Object_ice_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception&); + typedef void (T::*Sent)(bool); + + CallbackNC_Object_ice_flushBatchRequests(const TPtr& instance, Exception excb, Sent sentcb) : + ::IceInternal::OnewayCallbackNC(instance, 0, excb, sentcb) + { + } +}; + +template +class Callback_Object_ice_flushBatchRequests : public Callback_Object_ice_flushBatchRequests_Base, public ::IceInternal::OnewayCallback +{ +public: + + typedef IceUtil::Handle TPtr; + + typedef void (T::*Exception)(const ::Ice::Exception&, const CT&); + typedef void (T::*Sent)(bool, const CT&); + + Callback_Object_ice_flushBatchRequests(const TPtr& instance, Exception excb, Sent sentcb) : + ::IceInternal::OnewayCallback(instance, 0, excb, sentcb) + { + } +}; + template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, void (T::*cb)(bool), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_isA(instance, cb, excb, sentcb); @@ -1734,17 +1793,67 @@ newCallback_Object_ice_isA(const IceUtil::Handle& instance, template Callback_Object_ice_isAPtr newCallback_Object_ice_isA(const IceUtil::Handle& instance, - void (T::*cb)(bool, const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + void (T::*cb)(bool, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_isA(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_isA(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_isA(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(T* instance, + void (T::*cb)(bool), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_isA(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(T* instance, + void (T::*cb)(bool, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_isA(instance, cb, excb, sentcb); } +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_isA(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_isAPtr +newCallback_Object_ice_isA(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_isA(instance, 0, excb, sentcb); +} + template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, void (T::*cb)(), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ping(instance, cb, excb, sentcb); @@ -1752,17 +1861,67 @@ newCallback_Object_ice_ping(const IceUtil::Handle& instance, template Callback_Object_ice_pingPtr newCallback_Object_ice_ping(const IceUtil::Handle& instance, - void (T::*cb)(const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + void (T::*cb)(const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ping(instance, cb, excb, sentcb); } +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ping(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ping(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(T* instance, + void (T::*cb)(), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ping(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(T* instance, + void (T::*cb)(const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ping(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ping(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_pingPtr +newCallback_Object_ice_ping(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ping(instance, 0, excb, sentcb); +} + template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, void (T::*cb)(const ::std::vector< ::std::string>&), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_ids(instance, cb, excb, sentcb); @@ -1770,17 +1929,67 @@ newCallback_Object_ice_ids(const IceUtil::Handle& instance, template Callback_Object_ice_idsPtr newCallback_Object_ice_ids(const IceUtil::Handle& instance, - void (T::*cb)(const ::std::vector< ::std::string>&, const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + void (T::*cb)(const ::std::vector< ::std::string>&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_ids(instance, cb, excb, sentcb); } +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ids(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ids(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(T* instance, + void (T::*cb)(const ::std::vector< ::std::string>&), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ids(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(T* instance, + void (T::*cb)(const ::std::vector< ::std::string>&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ids(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_ids(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idsPtr +newCallback_Object_ice_ids(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_ids(instance, 0, excb, sentcb); +} + template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, void (T::*cb)(const ::std::string&), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_id(instance, cb, excb, sentcb); @@ -1788,17 +1997,67 @@ newCallback_Object_ice_id(const IceUtil::Handle& instance, template Callback_Object_ice_idPtr newCallback_Object_ice_id(const IceUtil::Handle& instance, - void (T::*cb)(const ::std::string&, const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + void (T::*cb)(const ::std::string&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_id(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_id(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_id(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(T* instance, + void (T::*cb)(const ::std::string&), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_id(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(T* instance, + void (T::*cb)(const ::std::string&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_id(instance, cb, excb, sentcb); } +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_id(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_idPtr +newCallback_Object_ice_id(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_id(instance, 0, excb, sentcb); +} + template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::vector&), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); @@ -1807,7 +2066,7 @@ newCallback_Object_ice_invoke(const IceUtil::Handle& instance, template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&), - void (T::*excb)(const ::Ice::Exception&) = 0, + void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) { return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); @@ -1815,9 +2074,9 @@ newCallback_Object_ice_invoke(const IceUtil::Handle& instance, template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, - void (T::*cb)(bool, const std::vector&, const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + void (T::*cb)(bool, const std::vector&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } @@ -1825,13 +2084,114 @@ newCallback_Object_ice_invoke(const IceUtil::Handle& instance, template Callback_Object_ice_invokePtr newCallback_Object_ice_invoke(const IceUtil::Handle& instance, void (T::*cb)(bool, const std::pair&, - const IceUtil::Handle&), - void (T::*excb)(const ::Ice::Exception&, const IceUtil::Handle&) = 0, - void (T::*sentcb)(bool, const IceUtil::Handle&) = 0) + const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) { return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); } +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_invoke(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_invoke(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*cb)(bool, const std::vector&), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*cb)(bool, const std::pair&), + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_invoke(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*cb)(bool, const std::vector&, const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*cb)(bool, const std::pair&, + const CT&), + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_invoke(instance, cb, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_invoke(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_invokePtr +newCallback_Object_ice_invoke(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_invoke(instance, 0, excb, sentcb); +} + +template Callback_Object_ice_flushBatchRequestsPtr +newCallback_Object_ice_flushBatchRequests(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_flushBatchRequests(instance, excb, sentcb); +} + +template Callback_Object_ice_flushBatchRequestsPtr +newCallback_Object_ice_flushBatchRequests(const IceUtil::Handle& instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_flushBatchRequests(instance, excb, sentcb); +} + +template Callback_Object_ice_flushBatchRequestsPtr +newCallback_Object_ice_flushBatchRequests(T* instance, + void (T::*excb)(const ::Ice::Exception&), + void (T::*sentcb)(bool) = 0) +{ + return new CallbackNC_Object_ice_flushBatchRequests(instance, excb, sentcb); +} + +template Callback_Object_ice_flushBatchRequestsPtr +newCallback_Object_ice_flushBatchRequests(T* instance, + void (T::*excb)(const ::Ice::Exception&, const CT&), + void (T::*sentcb)(bool, const CT&) = 0) +{ + return new Callback_Object_ice_flushBatchRequests(instance, excb, sentcb); +} + } #endif diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp index a6e6e8d1556..5d699e44083 100644 --- a/cpp/src/Glacier2/SessionRouterI.cpp +++ b/cpp/src/Glacier2/SessionRouterI.cpp @@ -483,39 +483,6 @@ private: } -namespace -{ - -class SessionPingCallback : public IceUtil::Shared -{ -public: - - SessionPingCallback(const Glacier2::InstancePtr& instance, const Ice::ConnectionPtr& connection) : - _instance(instance), - _connection(connection) - { - } - - void exception(const Ice::Exception&) - { - try - { - _instance->sessionRouter()->destroySession(_connection); - } - catch(...) - { - } - } - -private: - - Glacier2::InstancePtr _instance; - Ice::ConnectionPtr _connection; -}; -typedef IceUtil::Handle SessionPingCallbackPtr; - -} - using namespace Glacier2; Glacier2::CreateSession::CreateSession(const SessionRouterIPtr& sessionRouter, const string& user, @@ -748,8 +715,10 @@ Glacier2::SessionRouterI::SessionRouterI(const InstancePtr& instance, _sessionThread(_sessionTimeout > IceUtil::Time() ? new SessionThread(this, _sessionTimeout) : 0), _routersByConnectionHint(_routersByConnection.end()), _routersByCategoryHint(_routersByCategory.end()), + _sessionPingCallback(newCallback_Object_ice_ping(this, &SessionRouterI::sessionPingException)), _destroy(false) { + // // This session router is used directly as servant for the main // Glacier2 router Ice object. @@ -835,6 +804,8 @@ Glacier2::SessionRouterI::destroy() sessionThread = _sessionThread; _sessionThread = 0; + + _sessionPingCallback = 0; // Break cyclic reference count. } // @@ -979,9 +950,8 @@ Glacier2::SessionRouterI::refreshSession(const Ice::Current& current) // // Ping the session to ensure it does not timeout. // - SessionPingCallbackPtr cb = new SessionPingCallback(_instance, current.con); - Ice::CallbackPtr d = Ice::newCallback(cb, &SessionPingCallback::exception); - router->getSession()->begin_ice_ping(d); + assert(_sessionPingCallback); + router->getSession()->begin_ice_ping(_sessionPingCallback, current.con); } void @@ -1173,6 +1143,12 @@ Glacier2::SessionRouterI::expireSessions() } } +void +Glacier2::SessionRouterI::sessionPingException(const Ice::Exception&, const Ice::ConnectionPtr& con) +{ + destroySession(con); +} + bool Glacier2::SessionRouterI::startCreateSession(const CreateSessionPtr& cb, const ConnectionPtr& connection) { diff --git a/cpp/src/Glacier2/SessionRouterI.h b/cpp/src/Glacier2/SessionRouterI.h index 7f9aa5626de..fc8f43168db 100644 --- a/cpp/src/Glacier2/SessionRouterI.h +++ b/cpp/src/Glacier2/SessionRouterI.h @@ -110,6 +110,8 @@ public: private: + void sessionPingException(const Ice::Exception&, const ::Ice::ConnectionPtr&); + bool startCreateSession(const CreateSessionPtr&, const Ice::ConnectionPtr&); void finishCreateSession(const Ice::ConnectionPtr&, const RouterIPtr&); friend class Glacier2::CreateSession; @@ -150,7 +152,9 @@ private: mutable std::map::iterator _routersByCategoryHint; std::map _pending; - + + Ice::Callback_Object_ice_pingPtr _sessionPingCallback; + bool _destroy; }; diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index cb31063381e..7ff28fdf705 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -418,7 +418,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, del); - return result->sentSynchronously(); + return result->isSentSynchronously(); } bool @@ -443,7 +443,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, context, del); - return result->sentSynchronously(); + return result->isSentSynchronously(); } AsyncResultPtr @@ -539,7 +539,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, del); - return result->sentSynchronously(); + return result->isSentSynchronously(); } bool @@ -564,7 +564,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, context, del); - return result->sentSynchronously(); + return result->isSentSynchronously(); } AsyncResultPtr @@ -592,7 +592,7 @@ IceProxy::Ice::Object::begin_ice_invoke(const string& operation, } bool -IceProxy::Ice::Object::end_ice_invoke(pair& outParams, const AsyncResultPtr& __result) +IceProxy::Ice::Object::___end_ice_invoke(pair& outParams, const AsyncResultPtr& __result) { AsyncResult::__check(__result, this, ice_invoke_name); bool ok = __result->__wait(); @@ -1118,8 +1118,19 @@ IceProxy::Ice::Object::ice_flushBatchRequests() bool IceProxy::Ice::Object::ice_flushBatchRequests_async(const AMI_Object_ice_flushBatchRequestsPtr& cb) { - ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequests(newAMICallback(cb)); - return result->sentSynchronously(); + Callback_Object_ice_flushBatchRequestsPtr __del; + if(dynamic_cast< AMISentCallback*>(cb.get())) + { + __del = newCallback_Object_ice_flushBatchRequests(cb, + &AMI_Object_ice_flushBatchRequests::__exception, + &AMI_Object_ice_flushBatchRequests::__sent); + } + else + { + __del = newCallback_Object_ice_flushBatchRequests(cb, &AMI_Object_ice_flushBatchRequests::__exception); + } + ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequests(0, __del, 0); + return result->isSentSynchronously(); } ::Ice::AsyncResultPtr diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index fa2e480a625..8fef2765047 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2849,8 +2849,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) else { C << nl << "::IceInternal::CallbackBasePtr __del;"; - C << nl << "if(ice_isTwoway())"; - C << sb; C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; C << sb; C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" @@ -2861,14 +2859,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" << opScopedAMI << "::__exception);"; C << eb; - C << eb; - C << nl << "else"; - C << sb; - C << nl << "__del = ::Ice::newAMICallback(__cb);"; - C << eb; } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; - C << nl << "return __ar->sentSynchronously();"; + C << nl << "return __ar->isSentSynchronously();"; C << eb; C << sp << nl << "bool" << nl << "IceProxy" << scope << name << "_async" << spar @@ -2892,7 +2885,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) else { C << nl << "::IceInternal::CallbackBasePtr __del;"; - C << nl << "if(ice_isTwoway())"; C << nl << "if(dynamic_cast< ::Ice::AMISentCallback*>(__cb.get()))"; C << sb; C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" @@ -2903,14 +2895,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << " __del = " << classScope << "new" << delName << "(__cb, &" << opScopedAMI << "::__response, &" << opScopedAMI << "::__exception);"; C << eb; - C << nl << "else"; - C << sb; - C << nl << "__del = ::Ice::newAMICallback(__cb);"; - C << eb; } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar << ';'; - C << nl << "return __ar->sentSynchronously();"; + C << nl << "return __ar->isSentSynchronously();"; C << eb; } } @@ -5359,17 +5347,13 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H.inc(); H << sp << nl << "typedef IceUtil::Handle TPtr;"; - if(withCookie) - { - H << nl << "typedef IceUtil::Handle CTPtr;"; - } string cookieT; string comCookieT; if(withCookie) { - cookieT = "const CTPtr&"; - comCookieT = " , const CTPtr&"; + cookieT = "const CT&"; + comCookieT = " , const CT&"; } H << sp << nl << "typedef void (T::*Exception)(const ::Ice::Exception&" << comCookieT << ");"; @@ -5473,7 +5457,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << outArgs; if(withCookie) { - H << "CTPtr::dynamicCast(__result->getCookie())"; + H << "CT::dynamicCast(__result->getCookie())"; } H << epar << ';'; H.zeroIndent(); @@ -5487,7 +5471,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << outArgs; if(withCookie) { - H << "CTPtr::dynamicCast(__result->getCookie())"; + H << "CT::dynamicCast(__result->getCookie())"; } H << epar << ';'; H.zeroIndent(); @@ -5501,48 +5485,75 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << eb << ';'; // Factory method - if(withCookie) + for(int i = 0; i < 2; i++) { - cookieT = "const ::IceUtil::Handle&"; - comCookieT = " , const ::IceUtil::Handle&"; - H << sp << nl << "template " << delName << "Ptr"; - } - else - { - H << sp << nl << "template " << delName << "Ptr"; - } + string callbackT = i == 0 ? "const IceUtil::Handle&" : "T*"; - H << nl << "new" << delName << "(const ::IceUtil::Handle& instance, "; - if(p->returnsData()) - { - H << "void (T::*cb)" << spar; - if(ret) + if(withCookie) { - H << retS; + cookieT = "const CT&"; + comCookieT = " , const CT&"; + H << sp << nl << "template " << delName << "Ptr"; } - H << outDecls; + else + { + H << sp << nl << "template " << delName << "Ptr"; + } + + H << nl << "new" << delName << "(" << callbackT << " instance, "; + if(p->returnsData()) + { + H << "void (T::*cb)" << spar; + if(ret) + { + H << retS; + } + H << outDecls; + if(withCookie) + { + H << cookieT; + } + H << epar << ", "; + } + else + { + H << "void (T::*cb)(" << cookieT << "),"; + } + H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << "),"; + H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; + H << sb; if(withCookie) { - H << cookieT; + H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; } - H << epar << ", "; - } - else - { - H << "void (T::*cb)(" << cookieT << "),"; - } - H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << ") = 0,"; - H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; - H << sb; - if(withCookie) - { - H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; - } - else - { - H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; + else + { + H << nl << "return new " << delTmplName << "(instance, cb, excb, sentcb);"; + } + H << eb; + + if(withCookie) + { + H << sp << nl << "template " << delName << "Ptr"; + } + else + { + H << sp << nl << "template " << delName << "Ptr"; + } + H << nl << "new" << delName << "(" << callbackT << " instance, "; + H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << "),"; + H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; + H << sb; + if(withCookie) + { + H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; + } + else + { + H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; + } + H << eb; } - H << eb; } Slice::Gen::IceInternalVisitor::IceInternalVisitor(Output& h, Output& c, const string& dllExport) : diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 1718b292191..101579c4086 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4321,6 +4321,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << nl << "return;"; _out << eb; + _out << nl << "if(cb__ != null)"; + _out << sb; _out << nl << "cb__" << spar; if(ret) { @@ -4332,13 +4334,17 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } _out << epar << ';'; _out << eb; + _out << eb; } else { _out << sp << nl << "private void " << op->name() << "_completed__(" << delType << " cb__)"; _out << sb; + _out << nl << "if(cb__ != null)"; + _out << sb; _out << nl << "cb__();"; _out << eb; + _out << eb; } } @@ -4370,9 +4376,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ".whenCompleted(cb__.response__, cb__.exception__);"; _out << nl << "if(cb__ is Ice.AMISentCallback)"; _out << sb; - _out << nl << "result__.whenSent(cb__.sent__);"; + _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.sentSynchronously();"; + _out << "return result__.isSentSynchronously();"; _out << eb; _out << sp; @@ -4385,9 +4391,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ".whenCompleted(cb__.response__, cb__.exception__);"; _out << nl << "if(cb__ is Ice.AMISentCallback)"; _out << sb; - _out << nl << "result__.whenSent(cb__.sent__);"; + _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.sentSynchronously();"; + _out << "return result__.isSentSynchronously();"; _out << eb; } } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 4300a1f2f23..736241f8b83 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -4025,7 +4025,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false" << "__cb" << epar << ';'; - out << nl << "return __r.sentSynchronously();"; + out << nl << "return __r.isSentSynchronously();"; out << eb; out << sp; @@ -4034,7 +4034,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true" << "__cb" << epar << ';'; - out << nl << "return __r.sentSynchronously();"; + out << nl << "return __r.isSentSynchronously();"; out << eb; } } diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index 040e2ef05d7..4dd6c3569e2 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -27,7 +27,8 @@ struct Cookie : public Ice::LocalObject typedef IceUtil::Handle CookiePtr; -class CallbackBase : public Ice::LocalObject +class CallbackBase + : public Ice::LocalObject { public: @@ -290,6 +291,10 @@ public: called(); } } + + void ex(const Ice::Exception&) + { + } }; typedef IceUtil::Handle ResponseCallbackPtr; @@ -355,6 +360,10 @@ public: } } + void ex(const Ice::Exception&, const CookiePtr&) + { + } + private: CookiePtr _cookie; @@ -394,6 +403,12 @@ public: test(false); } + void opWithUE(const Ice::Exception& ex) + { + test(dynamic_cast(&ex)); + called(); + } + void ex(const Ice::Exception& ex) { test(dynamic_cast(&ex)); @@ -440,6 +455,13 @@ public: test(false); } + void opWithUE(const Ice::Exception& ex, const CookiePtr& cookie) + { + test(cookie == _cookie); + test(dynamic_cast(&ex)); + called(); + } + void ex(const Ice::Exception& ex, const CookiePtr& cookie) { test(cookie == _cookie); @@ -524,22 +546,22 @@ public: void sentAsync(const Ice::AsyncResultPtr& result) { - test(result->sentSynchronously() && _thread == IceUtil::ThreadControl() || - !result->sentSynchronously() && _thread != IceUtil::ThreadControl()); + test(result->isSentSynchronously() && _thread == IceUtil::ThreadControl() || + !result->isSentSynchronously() && _thread != IceUtil::ThreadControl()); called(); } - void sent(bool sentSynchronously) + void sent(bool isSentSynchronously) { - test(sentSynchronously && _thread == IceUtil::ThreadControl() || - !sentSynchronously && _thread != IceUtil::ThreadControl()); + test(isSentSynchronously && _thread == IceUtil::ThreadControl() || + !isSentSynchronously && _thread != IceUtil::ThreadControl()); called(); } - void sentWC(bool sentSynchronously, const CookiePtr& cookie) + void sentWC(bool isSentSynchronously, const CookiePtr& cookie) { - test(sentSynchronously && _thread == IceUtil::ThreadControl() || - !sentSynchronously && _thread != IceUtil::ThreadControl()); + test(isSentSynchronously && _thread == IceUtil::ThreadControl() || + !isSentSynchronously && _thread != IceUtil::ThreadControl()); test(cookie == _cookie); called(); } @@ -600,6 +622,16 @@ public: throwEx(); } + void noEx(const Ice::Exception& ex) + { + test(false); + } + + void noExWC(const Ice::Exception& ex, const CookiePtr&) + { + test(false); + } + void sent(bool) { called(); @@ -803,62 +835,68 @@ allTests(const Ice::CommunicatorPtr& communicator) CookiePtr cookie = new Cookie(5); ResponseCallbackWCPtr cbWC = new ResponseCallbackWC(cookie); - p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA)); + Ice::CallbackNC_Object_ice_isA::Exception nullEx = 0; + Ice::Callback_Object_ice_isA::Exception nullExWC = 0; + + p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA, + nullEx)); cb->check(); p->begin_ice_isA(Test::TestIntf::ice_staticId(), - Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA), cookie); + Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA, nullExWC), cookie); cbWC->check(); p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, - Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA)); + Ice::newCallback_Object_ice_isA(cb, &ResponseCallback::isA, nullEx)); cb->check(); p->begin_ice_isA(Test::TestIntf::ice_staticId(), ctx, - Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA), cookie); + Ice::newCallback_Object_ice_isA(cbWC, &ResponseCallbackWC::isA, nullExWC), cookie); cbWC->check(); - p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping)); + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping, nullEx)); cb->check(); - p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping), cookie); + p->begin_ice_ping(Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping, nullExWC), cookie); cbWC->check(); - p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping)); + p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cb, &ResponseCallback::ping, nullEx)); cb->check(); - p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping), cookie); + p->begin_ice_ping(ctx, Ice::newCallback_Object_ice_ping(cbWC, &ResponseCallbackWC::ping, nullExWC), cookie); cbWC->check(); - p->begin_ice_id(Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id)); + p->begin_ice_id(Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id, nullEx)); cb->check(); - p->begin_ice_id(Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id), cookie); + p->begin_ice_id(Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id, nullExWC), cookie); cbWC->check(); - p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id)); + p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cb, &ResponseCallback::id, nullEx)); cb->check(); - p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id), cookie); + p->begin_ice_id(ctx, Ice::newCallback_Object_ice_id(cbWC, &ResponseCallbackWC::id, nullExWC), cookie); cbWC->check(); - p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids)); + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids, nullEx)); cb->check(); - p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids), cookie); + p->begin_ice_ids(Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids, nullExWC), cookie); cbWC->check(); - p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids)); + p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cb, &ResponseCallback::ids, nullEx)); cb->check(); - p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids), cookie); + p->begin_ice_ids(ctx, Ice::newCallback_Object_ice_ids(cbWC, &ResponseCallbackWC::ids, nullExWC), cookie); cbWC->check(); - p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op)); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op, nullEx)); cb->check(); - p->begin_op(Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op), cookie); + p->begin_op(Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op, nullExWC), cookie); cbWC->check(); - p->begin_op(ctx, Test::newCallback_TestIntf_op(cb, &ResponseCallback::op)); + p->begin_op(ctx, Test::newCallback_TestIntf_op(cb, &ResponseCallback::op, nullEx)); cb->check(); - p->begin_op(ctx, Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op), cookie); + p->begin_op(ctx, Test::newCallback_TestIntf_op(cbWC, &ResponseCallbackWC::op, nullExWC), cookie); cbWC->check(); - p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult)); + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult, nullEx)); cb->check(); - p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult), cookie); + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult, + nullExWC), cookie); cbWC->check(); - p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult)); + p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cb, &ResponseCallback::opWithResult, + nullEx)); cb->check(); - p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult), - cookie); + p->begin_opWithResult(ctx, Test::newCallback_TestIntf_opWithResult(cbWC, &ResponseCallbackWC::opWithResult, + nullExWC), cookie); cbWC->check(); p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ResponseCallback::op, &ResponseCallback::opWithUE)); @@ -1004,35 +1042,44 @@ allTests(const Ice::CommunicatorPtr& communicator) CookiePtr cookie = new Cookie(5); ExceptionCallbackWCPtr cbWC = new ExceptionCallbackWC(cookie); - i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &ExceptionCallback::ex)); + i->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cb, &ExceptionCallback::ex)); cb->check(); - i->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + i->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cbWC, &ExceptionCallbackWC::ex), cookie); cbWC->check(); - i->begin_op(Ice::newCallback(cb, &ExceptionCallback::ex)); + i->begin_op(Test::newCallback_TestIntf_op(cb, &ExceptionCallback::ex)); cb->check(); - i->begin_op(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + i->begin_op(Test::newCallback_TestIntf_op(cbWC, &ExceptionCallbackWC::ex), cookie); cbWC->check(); - i->begin_opWithResult(Ice::newCallback(cb, &ExceptionCallback::ex)); + i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::ex)); cb->check(); - i->begin_opWithResult(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::ex), cookie); cbWC->check(); - i->begin_opWithUE(Ice::newCallback(cb, &ExceptionCallback::ex)); + i->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ExceptionCallback::ex)); cb->check(); - i->begin_opWithUE(Ice::newCallback(cbWC, &ExceptionCallbackWC::ex), cookie); + i->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cbWC, &ExceptionCallbackWC::ex), cookie); cbWC->check(); // Ensures no exception is called when response is received - p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cb, &ExceptionCallback::noEx)); - p->begin_ice_isA(Test::TestIntf::ice_staticId(), Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); - p->begin_op(Ice::newCallback(cb, &ExceptionCallback::noEx)); - p->begin_op(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); - p->begin_opWithResult(Ice::newCallback(cb, &ExceptionCallback::noEx)); - p->begin_opWithResult(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); - p->begin_opWithUE(Ice::newCallback(cb, &ExceptionCallback::noEx)); - p->begin_opWithUE(Ice::newCallback(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cb, &ExceptionCallback::noEx)); + p->begin_ice_isA(Test::TestIntf::ice_staticId(), + Ice::newCallback_Object_ice_isA(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ExceptionCallback::noEx)); + p->begin_op(Test::newCallback_TestIntf_op(cbWC, &ExceptionCallbackWC::noEx), cookie); + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::noEx)); + p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::noEx), cookie); + + // If response is a user exception, it should be received. + p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ExceptionCallback::opWithUE)); + cb->check(); + + p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cbWC, &ExceptionCallbackWC::opWithUE), cookie); + cbWC->check(); } cout << "ok" << endl; @@ -1080,9 +1127,9 @@ allTests(const Ice::CommunicatorPtr& communicator) p->begin_op(Ice::newCallback(cbWC, &SentCallback::opAsync, &SentCallback::sentAsync), cookie); cbWC->check(); - p->begin_op(Ice::newCallback(cb, &SentCallback::ex, &SentCallback::sent)); + p->begin_op(Test::newCallback_TestIntf_op(cb, &SentCallback::ex, &SentCallback::sent)); cb->check(); - p->begin_op(Ice::newCallback(cbWC, &SentCallback::exWC, &SentCallback::sentWC), cookie); + p->begin_op(Test::newCallback_TestIntf_op(cbWC, &SentCallback::exWC, &SentCallback::sentWC), cookie); cbWC->check(); vector cbs; @@ -1094,8 +1141,8 @@ allTests(const Ice::CommunicatorPtr& communicator) } testController->holdAdapter(); cb = new SentCallback(); - while(p->begin_opWithPayload(seq, - Ice::newCallback(cb, &SentCallback::ex, &SentCallback::sent))->sentSynchronously()) + while(p->begin_opWithPayload(seq, Test::newCallback_TestIntf_opWithPayload( + cb, &SentCallback::ex, &SentCallback::sent))->isSentSynchronously()) { cbs.push_back(cb); cb = new SentCallback(); @@ -1153,7 +1200,8 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackPtr(), &ResponseCallback::op)); + p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackPtr(), &ResponseCallback::op, + &ResponseCallback::ex)); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1162,7 +1210,8 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackWCPtr(), &ResponseCallbackWC::op)); + p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackWCPtr(), &ResponseCallbackWC::op, + &ResponseCallbackWC::ex)); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1172,7 +1221,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { void (AsyncCallback::*nullCallback)(const Ice::AsyncResultPtr&) = 0; - p->begin_op(Ice::newCallback(AsyncCallbackPtr(new AsyncCallback), nullCallback)); + p->begin_op(Ice::newCallback(new AsyncCallback, nullCallback)); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1182,7 +1231,8 @@ allTests(const Ice::CommunicatorPtr& communicator) try { void (ResponseCallback::*nullCallback)() = 0; - p->begin_op(Test::newCallback_TestIntf_op(ResponseCallbackPtr(new ResponseCallback), nullCallback)); + void (ResponseCallback::*nullExCallback)(const Ice::Exception&) = 0; + p->begin_op(Test::newCallback_TestIntf_op(new ResponseCallback, nullCallback, nullExCallback)); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1192,7 +1242,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { ResponseCallbackPtr cb = new ResponseCallback(); - p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op), new Cookie(3)); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallback::op, &ResponseCallback::ex), new Cookie(3)); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1202,7 +1252,8 @@ allTests(const Ice::CommunicatorPtr& communicator) try { ResponseCallbackWCPtr cb = new ResponseCallbackWC(new Cookie(3)); - p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallbackWC::op), new Ice::LocalObject()); + p->begin_op(Test::newCallback_TestIntf_op(cb, &ResponseCallbackWC::op, &ResponseCallbackWC::ex), + new Ice::LocalObject()); test(false); } catch(const IceUtil::IllegalArgumentException&) @@ -1224,10 +1275,10 @@ allTests(const Ice::CommunicatorPtr& communicator) p->begin_op(Ice::newCallback(cb, &Thrower::opAsync)); cb->check(); - p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::op)); + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::op, &Thrower::noEx)); cb->check(); - p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::opWC), cookie); + p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::opWC, &Thrower::noExWC), cookie); cb->check(); q->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::op, &Thrower::ex)); @@ -1242,10 +1293,10 @@ allTests(const Ice::CommunicatorPtr& communicator) p->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::noOpWC, &Thrower::exWC, &Thrower::sentWC), cookie); cb->check(); - q->begin_op(Ice::newCallback(cb, &Thrower::ex)); + q->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::ex)); cb->check(); - q->begin_op(Ice::newCallback(cb, &Thrower::exWC), cookie); + q->begin_op(Test::newCallback_TestIntf_op(cb, &Thrower::exWC), cookie); cb->check(); } } @@ -1263,7 +1314,7 @@ allTests(const Ice::CommunicatorPtr& communicator) *q = static_cast(IceUtilInternal::random(255)); } Ice::AsyncResultPtr r2; - while((r2 = p->begin_opWithPayload(seq))->sentSynchronously()); + while((r2 = p->begin_opWithPayload(seq))->isSentSynchronously()); test(r1 == r1); test(r1 != r2); @@ -1272,10 +1323,10 @@ allTests(const Ice::CommunicatorPtr& communicator) test(r1->getHash() != r2->getHash()); test(r1->getHash() < r2->getHash() || r2->getHash() < r1->getHash()); - test(r1->sentSynchronously() && r1->isSent() && !r1->isCompleted() || - !r1->sentSynchronously() && !r1->isCompleted()); + test(r1->isSentSynchronously() && r1->isSent() && !r1->isCompleted() || + !r1->isSentSynchronously() && !r1->isCompleted()); - test(!r2->sentSynchronously() && !r2->isCompleted()); + test(!r2->isSentSynchronously() && !r2->isCompleted()); testController->resumeAdapter(); diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 9fab51ebd62..84e70db71de 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -352,7 +352,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrx& b } Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { prx->end_op(r); @@ -364,8 +364,8 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrx& b test(r->isCompleted()); OpAMICallbackPtr cbEx = new OpAMICallback(); - r = prx->begin_op(Ice::newCallback(cbEx, &OpAMICallback::exception)); - test(!r->sentSynchronously()); + r = prx->begin_op(Test::newCallback_Background_op(cbEx, &OpAMICallback::exception)); + test(!r->isSentSynchronously()); cbEx->checkException(); test(r->isCompleted()); @@ -457,7 +457,7 @@ initializeTests(const ConfigurationPtr& configuration, } Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { prx->end_op(r); @@ -469,8 +469,8 @@ initializeTests(const ConfigurationPtr& configuration, test(r->isCompleted()); OpAMICallbackPtr cbEx = new OpAMICallback(); - r = prx->begin_op(Ice::newCallback(cbEx, &OpAMICallback::exception)); - test(!r->sentSynchronously()); + r = prx->begin_op(Test::newCallback_Background_op(cbEx, &OpAMICallback::exception)); + test(!r->isSentSynchronously()); cbEx->checkException(); test(r->isCompleted()); @@ -685,7 +685,7 @@ validationTests(const ConfigurationPtr& configuration, configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); BackgroundPrx prx = i == 0 ? background : background->ice_oneway(); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { prx->end_op(r); @@ -738,7 +738,7 @@ validationTests(const ConfigurationPtr& configuration, configuration->readReady(false); configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { background->end_op(r); @@ -756,7 +756,7 @@ validationTests(const ConfigurationPtr& configuration, ctl->holdAdapter(); // Hold to block in connection validation Ice::AsyncResultPtr r = background->begin_op(); Ice::AsyncResultPtr r2 = background->begin_op(); - test(!r->sentSynchronously() && !r2->sentSynchronously()); + test(!r->isSentSynchronously() && !r2->isSentSynchronously()); test(!r->isCompleted() && !r2->isCompleted()); ctl->resumeAdapter(); background->end_op(r); @@ -971,7 +971,7 @@ readWriteTests(const ConfigurationPtr& configuration, background->ice_ping(); configuration->writeException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { prx->end_op(r); @@ -1000,7 +1000,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - if(!r->sentSynchronously()) + if(!r->isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. #ifndef ICE_USE_IOCP @@ -1070,7 +1070,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->writeReady(false); configuration->writeException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->sentSynchronously()); + test(!r->isSentSynchronously()); try { prx->end_op(r); @@ -1103,7 +1103,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - if(!r->sentSynchronously()) + if(!r->isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. #ifndef ICE_USE_IOCP @@ -1167,7 +1167,7 @@ readWriteTests(const ConfigurationPtr& configuration, Callback_Background_opWithPayloadPtr callbackWP = newCallback_Background_opWithPayload(cb, &OpAMICallback::noResponse, &OpAMICallback::noException); - while(backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()) + while(backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()) { } @@ -1177,17 +1177,17 @@ readWriteTests(const ConfigurationPtr& configuration, &OpAMICallback::response, &OpAMICallback::noException, &OpAMICallback::sent)); - test(!r1->sentSynchronously() && !r1->isSent()); + test(!r1->isSentSynchronously() && !r1->isSent()); OpAMICallbackPtr cb2 = new OpAMICallback(); Ice::AsyncResultPtr r2 = background->begin_op(newCallback_Background_op(cb2, &OpAMICallback::response, &OpAMICallback::noException, &OpAMICallback::sent)); - test(!r2->sentSynchronously() && !r2->isSent()); + test(!r2->isSentSynchronously() && !r2->isSent()); - test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()); - test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()); + test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()); + test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()); test(!cb->checkResponse(false)); test(!cb2->checkResponse(false)); diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp index 65608623bcd..e4d4ea1eaa4 100644 --- a/cpp/test/Ice/custom/AllTests.cpp +++ b/cpp/test/Ice/custom/AllTests.cpp @@ -1436,6 +1436,12 @@ public: test(false); } } + + void + noEx(const Ice::Exception&, const InParamPtr&) + { + test(false); + } }; typedef IceUtil::Handle CallbackPtr; @@ -2925,7 +2931,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opDoubleArrayPtr callback = - Test::newCallback_TestIntf_opDoubleArray(cb, &Callback::opDoubleArray); + Test::newCallback_TestIntf_opDoubleArray(cb, &Callback::opDoubleArray, &Callback::noEx); t->begin_opDoubleArray(inPair, callback, newInParam(inPair)); cb->check(); } @@ -2946,7 +2952,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opBoolArrayPtr callback = - Test::newCallback_TestIntf_opBoolArray(cb, &Callback::opBoolArray); + Test::newCallback_TestIntf_opBoolArray(cb, &Callback::opBoolArray, &Callback::noEx); t->begin_opBoolArray(inPair, callback, newInParam(inPair)); cb->check(); } @@ -2962,7 +2968,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opByteArrayPtr callback = - Test::newCallback_TestIntf_opByteArray(cb, &Callback::opByteArray); + Test::newCallback_TestIntf_opByteArray(cb, &Callback::opByteArray, &Callback::noEx); t->begin_opByteArray(inPair, callback, newInParam(inPair)); cb->check(); } @@ -2984,7 +2990,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opVariableArrayPtr callback = - Test::newCallback_TestIntf_opVariableArray(cb, &Callback::opVariableArray); + Test::newCallback_TestIntf_opVariableArray(cb, &Callback::opVariableArray, &Callback::noEx); t->begin_opVariableArray(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3000,7 +3006,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opBoolRangePtr callback = - Test::newCallback_TestIntf_opBoolRange(cb, &Callback::opBoolRange); + Test::newCallback_TestIntf_opBoolRange(cb, &Callback::opBoolRange, &Callback::noEx); t->begin_opBoolRange(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3016,7 +3022,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opByteRangePtr callback = - Test::newCallback_TestIntf_opByteRange(cb, &Callback::opByteRange); + Test::newCallback_TestIntf_opByteRange(cb, &Callback::opByteRange, &Callback::noEx); t->begin_opByteRange(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3038,7 +3044,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opVariableRangePtr callback = - Test::newCallback_TestIntf_opVariableRange(cb, &Callback::opVariableRange); + Test::newCallback_TestIntf_opVariableRange(cb, &Callback::opVariableRange, &Callback::noEx); t->begin_opVariableRange(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3059,7 +3065,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opBoolRangeTypePtr callback = - Test::newCallback_TestIntf_opBoolRangeType(cb, &Callback::opBoolRangeType); + Test::newCallback_TestIntf_opBoolRangeType(cb, &Callback::opBoolRangeType, &Callback::noEx); t->begin_opBoolRangeType(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3075,7 +3081,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opByteRangeTypePtr callback = - Test::newCallback_TestIntf_opByteRangeType(cb, &Callback::opByteRangeType); + Test::newCallback_TestIntf_opByteRangeType(cb, &Callback::opByteRangeType, &Callback::noEx); t->begin_opByteRangeType(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3104,7 +3110,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opVariableRangeTypePtr callback = - Test::newCallback_TestIntf_opVariableRangeType(cb, &Callback::opVariableRangeType); + Test::newCallback_TestIntf_opVariableRangeType(cb, &Callback::opVariableRangeType, &Callback::noEx); t->begin_opVariableRangeType(inPair, callback, newInParam(inPair)); cb->check(); } @@ -3119,7 +3125,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opBoolSeqPtr callback = - Test::newCallback_TestIntf_opBoolSeq(cb, &Callback::opBoolSeq); + Test::newCallback_TestIntf_opBoolSeq(cb, &Callback::opBoolSeq, &Callback::noEx); t->begin_opBoolSeq(in, callback, newInParam(in)); cb->check(); } @@ -3134,7 +3140,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opBoolListPtr callback = - Test::newCallback_TestIntf_opBoolList(cb, &Callback::opBoolList); + Test::newCallback_TestIntf_opBoolList(cb, &Callback::opBoolList, &Callback::noEx); t->begin_opBoolList(in, callback, newInParam(in)); cb->check(); } @@ -3149,7 +3155,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opByteSeqPtr callback = - Test::newCallback_TestIntf_opByteSeq(cb, &Callback::opByteSeq); + Test::newCallback_TestIntf_opByteSeq(cb, &Callback::opByteSeq, &Callback::noEx); t->begin_opByteSeq(in, callback, newInParam(in)); cb->check(); } @@ -3164,7 +3170,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opByteListPtr callback = - Test::newCallback_TestIntf_opByteList(cb, &Callback::opByteList); + Test::newCallback_TestIntf_opByteList(cb, &Callback::opByteList, &Callback::noEx); t->begin_opByteList(in, callback, newInParam(in)); cb->check(); } @@ -3179,7 +3185,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opMyByteSeqPtr callback = - Test::newCallback_TestIntf_opMyByteSeq(cb, &Callback::opMyByteSeq); + Test::newCallback_TestIntf_opMyByteSeq(cb, &Callback::opMyByteSeq, &Callback::noEx); t->begin_opMyByteSeq(in, callback, newInParam(in)); cb->check(); } @@ -3194,7 +3200,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opStringSeqPtr callback = - Test::newCallback_TestIntf_opStringSeq(cb, &Callback::opStringSeq); + Test::newCallback_TestIntf_opStringSeq(cb, &Callback::opStringSeq, &Callback::noEx); t->begin_opStringSeq(in, callback, newInParam(in)); cb->check(); } @@ -3209,7 +3215,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opStringListPtr callback = - Test::newCallback_TestIntf_opStringList(cb, &Callback::opStringList); + Test::newCallback_TestIntf_opStringList(cb, &Callback::opStringList, &Callback::noEx); t->begin_opStringList(in, callback, newInParam(in)); cb->check(); } @@ -3224,7 +3230,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opFixedSeqPtr callback = - Test::newCallback_TestIntf_opFixedSeq(cb, &Callback::opFixedSeq); + Test::newCallback_TestIntf_opFixedSeq(cb, &Callback::opFixedSeq, &Callback::noEx); t->begin_opFixedSeq(in, callback, newInParam(in)); cb->check(); } @@ -3239,7 +3245,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opFixedListPtr callback = - Test::newCallback_TestIntf_opFixedList(cb, &Callback::opFixedList); + Test::newCallback_TestIntf_opFixedList(cb, &Callback::opFixedList, &Callback::noEx); t->begin_opFixedList(in, callback, newInParam(in)); cb->check(); } @@ -3254,7 +3260,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opVariableSeqPtr callback = - Test::newCallback_TestIntf_opVariableSeq(cb, &Callback::opVariableSeq); + Test::newCallback_TestIntf_opVariableSeq(cb, &Callback::opVariableSeq, &Callback::noEx); t->begin_opVariableSeq(in, callback, newInParam(in)); cb->check(); } @@ -3275,7 +3281,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opVariableListPtr callback = - Test::newCallback_TestIntf_opVariableList(cb, &Callback::opVariableList); + Test::newCallback_TestIntf_opVariableList(cb, &Callback::opVariableList, &Callback::noEx); t->begin_opVariableList(in, callback, newInParam(in)); cb->check(); } @@ -3290,7 +3296,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opStringStringDictSeqPtr callback = - Test::newCallback_TestIntf_opStringStringDictSeq(cb, &Callback::opStringStringDictSeq); + Test::newCallback_TestIntf_opStringStringDictSeq(cb, &Callback::opStringStringDictSeq, &Callback::noEx); t->begin_opStringStringDictSeq(in, callback, newInParam(in)); cb->check(); } @@ -3311,7 +3317,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opStringStringDictListPtr callback = - Test::newCallback_TestIntf_opStringStringDictList(cb, &Callback::opStringStringDictList); + Test::newCallback_TestIntf_opStringStringDictList(cb, &Callback::opStringStringDictList, &Callback::noEx); t->begin_opStringStringDictList(in, callback, newInParam(in)); cb->check(); } @@ -3326,7 +3332,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opESeqPtr callback = - Test::newCallback_TestIntf_opESeq(cb, &Callback::opESeq); + Test::newCallback_TestIntf_opESeq(cb, &Callback::opESeq, &Callback::noEx); t->begin_opESeq(in, callback, newInParam(in)); cb->check(); } @@ -3341,7 +3347,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opEListPtr callback = - Test::newCallback_TestIntf_opEList(cb, &Callback::opEList); + Test::newCallback_TestIntf_opEList(cb, &Callback::opEList, &Callback::noEx); t->begin_opEList(in, callback, newInParam(in)); cb->check(); } @@ -3356,7 +3362,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opCPrxSeqPtr callback = - Test::newCallback_TestIntf_opCPrxSeq(cb, &Callback::opCPrxSeq); + Test::newCallback_TestIntf_opCPrxSeq(cb, &Callback::opCPrxSeq, &Callback::noEx); t->begin_opCPrxSeq(in, callback, newInParam(in)); cb->check(); } @@ -3371,7 +3377,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opCPrxListPtr callback = - Test::newCallback_TestIntf_opCPrxList(cb, &Callback::opCPrxList); + Test::newCallback_TestIntf_opCPrxList(cb, &Callback::opCPrxList, &Callback::noEx); t->begin_opCPrxList(in, callback, newInParam(in)); cb->check(); } @@ -3385,7 +3391,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) in[4] = in[0]; CallbackPtr cb = new Callback(); - Test::Callback_TestIntf_opCSeqPtr callback = Test::newCallback_TestIntf_opCSeq(cb, &Callback::opCSeq); + Test::Callback_TestIntf_opCSeqPtr callback = Test::newCallback_TestIntf_opCSeq(cb, &Callback::opCSeq, &Callback::noEx); t->begin_opCSeq(in, callback, newInParam(in)); cb->check(); } @@ -3400,7 +3406,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opCListPtr callback = - Test::newCallback_TestIntf_opCList(cb, &Callback::opCList); + Test::newCallback_TestIntf_opCList(cb, &Callback::opCList, &Callback::noEx); t->begin_opCList(in, callback, newInParam(in)); cb->check(); } @@ -3450,7 +3456,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { CallbackPtr cb = new Callback(); Test::Callback_TestIntf_opClassStructPtr callback = - Test::newCallback_TestIntf_opClassStruct(cb, &Callback::opClassStruct); + Test::newCallback_TestIntf_opClassStruct(cb, &Callback::opClassStruct, &Callback::noEx); t->begin_opClassStruct(cs, csseq1, callback, newInParam(make_pair(cs, csseq1))); cb->check(); } @@ -3505,7 +3511,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) } { CallbackPtr cb = new Callback(); - wsc1->begin_opString(wstr, Test1::newCallback_WstringClass_opString(cb, &Callback::opString), + wsc1->begin_opString(wstr, Test1::newCallback_WstringClass_opString(cb, &Callback::opString, &Callback::noEx), newInParam(wstr)); cb->check(); } @@ -3531,8 +3537,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) } { CallbackPtr cb = new Callback(); - wsc2->begin_opString(wstr, Test2::newCallback_WstringClass_opString(cb, &Callback::opString), - newInParam(wstr)); + wsc2->begin_opString(wstr, Test2::newCallback_WstringClass_opString(cb, &Callback::opString, + &Callback::noEx), newInParam(wstr)); cb->check(); } } diff --git a/cpp/test/Ice/dispatcher/AllTests.cpp b/cpp/test/Ice/dispatcher/AllTests.cpp index 80741e951e0..0ff7d5a6c5a 100644 --- a/cpp/test/Ice/dispatcher/AllTests.cpp +++ b/cpp/test/Ice/dispatcher/AllTests.cpp @@ -36,9 +36,9 @@ public: } void - sent(bool sentSynchronously) + sent(bool isSentSynchronously) { - test(sentSynchronously || Dispatcher::isDispatcherThread()); + test(isSentSynchronously || Dispatcher::isDispatcherThread()); } }; typedef IceUtil::Handle CallbackPtr; @@ -85,7 +85,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { *q = static_cast(IceUtilInternal::random(255)); } - while(p->begin_opWithPayload(seq, callback2)->sentSynchronously()); + while(p->begin_opWithPayload(seq, callback2)->isSentSynchronously()); testController->resumeAdapter(); } cout << "ok" << endl; diff --git a/cpp/test/Ice/invoke/AllTests.cpp b/cpp/test/Ice/invoke/AllTests.cpp index 5d334bcfd18..30433569feb 100644 --- a/cpp/test/Ice/invoke/AllTests.cpp +++ b/cpp/test/Ice/invoke/AllTests.cpp @@ -233,6 +233,9 @@ allTests(const Ice::CommunicatorPtr& communicator) Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); + + void (Callback::*nullEx)(const Ice::Exception&) = 0; + void (Callback::*nullExWC)(const Ice::Exception&, const CookiePtr&) = 0; cout << "testing ice_invoke... " << flush; @@ -328,10 +331,9 @@ allTests(const Ice::CommunicatorPtr& communicator) // begin_ice_invoke with no callback and array mapping pair inPair(&inParams[0], &inParams[0] + inParams.size()); result = cl->begin_ice_invoke("opString", Ice::Normal, inPair); - pair outPair; - if(cl->end_ice_invoke(outPair, result)) + if(cl->end_ice_invoke(outParams, result)) { - Ice::InputStreamPtr in = Ice::createInputStream(communicator, outPair); + Ice::InputStreamPtr in = Ice::createInputStream(communicator, outParams); string s; in->read(s); test(s == testString); @@ -355,26 +357,25 @@ allTests(const Ice::CommunicatorPtr& communicator) // begin_ice_invoke with Callback_Object_ice_invoke cb = new Callback(communicator, false); - Ice::Callback_Object_ice_invokePtr d = - Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringNC); + Ice::Callback_Object_ice_invokePtr d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringNC, nullEx); cl->begin_ice_invoke("opString", Ice::Normal, inParams, d); cb->check(); // begin_ice_invoke with Callback_Object_ice_invoke with Cookie cb = new Callback(communicator, false); - d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringWC); + d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringWC, nullExWC); cl->begin_ice_invoke("opString", Ice::Normal, inParams, d, cookie); cb->check(); // begin_ice_invoke with Callback_Object_ice_invoke and array mapping cb = new Callback(communicator, false); - d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringNC); + d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringNC, nullEx); cl->begin_ice_invoke("opString", Ice::Normal, inPair, d); cb->check(); // begin_ice_invoke with Callback_Object_ice_invoke and array mapping with Cookie cb = new Callback(communicator, false); - d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringWC); + d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opStringWC, nullExWC); cl->begin_ice_invoke("opString", Ice::Normal, inPair, d, cookie); cb->check(); } @@ -418,13 +419,13 @@ allTests(const Ice::CommunicatorPtr& communicator) // begin_ice_invoke with Callback_Object_ice_invoke cb = new Callback(communicator, false); - Ice::Callback_Object_ice_invokePtr d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opExceptionNC); + Ice::Callback_Object_ice_invokePtr d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opExceptionNC, nullEx); cl->begin_ice_invoke("opException", Ice::Normal, inParams, d); cb->check(); // begin_ice_invoke with Callback_Object_ice_invoke with Cookie cb = new Callback(communicator, false); - d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opExceptionWC); + d = Ice::newCallback_Object_ice_invoke(cb, &Callback::opExceptionWC, nullExWC); cl->begin_ice_invoke("opException", Ice::Normal, inParams, d, cookie); cb->check(); } diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp index 79d9ee19bea..9f62376107f 100644 --- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp @@ -102,28 +102,29 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::noException, &Callback::sent); + Ice::Callback_Object_ice_pingPtr callback = + Ice::newCallback_Object_ice_ping(cb, &Callback::noException, &Callback::sent); p->begin_ice_ping(callback); cb->check(); } { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, &Callback::twowayOnlyException); p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); cb->check(); } { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, &Callback::twowayOnlyException); p->begin_ice_id(callback); cb->check(); } { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, &Callback::twowayOnlyException); p->begin_ice_ids(callback); cb->check(); } @@ -131,7 +132,8 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::noException, &Callback::sent); + Test::Callback_MyClass_opVoidPtr callback = + Test::newCallback_MyClass_opVoid(cb, &Callback::noException, &Callback::sent); p->begin_opVoid(callback); cb->check(); } @@ -142,7 +144,8 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& // { CallbackPtr cb = new Callback; - Ice::CallbackPtr callback = Ice::newCallback(cb, &Callback::twowayOnlyException); + Test::Callback_MyClass_opBytePtr callback = + Test::newCallback_MyClass_opByte(cb, &Callback::twowayOnlyException); p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); cb->check(); } diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index 035751b68ea..c5594c70ca1 100644 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -61,20 +61,22 @@ namespace Ice bool isSent(); void waitForSent(); - bool sentSynchronously(); + bool isSentSynchronously(); string getOperation(); - AsyncResult whenSentWithResult(Ice.AsyncCallback cb); - + AsyncResult whenSent(Ice.AsyncCallback cb); AsyncResult whenSent(Ice.SentCallback cb); - AsyncResult whenCompleted(Ice.ExceptionCallback cb); + + AsyncResult whenCompleted(Ice.ExceptionCallback excb); } public interface AsyncResult : AsyncResult { AsyncResult whenCompleted(T cb, Ice.ExceptionCallback excb); - AsyncResult whenCompleted(T cb); + + new AsyncResult whenCompleted(Ice.ExceptionCallback excb); + new AsyncResult whenSent(Ice.SentCallback cb); }; } @@ -116,7 +118,7 @@ namespace IceInternal void finished__(Ice.LocalException ex, bool sent); } - public class OutgoingAsyncBase : Ice.AsyncResult + abstract public class OutgoingAsyncBase : Ice.AsyncResult { public virtual Ice.Communicator getCommunicator() { @@ -171,16 +173,11 @@ namespace IceInternal } } - public bool sentSynchronously() + public bool isSentSynchronously() { return sentSynchronously_; // No lock needed, immutable once send__() is called } - public string getOperation() - { - return operation_; - } - // // Implementation of System.IAsyncResult properties // @@ -228,7 +225,7 @@ namespace IceInternal } } - public Ice.AsyncResult whenSentWithResult(Ice.AsyncCallback cb) + public Ice.AsyncResult whenSent(Ice.AsyncCallback cb) { lock(monitor_) { @@ -271,35 +268,6 @@ namespace IceInternal return this; } - public Ice.AsyncResult whenCompletedWithAsyncCallback(Ice.AsyncCallback cb) - { - lock(monitor_) - { - setCompletedCallback(cb); - if((state_ & Done) == 0) - { - return this; - } - else if((getProxy() == null || getProxy().ice_isOneway()) && exception_ == null) - { - return this; - } - } - - instance_.clientThreadPool().dispatch(delegate() - { - try - { - cb(this); - } - catch(System.Exception ex) - { - warning__(ex); - } - }); - return this; - } - public Ice.AsyncResult whenSent(Ice.SentCallback cb) { lock(monitor_) @@ -310,7 +278,7 @@ namespace IceInternal } sentCallback_ = delegate(Ice.AsyncResult result) { - cb(result.sentSynchronously()); + cb(result.isSentSynchronously()); }; if((state_ & Sent) == 0) { @@ -339,18 +307,47 @@ namespace IceInternal } catch(System.Exception ex) { - warning__(ex); + warning__(ex); } }); } return this; } + public Ice.AsyncResult whenCompletedWithAsyncCallback(Ice.AsyncCallback cb) + { + lock(monitor_) + { + setCompletedCallback(cb); + if((state_ & Done) == 0) + { + return this; + } + else if((getProxy() == null || getProxy().ice_isOneway()) && exception_ == null) + { + return this; + } + } + + instance_.clientThreadPool().dispatch(delegate() + { + try + { + cb(this); + } + catch(System.Exception ex) + { + warning__(ex); + } + }); + return this; + } + public Ice.AsyncResult whenCompleted(Ice.ExceptionCallback cb) { lock(monitor_) { - setCompletedCallback(completed__); + setCompletedCallback(getCompletedCallback()); exceptionCallback_ = cb; if((state_ & Done) == 0) { @@ -376,6 +373,11 @@ namespace IceInternal return this; } + public string getOperation() + { + return operation_; + } + public IceInternal.BasicStream ostr__ { get @@ -604,6 +606,11 @@ namespace IceInternal } } + protected virtual Ice.AsyncCallback getCompletedCallback() + { + return completed__; + } + private void completed__(Ice.AsyncResult result) { Debug.Assert(exceptionCallback_ != null); @@ -650,7 +657,7 @@ namespace IceInternal private object _cookie; } - public class OutgoingAsync : OutgoingAsyncBase, OutgoingAsyncMessageCallback + abstract public class OutgoingAsync : OutgoingAsyncBase, OutgoingAsyncMessageCallback { public OutgoingAsync(Ice.ObjectPrx prx, string operation, object cookie) : base(((Ice.ObjectPrxHelperBase)prx).reference__().getInstance(), operation, cookie) @@ -1139,21 +1146,18 @@ namespace IceInternal private static Dictionary emptyContext_ = new Dictionary(); } - public class TwowayOutgoingAsync : OutgoingAsync, Ice.AsyncResult + abstract public class OutgoingAsync : OutgoingAsync, Ice.AsyncResult { - public TwowayOutgoingAsync(Ice.ObjectPrx prx, string operation, ProxyTwowayCallback cb, object cookie) : + public OutgoingAsync(Ice.ObjectPrx prx, string operation, object cookie) : base(prx, operation, cookie) { - Debug.Assert(cb != null); - _completed = cb; } - public Ice.AsyncResult whenCompleted(T cb, Ice.ExceptionCallback excb) + new public Ice.AsyncResult whenCompleted(Ice.ExceptionCallback excb) { lock(monitor_) { - setCompletedCallback(completed__); - _responseCallback = cb; + setCompletedCallback(getCompletedCallback()); exceptionCallback_ = excb; if((state_ & Done) == 0) { @@ -1169,7 +1173,7 @@ namespace IceInternal { try { - _completed(this, _responseCallback, exceptionCallback_); + completedCallback_(this); } catch(System.Exception ex) { @@ -1179,35 +1183,12 @@ namespace IceInternal return this; } - public Ice.AsyncResult whenCompleted(T cb) - { - return whenCompleted(cb, null); - } - - private void completed__(Ice.AsyncResult result) - { - _completed(this, _responseCallback, exceptionCallback_); - } - - private ProxyTwowayCallback _completed; - private T _responseCallback; - }; - - public class OnewayOutgoingAsync : OutgoingAsync, Ice.AsyncResult - { - public OnewayOutgoingAsync(Ice.ObjectPrx prx, string operation, ProxyOnewayCallback cb,object cookie) : - base(prx, operation, cookie) - { - Debug.Assert(cb != null); - _completed = cb; - } - public Ice.AsyncResult whenCompleted(T cb, Ice.ExceptionCallback excb) { lock(monitor_) { - setCompletedCallback(completed__); - _responseCallback = cb; + setCompletedCallback(getCompletedCallback()); + responseCallback_ = cb; exceptionCallback_ = excb; if((state_ & Done) == 0) { @@ -1220,29 +1201,70 @@ namespace IceInternal } instance_.clientThreadPool().dispatch(delegate() - { + { try { - completed__(this); + completedCallback_(this); } catch(System.Exception ex) { warning__(ex); } - }); + }); + return this; + } + + new public Ice.AsyncResult whenSent(Ice.SentCallback cb) + { + base.whenSent(cb); return this; } - public Ice.AsyncResult whenCompleted(T cb) + protected T responseCallback_; + }; + + public class TwowayOutgoingAsync : OutgoingAsync + { + public TwowayOutgoingAsync(Ice.ObjectPrx prx, string operation, ProxyTwowayCallback cb, object cookie) : + base(prx, operation, cookie) + { + Debug.Assert(cb != null); + _completed = cb; + } + + override protected Ice.AsyncCallback getCompletedCallback() + { + return completed__; + } + + private void completed__(Ice.AsyncResult result) + { + _completed(this, responseCallback_, exceptionCallback_); + } + + private ProxyTwowayCallback _completed; + }; + + public class OnewayOutgoingAsync : OutgoingAsync + { + public OnewayOutgoingAsync(Ice.ObjectPrx prx, string operation, ProxyOnewayCallback cb,object cookie) : + base(prx, operation, cookie) + { + Debug.Assert(cb != null); + _completed = cb; + } + + override protected Ice.AsyncCallback getCompletedCallback() { - return whenCompleted(cb, null); + return completed__; } protected void completed__(Ice.AsyncResult r__) { try { - ((Ice.ObjectPrxHelperBase)(r__.getProxy())).end__(r__, r__.getOperation()); + IceInternal.OutgoingAsync outAsync__ = (IceInternal.OutgoingAsync)r__; + ((Ice.ObjectPrxHelperBase)(outAsync__.getProxy())).end__(outAsync__, outAsync__.getOperation()); } catch(Ice.Exception ex__) { @@ -1252,11 +1274,10 @@ namespace IceInternal } return; } - _completed(_responseCallback); + _completed(responseCallback_); } private ProxyOnewayCallback _completed; - private T _responseCallback; } public class BatchOutgoingAsync : OutgoingAsyncBase, OutgoingAsyncMessageCallback @@ -1373,9 +1394,9 @@ namespace Ice ice_exception(ex); } - public void sent__(bool sentSynchronously) + public void sent__(Ice.AsyncResult result) { - if(!sentSynchronously) + if(!result.isSentSynchronously()) { ((AMISentCallback)this).ice_sent(); } diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 8cd286eb0a1..bee64db394b 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -728,7 +728,10 @@ namespace Ice } return; } - cb__(ret__); + if(cb__ != null) + { + cb__(ret__); + } } /// @@ -832,7 +835,10 @@ namespace Ice private void ice_ping_completed__(Callback_Object_ice_ping cb) { - cb(); + if(cb != null) + { + cb(); + } } /// @@ -971,7 +977,10 @@ namespace Ice } return; } - cb__(ret__); + if(cb__ != null) + { + cb__(ret__); + } } /// @@ -1108,7 +1117,10 @@ namespace Ice } return; } - cb__(ret__); + if(cb__ != null) + { + cb__(ret__); + } } /// @@ -1200,9 +1212,9 @@ namespace Ice result.whenCompleted(cb.response__, cb.exception__); if(cb is Ice.AMISentCallback) { - result.whenSent(cb.sent__); + result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.sentSynchronously(); + return result.isSentSynchronously(); } /// @@ -1223,9 +1235,9 @@ namespace Ice result.whenCompleted(cb.response__, cb.exception__); if(cb is Ice.AMISentCallback) { - result.whenSent(cb.sent__); + result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.sentSynchronously(); + return result.isSentSynchronously(); } public AsyncResult begin_ice_invoke(string operation, @@ -1327,7 +1339,10 @@ namespace Ice } return; } - cb__(ret__, outParams); + if(cb__ != null) + { + cb__(ret__, outParams); + } } /// @@ -1972,9 +1987,9 @@ namespace Ice Ice.AsyncResult result = begin_ice_flushBatchRequests().whenCompleted(cb.exception__); if(cb is Ice.AMISentCallback) { - result.whenSent(cb.sent__); + result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.sentSynchronously(); + return result.isSentSynchronously(); } private const string __ice_flushBatchRequests_name = "ice_flushBatchRequests"; diff --git a/cs/test/Ice/ami/AllTests.cs b/cs/test/Ice/ami/AllTests.cs index e57e586bb65..9d3683f54e7 100644 --- a/cs/test/Ice/ami/AllTests.cs +++ b/cs/test/Ice/ami/AllTests.cs @@ -343,6 +343,23 @@ public class AllTests test(false); } + public void + opWithUE(Ice.Exception e) + { + try + { + throw e; + } + catch(TestIntfException) + { + called(); + } + catch(Ice.Exception) + { + test(false); + } + } + public void ex(Ice.Exception ex) { @@ -402,8 +419,8 @@ public class AllTests public void sentAsync(Ice.AsyncResult r) { - test(r.sentSynchronously() && _thread == Thread.CurrentThread || - !r.sentSynchronously() && _thread != Thread.CurrentThread); + test(r.isSentSynchronously() && _thread == Thread.CurrentThread || + !r.isSentSynchronously() && _thread != Thread.CurrentThread); called(); } @@ -638,34 +655,34 @@ public class AllTests ResponseCallback cb = new ResponseCallback(); Dictionary ctx = new Dictionary(); - p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA); + p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, null); cb.check(); - p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted(cb.isA); + p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted(cb.isA, null); cb.check(); - p.begin_ice_ping().whenCompleted(cb.ping); + p.begin_ice_ping().whenCompleted(cb.ping, null); cb.check(); - p.begin_ice_ping(ctx).whenCompleted(cb.ping); + p.begin_ice_ping(ctx).whenCompleted(cb.ping, null); cb.check(); - p.begin_ice_id().whenCompleted(cb.id); + p.begin_ice_id().whenCompleted(cb.id, null); cb.check(); - p.begin_ice_id(ctx).whenCompleted(cb.id); + p.begin_ice_id(ctx).whenCompleted(cb.id, null); cb.check(); - p.begin_ice_ids().whenCompleted(cb.ids); + p.begin_ice_ids().whenCompleted(cb.ids, null); cb.check(); - p.begin_ice_ids(ctx).whenCompleted(cb.ids); + p.begin_ice_ids(ctx).whenCompleted(cb.ids, null); cb.check(); - p.begin_op().whenCompleted(cb.op); + p.begin_op().whenCompleted(cb.op, null); cb.check(); - p.begin_op(ctx).whenCompleted(cb.op); + p.begin_op(ctx).whenCompleted(cb.op, null); cb.check(); - p.begin_opWithResult().whenCompleted(cb.opWithResult); + p.begin_opWithResult().whenCompleted(cb.opWithResult, null); cb.check(); - p.begin_opWithResult(ctx).whenCompleted(cb.opWithResult); + p.begin_opWithResult(ctx).whenCompleted(cb.opWithResult, null); cb.check(); p.begin_opWithUE().whenCompleted(cb.op, cb.opWithUE); @@ -788,23 +805,26 @@ public class AllTests Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); - i.begin_ice_isA("::Test::TestIntf").whenCompleted((Ice.ExceptionCallback)cb.ex); + i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.ex); cb.check(); i.begin_op().whenCompleted(cb.ex); cb.check(); - i.begin_opWithResult().whenCompleted((Ice.ExceptionCallback)cb.ex); + i.begin_opWithResult().whenCompleted(cb.ex); cb.check(); i.begin_opWithUE().whenCompleted(cb.ex); cb.check(); // Ensures no exception is called when response is received - p.begin_ice_isA("::Test::TestIntf").whenCompleted((Ice.ExceptionCallback)cb.noEx); + p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.noEx); p.begin_op().whenCompleted(cb.noEx); - p.begin_opWithResult().whenCompleted((Ice.ExceptionCallback)cb.noEx); - p.begin_opWithUE().whenCompleted(cb.noEx); + p.begin_opWithResult().whenCompleted(cb.noEx); + + // If response is a user exception, it should be received. + p.begin_opWithUE().whenCompleted(cb.opWithUE); + cb.check(); } Console.Out.WriteLine("ok"); @@ -828,7 +848,7 @@ public class AllTests p.begin_op().whenCompleted(cb.op, cb.ex).whenSent(cb.sent); cb.check(); - p.begin_op(cb.opAsync, null).whenSentWithResult(cb.sentAsync); + p.begin_op(cb.opAsync, null).whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); p.begin_op().whenCompleted(cb.ex).whenSent(cb.sent); @@ -845,7 +865,7 @@ public class AllTests r = p.begin_opWithPayload(seq).whenCompleted(cb2.ex).whenSent(cb2.sent); cbs.Add(cb2); } - while(r.sentSynchronously()); + while(r.isSentSynchronously()); testController.resumeAdapter(); foreach(SentCallback cb3 in cbs) { @@ -905,7 +925,7 @@ public class AllTests p.begin_op(cb.opAsync, null); cb.check(); - p.begin_op().whenCompleted(cb.op); + p.begin_op().whenCompleted(cb.op, null); cb.check(); q.begin_op().whenCompleted(cb.op, cb.ex); @@ -929,12 +949,12 @@ public class AllTests byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); Ice.AsyncResult r2; - while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); + while((r2 = p.begin_opWithPayload(seq)).isSentSynchronously()); - test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted_() || - !r1.sentSynchronously() && !r1.isCompleted_()); + test(r1.isSentSynchronously() && r1.isSent() && !r1.isCompleted_() || + !r1.isSentSynchronously() && !r1.isCompleted_()); - test(!r2.sentSynchronously() && !r2.isCompleted_()); + test(!r2.isSentSynchronously() && !r2.isCompleted_()); test(!r1.IsCompleted && !r1.CompletedSynchronously); test(!r2.IsCompleted && !r2.CompletedSynchronously); diff --git a/cs/test/Ice/background/AllTests.cs b/cs/test/Ice/background/AllTests.cs index 12dff01afc9..0f97517a6cd 100644 --- a/cs/test/Ice/background/AllTests.cs +++ b/cs/test/Ice/background/AllTests.cs @@ -15,50 +15,50 @@ using System.Threading; public class AllTests { private static void test(bool b) - { - if(!b) { - throw new System.Exception(); + if(!b) + { + throw new System.Exception(); + } } - } private class Callback { internal Callback() - { - _called = false; - } + { + _called = false; + } public virtual void check() - { - lock(this) { - while(!_called) + lock(this) { - Monitor.Wait(this); - } + while(!_called) + { + Monitor.Wait(this); + } - _called = false; + _called = false; + } } - } public virtual void called() - { - lock(this) { - Debug.Assert(!_called); - _called = true; - Monitor.Pulse(this); + lock(this) + { + Debug.Assert(!_called); + _called = true; + Monitor.Pulse(this); + } } - } public virtual bool isCalled() - { - lock(this) { - return _called; + lock(this) + { + return _called; + } } - } private bool _called; } @@ -66,62 +66,62 @@ public class AllTests private class OpAMICallback { public void response() - { - _response.called(); - } + { + _response.called(); + } public void noResponse() - { - test(false); - } + { + test(false); + } public void exception(Ice.Exception ex) - { - _response.called(); - } + { + _response.called(); + } public void noException(Ice.Exception ex) - { - Console.Error.WriteLine(ex); - test(false); - } + { + Console.Error.WriteLine(ex); + test(false); + } public void sent(bool ss) - { - _sent.called(); - } - - public bool checkException(bool wait) - { - if(wait) { - _response.check(); - return true; + _sent.called(); } - else + + public bool checkException(bool wait) { - return _response.isCalled(); + if(wait) + { + _response.check(); + return true; + } + else + { + return _response.isCalled(); + } } - } public bool checkResponse(bool wait) - { - if(wait) - { - _response.check(); - return true; - } - else { - return _response.isCalled(); + if(wait) + { + _response.check(); + return true; + } + else + { + return _response.isCalled(); + } } - } public void checkResponseAndSent() - { - _sent.check(); - _response.check(); - } + { + _sent.check(); + _response.check(); + } private Callback _response = new Callback(); private Callback _sent = new Callback(); @@ -130,58 +130,58 @@ public class AllTests private class OpThread { internal OpThread(BackgroundPrx background) - { - _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway()); - Start(); - } + { + _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway()); + Start(); + } public void Join() - { - _thread.Join(); - } + { + _thread.Join(); + } public void Start() - { - _thread = new Thread(new ThreadStart(Run)); - _thread.Start(); - } + { + _thread = new Thread(new ThreadStart(Run)); + _thread.Start(); + } public void Run() - { - int count = 0; - while(true) { - lock(this) + int count = 0; + while(true) { - if(_destroyed) + lock(this) { - return; + if(_destroyed) + { + return; + } } - } - try - { - if(++count == 10) // Don't blast the connection with only oneway's + try + { + if(++count == 10) // Don't blast the connection with only oneway's + { + count = 0; + _background.ice_twoway().ice_ping(); + } + _background.begin_op(); + Thread.Sleep(1); + } + catch(Ice.LocalException) { - count = 0; - _background.ice_twoway().ice_ping(); } - _background.begin_op(); - Thread.Sleep(1); - } - catch(Ice.LocalException) - { } } - } public void destroy() - { - lock(this) { - _destroyed = true; + lock(this) + { + _destroyed = true; + } } - } private bool _destroyed = false; private BackgroundPrx _background = null; @@ -189,401 +189,401 @@ public class AllTests } public static Test.BackgroundPrx allTests(Ice.Communicator communicator) - { - string sref = "background:default -p 12010"; - Ice.ObjectPrx obj = communicator.stringToProxy(sref); - test(obj != null); - - BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj); - - sref = "backgroundController:tcp -p 12011"; - obj = communicator.stringToProxy(sref); - test(obj != null); - - BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj); - - Configuration configuration = Configuration.getInstance(); - - Console.Write("testing connect... "); - Console.Out.Flush(); { - connectTests(configuration, background); - } - Console.Out.WriteLine("ok"); + string sref = "background:default -p 12010"; + Ice.ObjectPrx obj = communicator.stringToProxy(sref); + test(obj != null); - Console.Write("testing initialization... "); - Console.Out.Flush(); - { - initializeTests(configuration, background, backgroundController); - } - Console.Out.WriteLine("ok"); + BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj); - Console.Write("testing connection validation... "); - Console.Out.Flush(); - { - validationTests(configuration, background, backgroundController); - } - Console.Out.WriteLine("ok"); + sref = "backgroundController:tcp -p 12011"; + obj = communicator.stringToProxy(sref); + test(obj != null); - Console.Write("testing read/write... "); - Console.Out.Flush(); - { - readWriteTests(configuration, background, backgroundController); - } - Console.Out.WriteLine("ok"); + BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj); - Console.Write("testing locator... "); - Console.Out.Flush(); - { - Ice.LocatorPrx locator; - obj = communicator.stringToProxy("locator:default -p 12010 -t 500"); - locator = Ice.LocatorPrxHelper.uncheckedCast(obj); - obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); + Configuration configuration = Configuration.getInstance(); - backgroundController.pauseCall("findAdapterById"); - try + Console.Write("testing connect... "); + Console.Out.Flush(); { - obj.ice_ping(); - test(false); + connectTests(configuration, background); } - catch(Ice.TimeoutException) + Console.Out.WriteLine("ok"); + + Console.Write("testing initialization... "); + Console.Out.Flush(); { + initializeTests(configuration, background, backgroundController); } - backgroundController.resumeCall("findAdapterById"); - - obj = communicator.stringToProxy("locator:default -p 12010"); - locator = Ice.LocatorPrxHelper.uncheckedCast(obj); - obj = obj.ice_locator(locator); - obj.ice_ping(); - - obj = communicator.stringToProxy("background@Test").ice_locator(locator); - BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); - - backgroundController.pauseCall("findAdapterById"); - Ice.AsyncResult r1 = bg.begin_op(); - Ice.AsyncResult r2 = bg.begin_op(); - test(!r1.IsCompleted); - test(!r2.IsCompleted); - backgroundController.resumeCall("findAdapterById"); - bg.end_op(r1); - bg.end_op(r2); - test(r1.IsCompleted); - test(r2.IsCompleted); - } - Console.Out.WriteLine("ok"); + Console.Out.WriteLine("ok"); - Console.Write("testing router... "); - Console.Out.Flush(); - { - Ice.RouterPrx router; - - obj = communicator.stringToProxy("router:default -p 12010 -t 500"); - router = Ice.RouterPrxHelper.uncheckedCast(obj); - obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); - - backgroundController.pauseCall("getClientProxy"); - try + Console.Write("testing connection validation... "); + Console.Out.Flush(); { - obj.ice_ping(); - test(false); + validationTests(configuration, background, backgroundController); } - catch(Ice.TimeoutException) + Console.Out.WriteLine("ok"); + + Console.Write("testing read/write... "); + Console.Out.Flush(); { + readWriteTests(configuration, background, backgroundController); } - backgroundController.resumeCall("getClientProxy"); - - obj = communicator.stringToProxy("router:default -p 12010"); - router = Ice.RouterPrxHelper.uncheckedCast(obj); - obj = communicator.stringToProxy("background@Test").ice_router(router); - BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); - test(bg.ice_getRouter() != null); - - backgroundController.pauseCall("getClientProxy"); - Ice.AsyncResult r1 = bg.begin_op(); - Ice.AsyncResult r2 = bg.begin_op(); - test(!r1.IsCompleted); - test(!r2.IsCompleted); - backgroundController.resumeCall("getClientProxy"); - bg.end_op(r1); - bg.end_op(r2); - test(r1.IsCompleted); - test(r2.IsCompleted); - } - Console.Out.WriteLine("ok"); + Console.Out.WriteLine("ok"); - return background; - } + Console.Write("testing locator... "); + Console.Out.Flush(); + { + Ice.LocatorPrx locator; + obj = communicator.stringToProxy("locator:default -p 12010 -t 500"); + locator = Ice.LocatorPrxHelper.uncheckedCast(obj); + obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); - private static void connectTests(Configuration configuration, Test.BackgroundPrx background) - { - try - { - background.op(); - } - catch(Ice.LocalException ex) - { - System.Console.Out.WriteLine(ex); - test(false); - } - background.ice_getConnection().close(false); + backgroundController.pauseCall("findAdapterById"); + try + { + obj.ice_ping(); + test(false); + } + catch(Ice.TimeoutException) + { + } + backgroundController.resumeCall("findAdapterById"); - for(int i = 0; i < 4; ++i) - { - if(i == 0 || i == 2) - { - configuration.connectorsException(new Ice.DNSException()); - } - else - { - configuration.connectException(new Ice.SocketException()); - } - BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway(); + obj = communicator.stringToProxy("locator:default -p 12010"); + locator = Ice.LocatorPrxHelper.uncheckedCast(obj); + obj = obj.ice_locator(locator); + obj.ice_ping(); - try - { - prx.op(); - test(false); - } - catch(Ice.Exception) - { - } + obj = communicator.stringToProxy("background@Test").ice_locator(locator); + BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); - Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); - try - { - prx.end_op(r); - test(false); + backgroundController.pauseCall("findAdapterById"); + Ice.AsyncResult r1 = bg.begin_op(); + Ice.AsyncResult r2 = bg.begin_op(); + test(!r1.IsCompleted); + test(!r2.IsCompleted); + backgroundController.resumeCall("findAdapterById"); + bg.end_op(r1); + bg.end_op(r2); + test(r1.IsCompleted); + test(r2.IsCompleted); } - catch(Ice.Exception) + Console.Out.WriteLine("ok"); + + Console.Write("testing router... "); + Console.Out.Flush(); { - } - test(r.IsCompleted); + Ice.RouterPrx router; - OpAMICallback cbEx = new OpAMICallback(); - r = prx.begin_op().whenCompleted(cbEx.exception); - test(!r.sentSynchronously()); - cbEx.checkException(true); - test(r.IsCompleted); + obj = communicator.stringToProxy("router:default -p 12010 -t 500"); + router = Ice.RouterPrxHelper.uncheckedCast(obj); + obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); - if(i == 0 || i == 2) - { - configuration.connectorsException(null); - } - else - { - configuration.connectException(null); + backgroundController.pauseCall("getClientProxy"); + try + { + obj.ice_ping(); + test(false); + } + catch(Ice.TimeoutException) + { + } + backgroundController.resumeCall("getClientProxy"); + + obj = communicator.stringToProxy("router:default -p 12010"); + router = Ice.RouterPrxHelper.uncheckedCast(obj); + obj = communicator.stringToProxy("background@Test").ice_router(router); + BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); + test(bg.ice_getRouter() != null); + + backgroundController.pauseCall("getClientProxy"); + Ice.AsyncResult r1 = bg.begin_op(); + Ice.AsyncResult r2 = bg.begin_op(); + test(!r1.IsCompleted); + test(!r2.IsCompleted); + backgroundController.resumeCall("getClientProxy"); + bg.end_op(r1); + bg.end_op(r2); + test(r1.IsCompleted); + test(r2.IsCompleted); } - } + Console.Out.WriteLine("ok"); - OpThread thread1 = new OpThread(background); - OpThread thread2 = new OpThread(background); + return background; + } - for(int i = 0; i < 5; i++) + private static void connectTests(Configuration configuration, Test.BackgroundPrx background) { try { - background.ice_ping(); + background.op(); } - catch(Ice.LocalException) + catch(Ice.LocalException ex) { + System.Console.Out.WriteLine(ex); test(false); } + background.ice_getConnection().close(false); - configuration.connectException(new Ice.SocketException()); - background.ice_getCachedConnection().close(true); - Thread.Sleep(10); - configuration.connectException(null); - try + for(int i = 0; i < 4; ++i) { - background.ice_ping(); - } - catch(Ice.LocalException) - { - } - } + if(i == 0 || i == 2) + { + configuration.connectorsException(new Ice.DNSException()); + } + else + { + configuration.connectException(new Ice.SocketException()); + } + BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway(); - thread1.destroy(); - thread2.destroy(); + try + { + prx.op(); + test(false); + } + catch(Ice.Exception) + { + } - thread1.Join(); - thread2.Join(); - } + Ice.AsyncResult r = prx.begin_op(); + test(!r.isSentSynchronously()); + try + { + prx.end_op(r); + test(false); + } + catch(Ice.Exception) + { + } + test(r.IsCompleted); - private static void initializeTests(Configuration configuration, Test.BackgroundPrx background, - Test.BackgroundControllerPrx ctl) - { - try - { - background.op(); - } - catch(Ice.LocalException) - { - test(false); - } - background.ice_getConnection().close(false); + OpAMICallback cbEx = new OpAMICallback(); + r = prx.begin_op().whenCompleted(cbEx.exception); + test(!r.isSentSynchronously()); + cbEx.checkException(true); + test(r.IsCompleted); - for(int i = 0; i < 4; ++i) - { - if(i == 0 || i == 2) - { - configuration.initializeException(new Ice.SocketException()); - } - else - { - continue; + if(i == 0 || i == 2) + { + configuration.connectorsException(null); + } + else + { + configuration.connectException(null); + } } - BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway(); - try - { - prx.op(); - test(false); - } - catch(Ice.SocketException) - { - } + OpThread thread1 = new OpThread(background); + OpThread thread2 = new OpThread(background); - Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); - try - { - prx.end_op(r); - test(false); - } - catch(Ice.Exception) + for(int i = 0; i < 5; i++) { - } - test(r.IsCompleted); - - OpAMICallback cbEx = new OpAMICallback(); - r = prx.begin_op().whenCompleted(cbEx.exception); - test(!r.sentSynchronously()); - cbEx.checkException(true); - test(r.IsCompleted); + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } - if(i == 0 || i == 2) - { - configuration.initializeException(null); + configuration.connectException(new Ice.SocketException()); + background.ice_getCachedConnection().close(true); + Thread.Sleep(10); + configuration.connectException(null); + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + } } - } - // - // Now run the same tests with the server side. - // + thread1.destroy(); + thread2.destroy(); - try - { - ctl.initializeException(true); - background.op(); - test(false); - } - catch(Ice.ConnectionLostException) - { - ctl.initializeException(false); - } - catch(Ice.SecurityException) - { - ctl.initializeException(false); + thread1.Join(); + thread2.Join(); } - OpThread thread1 = new OpThread(background); - OpThread thread2 = new OpThread(background); - - for(int i = 0; i < 5; i++) + private static void initializeTests(Configuration configuration, Test.BackgroundPrx background, + Test.BackgroundControllerPrx ctl) { try { - background.ice_ping(); + background.op(); } catch(Ice.LocalException) { test(false); } + background.ice_getConnection().close(false); - configuration.initializeException(new Ice.SocketException()); - background.ice_getCachedConnection().close(true); - Thread.Sleep(10); - configuration.initializeException(null); - try + for(int i = 0; i < 4; ++i) { - background.ice_ping(); + if(i == 0 || i == 2) + { + configuration.initializeException(new Ice.SocketException()); + } + else + { + continue; + } + BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway(); + + try + { + prx.op(); + test(false); + } + catch(Ice.SocketException) + { + } + + Ice.AsyncResult r = prx.begin_op(); + test(!r.isSentSynchronously()); + try + { + prx.end_op(r); + test(false); + } + catch(Ice.Exception) + { + } + test(r.IsCompleted); + + OpAMICallback cbEx = new OpAMICallback(); + r = prx.begin_op().whenCompleted(cbEx.exception); + test(!r.isSentSynchronously()); + cbEx.checkException(true); + test(r.IsCompleted); + + if(i == 0 || i == 2) + { + configuration.initializeException(null); + } } - catch(Ice.LocalException) + + // + // Now run the same tests with the server side. + // + + try { + ctl.initializeException(true); + background.op(); + test(false); } - try + catch(Ice.ConnectionLostException) { - background.ice_ping(); + ctl.initializeException(false); } - catch(Ice.LocalException) + catch(Ice.SecurityException) { - test(false); + ctl.initializeException(false); } - background.ice_getCachedConnection().close(true); - background.ice_ping(); + OpThread thread1 = new OpThread(background); + OpThread thread2 = new OpThread(background); - ctl.initializeException(true); - background.ice_getCachedConnection().close(true); - Thread.Sleep(10); - ctl.initializeException(false); - try + for(int i = 0; i < 5; i++) { + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + + configuration.initializeException(new Ice.SocketException()); + background.ice_getCachedConnection().close(true); + Thread.Sleep(10); + configuration.initializeException(null); + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + } + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + + background.ice_getCachedConnection().close(true); background.ice_ping(); + + ctl.initializeException(true); + background.ice_getCachedConnection().close(true); + Thread.Sleep(10); + ctl.initializeException(false); + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + } + try + { + background.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + + try + { + background.ice_getCachedConnection().close(true); + background.op(); + } + catch(Ice.LocalException) + { + test(false); + } } - catch(Ice.LocalException) - { - } + + thread1.destroy(); + thread2.destroy(); + + thread1.Join(); + thread2.Join(); + } + + private static void validationTests(Configuration configuration, Test.BackgroundPrx background, + Test.BackgroundControllerPrx ctl) + { try { - background.ice_ping(); + background.op(); } catch(Ice.LocalException) { test(false); } + background.ice_getConnection().close(false); try { - background.ice_getCachedConnection().close(true); + // Get the read() of connection validation to throw right away. + configuration.readException(new Ice.SocketException()); background.op(); - } - catch(Ice.LocalException) - { test(false); } - } - - thread1.destroy(); - thread2.destroy(); - - thread1.Join(); - thread2.Join(); - } - - private static void validationTests(Configuration configuration, Test.BackgroundPrx background, - Test.BackgroundControllerPrx ctl) - { - try - { - background.op(); - } - catch(Ice.LocalException) - { - test(false); - } - background.ice_getConnection().close(false); - - try - { - // Get the read() of connection validation to throw right away. - configuration.readException(new Ice.SocketException()); - background.op(); - test(false); - } - catch(Ice.SocketException) - { + catch(Ice.SocketException) + { configuration.readException(null); } @@ -592,7 +592,7 @@ public class AllTests configuration.readException(new Ice.SocketException()); BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway(); Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -640,7 +640,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { background.end_op(r); @@ -659,7 +659,7 @@ public class AllTests ctl.holdAdapter(); // Hold to block in connection validation Ice.AsyncResult r = background.begin_op(); Ice.AsyncResult r2 = background.begin_op(); - test(!r.sentSynchronously() && !r2.sentSynchronously()); + test(!r.isSentSynchronously() && !r2.isSentSynchronously()); test(!r.IsCompleted && !r2.IsCompleted); ctl.resumeAdapter(); background.end_op(r); @@ -837,7 +837,7 @@ public class AllTests background.ice_ping(); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -867,7 +867,7 @@ public class AllTests configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. //test(r.IsCompleted); @@ -931,7 +931,7 @@ public class AllTests configuration.writeReady(false); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -964,7 +964,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. //test(r.isCompleted()); @@ -1014,20 +1014,23 @@ public class AllTests byte[] seq = new byte[512 * 1024]; (new System.Random()).NextBytes(seq); OpAMICallback cbWP = new OpAMICallback(); - while(backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, cbWP.noException).sentSynchronously()) + while(backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, + cbWP.noException).isSentSynchronously()) { } OpAMICallback cb = new OpAMICallback(); Ice.AsyncResult r1 = background.begin_op().whenCompleted(cb.response, cb.noException).whenSent(cb.sent); - test(!r1.sentSynchronously() && !r1.isSent()); + test(!r1.isSentSynchronously() && !r1.isSent()); OpAMICallback cb2 = new OpAMICallback(); Ice.AsyncResult r2 = background.begin_op().whenCompleted(cb2.response, cb2.noException).whenSent(cb2.sent); - test(!r2.sentSynchronously() && !r2.isSent()); + test(!r2.isSentSynchronously() && !r2.isSent()); - test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, cbWP.noException).sentSynchronously()); - test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, cbWP.noException).sentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, + cbWP.noException).isSentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, + cbWP.noException).isSentSynchronously()); test(!cb.checkResponse(false)); test(!cb2.checkResponse(false)); diff --git a/cs/test/Ice/dispatcher/AllTests.cs b/cs/test/Ice/dispatcher/AllTests.cs index ef8f539484d..5b7e1018a4b 100644 --- a/cs/test/Ice/dispatcher/AllTests.cs +++ b/cs/test/Ice/dispatcher/AllTests.cs @@ -43,7 +43,7 @@ public class AllTests { p.op(); - p.begin_op().whenCompleted(delegate() { test(Dispatcher.isDispatcherThread()); }); + p.begin_op().whenCompleted(delegate() { test(Dispatcher.isDispatcherThread()); }, null); TestIntfPrx i = (TestIntfPrx)p.ice_adapterId("dummy"); i.begin_op().whenCompleted(delegate(Ice.Exception ex) @@ -54,14 +54,14 @@ public class AllTests testController.holdAdapter(); Test.Callback_TestIntf_opWithPayload rcb = delegate() { test(Dispatcher.isDispatcherThread()); }; - Ice.SentCallback scb = delegate(bool sentSynchronously) + Ice.SentCallback scb = delegate(bool isSentSynchronously) { - test(sentSynchronously || Dispatcher.isDispatcherThread()); + test(isSentSynchronously || Dispatcher.isDispatcherThread()); }; byte[] seq = new byte[10 * 1024]; (new System.Random()).NextBytes(seq); - while(p.begin_opWithPayload(seq).whenCompleted(rcb).whenSent(scb).sentSynchronously()); + while(p.begin_opWithPayload(seq).whenCompleted(rcb, null).whenSent(scb).isSentSynchronously()); testController.resumeAdapter(); } Console.Out.WriteLine("ok"); diff --git a/cs/test/Ice/invoke/AllTests.cs b/cs/test/Ice/invoke/AllTests.cs index d8a52f077d6..c6e9ab5dc90 100644 --- a/cs/test/Ice/invoke/AllTests.cs +++ b/cs/test/Ice/invoke/AllTests.cs @@ -269,7 +269,7 @@ public class AllTests // begin_ice_invoke with Callback_Object_ice_invoke cb = new Callback(communicator, true); - cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inParams).whenCompleted(cb.opStringNC); + cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inParams).whenCompleted(cb.opStringNC, null); cb.check(); } @@ -309,7 +309,7 @@ public class AllTests // begin_ice_invoke with Callback_Object_ice_invoke cb = new Callback(communicator, true); - cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null).whenCompleted(cb.opExceptionNC); + cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null).whenCompleted(cb.opExceptionNC, null); cb.check(); } diff --git a/cs/test/Ice/invoke/client.exe.config b/cs/test/Ice/invoke/client.exe.config new file mode 100755 index 00000000000..cf795ac3756 --- /dev/null +++ b/cs/test/Ice/invoke/client.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/cs/test/Ice/invoke/server.exe.config b/cs/test/Ice/invoke/server.exe.config new file mode 100755 index 00000000000..cf795ac3756 --- /dev/null +++ b/cs/test/Ice/invoke/server.exe.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/cs/test/Ice/operations/OnewaysNewAMI.cs b/cs/test/Ice/operations/OnewaysNewAMI.cs index 8ebe124f693..2736a396dad 100644 --- a/cs/test/Ice/operations/OnewaysNewAMI.cs +++ b/cs/test/Ice/operations/OnewaysNewAMI.cs @@ -94,7 +94,7 @@ public class OnewaysNewAMI { Callback cb = new Callback(); - p.begin_ice_ping().whenCompleted(cb.noException).whenSent(cb.sent); + p.begin_ice_ping().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); cb.check(); } @@ -119,7 +119,7 @@ public class OnewaysNewAMI { { Callback cb = new Callback(); - p.begin_opVoid().whenCompleted(cb.noException).whenSent(cb.sent); + p.begin_opVoid().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); cb.check(); } } diff --git a/java/demo/Ice/applet/HelloApplet.java b/java/demo/Ice/applet/HelloApplet.java index 34f52fd23c9..045e9fc98f6 100644 --- a/java/demo/Ice/applet/HelloApplet.java +++ b/java/demo/Ice/applet/HelloApplet.java @@ -415,7 +415,7 @@ public class HelloApplet extends JApplet if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/demo/Ice/swing/Client.java b/java/demo/Ice/swing/Client.java index 1c758cb621d..2ed4933cc12 100644 --- a/java/demo/Ice/swing/Client.java +++ b/java/demo/Ice/swing/Client.java @@ -464,7 +464,7 @@ public class Client extends JFrame if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java index 24b17fe10db..3887ff39d09 100644 --- a/java/src/Ice/AsyncResult.java +++ b/java/src/Ice/AsyncResult.java @@ -87,7 +87,7 @@ public class AsyncResult } } - public final boolean sentSynchronously() + public final boolean isSentSynchronously() { return _sentSynchronously; // No lock needed, immutable once __send() is called } diff --git a/java/src/Ice/ExceptionCallback.java b/java/src/Ice/ExceptionCallback.java deleted file mode 100644 index b213f639938..00000000000 --- a/java/src/Ice/ExceptionCallback.java +++ /dev/null @@ -1,50 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 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. -// -// ********************************************************************** - -package Ice; - -/** - * An application can optionally supply an instance of this class in an - * asynchronous invocation. The application must create a subclass and - * implement the exception method. - **/ -public abstract class ExceptionCallback extends Callback -{ - /** - * Called when the invocation raises an Ice run-time exception. - * - * @param __ex The Ice run-time exception raised by the operation. - **/ - public abstract void exception(LocalException __ex); - - /** - * Called when a queued invocation is sent successfully. - **/ - public void sent(boolean sentSynchronously) - { - } - - public final void __completed(AsyncResult __result) - { - try - { - __result.__wait(); - } - catch(LocalException __ex) - { - exception(__ex); - return; - } - } - - public final void __sent(AsyncResult __result) - { - sent(__result.sentSynchronously()); - } -} diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 891fe6653e4..1b477144914 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -1025,7 +1025,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams) { AsyncResult __result = begin_ice_invoke(operation, mode, inParams, cb); - return __result.sentSynchronously(); + return __result.isSentSynchronously(); } /** @@ -1048,7 +1048,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable java.util.Map context) { AsyncResult __result = begin_ice_invoke(operation, mode, inParams, context, cb); - return __result.sentSynchronously(); + return __result.isSentSynchronously(); } /** @@ -1786,7 +1786,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable ice_flushBatchRequests_async(AMI_Object_ice_flushBatchRequests cb) { AsyncResult result = begin_ice_flushBatchRequests(cb); - return result.sentSynchronously(); + return result.isSentSynchronously(); } /** diff --git a/java/src/Ice/OnewayCallback.java b/java/src/Ice/OnewayCallback.java index 7464e397911..3e71390a36a 100644 --- a/java/src/Ice/OnewayCallback.java +++ b/java/src/Ice/OnewayCallback.java @@ -35,7 +35,7 @@ public abstract class OnewayCallback extends IceInternal.CallbackBase public final void __sent(AsyncResult __result) { - sent(__result.sentSynchronously()); + sent(__result.isSentSynchronously()); } public final void __completed(AsyncResult __result) diff --git a/java/src/Ice/TwowayCallback.java b/java/src/Ice/TwowayCallback.java index 78b022fd58a..6ca469b417a 100644 --- a/java/src/Ice/TwowayCallback.java +++ b/java/src/Ice/TwowayCallback.java @@ -30,6 +30,6 @@ public abstract class TwowayCallback extends IceInternal.CallbackBase public final void __sent(AsyncResult __result) { - sent(__result.sentSynchronously()); + sent(__result.isSentSynchronously()); } } diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java index b0882fc3c81..c5db4d978cc 100644 --- a/java/test/Ice/ami/AllTests.java +++ b/java/test/Ice/ami/AllTests.java @@ -19,6 +19,7 @@ import test.Ice.ami.Test.TestIntfException; import test.Ice.ami.Test.Callback_TestIntf_op; import test.Ice.ami.Test.Callback_TestIntf_opWithResult; import test.Ice.ami.Test.Callback_TestIntf_opWithUE; +import test.Ice.ami.Test.Callback_TestIntf_opWithPayload; public class AllTests { @@ -382,8 +383,8 @@ public class AllTests public void sent(Ice.AsyncResult r) { - test(r.sentSynchronously() && _thread == Thread.currentThread().getId() || - !r.sentSynchronously() && _thread != Thread.currentThread().getId()); + test(r.isSentSynchronously() && _thread == Thread.currentThread().getId() || + !r.isSentSynchronously() && _thread != Thread.currentThread().getId()); called(); } @@ -1110,88 +1111,6 @@ public class AllTests } out.println("ok"); - out.print("testing exception callback... "); - out.flush(); - { - TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); - final ExceptionCallback cb = new ExceptionCallback(); - - i.begin_ice_isA("::Test::TestIntf", new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - }); - cb.check(); - - i.begin_op(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - }); - cb.check(); - - i.begin_opWithResult(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - }); - cb.check(); - - i.begin_opWithUE(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - }); - cb.check(); - - // Ensures no exception is called when response is received - p.begin_ice_isA("::Test::TestIntf", new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.noEx(ex); - } - }); - p.begin_op(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.noEx(ex); - } - }); - p.begin_opWithResult(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.noEx(ex); - } - }); - p.begin_opWithUE(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.noEx(ex); - } - }); - } - out.println("ok"); - out.print("testing sent callback... "); out.flush(); { @@ -1323,22 +1242,6 @@ public class AllTests }); cb.check(); - p.begin_op(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - - public void - sent(boolean ss) - { - cb.sent(ss); - } - }); - cb.check(); - java.util.List cbs = new java.util.ArrayList(); byte[] seq = new byte[10024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. @@ -1347,8 +1250,13 @@ public class AllTests do { final SentCallback cb2 = new SentCallback(); - r = p.begin_opWithPayload(seq, new Ice.ExceptionCallback() + r = p.begin_opWithPayload(seq, new Callback_TestIntf_opWithPayload() { + public void + response() + { + } + public void exception(Ice.LocalException ex) { @@ -1363,7 +1271,7 @@ public class AllTests }); cbs.add(cb2); } - while(r.sentSynchronously()); + while(r.isSentSynchronously()); testController.resumeAdapter(); for(SentCallback cb3 : cbs) { @@ -1497,16 +1405,6 @@ public class AllTests } }); cb.check(); - - q.begin_op(new Ice.ExceptionCallback() - { - public void - exception(Ice.LocalException ex) - { - cb.ex(ex); - } - }); - cb.check(); } } out.println("ok"); @@ -1520,12 +1418,12 @@ public class AllTests byte[] seq = new byte[10024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. Ice.AsyncResult r2; - while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); + while((r2 = p.begin_opWithPayload(seq)).isSentSynchronously()); - test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || - !r1.sentSynchronously() && !r1.isCompleted()); + test(r1.isSentSynchronously() && r1.isSent() && !r1.isCompleted() || + !r1.isSentSynchronously() && !r1.isCompleted()); - test(!r2.sentSynchronously() && !r2.isCompleted()); + test(!r2.isSentSynchronously() && !r2.isCompleted()); testController.resumeAdapter(); diff --git a/java/test/Ice/background/AllTests.java b/java/test/Ice/background/AllTests.java index 1d26846b671..9a0b6b6fddc 100644 --- a/java/test/Ice/background/AllTests.java +++ b/java/test/Ice/background/AllTests.java @@ -409,7 +409,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -422,7 +422,7 @@ public class AllTests OpAMICallbackEx cbEx = new OpAMICallbackEx(); r = prx.begin_op(cbEx); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); cbEx.exception(true); test(r.isCompleted()); @@ -519,7 +519,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -532,7 +532,7 @@ public class AllTests OpAMICallbackEx cbEx = new OpAMICallbackEx(); r = prx.begin_op(cbEx); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); cbEx.exception(true); test(r.isCompleted()); @@ -761,7 +761,7 @@ public class AllTests configuration.readException(new Ice.SocketException()); BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway(); Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -809,7 +809,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { background.end_op(r); @@ -827,7 +827,7 @@ public class AllTests ctl.holdAdapter(); // Hold to block in connection validation Ice.AsyncResult r = background.begin_op(); Ice.AsyncResult r2 = background.begin_op(); - test(!r.sentSynchronously() && !r2.sentSynchronously()); + test(!r.isSentSynchronously() && !r2.isSentSynchronously()); test(!r.isCompleted() && !r2.isCompleted()); ctl.resumeAdapter(); background.end_op(r); @@ -1005,7 +1005,7 @@ public class AllTests background.ice_ping(); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -1034,7 +1034,7 @@ public class AllTests configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. test(r.isCompleted()); @@ -1097,7 +1097,7 @@ public class AllTests configuration.writeReady(false); configuration.writeException(new Ice.SocketException()); r = prx.begin_op(); - test(!r.sentSynchronously()); + test(!r.isSentSynchronously()); try { prx.end_op(r); @@ -1130,7 +1130,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); r = background.begin_op(); - if(!r.sentSynchronously()) + if(!r.isSentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. test(r.isCompleted()); @@ -1180,20 +1180,20 @@ public class AllTests byte[] seq = new byte[512 * 1024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. NoResponse noResponse = new NoResponse(); - while(backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()) + while(backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()) { } OpAMICallback cb = new OpAMICallback(); Ice.AsyncResult r1 = background.begin_op(cb); - test(!r1.sentSynchronously() && !r1.isSent()); + test(!r1.isSentSynchronously() && !r1.isSent()); OpAMICallback cb2 = new OpAMICallback(); Ice.AsyncResult r2 = background.begin_op(cb2); - test(!r2.sentSynchronously() && !r2.isSent()); + test(!r2.isSentSynchronously() && !r2.isSent()); - test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()); - test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()); test(!cb.response(false)); test(!cb2.response(false)); diff --git a/java/test/Ice/dispatcher/AllTests.java b/java/test/Ice/dispatcher/AllTests.java index 2d6996f77c8..ebea3bbf6b3 100644 --- a/java/test/Ice/dispatcher/AllTests.java +++ b/java/test/Ice/dispatcher/AllTests.java @@ -98,15 +98,15 @@ public class AllTests } public void - sent(boolean sentSynchronously) + sent(boolean isSentSynchronously) { - test(sentSynchronously || Dispatcher.isDispatcherThread()); + test(isSentSynchronously || Dispatcher.isDispatcherThread()); } }; byte[] seq = new byte[10 * 1024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. - while(p.begin_opWithPayload(seq, callback).sentSynchronously()); + while(p.begin_opWithPayload(seq, callback).isSentSynchronously()); testController.resumeAdapter(); } out.println("ok"); diff --git a/java/test/Ice/operations/OnewaysNewAMI.java b/java/test/Ice/operations/OnewaysNewAMI.java index b11ce8e3b37..15670f50138 100644 --- a/java/test/Ice/operations/OnewaysNewAMI.java +++ b/java/test/Ice/operations/OnewaysNewAMI.java @@ -13,6 +13,8 @@ import test.Ice.operations.Test.Callback_MyClass_opVoid; import test.Ice.operations.Test.MyClass; import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.Callback_MyClass_opVoid; +import test.Ice.operations.Test.Callback_MyClass_opByte; class OnewaysNewAMI { @@ -100,8 +102,14 @@ class OnewaysNewAMI { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Ice.Callback_Object_ice_ping callback = new Ice.Callback_Object_ice_ping() { + public void + response() + { + test(false); + } + public void exception(Ice.LocalException ex) { @@ -120,8 +128,14 @@ class OnewaysNewAMI { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Ice.Callback_Object_ice_isA callback = new Ice.Callback_Object_ice_isA() { + public void + response(boolean isA) + { + test(false); + } + public void exception(Ice.LocalException ex) { @@ -134,8 +148,14 @@ class OnewaysNewAMI { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Ice.Callback_Object_ice_id callback = new Ice.Callback_Object_ice_id() { + public void + response(String id) + { + test(false); + } + public void exception(Ice.LocalException ex) { @@ -148,8 +168,14 @@ class OnewaysNewAMI { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Ice.Callback_Object_ice_ids callback = new Ice.Callback_Object_ice_ids() { + public void + response(String[] ids) + { + test(false); + } + public void exception(Ice.LocalException ex) { @@ -162,8 +188,14 @@ class OnewaysNewAMI { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Callback_MyClass_opVoid callback = new Callback_MyClass_opVoid() { + public void + response() + { + test(false); + } + public void exception(Ice.LocalException ex) { @@ -185,8 +217,14 @@ class OnewaysNewAMI // { final Callback cb = new Callback(); - Ice.ExceptionCallback callback = new Ice.ExceptionCallback() + Callback_MyClass_opByte callback = new Callback_MyClass_opByte() { + public void + response(byte r, byte o) + { + test(false); + } + public void exception(Ice.LocalException ex) { -- cgit v1.2.3 From 2774ed67d93daefcad79959dab04144b63dfb707 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Thu, 3 Dec 2009 09:25:15 +0100 Subject: Changed back isSentSynchronously to sentSynchronously, only generate newCallback exception for oneway requests --- cpp/include/Ice/OutgoingAsync.h | 2 +- cpp/include/Ice/Proxy.h | 4 +-- cpp/src/Ice/Proxy.cpp | 10 +++---- cpp/src/slice2cpp/Gen.cpp | 45 ++++++++++++++++--------------- cpp/src/slice2cs/Gen.cpp | 4 +-- cpp/src/slice2java/Gen.cpp | 4 +-- cpp/test/Ice/ami/AllTests.cpp | 39 ++++++++++++++------------- cpp/test/Ice/background/AllTests.cpp | 32 +++++++++++----------- cpp/test/Ice/dispatcher/AllTests.cpp | 6 ++--- cpp/test/Ice/operations/OnewaysNewAMI.cpp | 6 ++++- cs/src/Ice/OutgoingAsync.cs | 8 +++--- cs/src/Ice/Proxy.cs | 6 ++--- cs/test/Ice/ami/AllTests.cs | 14 +++++----- cs/test/Ice/background/AllTests.cs | 32 +++++++++++----------- cs/test/Ice/dispatcher/AllTests.cs | 6 ++--- java/demo/Ice/applet/HelloApplet.java | 2 +- java/demo/Ice/swing/Client.java | 2 +- java/src/Ice/AsyncResult.java | 2 +- java/src/Ice/ObjectPrxHelperBase.java | 6 ++--- java/src/Ice/OnewayCallback.java | 2 +- java/src/Ice/TwowayCallback.java | 2 +- java/test/Ice/ami/AllTests.java | 14 +++++----- java/test/Ice/background/AllTests.java | 32 +++++++++++----------- java/test/Ice/dispatcher/AllTests.java | 6 ++--- 24 files changed, 147 insertions(+), 139 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 194a83f895b..1bd2a7e34b8 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -65,7 +65,7 @@ public: bool isSent() const; void waitForSent(); - bool isSentSynchronously() const + bool sentSynchronously() const { return _sentSynchronously; // No lock needed, immutable once __send() is called } diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 3888c84b5e5..28d4d21f167 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -1073,7 +1073,7 @@ public: { if(sent) { - (callback.get()->*sent)(result->isSentSynchronously()); + (callback.get()->*sent)(result->sentSynchronously()); } } @@ -1127,7 +1127,7 @@ public: { if(sent) { - (callback.get()->*sent)(result->isSentSynchronously(), CT::dynamicCast(result->getCookie())); + (callback.get()->*sent)(result->sentSynchronously(), CT::dynamicCast(result->getCookie())); } } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 7ff28fdf705..5b5f32ccf9d 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -418,7 +418,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, del); - return result->isSentSynchronously(); + return result->sentSynchronously(); } bool @@ -443,7 +443,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, &AMI_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, context, del); - return result->isSentSynchronously(); + return result->sentSynchronously(); } AsyncResultPtr @@ -539,7 +539,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, del); - return result->isSentSynchronously(); + return result->sentSynchronously(); } bool @@ -564,7 +564,7 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb &AMI_Array_Object_ice_invoke::__exception); } ::Ice::AsyncResultPtr result = begin_ice_invoke(operation, mode, inParams, context, del); - return result->isSentSynchronously(); + return result->sentSynchronously(); } AsyncResultPtr @@ -1130,7 +1130,7 @@ IceProxy::Ice::Object::ice_flushBatchRequests_async(const AMI_Object_ice_flushBa __del = newCallback_Object_ice_flushBatchRequests(cb, &AMI_Object_ice_flushBatchRequests::__exception); } ::Ice::AsyncResultPtr result = begin_ice_flushBatchRequests(0, __del, 0); - return result->isSentSynchronously(); + return result->sentSynchronously(); } ::Ice::AsyncResultPtr diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 8fef2765047..702fd98e639 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2861,7 +2861,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; - C << nl << "return __ar->isSentSynchronously();"; + C << nl << "return __ar->sentSynchronously();"; C << eb; C << sp << nl << "bool" << nl << "IceProxy" << scope << name << "_async" << spar @@ -2898,7 +2898,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar << ';'; - C << nl << "return __ar->isSentSynchronously();"; + C << nl << "return __ar->sentSynchronously();"; C << eb; } } @@ -5532,27 +5532,30 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& } H << eb; - if(withCookie) - { - H << sp << nl << "template " << delName << "Ptr"; - } - else + if(!ret && outParams.empty()) { - H << sp << nl << "template " << delName << "Ptr"; - } - H << nl << "new" << delName << "(" << callbackT << " instance, "; - H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << "),"; - H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; - H << sb; - if(withCookie) - { - H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; - } - else - { - H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; + if(withCookie) + { + H << sp << nl << "template " << delName << "Ptr"; + } + else + { + H << sp << nl << "template " << delName << "Ptr"; + } + H << nl << "new" << delName << "(" << callbackT << " instance, "; + H << "void (T::*excb)(" << "const ::Ice::Exception&" << comCookieT << "),"; + H << "void (T::*sentcb)(bool" << comCookieT << ") = 0)"; + H << sb; + if(withCookie) + { + H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; + } + else + { + H << nl << "return new " << delTmplName << "(instance, 0, excb, sentcb);"; + } + H << eb; } - H << eb; } } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 101579c4086..3bc45e98ce2 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4378,7 +4378,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.isSentSynchronously();"; + _out << "return result__.sentSynchronously();"; _out << eb; _out << sp; @@ -4393,7 +4393,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.isSentSynchronously();"; + _out << "return result__.sentSynchronously();"; _out << eb; } } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 736241f8b83..4300a1f2f23 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -4025,7 +4025,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false" << "__cb" << epar << ';'; - out << nl << "return __r.isSentSynchronously();"; + out << nl << "return __r.sentSynchronously();"; out << eb; out << sp; @@ -4034,7 +4034,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true" << "__cb" << epar << ';'; - out << nl << "return __r.isSentSynchronously();"; + out << nl << "return __r.sentSynchronously();"; out << eb; } } diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index 4dd6c3569e2..fd12efca5f9 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -546,22 +546,22 @@ public: void sentAsync(const Ice::AsyncResultPtr& result) { - test(result->isSentSynchronously() && _thread == IceUtil::ThreadControl() || - !result->isSentSynchronously() && _thread != IceUtil::ThreadControl()); + test(result->sentSynchronously() && _thread == IceUtil::ThreadControl() || + !result->sentSynchronously() && _thread != IceUtil::ThreadControl()); called(); } - void sent(bool isSentSynchronously) + void sent(bool sentSynchronously) { - test(isSentSynchronously && _thread == IceUtil::ThreadControl() || - !isSentSynchronously && _thread != IceUtil::ThreadControl()); + test(sentSynchronously && _thread == IceUtil::ThreadControl() || + !sentSynchronously && _thread != IceUtil::ThreadControl()); called(); } - void sentWC(bool isSentSynchronously, const CookiePtr& cookie) + void sentWC(bool sentSynchronously, const CookiePtr& cookie) { - test(isSentSynchronously && _thread == IceUtil::ThreadControl() || - !isSentSynchronously && _thread != IceUtil::ThreadControl()); + test(sentSynchronously && _thread == IceUtil::ThreadControl() || + !sentSynchronously && _thread != IceUtil::ThreadControl()); test(cookie == _cookie); called(); } @@ -1054,10 +1054,11 @@ allTests(const Ice::CommunicatorPtr& communicator) i->begin_op(Test::newCallback_TestIntf_op(cbWC, &ExceptionCallbackWC::ex), cookie); cbWC->check(); - i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::ex)); - cb->check(); - i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::ex), cookie); - cbWC->check(); + // Operations that return a result must provide the response callback + //i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::ex)); + //cb->check(); + //i->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::ex), cookie); + //cbWC->check(); i->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ExceptionCallback::ex)); cb->check(); @@ -1071,8 +1072,8 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::newCallback_Object_ice_isA(cbWC, &ExceptionCallbackWC::noEx), cookie); p->begin_op(Test::newCallback_TestIntf_op(cb, &ExceptionCallback::noEx)); p->begin_op(Test::newCallback_TestIntf_op(cbWC, &ExceptionCallbackWC::noEx), cookie); - p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::noEx)); - p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::noEx), cookie); + //p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cb, &ExceptionCallback::noEx)); + //p->begin_opWithResult(Test::newCallback_TestIntf_opWithResult(cbWC, &ExceptionCallbackWC::noEx), cookie); // If response is a user exception, it should be received. p->begin_opWithUE(Test::newCallback_TestIntf_opWithUE(cb, &ExceptionCallback::opWithUE)); @@ -1142,7 +1143,7 @@ allTests(const Ice::CommunicatorPtr& communicator) testController->holdAdapter(); cb = new SentCallback(); while(p->begin_opWithPayload(seq, Test::newCallback_TestIntf_opWithPayload( - cb, &SentCallback::ex, &SentCallback::sent))->isSentSynchronously()) + cb, &SentCallback::ex, &SentCallback::sent))->sentSynchronously()) { cbs.push_back(cb); cb = new SentCallback(); @@ -1314,7 +1315,7 @@ allTests(const Ice::CommunicatorPtr& communicator) *q = static_cast(IceUtilInternal::random(255)); } Ice::AsyncResultPtr r2; - while((r2 = p->begin_opWithPayload(seq))->isSentSynchronously()); + while((r2 = p->begin_opWithPayload(seq))->sentSynchronously()); test(r1 == r1); test(r1 != r2); @@ -1323,10 +1324,10 @@ allTests(const Ice::CommunicatorPtr& communicator) test(r1->getHash() != r2->getHash()); test(r1->getHash() < r2->getHash() || r2->getHash() < r1->getHash()); - test(r1->isSentSynchronously() && r1->isSent() && !r1->isCompleted() || - !r1->isSentSynchronously() && !r1->isCompleted()); + test(r1->sentSynchronously() && r1->isSent() && !r1->isCompleted() || + !r1->sentSynchronously() && !r1->isCompleted()); - test(!r2->isSentSynchronously() && !r2->isCompleted()); + test(!r2->sentSynchronously() && !r2->isCompleted()); testController->resumeAdapter(); diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 84e70db71de..debfb799ab4 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -352,7 +352,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrx& b } Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { prx->end_op(r); @@ -365,7 +365,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrx& b OpAMICallbackPtr cbEx = new OpAMICallback(); r = prx->begin_op(Test::newCallback_Background_op(cbEx, &OpAMICallback::exception)); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); cbEx->checkException(); test(r->isCompleted()); @@ -457,7 +457,7 @@ initializeTests(const ConfigurationPtr& configuration, } Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { prx->end_op(r); @@ -470,7 +470,7 @@ initializeTests(const ConfigurationPtr& configuration, OpAMICallbackPtr cbEx = new OpAMICallback(); r = prx->begin_op(Test::newCallback_Background_op(cbEx, &OpAMICallback::exception)); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); cbEx->checkException(); test(r->isCompleted()); @@ -685,7 +685,7 @@ validationTests(const ConfigurationPtr& configuration, configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); BackgroundPrx prx = i == 0 ? background : background->ice_oneway(); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { prx->end_op(r); @@ -738,7 +738,7 @@ validationTests(const ConfigurationPtr& configuration, configuration->readReady(false); configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { background->end_op(r); @@ -756,7 +756,7 @@ validationTests(const ConfigurationPtr& configuration, ctl->holdAdapter(); // Hold to block in connection validation Ice::AsyncResultPtr r = background->begin_op(); Ice::AsyncResultPtr r2 = background->begin_op(); - test(!r->isSentSynchronously() && !r2->isSentSynchronously()); + test(!r->sentSynchronously() && !r2->sentSynchronously()); test(!r->isCompleted() && !r2->isCompleted()); ctl->resumeAdapter(); background->end_op(r); @@ -971,7 +971,7 @@ readWriteTests(const ConfigurationPtr& configuration, background->ice_ping(); configuration->writeException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { prx->end_op(r); @@ -1000,7 +1000,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - if(!r->isSentSynchronously()) + if(!r->sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. #ifndef ICE_USE_IOCP @@ -1070,7 +1070,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->writeReady(false); configuration->writeException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = prx->begin_op(); - test(!r->isSentSynchronously()); + test(!r->sentSynchronously()); try { prx->end_op(r); @@ -1103,7 +1103,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); Ice::AsyncResultPtr r = background->begin_op(); - if(!r->isSentSynchronously()) + if(!r->sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. #ifndef ICE_USE_IOCP @@ -1167,7 +1167,7 @@ readWriteTests(const ConfigurationPtr& configuration, Callback_Background_opWithPayloadPtr callbackWP = newCallback_Background_opWithPayload(cb, &OpAMICallback::noResponse, &OpAMICallback::noException); - while(backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()) + while(backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()) { } @@ -1177,17 +1177,17 @@ readWriteTests(const ConfigurationPtr& configuration, &OpAMICallback::response, &OpAMICallback::noException, &OpAMICallback::sent)); - test(!r1->isSentSynchronously() && !r1->isSent()); + test(!r1->sentSynchronously() && !r1->isSent()); OpAMICallbackPtr cb2 = new OpAMICallback(); Ice::AsyncResultPtr r2 = background->begin_op(newCallback_Background_op(cb2, &OpAMICallback::response, &OpAMICallback::noException, &OpAMICallback::sent)); - test(!r2->isSentSynchronously() && !r2->isSent()); + test(!r2->sentSynchronously() && !r2->isSent()); - test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()); - test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->isSentSynchronously()); + test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()); + test(!backgroundOneway->begin_opWithPayload(seq, callbackWP)->sentSynchronously()); test(!cb->checkResponse(false)); test(!cb2->checkResponse(false)); diff --git a/cpp/test/Ice/dispatcher/AllTests.cpp b/cpp/test/Ice/dispatcher/AllTests.cpp index 0ff7d5a6c5a..80741e951e0 100644 --- a/cpp/test/Ice/dispatcher/AllTests.cpp +++ b/cpp/test/Ice/dispatcher/AllTests.cpp @@ -36,9 +36,9 @@ public: } void - sent(bool isSentSynchronously) + sent(bool sentSynchronously) { - test(isSentSynchronously || Dispatcher::isDispatcherThread()); + test(sentSynchronously || Dispatcher::isDispatcherThread()); } }; typedef IceUtil::Handle CallbackPtr; @@ -85,7 +85,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { *q = static_cast(IceUtilInternal::random(255)); } - while(p->begin_opWithPayload(seq, callback2)->isSentSynchronously()); + while(p->begin_opWithPayload(seq, callback2)->sentSynchronously()); testController->resumeAdapter(); } cout << "ok" << endl; diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp index 9f62376107f..21694cb3df9 100644 --- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp @@ -65,6 +65,10 @@ public: { } + void opByte(Ice::Byte b, Ice::Byte b1) + { + } + void sent(bool) { called(); @@ -145,7 +149,7 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { CallbackPtr cb = new Callback; Test::Callback_MyClass_opBytePtr callback = - Test::newCallback_MyClass_opByte(cb, &Callback::twowayOnlyException); + Test::newCallback_MyClass_opByte(cb, &Callback::opByte, &Callback::twowayOnlyException); p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); cb->check(); } diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index c5594c70ca1..8ec097d9a61 100644 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -61,7 +61,7 @@ namespace Ice bool isSent(); void waitForSent(); - bool isSentSynchronously(); + bool sentSynchronously(); string getOperation(); @@ -173,7 +173,7 @@ namespace IceInternal } } - public bool isSentSynchronously() + public bool sentSynchronously() { return sentSynchronously_; // No lock needed, immutable once send__() is called } @@ -278,7 +278,7 @@ namespace IceInternal } sentCallback_ = delegate(Ice.AsyncResult result) { - cb(result.isSentSynchronously()); + cb(result.sentSynchronously()); }; if((state_ & Sent) == 0) { @@ -1396,7 +1396,7 @@ namespace Ice public void sent__(Ice.AsyncResult result) { - if(!result.isSentSynchronously()) + if(!result.sentSynchronously()) { ((AMISentCallback)this).ice_sent(); } diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index bee64db394b..4e14e2fc22b 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -1214,7 +1214,7 @@ namespace Ice { result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.isSentSynchronously(); + return result.sentSynchronously(); } /// @@ -1237,7 +1237,7 @@ namespace Ice { result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.isSentSynchronously(); + return result.sentSynchronously(); } public AsyncResult begin_ice_invoke(string operation, @@ -1989,7 +1989,7 @@ namespace Ice { result.whenSent((Ice.AsyncCallback)cb.sent__); } - return result.isSentSynchronously(); + return result.sentSynchronously(); } private const string __ice_flushBatchRequests_name = "ice_flushBatchRequests"; diff --git a/cs/test/Ice/ami/AllTests.cs b/cs/test/Ice/ami/AllTests.cs index 9d3683f54e7..5504e206415 100644 --- a/cs/test/Ice/ami/AllTests.cs +++ b/cs/test/Ice/ami/AllTests.cs @@ -419,8 +419,8 @@ public class AllTests public void sentAsync(Ice.AsyncResult r) { - test(r.isSentSynchronously() && _thread == Thread.CurrentThread || - !r.isSentSynchronously() && _thread != Thread.CurrentThread); + test(r.sentSynchronously() && _thread == Thread.CurrentThread || + !r.sentSynchronously() && _thread != Thread.CurrentThread); called(); } @@ -865,7 +865,7 @@ public class AllTests r = p.begin_opWithPayload(seq).whenCompleted(cb2.ex).whenSent(cb2.sent); cbs.Add(cb2); } - while(r.isSentSynchronously()); + while(r.sentSynchronously()); testController.resumeAdapter(); foreach(SentCallback cb3 in cbs) { @@ -949,12 +949,12 @@ public class AllTests byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); Ice.AsyncResult r2; - while((r2 = p.begin_opWithPayload(seq)).isSentSynchronously()); + while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); - test(r1.isSentSynchronously() && r1.isSent() && !r1.isCompleted_() || - !r1.isSentSynchronously() && !r1.isCompleted_()); + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted_() || + !r1.sentSynchronously() && !r1.isCompleted_()); - test(!r2.isSentSynchronously() && !r2.isCompleted_()); + test(!r2.sentSynchronously() && !r2.isCompleted_()); test(!r1.IsCompleted && !r1.CompletedSynchronously); test(!r2.IsCompleted && !r2.CompletedSynchronously); diff --git a/cs/test/Ice/background/AllTests.cs b/cs/test/Ice/background/AllTests.cs index 0f97517a6cd..9fd97693d72 100644 --- a/cs/test/Ice/background/AllTests.cs +++ b/cs/test/Ice/background/AllTests.cs @@ -349,7 +349,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -362,7 +362,7 @@ public class AllTests OpAMICallback cbEx = new OpAMICallback(); r = prx.begin_op().whenCompleted(cbEx.exception); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); cbEx.checkException(true); test(r.IsCompleted); @@ -445,7 +445,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -458,7 +458,7 @@ public class AllTests OpAMICallback cbEx = new OpAMICallback(); r = prx.begin_op().whenCompleted(cbEx.exception); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); cbEx.checkException(true); test(r.IsCompleted); @@ -592,7 +592,7 @@ public class AllTests configuration.readException(new Ice.SocketException()); BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway(); Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -640,7 +640,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { background.end_op(r); @@ -659,7 +659,7 @@ public class AllTests ctl.holdAdapter(); // Hold to block in connection validation Ice.AsyncResult r = background.begin_op(); Ice.AsyncResult r2 = background.begin_op(); - test(!r.isSentSynchronously() && !r2.isSentSynchronously()); + test(!r.sentSynchronously() && !r2.sentSynchronously()); test(!r.IsCompleted && !r2.IsCompleted); ctl.resumeAdapter(); background.end_op(r); @@ -837,7 +837,7 @@ public class AllTests background.ice_ping(); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -867,7 +867,7 @@ public class AllTests configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. //test(r.IsCompleted); @@ -931,7 +931,7 @@ public class AllTests configuration.writeReady(false); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -964,7 +964,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. //test(r.isCompleted()); @@ -1015,22 +1015,22 @@ public class AllTests (new System.Random()).NextBytes(seq); OpAMICallback cbWP = new OpAMICallback(); while(backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, - cbWP.noException).isSentSynchronously()) + cbWP.noException).sentSynchronously()) { } OpAMICallback cb = new OpAMICallback(); Ice.AsyncResult r1 = background.begin_op().whenCompleted(cb.response, cb.noException).whenSent(cb.sent); - test(!r1.isSentSynchronously() && !r1.isSent()); + test(!r1.sentSynchronously() && !r1.isSent()); OpAMICallback cb2 = new OpAMICallback(); Ice.AsyncResult r2 = background.begin_op().whenCompleted(cb2.response, cb2.noException).whenSent(cb2.sent); - test(!r2.isSentSynchronously() && !r2.isSent()); + test(!r2.sentSynchronously() && !r2.isSent()); test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, - cbWP.noException).isSentSynchronously()); + cbWP.noException).sentSynchronously()); test(!backgroundOneway.begin_opWithPayload(seq).whenCompleted(cbWP.noResponse, - cbWP.noException).isSentSynchronously()); + cbWP.noException).sentSynchronously()); test(!cb.checkResponse(false)); test(!cb2.checkResponse(false)); diff --git a/cs/test/Ice/dispatcher/AllTests.cs b/cs/test/Ice/dispatcher/AllTests.cs index 5b7e1018a4b..e64a534af00 100644 --- a/cs/test/Ice/dispatcher/AllTests.cs +++ b/cs/test/Ice/dispatcher/AllTests.cs @@ -54,14 +54,14 @@ public class AllTests testController.holdAdapter(); Test.Callback_TestIntf_opWithPayload rcb = delegate() { test(Dispatcher.isDispatcherThread()); }; - Ice.SentCallback scb = delegate(bool isSentSynchronously) + Ice.SentCallback scb = delegate(bool sentSynchronously) { - test(isSentSynchronously || Dispatcher.isDispatcherThread()); + test(sentSynchronously || Dispatcher.isDispatcherThread()); }; byte[] seq = new byte[10 * 1024]; (new System.Random()).NextBytes(seq); - while(p.begin_opWithPayload(seq).whenCompleted(rcb, null).whenSent(scb).isSentSynchronously()); + while(p.begin_opWithPayload(seq).whenCompleted(rcb, null).whenSent(scb).sentSynchronously()); testController.resumeAdapter(); } Console.Out.WriteLine("ok"); diff --git a/java/demo/Ice/applet/HelloApplet.java b/java/demo/Ice/applet/HelloApplet.java index 045e9fc98f6..34f52fd23c9 100644 --- a/java/demo/Ice/applet/HelloApplet.java +++ b/java/demo/Ice/applet/HelloApplet.java @@ -415,7 +415,7 @@ public class HelloApplet extends JApplet if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/demo/Ice/swing/Client.java b/java/demo/Ice/swing/Client.java index 2ed4933cc12..1c758cb621d 100644 --- a/java/demo/Ice/swing/Client.java +++ b/java/demo/Ice/swing/Client.java @@ -464,7 +464,7 @@ public class Client extends JFrame if(!_deliveryMode.isBatch()) { Ice.AsyncResult r = hello.begin_sayHello(delay, new SayHelloI()); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { _status.setText("Sending request"); } diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java index 3887ff39d09..24b17fe10db 100644 --- a/java/src/Ice/AsyncResult.java +++ b/java/src/Ice/AsyncResult.java @@ -87,7 +87,7 @@ public class AsyncResult } } - public final boolean isSentSynchronously() + public final boolean sentSynchronously() { return _sentSynchronously; // No lock needed, immutable once __send() is called } diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 1b477144914..891fe6653e4 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -1025,7 +1025,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable ice_invoke_async(AMI_Object_ice_invoke cb, String operation, OperationMode mode, byte[] inParams) { AsyncResult __result = begin_ice_invoke(operation, mode, inParams, cb); - return __result.isSentSynchronously(); + return __result.sentSynchronously(); } /** @@ -1048,7 +1048,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable java.util.Map context) { AsyncResult __result = begin_ice_invoke(operation, mode, inParams, context, cb); - return __result.isSentSynchronously(); + return __result.sentSynchronously(); } /** @@ -1786,7 +1786,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable ice_flushBatchRequests_async(AMI_Object_ice_flushBatchRequests cb) { AsyncResult result = begin_ice_flushBatchRequests(cb); - return result.isSentSynchronously(); + return result.sentSynchronously(); } /** diff --git a/java/src/Ice/OnewayCallback.java b/java/src/Ice/OnewayCallback.java index 3e71390a36a..7464e397911 100644 --- a/java/src/Ice/OnewayCallback.java +++ b/java/src/Ice/OnewayCallback.java @@ -35,7 +35,7 @@ public abstract class OnewayCallback extends IceInternal.CallbackBase public final void __sent(AsyncResult __result) { - sent(__result.isSentSynchronously()); + sent(__result.sentSynchronously()); } public final void __completed(AsyncResult __result) diff --git a/java/src/Ice/TwowayCallback.java b/java/src/Ice/TwowayCallback.java index 6ca469b417a..78b022fd58a 100644 --- a/java/src/Ice/TwowayCallback.java +++ b/java/src/Ice/TwowayCallback.java @@ -30,6 +30,6 @@ public abstract class TwowayCallback extends IceInternal.CallbackBase public final void __sent(AsyncResult __result) { - sent(__result.isSentSynchronously()); + sent(__result.sentSynchronously()); } } diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java index c5db4d978cc..ca9a389db09 100644 --- a/java/test/Ice/ami/AllTests.java +++ b/java/test/Ice/ami/AllTests.java @@ -383,8 +383,8 @@ public class AllTests public void sent(Ice.AsyncResult r) { - test(r.isSentSynchronously() && _thread == Thread.currentThread().getId() || - !r.isSentSynchronously() && _thread != Thread.currentThread().getId()); + test(r.sentSynchronously() && _thread == Thread.currentThread().getId() || + !r.sentSynchronously() && _thread != Thread.currentThread().getId()); called(); } @@ -1271,7 +1271,7 @@ public class AllTests }); cbs.add(cb2); } - while(r.isSentSynchronously()); + while(r.sentSynchronously()); testController.resumeAdapter(); for(SentCallback cb3 : cbs) { @@ -1418,12 +1418,12 @@ public class AllTests byte[] seq = new byte[10024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. Ice.AsyncResult r2; - while((r2 = p.begin_opWithPayload(seq)).isSentSynchronously()); + while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); - test(r1.isSentSynchronously() && r1.isSent() && !r1.isCompleted() || - !r1.isSentSynchronously() && !r1.isCompleted()); + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || + !r1.sentSynchronously() && !r1.isCompleted()); - test(!r2.isSentSynchronously() && !r2.isCompleted()); + test(!r2.sentSynchronously() && !r2.isCompleted()); testController.resumeAdapter(); diff --git a/java/test/Ice/background/AllTests.java b/java/test/Ice/background/AllTests.java index 9a0b6b6fddc..1d26846b671 100644 --- a/java/test/Ice/background/AllTests.java +++ b/java/test/Ice/background/AllTests.java @@ -409,7 +409,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -422,7 +422,7 @@ public class AllTests OpAMICallbackEx cbEx = new OpAMICallbackEx(); r = prx.begin_op(cbEx); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); cbEx.exception(true); test(r.isCompleted()); @@ -519,7 +519,7 @@ public class AllTests } Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -532,7 +532,7 @@ public class AllTests OpAMICallbackEx cbEx = new OpAMICallbackEx(); r = prx.begin_op(cbEx); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); cbEx.exception(true); test(r.isCompleted()); @@ -761,7 +761,7 @@ public class AllTests configuration.readException(new Ice.SocketException()); BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway(); Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -809,7 +809,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { background.end_op(r); @@ -827,7 +827,7 @@ public class AllTests ctl.holdAdapter(); // Hold to block in connection validation Ice.AsyncResult r = background.begin_op(); Ice.AsyncResult r2 = background.begin_op(); - test(!r.isSentSynchronously() && !r2.isSentSynchronously()); + test(!r.sentSynchronously() && !r2.sentSynchronously()); test(!r.isCompleted() && !r2.isCompleted()); ctl.resumeAdapter(); background.end_op(r); @@ -1005,7 +1005,7 @@ public class AllTests background.ice_ping(); configuration.writeException(new Ice.SocketException()); Ice.AsyncResult r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -1034,7 +1034,7 @@ public class AllTests configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration.readException(new Ice.SocketException()); Ice.AsyncResult r = background.begin_op(); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. test(r.isCompleted()); @@ -1097,7 +1097,7 @@ public class AllTests configuration.writeReady(false); configuration.writeException(new Ice.SocketException()); r = prx.begin_op(); - test(!r.isSentSynchronously()); + test(!r.sentSynchronously()); try { prx.end_op(r); @@ -1130,7 +1130,7 @@ public class AllTests configuration.readReady(false); configuration.readException(new Ice.SocketException()); r = background.begin_op(); - if(!r.isSentSynchronously()) + if(!r.sentSynchronously()) { // The read exception might propagate before the message send is seen as completed on IOCP. test(r.isCompleted()); @@ -1180,20 +1180,20 @@ public class AllTests byte[] seq = new byte[512 * 1024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. NoResponse noResponse = new NoResponse(); - while(backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()) + while(backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()) { } OpAMICallback cb = new OpAMICallback(); Ice.AsyncResult r1 = background.begin_op(cb); - test(!r1.isSentSynchronously() && !r1.isSent()); + test(!r1.sentSynchronously() && !r1.isSent()); OpAMICallback cb2 = new OpAMICallback(); Ice.AsyncResult r2 = background.begin_op(cb2); - test(!r2.isSentSynchronously() && !r2.isSent()); + test(!r2.sentSynchronously() && !r2.isSent()); - test(!backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()); - test(!backgroundOneway.begin_opWithPayload(seq, noResponse).isSentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()); + test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously()); test(!cb.response(false)); test(!cb2.response(false)); diff --git a/java/test/Ice/dispatcher/AllTests.java b/java/test/Ice/dispatcher/AllTests.java index ebea3bbf6b3..2d6996f77c8 100644 --- a/java/test/Ice/dispatcher/AllTests.java +++ b/java/test/Ice/dispatcher/AllTests.java @@ -98,15 +98,15 @@ public class AllTests } public void - sent(boolean isSentSynchronously) + sent(boolean sentSynchronously) { - test(isSentSynchronously || Dispatcher.isDispatcherThread()); + test(sentSynchronously || Dispatcher.isDispatcherThread()); } }; byte[] seq = new byte[10 * 1024]; new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. - while(p.begin_opWithPayload(seq, callback).isSentSynchronously()); + while(p.begin_opWithPayload(seq, callback).sentSynchronously()); testController.resumeAdapter(); } out.println("ok"); -- cgit v1.2.3 From b5c76902b34afe4774e1d8b0b4707208895e729c Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Thu, 3 Dec 2009 15:05:04 -0330 Subject: Fix C++Builder 2010 compile errors --- cpp/include/IceUtil/ScopedArray.h | 2 +- cpp/src/slice2cpp/Gen.cpp | 2 +- cpp/test/Ice/custom/Makefile.mak | 5 ++++- cpp/test/Ice/operations/Makefile.mak | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/include/IceUtil/ScopedArray.h b/cpp/include/IceUtil/ScopedArray.h index 3a64076f26d..6836799f04b 100644 --- a/cpp/include/IceUtil/ScopedArray.h +++ b/cpp/include/IceUtil/ScopedArray.h @@ -28,7 +28,7 @@ public: ScopedArray(const ScopedArray& other) { _ptr = other._ptr; - other._ptr = 0; + const_cast(other)._ptr = 0; } ~ScopedArray() diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 702fd98e639..481de0e95da 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -6352,7 +6352,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) H << eb; H << nl << "void __sent(bool sentSynchronously)"; H << sb; - H << nl << "AMICallbackBase::__sent(sentSynchronously);"; + H << nl << "::Ice::AMICallbackBase::__sent(sentSynchronously);"; H << eb; H << eb << ';'; H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI diff --git a/cpp/test/Ice/custom/Makefile.mak b/cpp/test/Ice/custom/Makefile.mak index 222a609cd65..77e37463ba3 100644 --- a/cpp/test/Ice/custom/Makefile.mak +++ b/cpp/test/Ice/custom/Makefile.mak @@ -56,7 +56,10 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS) -CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -Zm300 +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN +!if "$(BCPLUSPLUS)" != "yes" +CPPFLAGS = $(CPPFLAGS) -Zm300 +!endif !if "$(GENERATE_PDB)" == "yes" CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) diff --git a/cpp/test/Ice/operations/Makefile.mak b/cpp/test/Ice/operations/Makefile.mak index 7f632140d41..42dc1a7cab9 100644 --- a/cpp/test/Ice/operations/Makefile.mak +++ b/cpp/test/Ice/operations/Makefile.mak @@ -54,7 +54,10 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak -CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -Zm200 +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN +!if "$(BCPLUSPLUS)" != "yes" +CPPFLAGS = $(CPPFLAGS) -Zm200 +!endif !if "$(GENERATE_PDB)" == "yes" CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) -- cgit v1.2.3 From c5b5f38299c69bd68febb52b3559c4e653f54acb Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Thu, 3 Dec 2009 21:14:59 +0100 Subject: AMI requests now throw IllegalArgumentExcption instaed of TwowayOnlyException --- cpp/include/Ice/Proxy.h | 1 + cpp/src/Ice/Proxy.cpp | 20 +++++++++++++++++--- cpp/src/slice2cpp/Gen.cpp | 6 +++--- cpp/src/slice2cs/Gen.cpp | 6 +++--- cpp/src/slice2java/Gen.cpp | 4 ++-- cpp/test/Ice/ami/AllTests.cpp | 5 ++--- cs/src/Ice/Proxy.cs | 32 ++++++++++++++++++++++---------- cs/test/Ice/ami/AllTests.cs | 5 ++--- java/src/Ice/ObjectPrxHelperBase.java | 20 +++++++++++++++++--- java/test/Ice/ami/AllTests.java | 5 ++--- 10 files changed, 71 insertions(+), 33 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 28d4d21f167..cd5a55ca567 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -603,6 +603,7 @@ public: const ::IceInternal::LocalExceptionWrapper&, bool, int&); void __checkTwowayOnly(const ::std::string&) const; + void __checkAsyncTwowayOnly(const ::std::string&) const; void __end(const ::Ice::AsyncResultPtr&, const std::string&) const; ::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate(bool); diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 5b5f32ccf9d..96df0c720ac 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -151,9 +151,9 @@ IceProxy::Ice::Object::begin_ice_isA(const string& typeId, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_isA_name, del, cookie); + __checkAsyncTwowayOnly(ice_isA_name); try { - __checkTwowayOnly(ice_isA_name); __result->__prepare(ice_isA_name, Normal, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->write(typeId); @@ -294,9 +294,9 @@ IceProxy::Ice::Object::begin_ice_ids(const Context* ctx, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_ids_name, del, cookie); + __checkAsyncTwowayOnly(ice_ids_name); try { - __checkTwowayOnly(ice_ids_name); __result->__prepare(ice_ids_name, Normal, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->endWriteEncaps(); @@ -338,9 +338,9 @@ IceProxy::Ice::Object::begin_ice_id(const Context* ctx, const ::Ice::LocalObjectPtr& cookie) { OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_id_name, del, cookie); + __checkAsyncTwowayOnly(ice_id_name); try { - __checkTwowayOnly(ice_id_name); __result->__prepare(ice_id_name, Normal, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->endWriteEncaps(); @@ -1306,6 +1306,20 @@ IceProxy::Ice::Object::__checkTwowayOnly(const string& name) const } } +void +IceProxy::Ice::Object::__checkAsyncTwowayOnly(const string& name) const +{ + // + // No mutex lock necessary, there is nothing mutable in this operation. + // + if(!ice_isTwoway()) + { + throw IceUtil::IllegalArgumentException(__FILE__, + __LINE__, + "`" + name + "' can only be called with a twoway proxy"); + } +} + void IceProxy::Ice::Object::__end(const ::Ice::AsyncResultPtr& __result, const std::string& operation) const { diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 481de0e95da..c0dddcce120 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2673,12 +2673,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) string flatName = p->flattenedScope() + name + "_name"; C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, "; C << flatName << ", __del, __cookie);"; - C << nl << "try"; - C << sb; if(p->returnsData()) { - C << nl << "__checkTwowayOnly(" << flatName << ");"; + C << nl << "__checkAsyncTwowayOnly(" << flatName << ");"; } + C << nl << "try"; + C << sb; C << nl << "__result->__prepare(" << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; C << nl << "::IceInternal::BasicStream* __os = __result->__getOs();"; writeMarshalCode(C, inParams, 0, StringList(), true); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 3bc45e98ce2..db4896c4d4f 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4254,12 +4254,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "result__.whenCompletedWithAsyncCallback(cb__);"; _out << eb; - _out << nl << "try"; - _out << sb; if(op->returnsData()) { - _out << nl << "((Ice.ObjectPrxHelperBase)this).checkTwowayOnly__(" << flatName << ");"; + _out << nl << "checkAsyncTwowayOnly__(" << flatName << ");"; } + _out << nl << "try"; + _out << sb; _out << nl << "result__.prepare__(" << flatName << ", " << sliceModeToIceMode(op->sendMode()) << ", ctx__, explicitContext__);"; _out << nl << "IceInternal.BasicStream os__ = result__.ostr__;"; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 4300a1f2f23..7afd33900ea 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -3863,12 +3863,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);"; - out << nl << "try"; - out << sb; if(op->returnsData()) { out << nl << "__checkTwowayOnly(__" << op->name() << "_name);"; } + out << nl << "try"; + out << sb; out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->mode()) << ", __ctx, __explicitCtx);"; out << nl << "IceInternal.BasicStream __os = __result.__os();"; diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index fd12efca5f9..7cf9e4faa9d 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -929,13 +929,12 @@ allTests(const Ice::CommunicatorPtr& communicator) } - r = p->ice_oneway()->begin_opWithResult(); try { - Test::TestIntfPrx::uncheckedCast(r->getProxy())->end_opWithResult(r); + r = p->ice_oneway()->begin_opWithResult(); test(false); } - catch(const Ice::TwowayOnlyException&) + catch(const IceUtil::IllegalArgumentException&) { } diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 4e14e2fc22b..481597df1d6 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -696,10 +696,10 @@ namespace Ice { result__.whenCompletedWithAsyncCallback(cb__); } + checkAsyncTwowayOnly__(__ice_isA_name); try { - ((ObjectPrxHelperBase)this).checkTwowayOnly__(__ice_isA_name); result__.prepare__(__ice_isA_name, OperationMode.Normal, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.writeString(id); @@ -946,10 +946,10 @@ namespace Ice { result__.whenCompletedWithAsyncCallback(cb__); } + checkAsyncTwowayOnly__(__ice_ids_name); try { - ((ObjectPrxHelperBase)this).checkTwowayOnly__(__ice_ids_name); result__.prepare__(__ice_ids_name, OperationMode.Normal, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.endWriteEncaps(); @@ -1086,10 +1086,10 @@ namespace Ice { result__.whenCompletedWithAsyncCallback(cb__); } + checkAsyncTwowayOnly__(__ice_id_name); try { - ((ObjectPrxHelperBase)this).checkTwowayOnly__(__ice_id_name); result__.prepare__(__ice_id_name, OperationMode.Normal, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.endWriteEncaps(); @@ -1290,12 +1290,12 @@ namespace Ice } private AsyncResult begin_ice_invoke(string operation, - OperationMode mode, - byte[] inParams, - Dictionary context__, - bool explicitContext__, - Ice.AsyncCallback cb__, - object cookie__) + OperationMode mode, + byte[] inParams, + Dictionary context__, + bool explicitContext__, + Ice.AsyncCallback cb__, + object cookie__) { IceInternal.TwowayOutgoingAsync result__ = new IceInternal.TwowayOutgoingAsync(this, __ice_invoke_name, @@ -1307,7 +1307,6 @@ namespace Ice try { - ((ObjectPrxHelperBase)this).checkTwowayOnly__(__ice_invoke_name); result__.prepare__(operation, mode, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.writeBlob(inParams); @@ -2212,6 +2211,19 @@ namespace Ice } } + public void checkAsyncTwowayOnly__(string name) + { + // + // No mutex lock necessary, there is nothing mutable in this + // operation. + // + + if(!ice_isTwoway()) + { + throw new System.ArgumentException("`" + name + "' can only be called with a twoway proxy"); + } + } + public void end__(AsyncResult result, string operation) { IceInternal.OutgoingAsync outAsync = (IceInternal.OutgoingAsync)result; diff --git a/cs/test/Ice/ami/AllTests.cs b/cs/test/Ice/ami/AllTests.cs index 5504e206415..b120a15f482 100644 --- a/cs/test/Ice/ami/AllTests.cs +++ b/cs/test/Ice/ami/AllTests.cs @@ -709,13 +709,12 @@ public class AllTests } - r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult(); try { - Test.TestIntfPrxHelper.uncheckedCast(r.getProxy()).end_opWithResult(r); + r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult(); test(false); } - catch(Ice.TwowayOnlyException) + catch(System.ArgumentException) { } diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 891fe6653e4..69baa8c3806 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -205,9 +205,9 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable IceInternal.CallbackBase __cb) { IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_isA_name, __cb); + __checkAsyncTwowayOnly(__ice_isA_name); try { - __checkTwowayOnly(__ice_isA_name); __result.__prepare(__ice_isA_name, OperationMode.Nonmutating, __context, __explicitCtx); IceInternal.BasicStream __os = __result.__os(); __os.writeString(__id); @@ -536,9 +536,9 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable begin_ice_ids(java.util.Map __context, boolean __explicitCtx, IceInternal.CallbackBase __cb) { IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_ids_name, __cb); + __checkAsyncTwowayOnly(__ice_ids_name); try { - __checkTwowayOnly(__ice_ids_name); __result.__prepare(__ice_ids_name, OperationMode.Nonmutating, __context, __explicitCtx); IceInternal.BasicStream __os = __result.__os(); __os.endWriteEncaps(); @@ -712,9 +712,9 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable begin_ice_id(java.util.Map __context, boolean __explicitCtx, IceInternal.CallbackBase __cb) { IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __ice_id_name, __cb); + __checkAsyncTwowayOnly(__ice_id_name); try { - __checkTwowayOnly(__ice_id_name); __result.__prepare(__ice_id_name, OperationMode.Nonmutating, __context, __explicitCtx); IceInternal.BasicStream __os = __result.__os(); __os.endWriteEncaps(); @@ -2032,6 +2032,20 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable } } + public final void + __checkAsyncTwowayOnly(String name) + { + // + // No mutex lock necessary, there is nothing mutable in this + // operation. + // + + if(!ice_isTwoway()) + { + throw new java.lang.IllegalArgumentException("`" + name + "' can only be called with a twoway proxy"); + } + } + public final _ObjectDel __getDelegate(boolean ami) { diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java index ca9a389db09..3746b1f703f 100644 --- a/java/test/Ice/ami/AllTests.java +++ b/java/test/Ice/ami/AllTests.java @@ -933,13 +933,12 @@ public class AllTests } - r = ((TestIntfPrx)p.ice_oneway()).begin_opWithResult(); try { - TestIntfPrxHelper.uncheckedCast(r.getProxy()).end_opWithResult(r); + r = ((TestIntfPrx)p.ice_oneway()).begin_opWithResult(); test(false); } - catch(Ice.TwowayOnlyException ex) + catch(java.lang.IllegalArgumentException ex) { } -- cgit v1.2.3 From 97b8898f58ca33ccbf8a24d483c6a7e530c4ac21 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Fri, 4 Dec 2009 10:02:20 +0100 Subject: Fixed bug 4426 and 4409 --- cpp/src/slice2cpp/Gen.cpp | 46 ++++++++-- cpp/src/slice2cs/Gen.cpp | 68 ++++++++++----- cpp/src/slice2java/Gen.cpp | 50 +++++++++-- cpp/test/Ice/operations/OnewaysNewAMI.cpp | 68 +++++++-------- cs/test/Ice/operations/OnewaysNewAMI.cs | 63 +++++++------- java/test/Freeze/fileLock/db/.gitignore | 0 java/test/Ice/operations/OnewaysNewAMI.java | 125 ++++++++-------------------- java/test/IceUtil/fileLock/ClientFail.java | 2 +- 8 files changed, 233 insertions(+), 189 deletions(-) delete mode 100644 java/test/Freeze/fileLock/db/.gitignore (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index c0dddcce120..6822f587487 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2671,12 +2671,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << "const ::Ice::LocalObjectPtr& __cookie" << epar; C << sb; string flatName = p->flattenedScope() + name + "_name"; - C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, "; - C << flatName << ", __del, __cookie);"; if(p->returnsData()) { C << nl << "__checkAsyncTwowayOnly(" << flatName << ");"; } + C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, "; + C << flatName << ", __del, __cookie);"; C << nl << "try"; C << sb; C << nl << "__result->__prepare(" << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);"; @@ -2860,7 +2860,25 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << opScopedAMI << "::__exception);"; C << eb; } - C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; + + if(p->returnsData()) + { + C << nl << "::Ice::AsyncResultPtr __ar;"; + C << nl << "try"; + C << sb; + C << nl << "__checkTwowayOnly(" << flatName << ");"; + C << nl << "__ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; + C << eb; + C << nl << "catch(const ::Ice::TwowayOnlyException& ex)"; + C << sb; + C << nl << "__ar = new ::IceInternal::OutgoingAsync(this, " << flatName << ", __del, 0);"; + C << nl << "__ar->__exceptionAsync(ex);"; + C << eb; + } + else + { + C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';'; + } C << nl << "return __ar->sentSynchronously();"; C << eb; @@ -2896,8 +2914,26 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << opScopedAMI << "::__exception);"; C << eb; } - C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar - << ';'; + + if(p->returnsData()) + { + C << nl << "::Ice::AsyncResultPtr __ar;"; + C << nl << "try"; + C << sb; + C << nl << "__checkTwowayOnly(" << flatName << ");"; + C << nl << "__ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar << ';'; + C << eb; + C << nl << "catch(const ::Ice::TwowayOnlyException& ex)"; + C << sb; + C << nl << "__ar = new ::IceInternal::OutgoingAsync(this, " << flatName << ", __del, 0);"; + C << nl << "__ar->__exceptionAsync(ex);"; + C << eb; + } + else + { + C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar + << ';'; + } C << nl << "return __ar->sentSynchronously();"; C << eb; } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index db4896c4d4f..e15880091e5 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4239,6 +4239,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; if(op->returnsData()) { + _out << nl << "checkAsyncTwowayOnly__(" << flatName << ");"; _out << nl << "IceInternal.TwowayOutgoingAsync<" << delType << "> result__ = " << " new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, " << flatName << ", " << op->name() << "_completed__"; @@ -4254,10 +4255,6 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "result__.whenCompletedWithAsyncCallback(cb__);"; _out << eb; - if(op->returnsData()) - { - _out << nl << "checkAsyncTwowayOnly__(" << flatName << ");"; - } _out << nl << "try"; _out << sb; _out << nl << "result__.prepare__(" << flatName << ", " @@ -4346,16 +4343,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << eb; } - } - - // - // Old AMI mapping. - // - for(r = ops.begin(); r != ops.end(); ++r) - { - OperationPtr op = *r; - ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container()); + // + // Old AMI mapping. + // if(containingClass->hasMetaData("ami") || op->hasMetaData("ami")) { vector paramsAMI = getParamsAsync(op, false); @@ -4363,6 +4354,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) vector argsNewAMI = getArgsAsync(op, true); string opName = op->name(); + string flatName = "__" + opName + "_name"; // // Write two versions of the operation - with and without a @@ -4372,13 +4364,32 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocCommentAsync(op, InParam); _out << nl << "public bool " << opName << "_async" << spar << paramsAMI << epar; _out << sb; - _out << nl << "Ice.AsyncResult result__ = begin_" << opName << spar << argsNewAMI << epar; - _out << ".whenCompleted(cb__.response__, cb__.exception__);"; + if(op->returnsData()) + { + _out << nl << "Ice.AsyncResult<" << delType << "> result__;"; + _out << nl << "try"; + _out << sb; + _out << nl << "checkTwowayOnly__(" << flatName << ");"; + _out << nl << "result__ = begin_" << opName << spar << argsNewAMI << epar << ";"; + _out << eb; + _out << nl << "catch(Ice.TwowayOnlyException ex)"; + _out << sb; + _out << nl << "result__ = new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, " + << flatName << ", " << op->name() << "_completed__, null);"; + _out << nl << "((IceInternal.OutgoingAsyncBase)result__).exceptionAsync__(ex);"; + _out << eb; + } + else + { + _out << nl << "Ice.AsyncResult<" << delType << "> result__ = begin_" << opName << spar << argsNewAMI + << epar << ";"; + } + _out << nl << "result__.whenCompleted(cb__.response__, cb__.exception__);"; _out << nl << "if(cb__ is Ice.AMISentCallback)"; _out << sb; _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.sentSynchronously();"; + _out << nl << "return result__.sentSynchronously();"; _out << eb; _out << sp; @@ -4387,13 +4398,32 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "public bool " << opName << "_async" << spar << paramsAMI << "_System.Collections.Generic.Dictionary ctx__" << epar; _out << sb; - _out << nl << "Ice.AsyncResult result__ = begin_" << opName << spar << argsNewAMI << "ctx__" << epar; - _out << ".whenCompleted(cb__.response__, cb__.exception__);"; + if(op->returnsData()) + { + _out << nl << "Ice.AsyncResult<" << delType << "> result__;"; + _out << nl << "try"; + _out << sb; + _out << nl << "checkTwowayOnly__(" << flatName << ");"; + _out << nl << "result__ = begin_" << opName << spar << argsNewAMI << "ctx__" << epar << ";"; + _out << eb; + _out << nl << "catch(Ice.TwowayOnlyException ex)"; + _out << sb; + _out << nl << "result__ = new IceInternal.TwowayOutgoingAsync<" << delType << ">(this, " + << flatName << ", " << op->name() << "_completed__, null);"; + _out << nl << "((IceInternal.OutgoingAsyncBase)result__).exceptionAsync__(ex);"; + _out << eb; + } + else + { + _out << nl << "Ice.AsyncResult<" << delType << "> result__ = begin_" << opName << spar << argsNewAMI + << "ctx__" << epar << ";"; + } + _out << nl << "result__.whenCompleted(cb__.response__, cb__.exception__);"; _out << nl << "if(cb__ is Ice.AMISentCallback)"; _out << sb; _out << nl << "result__.whenSent((Ice.AsyncCallback)cb__.sent__);"; _out << eb; - _out << "return result__.sentSynchronously();"; + _out << nl << "return result__.sentSynchronously();"; _out << eb; } } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 7afd33900ea..27d534ce518 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -3861,12 +3861,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "private Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << "boolean __explicitCtx" << "IceInternal.CallbackBase __cb" << epar; out << sb; - out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name() - << "_name, __cb);"; if(op->returnsData()) { - out << nl << "__checkTwowayOnly(__" << op->name() << "_name);"; + out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);"; } + out << nl << "IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __" << op->name() + << "_name, __cb);"; out << nl << "try"; out << sb; out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->mode()) @@ -4023,8 +4023,26 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocCommentAsync(out, op, InParam); out << nl << "public boolean" << nl << op->name() << "_async" << spar << paramsAMI << epar; out << sb; - out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false" - << "__cb" << epar << ';'; + if(op->returnsData()) + { + out << nl << "Ice.AsyncResult __r;"; + out << nl << "try"; + out << sb; + out << nl << "__checkTwowayOnly(__" << op->name() << "_name);"; + out << nl << "__r = begin_" << op->name() << spar << argsAMI << "null" << "false" + << "__cb" << epar << ';'; + out << eb; + out << nl << "catch(Ice.TwowayOnlyException ex)"; + out << sb; + out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);"; + out << nl << "__r.__exceptionAsync(ex);"; + out << eb; + } + else + { + out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "null" << "false" + << "__cb" << epar << ';'; + } out << nl << "return __r.sentSynchronously();"; out << eb; @@ -4032,8 +4050,26 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocCommentAsync(out, op, InParam, contextDoc); out << nl << "public boolean" << nl << op->name() << "_async" << spar << paramsAMI << contextParam << epar; out << sb; - out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true" - << "__cb" << epar << ';'; + if(op->returnsData()) + { + out << nl << "Ice.AsyncResult __r;"; + out << nl << "try"; + out << sb; + out << nl << "__checkTwowayOnly(__" << op->name() << "_name);"; + out << nl << "__r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true" + << "__cb" << epar << ';'; + out << eb; + out << nl << "catch(Ice.TwowayOnlyException ex)"; + out << sb; + out << nl << "__r = new IceInternal.OutgoingAsync(this, __" << op->name() << "_name, __cb);"; + out << nl << "__r.__exceptionAsync(ex);"; + out << eb; + } + else + { + out << nl << "Ice.AsyncResult __r = begin_" << op->name() << spar << argsAMI << "__ctx" << "true" + << "__cb" << epar << ';'; + } out << nl << "return __r.sentSynchronously();"; out << eb; } diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp index 21694cb3df9..c8f6517edb6 100644 --- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp @@ -78,22 +78,6 @@ public: { test(false); } - - void twowayOnlyException(const Ice::Exception& ex) - { - try - { - ex.ice_throw(); - } - catch(const Ice::TwowayOnlyException&) - { - called(); - } - catch(const Ice::Exception&) - { - test(false); - } - } }; typedef IceUtil::Handle CallbackPtr; @@ -113,24 +97,36 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& } { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, &Callback::twowayOnlyException); - p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); - cb->check(); + try + { + p->begin_ice_isA(Test::MyClass::ice_staticId()); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } } { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, &Callback::twowayOnlyException); - p->begin_ice_id(callback); - cb->check(); + try + { + p->begin_ice_id(); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } } { - CallbackPtr cb = new Callback; - Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, &Callback::twowayOnlyException); - p->begin_ice_ids(callback); - cb->check(); + try + { + p->begin_ice_ids(); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } } { @@ -143,14 +139,14 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& } } - // - // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. - // { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opBytePtr callback = - Test::newCallback_MyClass_opByte(cb, &Callback::opByte, &Callback::twowayOnlyException); - p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); - cb->check(); + try + { + p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f)); + test(false); + } + catch(const IceUtil::IllegalArgumentException&) + { + } } } diff --git a/cs/test/Ice/operations/OnewaysNewAMI.cs b/cs/test/Ice/operations/OnewaysNewAMI.cs index 2736a396dad..58aae690834 100644 --- a/cs/test/Ice/operations/OnewaysNewAMI.cs +++ b/cs/test/Ice/operations/OnewaysNewAMI.cs @@ -70,22 +70,6 @@ public class OnewaysNewAMI { test(false); } - - public void twowayOnlyException(Ice.Exception ex) - { - try - { - throw ex; - } - catch(Ice.TwowayOnlyException) - { - called(); - } - catch(Ice.Exception) - { - test(false); - } - } } internal static void onewaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx proxy) @@ -99,21 +83,36 @@ public class OnewaysNewAMI } { - Callback cb = new Callback(); - p.begin_ice_isA("::Test::MyClass").whenCompleted((Ice.ExceptionCallback)cb.twowayOnlyException); - cb.check(); + try + { + p.begin_ice_isA("::Test::MyClass"); + test(false); + } + catch(System.ArgumentException) + { + } } { - Callback cb = new Callback(); - p.begin_ice_id().whenCompleted((Ice.ExceptionCallback)cb.twowayOnlyException); - cb.check(); + try + { + p.begin_ice_id(); + test(false); + } + catch(System.ArgumentException) + { + } } { - Callback cb = new Callback(); - p.begin_ice_ids().whenCompleted((Ice.ExceptionCallback)cb.twowayOnlyException); - cb.check(); + try + { + p.begin_ice_ids(); + test(false); + } + catch(System.ArgumentException) + { + } } { @@ -124,13 +123,15 @@ public class OnewaysNewAMI } } - // - // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. - // { - Callback cb = new Callback(); - p.begin_opByte((byte)0xff, (byte)0x0f).whenCompleted(cb.twowayOnlyException); - cb.check(); + try + { + p.begin_opByte((byte)0xff, (byte)0x0f); + test(false); + } + catch(System.ArgumentException) + { + } } } } diff --git a/java/test/Freeze/fileLock/db/.gitignore b/java/test/Freeze/fileLock/db/.gitignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/java/test/Ice/operations/OnewaysNewAMI.java b/java/test/Ice/operations/OnewaysNewAMI.java index 15670f50138..6e7ffa0f85b 100644 --- a/java/test/Ice/operations/OnewaysNewAMI.java +++ b/java/test/Ice/operations/OnewaysNewAMI.java @@ -75,23 +75,7 @@ class OnewaysNewAMI void noException(Ice.LocalException ex) { test(false); - } - - void twowayOnlyException(Ice.LocalException ex) - { - try - { - throw ex; - } - catch(Ice.TwowayOnlyException e) - { - called(); - } - catch(Ice.LocalException e) - { - test(false); - } - } + } }; static void @@ -127,63 +111,36 @@ class OnewaysNewAMI } { - final Callback cb = new Callback(); - Ice.Callback_Object_ice_isA callback = new Ice.Callback_Object_ice_isA() - { - public void - response(boolean isA) - { - test(false); - } - - public void - exception(Ice.LocalException ex) - { - cb.twowayOnlyException(ex); - } - }; - p.begin_ice_isA("::Test::MyClass", callback); - cb.check(); + try + { + p.begin_ice_isA("::Test::MyClass"); + test(false); + } + catch(java.lang.IllegalArgumentException ex) + { + } } - - { - final Callback cb = new Callback(); - Ice.Callback_Object_ice_id callback = new Ice.Callback_Object_ice_id() - { - public void - response(String id) - { - test(false); - } - public void - exception(Ice.LocalException ex) - { - cb.twowayOnlyException(ex); - } - }; - p.begin_ice_id(callback); - cb.check(); - } - { - final Callback cb = new Callback(); - Ice.Callback_Object_ice_ids callback = new Ice.Callback_Object_ice_ids() - { - public void - response(String[] ids) - { - test(false); - } + try + { + p.begin_ice_id(); + test(false); + } + catch(java.lang.IllegalArgumentException ex) + { + } + } - public void - exception(Ice.LocalException ex) - { - cb.twowayOnlyException(ex); - } - }; - p.begin_ice_ids(callback); - cb.check(); + { + try + { + p.begin_ice_ids(); + test(false); + } + catch(java.lang.IllegalArgumentException ex) + { + } } { @@ -212,27 +169,15 @@ class OnewaysNewAMI cb.check(); } - // - // Test that calling a twoway operation with a oneway proxy raises TwowayOnlyException. - // { - final Callback cb = new Callback(); - Callback_MyClass_opByte callback = new Callback_MyClass_opByte() - { - public void - response(byte r, byte o) - { - test(false); - } - - public void - exception(Ice.LocalException ex) - { - cb.twowayOnlyException(ex); - } - }; - p.begin_opByte((byte)0xff, (byte)0x0f, callback); - cb.check(); + try + { + p.begin_opByte((byte)0xff, (byte)0x0f); + test(false); + } + catch(java.lang.IllegalArgumentException ex) + { + } } } } diff --git a/java/test/IceUtil/fileLock/ClientFail.java b/java/test/IceUtil/fileLock/ClientFail.java index bda4bce6fbc..627c632207c 100644 --- a/java/test/IceUtil/fileLock/ClientFail.java +++ b/java/test/IceUtil/fileLock/ClientFail.java @@ -70,7 +70,7 @@ public class ClientFail test(false); } - if(pid.isEmpty()) + if(pid.length() == 0) { test(false); } -- cgit v1.2.3