diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index 87e55711997..ccee68cccf0 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -1128,10 +1128,11 @@ Gen::ProxyVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) out << nl << "/// - throws: `Ice.LocalException` if a communication error occurs."; out << nl << "public func checkedCast" << spar << ("prx: " + getUnqualified("Ice.ObjectPrx", swiftModule)) << ("type: " + prx + ".Protocol") << ("facet: Swift.String? = nil") - << ("context: " + getUnqualified("Ice.Context", swiftModule) + "? = nil") << epar << " throws -> " << prx + << ("context: " + getUnqualified("Ice.Context", swiftModule) + "? = nil") << epar << " async throws -> " << prx << "?"; out << sb; - out << nl << "return try " << prxI << ".checkedCast(prx: prx, facet: facet, context: context) as " << prxI << "?"; + out << nl << "return try await " << prxI << ".checkedCast(prx: prx, facet: facet, context: context) as " << prxI + << "?"; out << eb; // @@ -1218,7 +1219,6 @@ void Gen::ProxyVisitor::visitOperation(const OperationPtr& op) { writeProxyOperation(out, op); - writeProxyAsyncOperation(out, op); } Gen::ValueVisitor::ValueVisitor(::IceInternal::Output& o) : out(o) {} @@ -1518,7 +1518,7 @@ Gen::ObjectVisitor::visitOperation(const OperationPtr& op) const ExceptionList allExceptions = op->throws(); out << sp; - writeOpDocSummary(out, op, true, true); + writeOpDocSummary(out, op, true); out << nl << "func " << opName; out << spar; for (ParamInfoList::const_iterator q = allInParams.begin(); q != allInParams.end(); ++q) diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp index 2356af16420..004a4aad186 100644 --- a/cpp/src/slice2swift/SwiftUtil.cpp +++ b/cpp/src/slice2swift/SwiftUtil.cpp @@ -259,6 +259,7 @@ SwiftGenerator::splitComment(const string& c) string comment = c; // + // TODO: this comment is suspicious. Does this apply to Swift docs as well? // Strip HTML markup and javadoc links -- MATLAB doesn't display them. // string::size_type pos = 0; @@ -662,7 +663,7 @@ SwiftGenerator::writeDocSummary(IceInternal::Output& out, const ContainedPtr& p) } void -SwiftGenerator::writeOpDocSummary(IceInternal::Output& out, const OperationPtr& p, bool async, bool dispatch) +SwiftGenerator::writeOpDocSummary(IceInternal::Output& out, const OperationPtr& p, bool dispatch) { DocElements doc = parseComment(p); if (!doc.overview.empty()) @@ -708,71 +709,63 @@ SwiftGenerator::writeOpDocSummary(IceInternal::Output& out, const OperationPtr& typeCtx = 0; - if (async) + const ParamInfoList allOutParams = getAllOutParams(p, typeCtx); + if (allOutParams.size() == 1) { + ParamInfo ret = allOutParams.front(); out << nl << "///"; - out << nl << "/// - returns: `" << operationReturnType(p, typeCtx) << "` - The result of the operation"; - } - else - { - const ParamInfoList allOutParams = getAllOutParams(p, typeCtx); - if (allOutParams.size() == 1) + out << nl << "/// - returns: `" << ret.typeStr << "`"; + if (p->returnType()) { - ParamInfo ret = allOutParams.front(); - out << nl << "///"; - out << nl << "/// - returns: `" << ret.typeStr << "`"; - if (p->returnType()) + if (!doc.returns.empty()) { - if (!doc.returns.empty()) - { - out << " - "; - writeDocLines(out, doc.returns, false); - } + out << " - "; + writeDocLines(out, doc.returns, false); } - else + } + else + { + map::const_iterator r = doc.params.find(ret.name); + if (r != doc.params.end() && !r->second.empty()) { - map::const_iterator r = doc.params.find(ret.name); - if (r != doc.params.end() && !r->second.empty()) - { - out << " - "; - writeDocLines(out, r->second, false); - } + out << " - "; + writeDocLines(out, r->second, false); } } - else if (allOutParams.size() > 1) + } + else if (allOutParams.size() > 1) + { + out << nl << "///"; + out << nl << "/// - returns: `" << operationReturnType(p, typeCtx) << "`:"; + if (p->returnType()) { + ParamInfo ret = allOutParams.back(); out << nl << "///"; - out << nl << "/// - returns: `" << operationReturnType(p, typeCtx) << "`:"; - if (p->returnType()) + out << nl << "/// - " << ret.name << ": `" << ret.typeStr << "`"; + if (!doc.returns.empty()) { - ParamInfo ret = allOutParams.back(); - out << nl << "///"; - out << nl << "/// - " << ret.name << ": `" << ret.typeStr << "`"; - if (!doc.returns.empty()) - { - out << " - "; - writeDocLines(out, doc.returns, false); - } + out << " - "; + writeDocLines(out, doc.returns, false); } + } - for (ParamInfoList::const_iterator q = allOutParams.begin(); q != allOutParams.end(); ++q) + for (ParamInfoList::const_iterator q = allOutParams.begin(); q != allOutParams.end(); ++q) + { + if (q->param != 0) { - if (q->param != 0) + out << nl << "///"; + out << nl << "/// - " << q->name << ": `" << q->typeStr << "`"; + map::const_iterator r = doc.params.find(q->name); + if (r != doc.params.end() && !r->second.empty()) { - out << nl << "///"; - out << nl << "/// - " << q->name << ": `" << q->typeStr << "`"; - map::const_iterator r = doc.params.find(q->name); - if (r != doc.params.end() && !r->second.empty()) - { - out << " - "; - writeDocLines(out, r->second, false); - } + out << " - "; + writeDocLines(out, r->second, false); } } } } - if (!doc.exceptions.empty() && !async) + if (!doc.exceptions.empty()) { out << nl << "///"; out << nl << "/// - throws:"; @@ -2374,93 +2367,7 @@ SwiftGenerator::writeProxyOperation(::IceInternal::Output& out, const OperationP const string swiftModule = getSwiftModule(getTopLevelModule(dynamic_pointer_cast(op))); out << sp; - writeOpDocSummary(out, op, false, false); - out << nl << "func " << opName; - out << spar; - for (ParamInfoList::const_iterator q = allInParams.begin(); q != allInParams.end(); ++q) - { - if (allInParams.size() == 1) - { - out << ("_ iceP_" + q->name + ": " + q->typeStr + (q->optional ? " = nil" : "")); - } - else - { - out << (q->name + " iceP_" + q->name + ": " + q->typeStr + (q->optional ? " = nil" : "")); - } - } - out << ("context: " + getUnqualified("Ice.Context", swiftModule) + "? = nil"); - - out << epar; - out << " throws"; - - if (allOutParams.size() > 0) - { - out << " -> " << operationReturnType(op); - } - - out << sb; - - // - // Invoke - // - out << sp; - out << nl; - if (allOutParams.size() > 0) - { - out << "return "; - } - out << "try _impl._invoke("; - - out.useCurrentPosAsIndent(); - out << "operation: \"" << op->name() << "\","; - out << nl << "mode: " << modeToString(op->mode()) << ","; - - if (op->format()) - { - out << nl << "format: " << opFormatTypeToString(op); - out << ","; - } - - if (allInParams.size() > 0) - { - out << nl << "write: "; - writeMarshalInParams(out, op); - out << ","; - } - - if (allOutParams.size() > 0) - { - out << nl << "read: "; - writeUnmarshalOutParams(out, op); - out << ","; - } - - if (allExceptions.size() > 0) - { - out << nl << "userException:"; - writeUnmarshalUserException(out, op); - out << ","; - } - - out << nl << "context: context)"; - out.restoreIndent(); - - out << eb; -} - -void -SwiftGenerator::writeProxyAsyncOperation(::IceInternal::Output& out, const OperationPtr& op) -{ - const string opName = fixIdent(op->name() + "Async"); - - const ParamInfoList allInParams = getAllInParams(op); - const ParamInfoList allOutParams = getAllOutParams(op); - const ExceptionList allExceptions = op->throws(); - - const string swiftModule = getSwiftModule(getTopLevelModule(dynamic_pointer_cast(op))); - - out << sp; - writeOpDocSummary(out, op, true, false); + writeOpDocSummary(out, op, false); out << nl << "func " << opName; out << spar; for (ParamInfoList::const_iterator q = allInParams.begin(); q != allInParams.end(); ++q) @@ -2492,7 +2399,7 @@ SwiftGenerator::writeProxyAsyncOperation(::IceInternal::Output& out, const Opera // Invoke // out << sp; - out << nl << "return try await _impl._invokeAsync("; + out << nl << "return try await _impl._invoke("; out.useCurrentPosAsIndent(); out << "operation: \"" << op->name() << "\","; diff --git a/cpp/src/slice2swift/SwiftUtil.h b/cpp/src/slice2swift/SwiftUtil.h index 64b8e908548..b65c3953b66 100644 --- a/cpp/src/slice2swift/SwiftUtil.h +++ b/cpp/src/slice2swift/SwiftUtil.h @@ -71,7 +71,7 @@ namespace Slice void writeDocSentence(IceInternal::Output&, const StringList&); void writeSeeAlso(IceInternal::Output&, const StringList&, const ContainerPtr&); void writeDocSummary(IceInternal::Output&, const ContainedPtr&); - void writeOpDocSummary(IceInternal::Output&, const OperationPtr&, bool, bool); + void writeOpDocSummary(IceInternal::Output&, const OperationPtr&, bool); void writeProxyDocSummary(IceInternal::Output&, const InterfaceDefPtr&, const std::string&); void writeServantDocSummary(IceInternal::Output&, const InterfaceDefPtr&, const std::string&); @@ -148,7 +148,6 @@ namespace Slice void writeUnmarshalUserException(::IceInternal::Output& out, const OperationPtr&); void writeSwiftAttributes(::IceInternal::Output&, const StringList&); void writeProxyOperation(::IceInternal::Output&, const OperationPtr&); - void writeProxyAsyncOperation(::IceInternal::Output&, const OperationPtr&); void writeDispatchOperation(::IceInternal::Output&, const OperationPtr&); private: diff --git a/swift/src/Ice/Proxy.swift b/swift/src/Ice/Proxy.swift index d40fbc89a35..916b601e635 100644 --- a/swift/src/Ice/Proxy.swift +++ b/swift/src/Ice/Proxy.swift @@ -335,8 +335,8 @@ public func checkedCast( type _: ObjectPrx.Protocol, facet: String? = nil, context: Ice.Context? = nil -) throws -> ObjectPrx? { - return try ObjectPrxI.checkedCast(prx: prx, facet: facet, context: context) as ObjectPrxI? +) async throws -> ObjectPrx? { + return try await ObjectPrxI.checkedCast(prx: prx, facet: facet, context: context) as ObjectPrxI? } /// Creates a new proxy that is identical to the passed proxy, except for its facet. This call does @@ -391,47 +391,15 @@ extension ObjectPrx { /// Sends ping request to the target object. /// /// - parameter context: `Ice.Context` - The optional context dictionary for the invocation. - /// - /// - throws: `Ice.LocalException` such as `Ice.ObjectNotExistException` and - /// `Ice.ConnectionRefusedException`. - public func ice_ping(context: Context? = nil) throws { - try _impl._invoke( - operation: "ice_ping", - mode: OperationMode.Idempotent, - context: context) - } - - /// Sends ping request to the target object asynchronously. - /// - /// - parameter context: `Ice.Context` - The optional context dictionary for the invocation. - public func ice_pingAsync( + public func ice_ping( context: Context? = nil ) async throws { - return try await _impl._invokeAsync( + return try await _impl._invoke( operation: "ice_ping", mode: .Idempotent, context: context) } - /// Tests whether this object supports a specific Slice interface. - /// - /// - parameter id: `String` - The type ID of the Slice interface to test against. - /// - /// - parameter context: `Ice.Context` - The optional context dictionary for the invocation. - /// - /// - returns: `Bool` - True if the target object has the interface specified by id or derives - /// from the interface specified by id. - public func ice_isA(id: String, context: Context? = nil) throws -> Bool { - return try _impl._invoke( - operation: "ice_isA", - mode: .Idempotent, - write: { ostr in - ostr.write(id) - }, - read: { istr in try istr.read() as Bool }, - context: context) - } - /// Tests whether this object supports a specific Slice interface. /// /// - parameter id: `String` - The type ID of the Slice interface to test against. @@ -439,10 +407,10 @@ extension ObjectPrx { /// - parameter context: `Ice.Context` - The optional context dictionary for the invocation. /// /// - returns: `Bool` - The result of the invocation. - public func ice_isAAsync( + public func ice_isA( id: String, context: Context? = nil ) async throws -> Bool { - return try await _impl._invokeAsync( + return try await _impl._invoke( operation: "ice_isA", mode: .Idempotent, write: { ostr in @@ -452,103 +420,36 @@ extension ObjectPrx { context: context) } - /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - /// - /// - parameter context: `Ice.Context?` - The optional context dictionary for the invocation. - /// - /// - returns: `String` - The Slice type ID of the most-derived interface. - public func ice_id(context: Context? = nil) throws -> String { - return try _impl._invoke( - operation: "ice_id", - mode: .Idempotent, - read: { istr in try istr.read() as String }, - context: context) - } - /// Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. /// /// - parameter context: `Ice.Context?` - The optional context dictionary for the invocation. /// /// - returns: `String` The result of the invocation. - public func ice_idAsync( + public func ice_id( context: Context? = nil ) async throws -> String { - return try await _impl._invokeAsync( + return try await _impl._invoke( operation: "ice_id", mode: .Idempotent, read: { istr in try istr.read() as String }, context: context) } - /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - /// - /// - parameter context: `Ice.Context?` - The optional context dictionary for the invocation. - /// - /// - returns: `Ice.StringSeq` - The Slice type IDs of the interfaces supported by the target object, - /// in alphabetical order. - public func ice_ids(context: Context? = nil) throws -> StringSeq { - return try _impl._invoke( - operation: "ice_ids", - mode: .Idempotent, - read: { istr in try istr.read() as StringSeq }, - context: context) - } - /// Returns the Slice type IDs of the interfaces supported by the target object of this proxy. /// /// - parameter context: `Ice.Context?` - The optional context dictionary for the invocation. /// /// - returns: `Ice.StringSeq` - The result of the invocation. - public func ice_idsAsync( + public func ice_ids( context: Context? = nil ) async throws -> StringSeq { - return try await _impl._invokeAsync( + return try await _impl._invoke( operation: "ice_ids", mode: .Idempotent, read: { istr in try istr.read() as StringSeq }, context: context) } - /// Invokes an operation dynamically. - /// - /// - parameter operation: `String` - The name of the operation to invoke. - /// - /// - parameter mode: `Ice.OperationMode` - The operation mode (normal or idempotent). - /// - /// - parameter inEncaps: `Data` - The encoded in-parameters for the operation. - /// - /// - parameter context: `Ice.Context` - The context dictionary for the invocation. - /// - /// - returns: A tuple with the following fields: - /// - /// - ok: `Bool` - If the operation completed successfully, the value - /// is set to true. If the operation raises a user exception, the return value - /// is false; in this case, outEncaps contains the encoded user exception. If - /// the operation raises a run-time exception, it throws it directly. - /// - /// - outEncaps: `Data` - The encoded out-paramaters and return value for the operation. - /// The return value follows any out-parameters. - public func ice_invoke( - operation: String, - mode: OperationMode, - inEncaps: Data, - context: Context? = nil - ) throws -> (ok: Bool, outEncaps: Data) { - if _impl.isTwoway { - var data: Data? - var ok: Bool = false - try _impl.handle.invoke(operation, mode: mode.rawValue, inParams: inEncaps, context: context) { - ok = $0 - data = Data(bytes: $1, count: $2) // make a copy - } - return (ok, data!) - } else { - try _impl.handle.onewayInvoke( - operation, mode: mode.rawValue, inParams: inEncaps, context: context) - return (true, Data()) - } - } - /// Invokes an operation dynamically. /// /// - parameter operation: `String` - The name of the operation to invoke. @@ -560,7 +461,7 @@ extension ObjectPrx { /// - parameter context: `Ice.Context` - The context dictionary for the invocation. /// /// - returns: `(ok: Bool, outEncaps: Data)` - The result of the invocation. - public func ice_invokeAsync( + public func ice_invoke( operation: String, mode: OperationMode, inEncaps: Data, @@ -568,7 +469,7 @@ extension ObjectPrx { ) async throws -> (ok: Bool, outEncaps: Data) { if _impl.isTwoway { return try await withCheckedThrowingContinuation { continuation in - _impl.handle.invokeAsync( + _impl.handle.invoke( operation, mode: mode.rawValue, inParams: inEncaps, @@ -589,9 +490,19 @@ extension ObjectPrx { continuation.resume(throwing: error) }) } + } else if ice_isBatchOneway() || ice_isBatchDatagram() { + return try autoreleasepool { + try _impl.handle.enqueueBatch( + operation, + mode: mode.rawValue, + inParams: inEncaps, + context: context) + + return (true, Data()) + } } else { return try await withCheckedThrowingContinuation { continuation in - _impl.handle.invokeAsync( + _impl.handle.invoke( operation, mode: mode.rawValue, inParams: inEncaps, @@ -626,7 +537,7 @@ extension ObjectPrx { } } - /// Asynchronously flushes any pending batched requests for this proxy. + /// Flushes any pending batched requests for this proxy. public func ice_flushBatchRequests() async throws { return try await withCheckedThrowingContinuation { continuation in _impl.handle.ice_flushBatchRequests( @@ -1037,121 +948,6 @@ open class ObjectPrxI: ObjectPrx { write: ((OutputStream) -> Void)? = nil, userException: ((UserException) throws -> Void)? = nil, context: Context? = nil - ) throws { - if userException != nil, !isTwoway { - throw TwowayOnlyException(operation: operation) - } - - let ostr = OutputStream(communicator: communicator) - if let write = write { - ostr.startEncapsulation(encoding: encoding, format: format) - write(ostr) - ostr.endEncapsulation() - } - - if isTwoway { - var uex: Error? - try autoreleasepool { - try handle.invoke( - operation, mode: mode.rawValue, - inParams: ostr.finished(), context: context, - response: { ok, bytes, count in - do { - let istr = InputStream( - communicator: self.communicator, - encoding: self.encoding, - bytes: Data( - bytesNoCopy: bytes, count: count, - deallocator: .none)) - if ok == false { - try ObjectPrxI.throwUserException( - istr: istr, - userException: userException) - } - try istr.skipEmptyEncapsulation() - } catch { - uex = error - } - }) - - if let e = uex { - throw e - } - } - } else { - try autoreleasepool { - try handle.onewayInvoke( - operation, - mode: mode.rawValue, - inParams: ostr.finished(), - context: context) - } - } - } - - public func _invoke( - operation: String, - mode: OperationMode, - format: FormatType? = nil, - write: ((OutputStream) -> Void)? = nil, - read: @escaping (InputStream) throws -> T, - userException: ((UserException) throws -> Void)? = nil, - context: Context? = nil - ) throws -> T { - if !isTwoway { - throw TwowayOnlyException(operation: operation) - } - let ostr = OutputStream(communicator: communicator) - if let write = write { - ostr.startEncapsulation(encoding: encoding, format: format) - write(ostr) - ostr.endEncapsulation() - } - var uex: Error? - var ret: T! - try autoreleasepool { - try handle.invoke( - operation, - mode: mode.rawValue, - inParams: ostr.finished(), - context: context, - response: { ok, bytes, count in - do { - let istr = InputStream( - communicator: self.communicator, - encoding: self.encoding, - bytes: Data( - bytesNoCopy: bytes, count: count, - deallocator: .none)) - if ok == false { - try ObjectPrxI.throwUserException( - istr: istr, - userException: userException) - } - try istr.startEncapsulation() - ret = try read(istr) - try istr.endEncapsulation() - } catch { - uex = error - } - }) - - if let e = uex { - throw e - } - } - - precondition(ret != nil) - return ret - } - - public func _invokeAsync( - operation: String, - mode: OperationMode, - format: FormatType? = nil, - write: ((OutputStream) -> Void)? = nil, - userException: ((UserException) throws -> Void)? = nil, - context: Context? = nil ) async throws { if userException != nil, !isTwoway { @@ -1165,7 +961,7 @@ open class ObjectPrxI: ObjectPrx { } if isTwoway { return try await withCheckedThrowingContinuation { continuation in - handle.invokeAsync( + handle.invoke( operation, mode: mode.rawValue, inParams: ostr.finished(), @@ -1193,46 +989,35 @@ open class ObjectPrxI: ObjectPrx { continuation.resume(throwing: error) }) } + } else if ice_isBatchOneway() || ice_isBatchDatagram() { + return try autoreleasepool { + try _impl.handle.enqueueBatch( + operation, + mode: mode.rawValue, + inParams: ostr.finished(), + context: context) + } } else { - if ice_isBatchOneway() || ice_isBatchDatagram() { - return try await withCheckedThrowingContinuation { continuation in - do { - try autoreleasepool { - try handle.onewayInvoke( - operation, - mode: mode.rawValue, - inParams: ostr.finished(), - context: context) - - continuation.resume(returning: ()) - } - } catch { + return try await withCheckedThrowingContinuation { continuation in + handle.invoke( + operation, + mode: mode.rawValue, + inParams: ostr.finished(), + context: context, + response: { _, _, _ in + fatalError("unexpected response") + }, + exception: { error in continuation.resume(throwing: error) - } - - } - } else { - return try await withCheckedThrowingContinuation { continuation in - handle.invokeAsync( - operation, - mode: mode.rawValue, - inParams: ostr.finished(), - context: context, - response: { _, _, _ in - fatalError("unexpected response") - }, - exception: { error in - continuation.resume(throwing: error) - }, - sent: { _ in - continuation.resume(returning: ()) - }) - } + }, + sent: { _ in + continuation.resume(returning: ()) + }) } } } - public func _invokeAsync( + public func _invoke( operation: String, mode: OperationMode, format: FormatType? = nil, @@ -1253,7 +1038,7 @@ open class ObjectPrxI: ObjectPrx { } return try await withCheckedThrowingContinuation { continuation in - handle.invokeAsync( + handle.invoke( operation, mode: mode.rawValue, inParams: ostr.finished(), @@ -1305,12 +1090,12 @@ open class ObjectPrxI: ObjectPrx { prx: ObjectPrx, facet: String? = nil, context: Context? = nil - ) throws -> ProxyImpl? + ) async throws -> ProxyImpl? where ProxyImpl: ObjectPrxI { let objPrx = facet != nil ? prx.ice_facet(facet!) : prx // checkedCast always calls ice_isA - no optimization on purpose - guard try objPrx.ice_isA(id: ProxyImpl.ice_staticId(), context: context) else { + guard try await objPrx.ice_isA(id: ProxyImpl.ice_staticId(), context: context) else { return nil } return ProxyImpl(from: objPrx) diff --git a/swift/src/IceImpl/Communicator.mm b/swift/src/IceImpl/Communicator.mm index 6a1c46b9aa3..6986e6378d1 100644 --- a/swift/src/IceImpl/Communicator.mm +++ b/swift/src/IceImpl/Communicator.mm @@ -237,8 +237,7 @@ - (void)flushBatchRequests:(std::uint8_t)compress exception:(void (^)(NSError*)) } catch (...) { - // Typically CommunicatorDestroyedException. Note that the callback is called on the - // thread making the invocation. + // Typically CommunicatorDestroyedException. exception(convertException(std::current_exception())); } } diff --git a/swift/src/IceImpl/Connection.mm b/swift/src/IceImpl/Connection.mm index ee7ebf10f0e..1652ac38175 100644 --- a/swift/src/IceImpl/Connection.mm +++ b/swift/src/IceImpl/Connection.mm @@ -79,8 +79,7 @@ - (void)flushBatchRequests:(std::uint8_t)compress exception:(void (^)(NSError*)) } catch (...) { - // Typically CommunicatorDestroyedException. Note that the callback is called on the - // thread making the invocation. + // Typically CommunicatorDestroyedException. exception(convertException(std::current_exception())); } } diff --git a/swift/src/IceImpl/ObjectPrx.mm b/swift/src/IceImpl/ObjectPrx.mm index 97bf89c07a6..182b80cee82 100644 --- a/swift/src/IceImpl/ObjectPrx.mm +++ b/swift/src/IceImpl/ObjectPrx.mm @@ -440,8 +440,7 @@ - (void)ice_getConnection:(void (^)(ICEConnection* _Nullable))response exception } catch (...) { - // Typically CommunicatorDestroyedException. Note that the callback is called on the - // thread making the invocation. + // Typically CommunicatorDestroyedException. exception(convertException(std::current_exception())); } } @@ -468,8 +467,7 @@ - (void)ice_flushBatchRequests:(void (^)(NSError*))exception sent:(void (^)(bool } catch (...) { - // Typically CommunicatorDestroyedException. Note that the callback is called on the - // thread making the invocation. + // Typically CommunicatorDestroyedException. exception(convertException(std::current_exception())); } } @@ -545,66 +543,14 @@ - (void)ice_write:(id)os [os copy:p.first count:static_cast(p.second - p.first)]; } -- (BOOL)invoke:(NSString* _Nonnull)op - mode:(std::uint8_t)mode - inParams:(NSData*)inParams - context:(NSDictionary* _Nullable)context - response:(void (^)(bool, void*, long))response - error:(NSError**)error -{ - std::pair params(0, 0); - params.first = static_cast(inParams.bytes); - params.second = params.first + inParams.length; - - try - { - Ice::Context ctx; - if (context) - { - fromNSDictionary(context, ctx); - } - std::vector outParams; - - // We use a std::promise and invokeAsync to avoid making an extra copy of the outParam buffer. - std::promise p; - - _prx->ice_invokeAsync( - fromNSString(op), - static_cast(mode), - params, - [response, &p](bool ok, std::pair outParams) - { - // We need an autorelease pool as the unmarshaling (in the response) can - // create autorelease objects, typically when unmarshaling proxies - @autoreleasepool - { - response( - ok, - const_cast(outParams.first), - static_cast(outParams.second - outParams.first)); - } - p.set_value(); - }, - [&p](std::exception_ptr e) { p.set_exception(e); }, - nullptr, - context ? ctx : Ice::noExplicitContext); - - p.get_future().get(); - return YES; - } - catch (...) - { - *error = convertException(std::current_exception()); - return NO; - } -} - -- (BOOL)onewayInvoke:(NSString*)op +- (BOOL)enqueueBatch:(NSString*)op mode:(std::uint8_t)mode inParams:(NSData*)inParams context:(NSDictionary*)context error:(NSError**)error { + assert(_prx->ice_isBatchOneway() || _prx->ice_isBatchDatagram()); + std::pair params(0, 0); params.first = static_cast(inParams.bytes); params.second = params.first + inParams.length; @@ -618,6 +564,7 @@ - (BOOL)onewayInvoke:(NSString*)op } std::vector ignored; + // So long as the proxy is batch oneway or batch datagram this will never block. _prx->ice_invoke( fromNSString(op), static_cast(mode), @@ -633,14 +580,16 @@ - (BOOL)onewayInvoke:(NSString*)op } } -- (void)invokeAsync:(NSString* _Nonnull)op - mode:(std::uint8_t)mode - inParams:(NSData*)inParams - context:(NSDictionary* _Nullable)context - response:(void (^)(bool, void*, long))response - exception:(void (^)(NSError*))exception - sent:(void (^_Nullable)(bool))sent +- (void)invoke:(NSString* _Nonnull)op + mode:(std::uint8_t)mode + inParams:(NSData*)inParams + context:(NSDictionary* _Nullable)context + response:(void (^)(bool, void*, long))response + exception:(void (^)(NSError*))exception + sent:(void (^_Nullable)(bool))sent { + assert(!_prx->ice_isBatchOneway() && !_prx->ice_isBatchDatagram()); + std::pair params(0, 0); params.first = static_cast(inParams.bytes); params.second = params.first + inParams.length; @@ -660,9 +609,7 @@ - (void)invokeAsync:(NSString* _Nonnull)op [response](bool ok, std::pair outParams) { // We need an autorelease pool in case the unmarshaling creates auto - // release objects, and in case the application attaches a handler to - // the promise that runs on nil (= the Ice thread/dispatch queue that - // executes response) + // release objects. @autoreleasepool { response( @@ -689,8 +636,7 @@ - (void)invokeAsync:(NSString* _Nonnull)op } catch (...) { - // Typically CommunicatorDestroyedException. Note that the callback is called on the - // thread making the invocation. + // Typically CommunicatorDestroyedException. exception(convertException(std::current_exception())); } } diff --git a/swift/src/IceImpl/include/ObjectPrx.h b/swift/src/IceImpl/include/ObjectPrx.h index 00f3021d5f0..5a4102e523b 100644 --- a/swift/src/IceImpl/include/ObjectPrx.h +++ b/swift/src/IceImpl/include/ObjectPrx.h @@ -84,27 +84,20 @@ ICEIMPL_API @interface ICEObjectPrx : NSObject encodingMajor:(uint8_t)encodingMajor encodingMinor:(uint8_t)encodingMinor; -- (BOOL)invoke:(NSString* _Nonnull)op - mode:(uint8_t)mode - inParams:(NSData*)inParams - context:(NSDictionary* _Nullable)context - response:(void (^)(bool, void*, long))response - error:(NSError* _Nullable* _Nullable)error; - -// Sync invocation on oneway proxy -- (BOOL)onewayInvoke:(NSString* _Nonnull)op +// Sync invocation on batch proxy +- (BOOL)enqueueBatch:(NSString* _Nonnull)op mode:(uint8_t)mode inParams:(NSData*)inParams context:(NSDictionary* _Nullable)context error:(NSError* _Nullable* _Nullable)error; -- (void)invokeAsync:(NSString* _Nonnull)op - mode:(uint8_t)mode - inParams:(NSData*)inParams - context:(NSDictionary* _Nullable)context - response:(void (^)(bool, void*, long))response - exception:(void (^)(NSError*))exception - sent:(void (^_Nullable)(bool))sent; +- (void)invoke:(NSString* _Nonnull)op + mode:(uint8_t)mode + inParams:(NSData*)inParams + context:(NSDictionary* _Nullable)context + response:(void (^)(bool, void*, long))response + exception:(void (^)(NSError*))exception + sent:(void (^_Nullable)(bool))sent; - (bool)isEqual:(ICEObjectPrx* _Nullable)prx; diff --git a/swift/test/Ice/adapterDeactivation/AllTests.swift b/swift/test/Ice/adapterDeactivation/AllTests.swift index 8ed279dea43..05a9fb43e7e 100644 --- a/swift/test/Ice/adapterDeactivation/AllTests.swift +++ b/swift/test/Ice/adapterDeactivation/AllTests.swift @@ -16,7 +16,7 @@ func allTests(_ helper: TestHelper) async throws { output.writeLine("ok") output.write("testing checked cast... ") - let obj = try checkedCast(prx: base, type: TestIntfPrx.self)! + let obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! try test(obj == base) output.writeLine("ok") @@ -42,8 +42,8 @@ func allTests(_ helper: TestHelper) async throws { } output.write("creating/activating/deactivating object adapter in one operation... ") - try obj.transient() - try await obj.transientAsync() + try await obj.transient() + try await obj.transient() output.writeLine("ok") do { @@ -57,7 +57,7 @@ func allTests(_ helper: TestHelper) async throws { let prx = try comm.stringToProxy(ref)! Task { - try await prx.ice_pingAsync() + try await prx.ice_ping() } comm.destroy() @@ -171,12 +171,12 @@ func allTests(_ helper: TestHelper) async throws { output.writeLine("ok") output.write("deactivating object adapter in the server... ") - try obj.deactivate() + try await obj.deactivate() output.writeLine("ok") output.write("testing whether server is gone... ") do { - try obj.ice_ping() + try await obj.ice_ping() try test(false) } catch is Ice.LocalException { output.writeLine("ok") diff --git a/swift/test/Ice/admin/AllTests.swift b/swift/test/Ice/admin/AllTests.swift index 1e61f3b8187..c7ea72e5852 100644 --- a/swift/test/Ice/admin/AllTests.swift +++ b/swift/test/Ice/admin/AllTests.swift @@ -117,7 +117,7 @@ func testFacets(com: Ice.Communicator, builtInFacets: Bool, helper: TestHelper) } catch is Ice.NotRegisteredException {} } -func allTests(_ helper: TestHelper) throws { +func allTests(_ helper: TestHelper) async throws { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -220,12 +220,12 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! - let proc = try checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process")! - try proc.shutdown() - try com.waitForShutdown() - try com.destroy() + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! + let proc = try await checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process")! + try await proc.shutdown() + try await com.waitForShutdown() + try await com.destroy() } output.writeLine("ok") @@ -239,20 +239,20 @@ func allTests(_ helper: TestHelper) throws { "Prop3": "3", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! - let pa = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties")! + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! + let pa = try await checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties")! // // Test: PropertiesAdmin::getProperty() // - try test(pa.getProperty("Prop2") == "2") - try test(pa.getProperty("Bogus") == "") + try await test(pa.getProperty("Prop2") == "2") + try await test(pa.getProperty("Bogus") == "") // // Test: PropertiesAdmin::getProperties() // - let pd = try pa.getPropertiesForPrefix("") + let pd = try await pa.getPropertiesForPrefix("") try test(pd.count == 5) try test(pd["Ice.Admin.Endpoints"] == "tcp -h 127.0.0.1") try test(pd["Ice.Admin.InstanceName"] == "Test") @@ -270,24 +270,24 @@ func allTests(_ helper: TestHelper) throws { "Prop4": "4", // Added "Prop5": "5", // Added ] - try pa.setProperties(setProps) - try test(pa.getProperty("Prop1") == "10") - try test(pa.getProperty("Prop2") == "20") - try test(pa.getProperty("Prop3") == "") - try test(pa.getProperty("Prop4") == "4") - try test(pa.getProperty("Prop5") == "5") - var changes = try com.getChanges() + try await pa.setProperties(setProps) + try await test(pa.getProperty("Prop1") == "10") + try await test(pa.getProperty("Prop2") == "20") + try await test(pa.getProperty("Prop3") == "") + try await test(pa.getProperty("Prop4") == "4") + try await test(pa.getProperty("Prop5") == "5") + var changes = try await com.getChanges() try test(changes.count == 5) try test(changes["Prop1"] == "10") try test(changes["Prop2"] == "20") try test(changes["Prop3"] == "") try test(changes["Prop4"] == "4") try test(changes["Prop5"] == "5") - try pa.setProperties(setProps) - changes = try com.getChanges() + try await pa.setProperties(setProps) + changes = try await com.getChanges() try test(changes.count == 0) - try com.destroy() + try await com.destroy() } output.writeLine("ok") @@ -310,7 +310,7 @@ func allTests(_ helper: TestHelper) throws { // try com.print("print") // let obj = try com.getAdmin()! - // let logger = try checkedCast(prx: obj, type: Ice.LoggerAdminPrx.self, facet: "Logger")! + // let logger = try await checkedCast(prx: obj, type: Ice.LoggerAdminPrx.self, facet: "Logger")! // // // // Get all @@ -515,11 +515,11 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! - let tf = try checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! - try tf.op() - try com.destroy() + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! + let tf = try await checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! + try await tf.op() + try await com.destroy() } output.writeLine("ok") @@ -535,17 +535,17 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.Facets": "Properties", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! do { - _ = try checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") + _ = try await checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") try test(false) } catch is Ice.FacetNotExistException {} do { - _ = try checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet") + _ = try await checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet") try test(false) } catch is Ice.FacetNotExistException {} - try com.destroy() + try await com.destroy() } do { @@ -558,17 +558,17 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.InstanceName": "Test", "Ice.Admin.Facets": "Process", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! do { - _ = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") + _ = try await checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") try test(false) } catch is Ice.FacetNotExistException {} do { - _ = try checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet") + _ = try await checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet") try test(false) } catch is Ice.FacetNotExistException {} - try com.destroy() + try await com.destroy() } do { @@ -582,17 +582,17 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.Facets": "TestFacet", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! do { - _ = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") + _ = try await checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") try test(false) } catch is Ice.FacetNotExistException {} do { - _ = try checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") + _ = try await checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") try test(false) } catch is Ice.FacetNotExistException {} - try com.destroy() + try await com.destroy() } do { @@ -606,17 +606,17 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.Facets": "Properties TestFacet", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! - let pa = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties")! - try test(pa.getProperty("Ice.Admin.InstanceName") == "Test") - let tf = try checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! - try tf.op() + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! + let pa = try await checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties")! + try await test(pa.getProperty("Ice.Admin.InstanceName") == "Test") + let tf = try await checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! + try await tf.op() do { - _ = try checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") + _ = try await checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process") try test(false) } catch is Ice.FacetNotExistException {} - try com.destroy() + try await com.destroy() } do { @@ -629,20 +629,20 @@ func allTests(_ helper: TestHelper) throws { "Ice.Admin.InstanceName": "Test", "Ice.Admin.Facets": "TestFacet, Process", ] - let com = try factory.createCommunicator(props)! - let obj = try com.getAdmin()! + let com = try await factory.createCommunicator(props)! + let obj = try await com.getAdmin()! do { - _ = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") + _ = try await checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") try test(false) } catch is Ice.FacetNotExistException {} - let tf = try checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! - try tf.op() - let proc = try checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process")! - try proc.shutdown() - try com.waitForShutdown() - try com.destroy() + let tf = try await checkedCast(prx: obj, type: TestFacetPrx.self, facet: "TestFacet")! + try await tf.op() + let proc = try await checkedCast(prx: obj, type: Ice.ProcessPrx.self, facet: "Process")! + try await proc.shutdown() + try await com.waitForShutdown() + try await com.destroy() } output.writeLine("ok") - try factory.shutdown() + try await factory.shutdown() } diff --git a/swift/test/Ice/admin/Client.swift b/swift/test/Ice/admin/Client.swift index 8c6c84de105..39cc845eb57 100644 --- a/swift/test/Ice/admin/Client.swift +++ b/swift/test/Ice/admin/Client.swift @@ -9,6 +9,6 @@ class Client: TestHelperI { defer { communicator.destroy() } - try allTests(self) + try await allTests(self) } } diff --git a/swift/test/Ice/ami/AllTests.swift b/swift/test/Ice/ami/AllTests.swift index 5255b79c553..45b0114189c 100644 --- a/swift/test/Ice/ami/AllTests.swift +++ b/swift/test/Ice/ami/AllTests.swift @@ -22,35 +22,35 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { do { let ctx: [String: String] = [:] - try await test(p.ice_isAAsync(id: "::Test::TestIntf")) - try await test(p.ice_isAAsync(id: "::Test::TestIntf", context: ctx)) + try await test(p.ice_isA(id: "::Test::TestIntf")) + try await test(p.ice_isA(id: "::Test::TestIntf", context: ctx)) - try await p.ice_pingAsync() - try await p.ice_pingAsync(context: ctx) + try await p.ice_ping() + try await p.ice_ping(context: ctx) - try await test(p.ice_idAsync() == "::Test::TestIntf") - try await test(p.ice_idAsync(context: ctx) == "::Test::TestIntf") + try await test(p.ice_id() == "::Test::TestIntf") + try await test(p.ice_id(context: ctx) == "::Test::TestIntf") - try await test(p.ice_idsAsync().count == 2) - try await test(p.ice_idsAsync(context: ctx).count == 2) + try await test(p.ice_ids().count == 2) + try await test(p.ice_ids(context: ctx).count == 2) if !collocated { try await test(p.ice_getConnection() != nil) } - try await p.opAsync() - try await p.opAsync(context: ctx) + try await p.op() + try await p.op(context: ctx) - try await test(p.opWithResultAsync() == 15) - try await test(p.opWithResultAsync(context: ctx) == 15) + try await test(p.opWithResult() == 15) + try await test(p.opWithResult(context: ctx) == 15) do { - try await p.opWithUEAsync() + try await p.opWithUE() try test(false) } catch is TestIntfException {} do { - try await p.opWithUEAsync(context: ctx) + try await p.opWithUE(context: ctx) try test(false) } catch is TestIntfException {} } @@ -59,11 +59,11 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { output.write("testing local exceptions... ") do { let indirect = p.ice_adapterId("dummy") - try await indirect.opAsync() + try await indirect.op() } catch is Ice.NoEndpointException {} do { - _ = try await p.ice_oneway().opWithResultAsync() + _ = try await p.ice_oneway().opWithResult() try test(false) } catch is Ice.LocalException {} @@ -73,10 +73,10 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { initData.properties = communicator.getProperties().clone() let ic = try helper.initialize(initData) let p2 = try makeProxy(communicator: ic, proxyString: p.ice_toString(), type: TestIntfPrx.self) - try await p2.ice_pingAsync() + try await p2.ice_ping() ic.destroy() do { - try await p2.opAsync() + try await p2.op() try test(false) } catch is Ice.CommunicatorDestroyedException {} } @@ -87,33 +87,33 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { let i = p.ice_adapterId("dummy") do { - _ = try await i.ice_isAAsync(id: "::Test::TestIntf") + _ = try await i.ice_isA(id: "::Test::TestIntf") try test(false) } catch is Ice.NoEndpointException {} do { - try await i.opAsync() + try await i.op() try test(false) } catch is Ice.NoEndpointException {} do { - _ = try await i.opWithResultAsync() + _ = try await i.opWithResult() try test(false) } catch is Ice.NoEndpointException {} do { - try await i.opWithUEAsync() + try await i.opWithUE() try test(false) } catch is Ice.NoEndpointException {} // Ensure no exception is thrown when response is received - _ = try await p.ice_isAAsync(id: "::Test::TestIntf") - try await p.opAsync() - _ = try await p.opWithResultAsync() + _ = try await p.ice_isA(id: "::Test::TestIntf") + try await p.op() + _ = try await p.opWithResult() do { // If response is a user exception, it should be received. - try await p.opWithUEAsync() + try await p.opWithUE() try test(false) } catch is TestIntfException {} } @@ -122,22 +122,22 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { output.write("testing batch requests with proxy... ") do { do { - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = p.ice_batchOneway() - try b1.opBatch() - try await b1.opBatchAsync() + try await b1.opBatch() + try await b1.opBatch() try await b1.ice_flushBatchRequests() - try test(p.waitForBatch(2)) + try await test(p.waitForBatch(2)) } if try await p.ice_getConnection() != nil { - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = p.ice_batchOneway() - try b1.opBatch() + try await b1.opBatch() try await b1.ice_getConnection()!.close(.GracefullyWithWait) try await b1.ice_flushBatchRequests() - try test(p.waitForBatch(1)) + try await test(p.waitForBatch(1)) } } output.writeLine("ok") @@ -146,26 +146,26 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { output.write("testing batch requests with connection... ") do { do { - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() - try b1.opBatch() - try b1.opBatch() + try await b1.opBatch() + try await b1.opBatch() try await b1.ice_getConnection()!.flushBatchRequests(.BasedOnProxy) - try test(p.waitForBatch(2)) + try await test(p.waitForBatch(2)) } - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() - try b1.opBatch() + try await b1.opBatch() try await b1.ice_getConnection()!.close(.GracefullyWithWait) do { try await b1.ice_getConnection()!.flushBatchRequests(.BasedOnProxy) try test(false) } catch is Ice.LocalException {} - try test(p.waitForBatch(0)) - try test(p.opBatchCount() == 0) + try await test(p.waitForBatch(0)) + try await test(p.opBatchCount() == 0) } output.writeLine("ok") @@ -174,40 +174,40 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // // Async task - 1 connection. // - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() - try b1.opBatch() - try b1.opBatch() + try await b1.opBatch() + try await b1.opBatch() try await communicator.flushBatchRequests(.BasedOnProxy) - try test(p.waitForBatch(2)) + try await test(p.waitForBatch(2)) } // // Async task exception - 1 connection. // do { - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() - try b1.opBatch() + try await b1.opBatch() try await b1.ice_getConnection()!.close(.GracefullyWithWait) try await communicator.flushBatchRequests(.BasedOnProxy) - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) } // // Async task - 2 connections. // do { - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() let con = try await p.ice_connectionId("2").ice_getConnection()! let b2 = p.ice_fixed(con).ice_batchOneway() - try b1.opBatch() - try b1.opBatch() - try b2.opBatch() - try b2.opBatch() + try await b1.opBatch() + try await b1.opBatch() + try await b2.opBatch() + try await b2.opBatch() try await communicator.flushBatchRequests(.BasedOnProxy) - try test(p.waitForBatch(4)) + try await test(p.waitForBatch(4)) } do { @@ -217,16 +217,16 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() let con = try await p.ice_connectionId("2").ice_getConnection()! let b2 = p.ice_fixed(con).ice_batchOneway() - try b1.opBatch() - try b2.opBatch() + try await b1.opBatch() + try await b2.opBatch() try await b1.ice_getConnection()!.close(.GracefullyWithWait) try await communicator.flushBatchRequests(.BasedOnProxy) - try test(p.waitForBatch(1)) + try await test(p.waitForBatch(1)) } do { @@ -235,22 +235,22 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // // The sent callback should be invoked even if all connections fail. // - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) let b1 = try await p.ice_fixed(p.ice_getConnection()!).ice_batchOneway() let con = try await p.ice_connectionId("2").ice_getConnection()! let b2 = p.ice_fixed(con).ice_batchOneway() - try b1.opBatch() - try b2.opBatch() + try await b1.opBatch() + try await b2.opBatch() try await b1.ice_getConnection()!.close(.GracefullyWithWait) try await b2.ice_getConnection()!.close(.GracefullyWithWait) try await communicator.flushBatchRequests(.BasedOnProxy) - try test(p.opBatchCount() == 0) + try await test(p.opBatchCount() == 0) } output.writeLine("ok") } - if try await p.ice_getConnection() != nil && p.supportsAMD() { + if try await p.ice_getConnection() != nil, try await p.supportsAMD() { output.write("testing graceful close connection with wait... ") do { // @@ -270,7 +270,7 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { } let p1 = p - async let r = Task { try await p1.sleepAsync(100) } + async let r = Task { try await p1.sleep(100) } try con.close(.GracefullyWithWait) try await r.value // Should complete successfully. await cb.value @@ -295,11 +295,11 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // try p.ice_ping() // var results: [Promise] = [] // for _ in 0.. { seal in - // _ = p.closeAsync(.GracefullyWithWait) { + // _ = p.close(.GracefullyWithWait) { // seal.fulfill($0) // } // } @@ -307,7 +307,7 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // if try !cb.isResolved || cb.wait() { // for _ in 0.. { seal in - // results.append(p.opWithPayloadAsync(seq) { seal.fulfill($0) }) + // results.append(p.opWithPayload(seq) { seal.fulfill($0) }) // } // if try cb.isResolved && cb.wait() { @@ -341,7 +341,7 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { do { // Ensure the request was sent before we close the connection. Oneway invocations are // completed when the request is sent. - async let startDispatch: Void = p.startDispatchAsync() + async let startDispatch: Void = p.startDispatch() try await Task.sleep(for: .milliseconds(100)) // Wait for the request to be sent. try con.close(.Gracefully) try await startDispatch @@ -350,7 +350,7 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { } catch let ex as Ice.ConnectionClosedException { try test(ex.closedByApplication) } - try p.finishDispatch() + try await p.finishDispatch() } do { @@ -370,8 +370,8 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { } } - async let t = Task { try await p.sleepAsync(100) } - try p.close(.Gracefully) // Close is delayed until sleep completes. + async let t = Task { try await p.sleep(100) } + try await p.close(.Gracefully) // Close is delayed until sleep completes. await cb.value try await t.value } @@ -383,10 +383,10 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // Local case: start an operation and then close the connection forcefully on the client side. // There will be no retry and we expect the invocation to fail with ConnectionAbortedException. // - try p.ice_ping() + try await p.ice_ping() let con = try await p.ice_getConnection()! - async let startDispatch: Void = p.startDispatchAsync() + async let startDispatch: Void = p.startDispatch() try await Task.sleep(for: .milliseconds(100)) // Wait for the request to be sent. try con.close(.Forcefully) do { @@ -395,7 +395,7 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { } catch let ex as Ice.ConnectionAbortedException { try test(ex.closedByApplication) } - try p.finishDispatch() + try await p.finishDispatch() // // Remote case: the server closes the connection forcefully. This causes the request to fail @@ -403,11 +403,11 @@ func allTests(_ helper: TestHelper, collocated: Bool = false) async throws { // will not retry. // do { - try p.close(.Forcefully) + try await p.close(.Forcefully) try test(false) } catch is Ice.ConnectionLostException {} // Expected. } output.writeLine("ok") } - try p.shutdown() + try await p.shutdown() } diff --git a/swift/test/Ice/ami/TestI.swift b/swift/test/Ice/ami/TestI.swift index 3f5409b4382..84fcf00e5d5 100644 --- a/swift/test/Ice/ami/TestI.swift +++ b/swift/test/Ice/ami/TestI.swift @@ -103,7 +103,7 @@ class TestI: TestIntf { func pingBiDir(reply: PingReplyPrx?, current: Current) async throws { if let reply = reply { - try reply.ice_fixed(current.con!).reply() + try await reply.ice_fixed(current.con!).reply() } } diff --git a/swift/test/Ice/binding/AllTests.swift b/swift/test/Ice/binding/AllTests.swift index 43dc52efdda..03be9eafd89 100644 --- a/swift/test/Ice/binding/AllTests.swift +++ b/swift/test/Ice/binding/AllTests.swift @@ -3,11 +3,11 @@ import Ice import TestCommon -func createTestIntfPrx(_ adapters: [RemoteObjectAdapterPrx]) throws -> TestIntfPrx { +func createTestIntfPrx(_ adapters: [RemoteObjectAdapterPrx]) async throws -> TestIntfPrx { var endpoints: [Ice.Endpoint] = [] var obj: TestIntfPrx! for adapter in adapters { - obj = try adapter.getTestIntf()! + obj = try await adapter.getTestIntf()! for e in obj.ice_getEndpoints() { endpoints.append(e) } @@ -15,9 +15,9 @@ func createTestIntfPrx(_ adapters: [RemoteObjectAdapterPrx]) throws -> TestIntfP return obj.ice_endpoints(endpoints) } -func deactivate(communicator: RemoteCommunicatorPrx, adapters: [RemoteObjectAdapterPrx]) throws { +func deactivate(communicator: RemoteCommunicatorPrx, adapters: [RemoteObjectAdapterPrx]) async throws { for adapter in adapters { - try communicator.deactivateObjectAdapter(adapter) + try await communicator.deactivateObjectAdapter(adapter) } } @@ -37,22 +37,22 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing binding with single endpoint... ") do { - let adapter = try com.createObjectAdapter(name: "Adapter", endpoints: "default")! + let adapter = try await com.createObjectAdapter(name: "Adapter", endpoints: "default")! - let test1 = try adapter.getTestIntf()! - let test2 = try adapter.getTestIntf()! + let test1 = try await adapter.getTestIntf()! + let test2 = try await adapter.getTestIntf()! try await test(test1.ice_getConnection() === test2.ice_getConnection()) - try test1.ice_ping() - try test2.ice_ping() + try await test1.ice_ping() + try await test2.ice_ping() - try com.deactivateObjectAdapter(adapter) + try await com.deactivateObjectAdapter(adapter) try await test(test1.ice_getConnection() === test2.ice_getConnection()) do { - try test1.ice_ping() + try await test1.ice_ping() try test(false) } catch is Ice.ConnectFailedException { // expected @@ -64,7 +64,7 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing binding with multiple endpoints... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "Adapter11", endpoints: "default")!, com.createObjectAdapter(name: "Adapter12", endpoints: "default")!, com.createObjectAdapter(name: "Adapter13", endpoints: "default")!, @@ -78,16 +78,16 @@ func allTests(_ helper: TestHelper) async throws { while names.count > 0 { var adpts = adapters - let test1 = try createTestIntfPrx(adpts) + let test1 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test2 = try createTestIntfPrx(adpts) + let test2 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test3 = try createTestIntfPrx(adpts) - try test1.ice_ping() + let test3 = try await createTestIntfPrx(adpts) + try await test1.ice_ping() try await test(test1.ice_getConnection() === test2.ice_getConnection()) try await test(test2.ice_getConnection() === test3.ice_getConnection()) - let adapterName = try test1.getAdapterName() + let adapterName = try await test1.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -98,15 +98,15 @@ func allTests(_ helper: TestHelper) async throws { // do { for adpt in adapters { - try adpt.getTestIntf()!.ice_ping() + try await adpt.getTestIntf()!.ice_ping() } - let t = try createTestIntfPrx(adapters) - let name = try t.getAdapterName() + let t = try await createTestIntfPrx(adapters) + let name = try await t.getAdapterName() let nRetry = 10 var i = 0 - while try i < nRetry && t.getAdapterName() == name { + while i < nRetry, try await t.getAdapterName() == name { i += 1 } try test(i == nRetry) @@ -120,23 +120,23 @@ func allTests(_ helper: TestHelper) async throws { // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) names.append("Adapter12") names.append("Adapter13") while names.count > 0 { var adpts = adapters - let test1 = try createTestIntfPrx(adpts) + let test1 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test2 = try createTestIntfPrx(adpts) + let test2 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test3 = try createTestIntfPrx(adpts) + let test3 = try await createTestIntfPrx(adpts) try await test(test1.ice_getConnection() === test2.ice_getConnection()) try await test(test2.ice_getConnection() === test3.ice_getConnection()) - let adapterName = try test1.getAdapterName() + let adapterName = try await test1.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await test1.ice_getConnection()!.close(.GracefullyWithWait) @@ -146,17 +146,17 @@ func allTests(_ helper: TestHelper) async throws { // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // - try com.deactivateObjectAdapter(adapters[2]) - let obj = try createTestIntfPrx(adapters) - try test(obj.getAdapterName() == "Adapter12") + try await com.deactivateObjectAdapter(adapters[2]) + let obj = try await createTestIntfPrx(adapters) + try await test(obj.getAdapterName() == "Adapter12") - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing binding with multiple random endpoints... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "AdapterRandom11", endpoints: "default")!, com.createObjectAdapter(name: "AdapterRandom12", endpoints: "default")!, com.createObjectAdapter(name: "AdapterRandom13", endpoints: "default")!, @@ -170,7 +170,7 @@ func allTests(_ helper: TestHelper) async throws { count -= 1 var proxies: [TestIntfPrx] = [] if count == 1 { - try com.deactivateObjectAdapter(adapters[4]) + try await com.deactivateObjectAdapter(adapters[4]) adapterCount -= 1 } @@ -179,18 +179,18 @@ func allTests(_ helper: TestHelper) async throws { for _ in 0.. 0 { var adpts = adapters - let test1 = try createTestIntfPrx(adpts) + let test1 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test2 = try createTestIntfPrx(adpts) + let test2 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test3 = try createTestIntfPrx(adpts) - try test1.ice_ping() + let test3 = try await createTestIntfPrx(adpts) + try await test1.ice_ping() try await test(test1.ice_getConnection() === test2.ice_getConnection()) try await test(test2.ice_getConnection() === test3.ice_getConnection()) - let adapterName = try test1.getAdapterName() + let adapterName = try await test1.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -249,14 +249,14 @@ func allTests(_ helper: TestHelper) async throws { // do { for adpt in adapters { - try adpt.getTestIntf()!.ice_ping() + try await adpt.getTestIntf()!.ice_ping() } - let t = try createTestIntfPrx(adapters) - let name = try await t.getAdapterNameAsync() + let t = try await createTestIntfPrx(adapters) + let name = try await t.getAdapterName() let nRetry = 10 var i = 0 - while i < nRetry, try await t.getAdapterNameAsync() == name { + while i < nRetry, try await t.getAdapterName() == name { i += 1 } try test(i == nRetry) @@ -270,21 +270,21 @@ func allTests(_ helper: TestHelper) async throws { // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) names.append("AdapterAMI12") names.append("AdapterAMI13") while names.count > 0 { var adpts = adapters - let test1 = try createTestIntfPrx(adpts) + let test1 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test2 = try createTestIntfPrx(adpts) + let test2 = try await createTestIntfPrx(adpts) adpts.shuffle() - let test3 = try createTestIntfPrx(adpts) + let test3 = try await createTestIntfPrx(adpts) try await test(test1.ice_getConnection() === test2.ice_getConnection()) try await test(test2.ice_getConnection() === test3.ice_getConnection()) - let adapterName = try test1.getAdapterName() + let adapterName = try await test1.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -293,28 +293,28 @@ func allTests(_ helper: TestHelper) async throws { // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // - try com.deactivateObjectAdapter(adapters[2]) - let obj = try createTestIntfPrx(adapters) - try await test(obj.getAdapterNameAsync() == "AdapterAMI12") + try await com.deactivateObjectAdapter(adapters[2]) + let obj = try await createTestIntfPrx(adapters) + try await test(obj.getAdapterName() == "AdapterAMI12") - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing random endpoint selection... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "Adapter21", endpoints: "default")!, com.createObjectAdapter(name: "Adapter22", endpoints: "default")!, com.createObjectAdapter(name: "Adapter23", endpoints: "default")!, ] - var obj = try createTestIntfPrx(adapters) + var obj = try await createTestIntfPrx(adapters) try test(obj.ice_getEndpointSelection() == .Random) var names = ["Adapter21", "Adapter22", "Adapter23"] while names.count > 0 { - let adapterName = try obj.getAdapterName() + let adapterName = try await obj.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -327,24 +327,24 @@ func allTests(_ helper: TestHelper) async throws { names.append("Adapter23") while names.count > 0 { - let adapterName = try obj.getAdapterName() + let adapterName = try await obj.getAdapterName() names.removeAll(where: { $0 == adapterName }) try await obj.ice_getConnection()!.close(.GracefullyWithWait) } - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing ordered endpoint selection... ") do { - var adapters = try [ + var adapters = try await [ com.createObjectAdapter(name: "Adapter31", endpoints: "default")!, com.createObjectAdapter(name: "Adapter32", endpoints: "default")!, com.createObjectAdapter(name: "Adapter33", endpoints: "default")!, ] - var obj = try createTestIntfPrx(adapters) + var obj = try await createTestIntfPrx(adapters) obj = obj.ice_endpointSelection(.Ordered) try test(obj.ice_getEndpointSelection() == .Ordered) let nRetry = 3 @@ -354,28 +354,28 @@ func allTests(_ helper: TestHelper) async throws { // one after the other. // var i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter31" { + while i < nRetry, try await obj.getAdapterName() == "Adapter31" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter32" { + while i < nRetry, try await obj.getAdapterName() == "Adapter32" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[1]) + try await com.deactivateObjectAdapter(adapters[1]) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter33" { + while i < nRetry, try await obj.getAdapterName() == "Adapter33" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[2]) + try await com.deactivateObjectAdapter(adapters[2]) do { - _ = try obj.getAdapterName() + _ = try await obj.getAdapterName() } catch is Ice.ConnectFailedException { // expected } catch is Ice.ConnectTimeoutException { @@ -390,51 +390,51 @@ func allTests(_ helper: TestHelper) async throws { // Now, re-activate the adapters with the same endpoints in the opposite // order. // - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter36", endpoints: endpoints[2].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter36" { + while i < nRetry, try await obj.getAdapterName() == "Adapter36" { i += 1 } try test(i == nRetry) try await obj.ice_getConnection()!.close(.GracefullyWithWait) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter35", endpoints: endpoints[1].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter35" { + while i < nRetry, try await obj.getAdapterName() == "Adapter35" { i += 1 } try test(i == nRetry) try await obj.ice_getConnection()!.close(.GracefullyWithWait) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter34", endpoints: endpoints[0].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter34" { + while i < nRetry, try await obj.getAdapterName() == "Adapter34" { i += 1 } try test(i == nRetry) - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing per request binding with single endpoint... ") do { - let adapter = try com.createObjectAdapter(name: "Adapter41", endpoints: "default")! + let adapter = try await com.createObjectAdapter(name: "Adapter41", endpoints: "default")! - let test1 = try adapter.getTestIntf()!.ice_connectionCached(false) - let test2 = try adapter.getTestIntf()!.ice_connectionCached(false) + let test1 = try await adapter.getTestIntf()!.ice_connectionCached(false) + let test2 = try await adapter.getTestIntf()!.ice_connectionCached(false) try test(!test1.ice_isConnectionCached()) try test(!test2.ice_isConnectionCached()) try await test(test1.ice_getConnection() != nil) try await test(test2.ice_getConnection() != nil) try await test(test1.ice_getConnection() === test2.ice_getConnection()) - try test1.ice_ping() + try await test1.ice_ping() - try com.deactivateObjectAdapter(adapter) + try await com.deactivateObjectAdapter(adapter) do { _ = try await test1.ice_getConnection() @@ -449,81 +449,81 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing per request binding with multiple endpoints... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "Adapter51", endpoints: "default")!, com.createObjectAdapter(name: "Adapter52", endpoints: "default")!, com.createObjectAdapter(name: "Adapter53", endpoints: "default")!, ] - let obj = try createTestIntfPrx(adapters).ice_connectionCached(false) + let obj = try await createTestIntfPrx(adapters).ice_connectionCached(false) try test(!obj.ice_isConnectionCached()) var names = ["Adapter51", "Adapter52", "Adapter53"] while names.count > 0 { - let name = try obj.getAdapterName() + let name = try await obj.getAdapterName() names.removeAll(where: { $0 == name }) } - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) names.append("Adapter52") names.append("Adapter53") while names.count > 0 { - let name = try obj.getAdapterName() + let name = try await obj.getAdapterName() names.removeAll(where: { $0 == name }) } - try com.deactivateObjectAdapter(adapters[2]) + try await com.deactivateObjectAdapter(adapters[2]) - try test(obj.getAdapterName() == "Adapter52") + try await test(obj.getAdapterName() == "Adapter52") - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing per request binding with multiple endpoints and AMI... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "AdapterAMI51", endpoints: "default")!, com.createObjectAdapter(name: "AdapterAMI52", endpoints: "default")!, com.createObjectAdapter(name: "AdapterAMI53", endpoints: "default")!, ] - let obj = try createTestIntfPrx(adapters).ice_connectionCached(false) + let obj = try await createTestIntfPrx(adapters).ice_connectionCached(false) try test(!obj.ice_isConnectionCached()) var names = ["AdapterAMI51", "AdapterAMI52", "AdapterAMI53"] while names.count > 0 { - let adapterName = try await obj.getAdapterNameAsync() + let adapterName = try await obj.getAdapterName() names.removeAll(where: { adapterName == $0 }) } - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) names.append("AdapterAMI52") names.append("AdapterAMI53") while names.count > 0 { - let adapterName = try await obj.getAdapterNameAsync() + let adapterName = try await obj.getAdapterName() names.removeAll(where: { adapterName == $0 }) } - try com.deactivateObjectAdapter(adapters[2]) + try await com.deactivateObjectAdapter(adapters[2]) - try await test(obj.getAdapterNameAsync() == "AdapterAMI52") + try await test(obj.getAdapterName() == "AdapterAMI52") - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing per request binding and ordered endpoint selection... ") do { - var adapters = try [ + var adapters = try await [ com.createObjectAdapter(name: "Adapter61", endpoints: "default")!, com.createObjectAdapter(name: "Adapter62", endpoints: "default")!, com.createObjectAdapter(name: "Adapter63", endpoints: "default")!, ] - var obj = try createTestIntfPrx(adapters) + var obj = try await createTestIntfPrx(adapters) obj = obj.ice_endpointSelection(.Ordered) try test(obj.ice_getEndpointSelection() == .Ordered) obj = obj.ice_connectionCached(false) @@ -534,28 +534,28 @@ func allTests(_ helper: TestHelper) async throws { // Ensure that endpoints are tried in order by deactivating the adapters // one after the other. // - while try i < nRetry && obj.getAdapterName() == "Adapter61" { + while i < nRetry, try await obj.getAdapterName() == "Adapter61" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter62" { + while i < nRetry, try await obj.getAdapterName() == "Adapter62" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[1]) + try await com.deactivateObjectAdapter(adapters[1]) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter63" { + while i < nRetry, try await obj.getAdapterName() == "Adapter63" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[2]) + try await com.deactivateObjectAdapter(adapters[2]) do { - _ = try obj.getAdapterName() + _ = try await obj.getAdapterName() } catch is Ice.ConnectFailedException { // expected } catch is Ice.ConnectTimeoutException { @@ -570,43 +570,43 @@ func allTests(_ helper: TestHelper) async throws { // Now, re-activate the adapters with the same endpoints in the opposite // order. // - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter66", endpoints: endpoints[2].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter66" { + while i < nRetry, try await obj.getAdapterName() == "Adapter66" { i += 1 } try test(i == nRetry) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter65", endpoints: endpoints[1].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter65" { + while i < nRetry, try await obj.getAdapterName() == "Adapter65" { i += 1 } try test(i == nRetry) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "Adapter64", endpoints: endpoints[0].toString())!) i = 0 - while try i < nRetry && obj.getAdapterName() == "Adapter64" { + while i < nRetry, try await obj.getAdapterName() == "Adapter64" { i += 1 } try test(i == nRetry) - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing per request binding and ordered endpoint selection and AMI... ") do { - var adapters = try [ + var adapters = try await [ com.createObjectAdapter(name: "AdapterAMI61", endpoints: "default")!, com.createObjectAdapter(name: "AdapterAMI62", endpoints: "default")!, com.createObjectAdapter(name: "AdapterAMI63", endpoints: "default")!, ] - var obj = try createTestIntfPrx(adapters) + var obj = try await createTestIntfPrx(adapters) obj = obj.ice_endpointSelection(.Ordered) try test(obj.ice_getEndpointSelection() == .Ordered) obj = obj.ice_connectionCached(false) @@ -619,27 +619,27 @@ func allTests(_ helper: TestHelper) async throws { // Ensure that endpoints are tried in order by deactivating the adapters // one after the other. // - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI61" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI61" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI62" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI62" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[1]) + try await com.deactivateObjectAdapter(adapters[1]) i = 0 - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI63" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI63" { i += 1 } try test(i == nRetry) - try com.deactivateObjectAdapter(adapters[2]) + try await com.deactivateObjectAdapter(adapters[2]) do { - _ = try obj.getAdapterName() + _ = try await obj.getAdapterName() } catch is Ice.ConnectFailedException { // expected } catch is Ice.ConnectTimeoutException { @@ -654,48 +654,48 @@ func allTests(_ helper: TestHelper) async throws { // Now, re-activate the adapters with the same endpoints in the opposite // order. // - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "AdapterAMI66", endpoints: endpoints[2].toString())!) i = 0 - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI66" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI66" { i += 1 } try test(i == nRetry) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "AdapterAMI65", endpoints: endpoints[1].toString())!) i = 0 - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI65" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI65" { i += 1 } try test(i == nRetry) - try adapters.append( + try await adapters.append( com.createObjectAdapter(name: "AdapterAMI64", endpoints: endpoints[0].toString())!) i = 0 - while i < nRetry, try await obj.getAdapterNameAsync() == "AdapterAMI64" { + while i < nRetry, try await obj.getAdapterName() == "AdapterAMI64" { i += 1 } try test(i == nRetry) - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") output.write("testing endpoint mode filtering... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "Adapter71", endpoints: "default")!, com.createObjectAdapter(name: "Adapter72", endpoints: "udp")!, ] - let obj = try createTestIntfPrx(adapters) - try test(obj.getAdapterName() == "Adapter71") + let obj = try await createTestIntfPrx(adapters) + try await test(obj.getAdapterName() == "Adapter71") let testUDP = obj.ice_datagram() try await test(obj.ice_getConnection() !== testUDP.ice_getConnection()) do { - _ = try testUDP.getAdapterName() + _ = try await testUDP.getAdapterName() } catch is Ice.TwowayOnlyException {} } output.writeLine("ok") @@ -703,14 +703,14 @@ func allTests(_ helper: TestHelper) async throws { if communicator.getProperties().getProperty("Ice.Default.Protocol") == "ssl" { output.write("testing unsecure vs. secure endpoints... ") do { - let adapters = try [ + let adapters = try await [ com.createObjectAdapter(name: "Adapter81", endpoints: "ssl")!, com.createObjectAdapter(name: "Adapter82", endpoints: "tcp")!, ] - let obj = try createTestIntfPrx(adapters) + let obj = try await createTestIntfPrx(adapters) for _ in 0..<5 { - try test(obj.getAdapterName() == "Adapter82") + try await test(obj.getAdapterName() == "Adapter82") try await obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -722,25 +722,25 @@ func allTests(_ helper: TestHelper) async throws { try test(testSecure.ice_isSecure()) try await test(obj.ice_getConnection() !== testSecure.ice_getConnection()) - try com.deactivateObjectAdapter(adapters[1]) + try await com.deactivateObjectAdapter(adapters[1]) for _ in 0..<5 { - try test(obj.getAdapterName() == "Adapter81") + try await test(obj.getAdapterName() == "Adapter81") try await obj.ice_getConnection()!.close(.GracefullyWithWait) } // Reactive tcp OA. - _ = try com.createObjectAdapter( + _ = try await com.createObjectAdapter( name: "Adapter83", endpoints: obj.ice_getEndpoints()[1].toString()) for _ in 0..<5 { - try test(obj.getAdapterName() == "Adapter83") + try await test(obj.getAdapterName() == "Adapter83") try await obj.ice_getConnection()!.close(.GracefullyWithWait) } - try com.deactivateObjectAdapter(adapters[0]) + try await com.deactivateObjectAdapter(adapters[0]) do { - try testSecure.ice_ping() + try await testSecure.ice_ping() try test(false) } catch is Ice.ConnectFailedException { // expected @@ -748,7 +748,7 @@ func allTests(_ helper: TestHelper) async throws { // expected } - try deactivate(communicator: com, adapters: adapters) + try await deactivate(communicator: com, adapters: adapters) } output.writeLine("ok") } @@ -828,7 +828,7 @@ func allTests(_ helper: TestHelper) async throws { var prx = try oa.createProxy(Ice.stringToIdentity("dummy")) do { - try prx.ice_collocationOptimized(false).ice_ping() + try await prx.ice_collocationOptimized(false).ice_ping() } catch is Ice.LocalException { serverCommunicator.destroy() continue // IP version not supported. @@ -841,7 +841,7 @@ func allTests(_ helper: TestHelper) async throws { let clientCommunicator = try Ice.initialize(clientInitData) prx = try clientCommunicator.stringToProxy(strPrx)! do { - try prx.ice_ping() + try await prx.ice_ping() try test(false) } catch is Ice.ObjectNotExistException { // Expected, no object registered. @@ -867,6 +867,6 @@ func allTests(_ helper: TestHelper) async throws { } output.writeLine("ok") - try com.shutdown() + try await com.shutdown() } } diff --git a/swift/test/Ice/binding/TestI.swift b/swift/test/Ice/binding/TestI.swift index bebf59254ed..9585ed9458f 100644 --- a/swift/test/Ice/binding/TestI.swift +++ b/swift/test/Ice/binding/TestI.swift @@ -50,7 +50,7 @@ class RemoteCommunicatorI: RemoteCommunicator { } func deactivateObjectAdapter(adapter: RemoteObjectAdapterPrx?, current _: Ice.Current) async throws { - try adapter!.deactivate() // Collocated call. + try await adapter!.deactivate() // Collocated call. } func shutdown(current: Ice.Current) async throws { diff --git a/swift/test/Ice/defaultServant/AllTests.swift b/swift/test/Ice/defaultServant/AllTests.swift index 36c00dccdb4..9fc1eed59a4 100644 --- a/swift/test/Ice/defaultServant/AllTests.swift +++ b/swift/test/Ice/defaultServant/AllTests.swift @@ -22,7 +22,7 @@ final class MyObjectI: ObjectI, MyObject { } } -func allTests(_ helper: TestHelper) throws { +func allTests(_ helper: TestHelper) async throws { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -61,31 +61,31 @@ func allTests(_ helper: TestHelper) throws { for name in names { identity.name = name prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) - try prx.ice_ping() - try test(prx.getName() == name) + try await prx.ice_ping() + try await test(prx.getName() == name) } identity.name = "ObjectNotExist" prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) do { - try prx.ice_ping() + try await prx.ice_ping() try test(false) } catch is Ice.ObjectNotExistException {} // Expected do { - _ = try prx.getName() + _ = try await prx.getName() try test(false) } catch is Ice.ObjectNotExistException {} // Expected identity.name = "FacetNotExist" prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) do { - try prx.ice_ping() + try await prx.ice_ping() try test(false) } catch is Ice.FacetNotExistException {} // Expected do { - _ = try prx.getName() + _ = try await prx.getName() try test(false) } catch is Ice.FacetNotExistException {} // Expected @@ -95,12 +95,12 @@ func allTests(_ helper: TestHelper) throws { prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) do { - try prx.ice_ping() + try await prx.ice_ping() try test(false) } catch is Ice.ObjectNotExistException {} // Expected do { - _ = try prx.getName() + _ = try await prx.getName() try test(false) } catch is Ice.ObjectNotExistException {} // Expected } @@ -109,7 +109,7 @@ func allTests(_ helper: TestHelper) throws { identity.category = "foo" prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) do { - try prx.ice_ping() + try await prx.ice_ping() try test(false) } catch is Ice.ObjectNotExistException {} // Expected @@ -128,8 +128,8 @@ func allTests(_ helper: TestHelper) throws { for name in names { identity.name = name prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) - try prx.ice_ping() - try test(prx.getName() == name) + try await prx.ice_ping() + try await test(prx.getName() == name) } output.writeLine("ok") } diff --git a/swift/test/Ice/defaultServant/Client.swift b/swift/test/Ice/defaultServant/Client.swift index 8c6c84de105..39cc845eb57 100644 --- a/swift/test/Ice/defaultServant/Client.swift +++ b/swift/test/Ice/defaultServant/Client.swift @@ -9,6 +9,6 @@ class Client: TestHelperI { defer { communicator.destroy() } - try allTests(self) + try await allTests(self) } } diff --git a/swift/test/Ice/enums/AllTests.swift b/swift/test/Ice/enums/AllTests.swift index 045a0541ae8..3611247c139 100644 --- a/swift/test/Ice/enums/AllTests.swift +++ b/swift/test/Ice/enums/AllTests.swift @@ -3,7 +3,7 @@ import Ice import TestCommon -func allTests(_ helper: TestHelper) throws -> TestIntfPrx { +func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -87,18 +87,18 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("testing enum operations... ") - try test(proxy.opByte(ByteEnum.benum1) == (ByteEnum.benum1, ByteEnum.benum1)) + try await test(proxy.opByte(ByteEnum.benum1) == (ByteEnum.benum1, ByteEnum.benum1)) - try test(proxy.opByte(ByteEnum.benum11) == (ByteEnum.benum11, ByteEnum.benum11)) + try await test(proxy.opByte(ByteEnum.benum11) == (ByteEnum.benum11, ByteEnum.benum11)) - try test(proxy.opShort(ShortEnum.senum1) == (ShortEnum.senum1, ShortEnum.senum1)) - try test(proxy.opShort(ShortEnum.senum11) == (ShortEnum.senum11, ShortEnum.senum11)) + try await test(proxy.opShort(ShortEnum.senum1) == (ShortEnum.senum1, ShortEnum.senum1)) + try await test(proxy.opShort(ShortEnum.senum11) == (ShortEnum.senum11, ShortEnum.senum11)) - try test(proxy.opInt(IntEnum.ienum1) == (IntEnum.ienum1, IntEnum.ienum1)) - try test(proxy.opInt(IntEnum.ienum11) == (IntEnum.ienum11, IntEnum.ienum11)) - try test(proxy.opInt(IntEnum.ienum12) == (IntEnum.ienum12, IntEnum.ienum12)) + try await test(proxy.opInt(IntEnum.ienum1) == (IntEnum.ienum1, IntEnum.ienum1)) + try await test(proxy.opInt(IntEnum.ienum11) == (IntEnum.ienum11, IntEnum.ienum11)) + try await test(proxy.opInt(IntEnum.ienum12) == (IntEnum.ienum12, IntEnum.ienum12)) - try test(proxy.opSimple(SimpleEnum.green) == (SimpleEnum.green, SimpleEnum.green)) + try await test(proxy.opSimple(SimpleEnum.green) == (SimpleEnum.green, SimpleEnum.green)) output.writeLine("ok") @@ -118,7 +118,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { ByteEnum.benum10, ByteEnum.benum11, ] - try test(proxy.opByteSeq(b1) == (b1, b1)) + try await test(proxy.opByteSeq(b1) == (b1, b1)) } do { @@ -136,7 +136,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { ShortEnum.senum11, ] - try test(proxy.opShortSeq(s1) == (s1, s1)) + try await test(proxy.opShortSeq(s1) == (s1, s1)) } do { @@ -154,7 +154,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { IntEnum.ienum11, ] - try test(proxy.opIntSeq(i1) == (i1, i1)) + try await test(proxy.opIntSeq(i1) == (i1, i1)) } do { @@ -163,7 +163,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { SimpleEnum.green, SimpleEnum.blue, ] - try test(proxy.opSimpleSeq(s1) == (s1, s1)) + try await test(proxy.opSimpleSeq(s1) == (s1, s1)) } output.writeLine("ok") diff --git a/swift/test/Ice/enums/Client.swift b/swift/test/Ice/enums/Client.swift index 4894a8b5fee..1d5b4aee46d 100644 --- a/swift/test/Ice/enums/Client.swift +++ b/swift/test/Ice/enums/Client.swift @@ -9,7 +9,7 @@ public class Client: TestHelperI { defer { communicator.destroy() } - let p = try allTests(self) - try p.shutdown() + let p = try await allTests(self) + try await p.shutdown() } } diff --git a/swift/test/Ice/exceptions/AllTests.swift b/swift/test/Ice/exceptions/AllTests.swift index f7c3cf235a5..1299fbeb313 100644 --- a/swift/test/Ice/exceptions/AllTests.swift +++ b/swift/test/Ice/exceptions/AllTests.swift @@ -85,13 +85,13 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.writeLine("ok") output.write("testing checked cast... ") - let thrower = try checkedCast(prx: base, type: ThrowerPrx.self)! + let thrower = try await checkedCast(prx: base, type: ThrowerPrx.self)! try test(thrower == base) output.writeLine("ok") output.write("catching exact types... ") do { - try thrower.throwAasA(1) + try await thrower.throwAasA(1) try test(false) } catch let ex as A { try test(ex.aMem == 1) @@ -101,7 +101,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwAorDasAorD(1) + try await thrower.throwAorDasAorD(1) try test(false) } catch let ex as A { try test(ex.aMem == 1) @@ -110,7 +110,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwAorDasAorD(-1) + try await thrower.throwAorDasAorD(-1) try test(false) } catch let ex as D { try test(ex.dMem == -1) @@ -119,7 +119,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwBasB(a: 1, b: 2) + try await thrower.throwBasB(a: 1, b: 2) try test(false) } catch let ex as B { try test(ex.aMem == 1) @@ -129,7 +129,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwCasC(a: 1, b: 2, c: 3) + try await thrower.throwCasC(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -140,7 +140,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwModA(a: 1, a2: 2) + try await thrower.throwModA(a: 1, a2: 2) try test(false) } catch let ex as ModA { try test(ex.aMem == 1) @@ -154,7 +154,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching base types... ") do { - try thrower.throwBasB(a: 1, b: 2) + try await thrower.throwBasB(a: 1, b: 2) try test(false) } catch let ex as A { try test(ex.aMem == 1) @@ -163,7 +163,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwCasC(a: 1, b: 2, c: 3) + try await thrower.throwCasC(a: 1, b: 2, c: 3) try test(false) } catch let ex as B { try test(ex.aMem == 1) @@ -173,7 +173,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwModA(a: 1, a2: 2) + try await thrower.throwModA(a: 1, a2: 2) try test(false) } catch let ex as ModA { try test(ex.aMem == 1) @@ -187,7 +187,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching derived types... ") do { - try thrower.throwBasA(a: 1, b: 2) + try await thrower.throwBasA(a: 1, b: 2) try test(false) } catch let ex as B { try test(ex.aMem == 1) @@ -197,7 +197,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwCasA(a: 1, b: 2, c: 3) + try await thrower.throwCasA(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -208,7 +208,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try thrower.throwCasB(a: 1, b: 2, c: 3) + try await thrower.throwCasB(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -219,26 +219,26 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } output.writeLine("ok") - let supportsUndeclaredExceptions = try thrower.supportsUndeclaredExceptions() + let supportsUndeclaredExceptions = try await thrower.supportsUndeclaredExceptions() if supportsUndeclaredExceptions { output.write("catching unknown user exception... ") do { - try thrower.throwUndeclaredA(1) + try await thrower.throwUndeclaredA(1) try test(false) } catch is Ice.UnknownUserException {} catch { try test(false) } do { - try thrower.throwUndeclaredB(a: 1, b: 2) + try await thrower.throwUndeclaredB(a: 1, b: 2) try test(false) } catch is Ice.UnknownUserException {} catch { try test(false) } do { - try thrower.throwUndeclaredC(a: 1, b: 2, c: 3) + try await thrower.throwUndeclaredC(a: 1, b: 2, c: 3) try test(false) } catch is Ice.UnknownUserException {} catch { try test(false) @@ -250,14 +250,14 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { if conn != nil { output.write("testing memory limit marshal exception...") do { - _ = try thrower.throwMemoryLimitException(ByteSeq()) + _ = try await thrower.throwMemoryLimitException(ByteSeq()) try test(false) } catch is Ice.MarshalException {} catch { try test(false) } do { - _ = try thrower.throwMemoryLimitException(ByteSeq(repeating: 0, count: 20 * 1024)) // 20KB + _ = try await thrower.throwMemoryLimitException(ByteSeq(repeating: 0, count: 20 * 1024)) // 20KB try test(false) } catch is Ice.ConnectionLostException {} catch is Ice.UnknownLocalException { // Expected with JS bidir server @@ -270,13 +270,13 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { let thrower2 = try uncheckedCast(prx: communicator.stringToProxy(str)!, type: ThrowerPrx.self) do { // 2MB(no limits) - _ = try thrower2.throwMemoryLimitException(ByteSeq(repeating: 0, count: 2 * 1024 * 1024)) + _ = try await thrower2.throwMemoryLimitException(ByteSeq(repeating: 0, count: 2 * 1024 * 1024)) } catch is Ice.MarshalException {} str = "thrower:\(helper.getTestEndpoint(num: 2))" let thrower3 = try uncheckedCast(prx: communicator.stringToProxy(str)!, type: ThrowerPrx.self) do { // 1KB limit - _ = try thrower3.throwMemoryLimitException(ByteSeq(repeating: 0, count: 1024)) + _ = try await thrower3.throwMemoryLimitException(ByteSeq(repeating: 0, count: 1024)) try test(false) } catch is Ice.ConnectionLostException {} } catch is Ice.ConnectionRefusedException { @@ -290,7 +290,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { let id = try Ice.stringToIdentity("does not exist") do { let thrower2 = uncheckedCast(prx: thrower.ice_identity(id), type: ThrowerPrx.self) - try thrower2.ice_ping() + try await thrower2.ice_ping() try test(false) } catch let ex as Ice.ObjectNotExistException { try test(ex.id == id) @@ -304,7 +304,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { do { let thrower2 = uncheckedCast(prx: thrower, type: ThrowerPrx.self, facet: "no such facet") do { - try thrower2.ice_ping() + try await thrower2.ice_ping() try test(false) } catch let ex as Ice.FacetNotExistException { try test(ex.facet == "no such facet") @@ -317,7 +317,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching operation not exist exception... ") do { let thrower2 = uncheckedCast(prx: thrower, type: WrongOperationPrx.self) - try thrower2.noSuchOperation() + try await thrower2.noSuchOperation() try test(false) } catch let ex as Ice.OperationNotExistException { try test(ex.operation == "noSuchOperation") @@ -328,14 +328,14 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching unknown local exception... ") do { - try thrower.throwLocalException() + try await thrower.throwLocalException() try test(false) } catch is Ice.UnknownLocalException {} catch { try test(false) } do { - try thrower.throwLocalExceptionIdempotent() + try await thrower.throwLocalExceptionIdempotent() try test(false) } catch is Ice.UnknownLocalException { } catch is Ice.OperationNotExistException {} catch { @@ -345,7 +345,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching unknown non-Ice exception... ") do { - try thrower.throwNonIceException() + try await thrower.throwNonIceException() try test(false) } catch is Ice.UnknownException {} catch { try test(false) @@ -354,13 +354,13 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("testing asynchronous exceptions... ") do { - try thrower.throwAfterResponse() + try await thrower.throwAfterResponse() } catch { try test(false) } do { - try thrower.throwAfterException() + try await thrower.throwAfterException() try test(false) } catch is A {} catch { try test(false) @@ -369,14 +369,14 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching exact types with AMI mapping... ") do { - try await thrower.throwAasAAsync(1) + try await thrower.throwAasA(1) try test(false) } catch let ex as A { try test(ex.aMem == 1) } do { - try await thrower.throwModAAsync(a: 1, a2: 2) + try await thrower.throwModA(a: 1, a2: 2) try test(false) } catch let ex as ModA { try test(ex.aMem == 1) @@ -387,7 +387,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { for i in [1, -1] { do { - try await thrower.throwAorDasAorDAsync(Int32(i)) + try await thrower.throwAorDasAorD(Int32(i)) try test(false) } catch let ex as A { try test(ex.aMem == 1) @@ -397,7 +397,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try await thrower.throwBasBAsync(a: 1, b: 2) + try await thrower.throwBasB(a: 1, b: 2) try test(false) } catch let ex as B { try test(ex.aMem == 1) @@ -405,7 +405,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try await thrower.throwCasCAsync(a: 1, b: 2, c: 3) + try await thrower.throwCasC(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -416,7 +416,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.write("catching derived types with new AMI mapping... ") do { - try await thrower.throwBasAAsync(a: 1, b: 2) + try await thrower.throwBasA(a: 1, b: 2) try test(false) } catch let ex as B { try test(ex.aMem == 1) @@ -424,7 +424,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try await thrower.throwCasAAsync(a: 1, b: 2, c: 3) + try await thrower.throwCasA(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -433,7 +433,7 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { } do { - try await thrower.throwCasBAsync(a: 1, b: 2, c: 3) + try await thrower.throwCasB(a: 1, b: 2, c: 3) try test(false) } catch let ex as C { try test(ex.aMem == 1) @@ -443,152 +443,5 @@ func allTests(_ helper: TestHelper) async throws -> ThrowerPrx { output.writeLine("ok") - if supportsUndeclaredExceptions { - output.write("catching unknown user exception with new AMI mapping... ") - - do { - try await thrower.throwUndeclaredAAsync(1) - try test(false) - } catch is Ice.UnknownUserException {} - - do { - try await thrower.throwUndeclaredBAsync(a: 1, b: 2) - try test(false) - } catch is Ice.UnknownUserException {} - - do { - try await thrower.throwUndeclaredCAsync(a: 1, b: 2, c: 3) - try test(false) - } catch is Ice.UnknownUserException {} - - output.writeLine("ok") - } - - output.write("catching object not exist exception with new AMI mapping... ") - do { - let id = try Ice.stringToIdentity("does not exist") - let thrower2 = uncheckedCast(prx: thrower.ice_identity(id), type: ThrowerPrx.self) - do { - try await thrower2.throwAasAAsync(1) - try test(false) - } catch let ex as Ice.ObjectNotExistException { - try test(ex.id == id) - } - } - output.writeLine("ok") - - output.write("catching facet not exist exception with new AMI mapping... ") - do { - let thrower2 = uncheckedCast(prx: thrower, type: ThrowerPrx.self, facet: "no such facet") - try await thrower2.throwAasAAsync(1) - try test(false) - } catch let ex as Ice.FacetNotExistException { - try test(ex.facet == "no such facet") - } - output.writeLine("ok") - - output.write("catching operation not exist exception with new AMI mapping... ") - do { - let thrower4 = uncheckedCast(prx: thrower, type: WrongOperationPrx.self) - try await thrower4.noSuchOperationAsync() - try test(false) - } catch let ex as Ice.OperationNotExistException { - try test(ex.operation == "noSuchOperation") - } - output.writeLine("ok") - - output.write("catching unknown local exception with new AMI mapping... ") - do { - try await thrower.throwLocalExceptionAsync() - try test(false) - } catch is Ice.UnknownLocalException {} catch is Ice.OperationNotExistException {} - - do { - try await thrower.throwLocalExceptionIdempotentAsync() - try test(false) - } catch is Ice.UnknownLocalException {} catch is Ice.OperationNotExistException {} - output.writeLine("ok") - - output.write("catching unknown non-Ice exception with new AMI mapping... ") - - do { - try await thrower.throwNonIceExceptionAsync() - try test(false) - } catch is Ice.UnknownException {} - output.writeLine("ok") - - if supportsUndeclaredExceptions { - output.write("catching unknown user exception with new AMI mapping... ") - do { - try await thrower.throwUndeclaredAAsync(1) - try test(false) - } catch is Ice.UnknownUserException {} - - do { - try await thrower.throwUndeclaredBAsync(a: 1, b: 2) - try test(false) - } catch is Ice.UnknownUserException {} - - do { - try await thrower.throwUndeclaredCAsync(a: 1, b: 2, c: 3) - try test(false) - } catch is Ice.UnknownUserException {} - output.writeLine("ok") - } - - output.write("catching object not exist exception with new AMI mapping... ") - do { - let id = try Ice.stringToIdentity("does not exist") - let thrower2 = uncheckedCast(prx: thrower.ice_identity(id), type: ThrowerPrx.self) - do { - try await thrower2.throwAasAAsync(1) - try test(false) - } catch let ex as Ice.ObjectNotExistException { - try test(ex.id == id) - } - } - output.writeLine("ok") - - output.write("catching facet not exist exception with new AMI mapping... ") - do { - let thrower2 = uncheckedCast(prx: thrower, type: ThrowerPrx.self, facet: "no such facet") - do { - try await thrower2.throwAasAAsync(1) - try test(false) - } catch let ex as Ice.FacetNotExistException { - try test(ex.facet == "no such facet") - } - } - output.writeLine("ok") - - output.write("catching operation not exist exception with new AMI mapping... ") - do { - let thrower4 = uncheckedCast(prx: thrower, type: WrongOperationPrx.self) - try await thrower4.noSuchOperationAsync() - try test(false) - } catch let ex as Ice.OperationNotExistException { - try test(ex.operation == "noSuchOperation") - } - output.writeLine("ok") - - output.write("catching unknown local exception with new AMI mapping... ") - do { - try await thrower.throwLocalExceptionAsync() - try test(false) - } catch is Ice.UnknownLocalException {} catch is Ice.OperationNotExistException {} - - do { - try await thrower.throwLocalExceptionIdempotentAsync() - try test(false) - } catch is Ice.UnknownLocalException {} catch is Ice.OperationNotExistException {} - output.writeLine("ok") - - output.write("catching unknown non-Ice exception with new AMI mapping... ") - do { - try await thrower.throwNonIceExceptionAsync() - try test(false) - } catch is Ice.UnknownException {} - output.writeLine("ok") - return thrower } diff --git a/swift/test/Ice/exceptions/Client.swift b/swift/test/Ice/exceptions/Client.swift index a25782043f3..7701d4a7bfa 100644 --- a/swift/test/Ice/exceptions/Client.swift +++ b/swift/test/Ice/exceptions/Client.swift @@ -18,6 +18,6 @@ public class Client: TestHelperI { communicator.destroy() } let thrower = try await allTests(self) - try thrower.shutdown() + try await thrower.shutdown() } } diff --git a/swift/test/Ice/facets/AllTests.swift b/swift/test/Ice/facets/AllTests.swift index bf381bcb305..6955efd944e 100644 --- a/swift/test/Ice/facets/AllTests.swift +++ b/swift/test/Ice/facets/AllTests.swift @@ -5,7 +5,7 @@ import TestCommon class EmptyI: Empty {} -func allTests(_ helper: TestHelper) throws -> GPrx { +func allTests(_ helper: TestHelper) async throws -> GPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -106,56 +106,56 @@ func allTests(_ helper: TestHelper) throws -> GPrx { output.writeLine("ok") output.write("testing checked cast... ") - prx = try checkedCast(prx: db, type: ObjectPrx.self)! + prx = try await checkedCast(prx: db, type: ObjectPrx.self)! try test(prx.ice_getFacet() == "") - prx = try checkedCast(prx: db, type: ObjectPrx.self, facet: "facetABCD")! + prx = try await checkedCast(prx: db, type: ObjectPrx.self, facet: "facetABCD")! try test(prx.ice_getFacet() == "facetABCD") - prx2 = try checkedCast(prx: prx, type: ObjectPrx.self)! + prx2 = try await checkedCast(prx: prx, type: ObjectPrx.self)! try test(prx2.ice_getFacet() == "facetABCD") - prx3 = try checkedCast(prx: prx, type: ObjectPrx.self, facet: "")! + prx3 = try await checkedCast(prx: prx, type: ObjectPrx.self, facet: "")! try test(prx3.ice_getFacet() == "") - d = try checkedCast(prx: db, type: DPrx.self)! + d = try await checkedCast(prx: db, type: DPrx.self)! try test(d.ice_getFacet() == "") - df = try checkedCast(prx: db, type: DPrx.self, facet: "facetABCD")! + df = try await checkedCast(prx: db, type: DPrx.self, facet: "facetABCD")! try test(df.ice_getFacet() == "facetABCD") - df2 = try checkedCast(prx: df, type: DPrx.self)! + df2 = try await checkedCast(prx: df, type: DPrx.self)! try test(df2.ice_getFacet() == "facetABCD") - df3 = try checkedCast(prx: df, type: DPrx.self, facet: "")! + df3 = try await checkedCast(prx: df, type: DPrx.self, facet: "")! try test(df3.ice_getFacet() == "") output.writeLine("ok") output.write("testing non-facets A, B, C, and D... ") - d = try checkedCast(prx: db, type: DPrx.self)! + d = try await checkedCast(prx: db, type: DPrx.self)! try test(d == db) - try test(d.callA() == "A") - try test(d.callB() == "B") - try test(d.callC() == "C") - try test(d.callD() == "D") + try await test(d.callA() == "A") + try await test(d.callB() == "B") + try await test(d.callC() == "C") + try await test(d.callD() == "D") output.writeLine("ok") output.write("testing facets A, B, C, and D... ") - df = try checkedCast(prx: d, type: DPrx.self, facet: "facetABCD")! - try test(df.callA() == "A") - try test(df.callB() == "B") - try test(df.callC() == "C") - try test(df.callD() == "D") + df = try await checkedCast(prx: d, type: DPrx.self, facet: "facetABCD")! + try await test(df.callA() == "A") + try await test(df.callB() == "B") + try await test(df.callC() == "C") + try await test(df.callD() == "D") output.writeLine("ok") output.write("testing facets E and F... ") - let ff = try checkedCast(prx: d, type: FPrx.self, facet: "facetEF")! - try test(ff.callE() == "E") - try test(ff.callF() == "F") + let ff = try await checkedCast(prx: d, type: FPrx.self, facet: "facetEF")! + try await test(ff.callE() == "E") + try await test(ff.callF() == "F") output.writeLine("ok") output.write("testing facet G... ") - let gf = try checkedCast(prx: ff, type: GPrx.self, facet: "facetGH")! - try test(gf.callG() == "G") + let gf = try await checkedCast(prx: ff, type: GPrx.self, facet: "facetGH")! + try await test(gf.callG() == "G") output.writeLine("ok") output.write("testing whether casting preserves the facet... ") - let hf = try checkedCast(prx: gf, type: HPrx.self)! - try test(hf.callG() == "G") - try test(hf.callH() == "H") + let hf = try await checkedCast(prx: gf, type: HPrx.self)! + try await test(hf.callG() == "G") + try await test(hf.callH() == "H") output.writeLine("ok") return gf } diff --git a/swift/test/Ice/facets/Client.swift b/swift/test/Ice/facets/Client.swift index f12e8ffce48..c0460070a55 100644 --- a/swift/test/Ice/facets/Client.swift +++ b/swift/test/Ice/facets/Client.swift @@ -16,7 +16,7 @@ public class Client: TestHelperI { defer { communicator.destroy() } - let g = try allTests(self) - try g.shutdown() + let g = try await allTests(self) + try await g.shutdown() } } diff --git a/swift/test/Ice/facets/Collocated.swift b/swift/test/Ice/facets/Collocated.swift index 2ab98256104..71467216461 100644 --- a/swift/test/Ice/facets/Collocated.swift +++ b/swift/test/Ice/facets/Collocated.swift @@ -27,6 +27,6 @@ class Collocated: TestHelperI { // try adapter.activate() // Don't activate OA to ensure collocation is used. - _ = try allTests(self) + _ = try await allTests(self) } } diff --git a/swift/test/Ice/hold/AllTests.swift b/swift/test/Ice/hold/AllTests.swift index af59f82f7ca..2bc079e8525 100644 --- a/swift/test/Ice/hold/AllTests.swift +++ b/swift/test/Ice/hold/AllTests.swift @@ -40,29 +40,29 @@ func allTests(_ helper: TestHelper) async throws { output.writeLine("ok") output.write("testing checked cast... ") - let hold = try checkedCast(prx: base, type: HoldPrx.self)! + let hold = try await checkedCast(prx: base, type: HoldPrx.self)! let holdOneway = uncheckedCast(prx: base.ice_oneway(), type: HoldPrx.self) try test(hold == base) - let holdSerialized = try checkedCast(prx: baseSerialized, type: HoldPrx.self)! + let holdSerialized = try await checkedCast(prx: baseSerialized, type: HoldPrx.self)! let holdSerializedOneway = uncheckedCast(prx: baseSerialized.ice_oneway(), type: HoldPrx.self) try test(holdSerialized == baseSerialized) output.writeLine("ok") output.write("changing state between active and hold rapidly... ") for _ in 0..<100 { - try hold.putOnHold(0) + try await hold.putOnHold(0) } for _ in 0..<100 { - try holdOneway.putOnHold(0) + try await holdOneway.putOnHold(0) } for _ in 0..<100 { - try holdSerialized.putOnHold(0) + try await holdSerialized.putOnHold(0) } for _ in 0..<100 { - try holdSerializedOneway.putOnHold(0) + try await holdSerializedOneway.putOnHold(0) } output.writeLine("ok") @@ -133,22 +133,22 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing waitForHold... ") do { - try hold.waitForHold() - try hold.waitForHold() + try await hold.waitForHold() + try await hold.waitForHold() for i in 0..<1000 { - try holdOneway.ice_ping() + try await holdOneway.ice_ping() if (i % 20) == 0 { - try hold.putOnHold(0) + try await hold.putOnHold(0) } } - try hold.putOnHold(-1) - try hold.ice_ping() - try hold.putOnHold(-1) - try hold.ice_ping() + try await hold.putOnHold(-1) + try await hold.ice_ping() + try await hold.putOnHold(-1) + try await hold.ice_ping() } output.writeLine("ok") output.write("changing state to hold and shutting down server... ") - try hold.shutdown() + try await hold.shutdown() output.writeLine("ok") } diff --git a/swift/test/Ice/info/AllTests.swift b/swift/test/Ice/info/AllTests.swift index 6ef0d89755c..ce1002fb771 100644 --- a/swift/test/Ice/info/AllTests.swift +++ b/swift/test/Ice/info/AllTests.swift @@ -147,7 +147,7 @@ func allTests(_ helper: TestHelper) async throws { let base = try communicator.stringToProxy( "test:" + helper.getTestEndpoint(num: 0) + ":" + helper.getTestEndpoint(num: 0, prot: "udp"))! - let testIntf = try checkedCast(prx: base, type: TestIntfPrx.self)! + let testIntf = try await checkedCast(prx: base, type: TestIntfPrx.self)! let defaultHost = communicator.getProperties().getProperty("Ice.Default.Host") @@ -159,7 +159,7 @@ func allTests(_ helper: TestHelper) async throws { try test(!tcpinfo.compress) try test(tcpinfo.host == defaultHost) - let ctx = try testIntf.getEndpointInfoAsContext() + let ctx = try await testIntf.getEndpointInfoAsContext() try test(ctx["host"] == tcpinfo.host) try test(ctx["compress"] == "false") let port = Int(ctx["port"]!)! @@ -191,7 +191,7 @@ func allTests(_ helper: TestHelper) async throws { try test(ipInfo.rcvSize >= 1024) try test(ipInfo.sndSize >= 2048) - let ctx = try testIntf.getConnectionInfoAsContext() + let ctx = try await testIntf.getConnectionInfoAsContext() try test(ctx["incoming"] == "true") try test(ctx["adapterName"] == "TestAdapter") try test(ctx["remoteAddress"] == ipInfo.localAddress) @@ -232,5 +232,5 @@ func allTests(_ helper: TestHelper) async throws { } output.writeLine("ok") - try testIntf.shutdown() + try await testIntf.shutdown() } diff --git a/swift/test/Ice/inheritance/AllTests.swift b/swift/test/Ice/inheritance/AllTests.swift index 255d9687405..78656f54c74 100644 --- a/swift/test/Ice/inheritance/AllTests.swift +++ b/swift/test/Ice/inheritance/AllTests.swift @@ -3,7 +3,7 @@ import Ice import TestCommon -func allTests(_ helper: TestHelper) throws -> InitialPrx { +func allTests(_ helper: TestHelper) async throws -> InitialPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -14,15 +14,15 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { let base = try communicator.stringToProxy("initial:\(helper.getTestEndpoint(num: 0))")! output.write("testing checked cast... ") - let initial = try checkedCast(prx: base, type: InitialPrx.self)! + let initial = try await checkedCast(prx: base, type: InitialPrx.self)! try test(initial == base) output.writeLine("ok") output.write("getting proxies for interface hierarchy... ") - let ia = try initial.iaop()! - let ib1 = try initial.ib1op()! - let ib2 = try initial.ib2op()! - let ic = try initial.icop()! + let ia = try await initial.iaop()! + let ib1 = try await initial.ib1op()! + let ib2 = try await initial.ib2op()! + let ic = try await initial.icop()! try test(ia !== ib1) try test(ia !== ib2) try test(ia !== ic) @@ -32,80 +32,80 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { output.write("invoking proxy operations on interface hierarchy... ") - var iao = try ia.iaop(ia)! + var iao = try await ia.iaop(ia)! try test(iao == ia) - iao = try ia.iaop(ib1)! + iao = try await ia.iaop(ib1)! try test(iao == ib1) - iao = try ia.iaop(ib2)! + iao = try await ia.iaop(ib2)! try test(iao == ib2) - iao = try ia.iaop(ic)! + iao = try await ia.iaop(ic)! try test(iao == ic) - iao = try ib1.iaop(ia)! + iao = try await ib1.iaop(ia)! try test(iao == ia) - iao = try ib1.iaop(ib1)! + iao = try await ib1.iaop(ib1)! try test(iao == ib1) - iao = try ib1.iaop(ib2)! + iao = try await ib1.iaop(ib2)! try test(iao == ib2) - iao = try ib1.iaop(ic)! + iao = try await ib1.iaop(ic)! try test(iao == ic) - iao = try ib2.iaop(ia)! + iao = try await ib2.iaop(ia)! try test(iao == ia) - iao = try ib2.iaop(ib1)! + iao = try await ib2.iaop(ib1)! try test(iao == ib1) - iao = try ib2.iaop(ib2)! + iao = try await ib2.iaop(ib2)! try test(iao == ib2) - iao = try ib2.iaop(ic)! + iao = try await ib2.iaop(ic)! try test(iao == ic) - iao = try ic.iaop(ia)! + iao = try await ic.iaop(ia)! try test(iao == ia) - iao = try ic.iaop(ib1)! + iao = try await ic.iaop(ib1)! try test(iao == ib1) - iao = try ic.iaop(ib2)! + iao = try await ic.iaop(ib2)! try test(iao == ib2) - iao = try ic.iaop(ic)! + iao = try await ic.iaop(ic)! try test(iao == ic) - iao = try ib1.ib1op(ib1)! + iao = try await ib1.ib1op(ib1)! try test(iao == ib1) - var ib1o = try ib1.ib1op(ib1)! + var ib1o = try await ib1.ib1op(ib1)! try test(ib1o == ib1) - iao = try ib1.ib1op(ic)! + iao = try await ib1.ib1op(ic)! try test(iao == ic) - ib1o = try ib1.ib1op(ic)! + ib1o = try await ib1.ib1op(ic)! try test(ib1o == ic) - iao = try ic.ib1op(ib1)! + iao = try await ic.ib1op(ib1)! try test(iao == ib1) - ib1o = try ic.ib1op(ib1)! + ib1o = try await ic.ib1op(ib1)! try test(ib1o == ib1) - iao = try ic.ib1op(ic)! + iao = try await ic.ib1op(ic)! try test(iao == ic) - ib1o = try ic.ib1op(ic)! + ib1o = try await ic.ib1op(ic)! try test(ib1o == ic) - iao = try ib2.ib2op(ib2)! + iao = try await ib2.ib2op(ib2)! try test(iao == ib2) - var ib2o = try ib2.ib2op(ib2)! + var ib2o = try await ib2.ib2op(ib2)! try test(ib2o == ib2) - iao = try ib2.ib2op(ic)! + iao = try await ib2.ib2op(ic)! try test(iao == ic) - ib2o = try ib2.ib2op(ic)! + ib2o = try await ib2.ib2op(ic)! try test(ib2o == ic) - iao = try ic.ib2op(ib2)! + iao = try await ic.ib2op(ib2)! try test(iao == ib2) - ib2o = try ic.ib2op(ib2)! + ib2o = try await ic.ib2op(ib2)! try test(ib2o == ib2) - iao = try ic.ib2op(ic)! + iao = try await ic.ib2op(ic)! try test(iao == ic) - ib2o = try ic.ib2op(ic)! + ib2o = try await ic.ib2op(ic)! try test(ib2o == ic) - iao = try ic.icop(ic)! + iao = try await ic.icop(ic)! try test(iao == ic) - ib1o = try ic.icop(ic)! + ib1o = try await ic.icop(ic)! try test(ib1o == ic) - ib2o = try ic.icop(ic)! + ib2o = try await ic.icop(ic)! try test(ib2o == ic) - let ico = try ic.icop(ic)! + let ico = try await ic.icop(ic)! try test(ico == ic) output.writeLine("ok") diff --git a/swift/test/Ice/inheritance/Client.swift b/swift/test/Ice/inheritance/Client.swift index 61ec2e25e63..3cb12a6788c 100644 --- a/swift/test/Ice/inheritance/Client.swift +++ b/swift/test/Ice/inheritance/Client.swift @@ -9,7 +9,7 @@ public class Client: TestHelperI { defer { communicator.destroy() } - let initial = try allTests(self) - try initial.shutdown() + let initial = try await allTests(self) + try await initial.shutdown() } } diff --git a/swift/test/Ice/inheritance/Collocated.swift b/swift/test/Ice/inheritance/Collocated.swift index 7f49bce6141..4766cdbd538 100644 --- a/swift/test/Ice/inheritance/Collocated.swift +++ b/swift/test/Ice/inheritance/Collocated.swift @@ -18,6 +18,6 @@ class Collocated: TestHelperI { try adapter.add(servant: InitialDisp(InitialI(adapter)), id: Ice.stringToIdentity("initial")) // try adapter.activate() // Don't activate OA to ensure collocation is used. - _ = try allTests(self) + _ = try await allTests(self) } } diff --git a/swift/test/Ice/invoke/AllTests.swift b/swift/test/Ice/invoke/AllTests.swift index 2eb5961fdae..08fe1a0847f 100644 --- a/swift/test/Ice/invoke/AllTests.swift +++ b/swift/test/Ice/invoke/AllTests.swift @@ -21,17 +21,17 @@ func allTests(_ helper: TestHelper) async throws -> MyClassPrx { let communicator = helper.communicator() let baseProxy = try communicator.stringToProxy("test:\(helper.getTestEndpoint(num: 0))")! - let cl = try checkedCast(prx: baseProxy, type: MyClassPrx.self)! + let cl = try await checkedCast(prx: baseProxy, type: MyClassPrx.self)! let oneway = cl.ice_oneway() let batchOneway = cl.ice_batchOneway() output.write("testing ice_invoke... ") do { - try test(oneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) - try test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) - try test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) - try test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) - try test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) + try await test(oneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) + try await test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) + try await test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) + try await test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) + try await test(batchOneway.ice_invoke(operation: "opOneway", mode: .Normal, inEncaps: Data()).ok) try await batchOneway.ice_flushBatchRequests() let outS = Ice.OutputStream(communicator: communicator) @@ -39,7 +39,7 @@ func allTests(_ helper: TestHelper) async throws -> MyClassPrx { outS.write(testString) outS.endEncapsulation() let inEncaps = outS.finished() - let result = try cl.ice_invoke(operation: "opString", mode: .Normal, inEncaps: inEncaps) + let result = try await cl.ice_invoke(operation: "opString", mode: .Normal, inEncaps: inEncaps) try test(result.ok) let inS = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try inS.startEncapsulation() @@ -56,7 +56,7 @@ func allTests(_ helper: TestHelper) async throws -> MyClassPrx { ctx = Ice.Context() ctx["raise"] = "" } - let result = try cl.ice_invoke( + let result = try await cl.ice_invoke( operation: "opException", mode: .Normal, inEncaps: Data(), context: ctx) try test(!result.ok) let inS = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) @@ -73,42 +73,5 @@ func allTests(_ helper: TestHelper) async throws -> MyClassPrx { output.writeLine("ok") - output.write("testing asynchronous ice_invoke... ") - do { - var result = try await oneway.ice_invokeAsync(operation: "opOneway", mode: .Normal, inEncaps: Data()) - try test(result.ok) - - let outS = Ice.OutputStream(communicator: communicator) - outS.startEncapsulation() - outS.write(testString) - outS.endEncapsulation() - let inEncaps = outS.finished() - - result = try await cl.ice_invokeAsync(operation: "opString", mode: .Normal, inEncaps: inEncaps) - try test(result.ok) - let inS = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) - _ = try inS.startEncapsulation() - var s: String = try inS.read() - try test(s == testString) - s = try inS.read() - try inS.endEncapsulation() - try test(s == testString) - } - - do { - let result = try await cl.ice_invokeAsync(operation: "opException", mode: .Normal, inEncaps: Data()) - try test(!result.ok) - let inS = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) - _ = try inS.startEncapsulation() - do { - try inS.throwException() - } catch is MyException { - try inS.endEncapsulation() - } catch { - try test(false) - } - } - - output.writeLine("ok") return cl } diff --git a/swift/test/Ice/invoke/Client.swift b/swift/test/Ice/invoke/Client.swift index c1dac251a0c..ed650ae9c27 100644 --- a/swift/test/Ice/invoke/Client.swift +++ b/swift/test/Ice/invoke/Client.swift @@ -15,6 +15,6 @@ public class Client: TestHelperI { communicator.destroy() } let cl = try await allTests(self) - try cl.shutdown() + try await cl.shutdown() } } diff --git a/swift/test/Ice/location/AllTests.swift b/swift/test/Ice/location/AllTests.swift index 99d87d67b21..c71fa8ffb44 100644 --- a/swift/test/Ice/location/AllTests.swift +++ b/swift/test/Ice/location/AllTests.swift @@ -22,7 +22,7 @@ func allTests(_ helper: TestHelper) async throws { ) let locator = uncheckedCast(prx: communicator.getDefaultLocator()!, type: TestLocatorPrx.self) - let registry = try uncheckedCast(prx: locator.getRegistry()!, type: TestLocatorRegistryPrx.self) + let registry = try await uncheckedCast(prx: locator.getRegistry()!, type: TestLocatorRegistryPrx.self) output.write("testing stringToProxy... ") var base = try communicator.stringToProxy("test @ TestAdapter")! @@ -71,92 +71,92 @@ func allTests(_ helper: TestHelper) async throws { output.writeLine("ok") output.write("starting server... ") - try manager.startServer() + try await manager.startServer() output.writeLine("ok") output.write("testing checked cast... ") - var obj = try checkedCast(prx: base, type: TestIntfPrx.self)! - let obj2 = try checkedCast(prx: base2, type: TestIntfPrx.self)! - let obj3 = try checkedCast(prx: base3, type: TestIntfPrx.self)! - _ = try checkedCast(prx: base4, type: ServerManagerPrx.self)! - let obj5 = try checkedCast(prx: base5, type: TestIntfPrx.self)! - let obj6 = try checkedCast(prx: base6, type: TestIntfPrx.self)! + var obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! + let obj2 = try await checkedCast(prx: base2, type: TestIntfPrx.self)! + let obj3 = try await checkedCast(prx: base3, type: TestIntfPrx.self)! + _ = try await checkedCast(prx: base4, type: ServerManagerPrx.self)! + let obj5 = try await checkedCast(prx: base5, type: TestIntfPrx.self)! + let obj6 = try await checkedCast(prx: base6, type: TestIntfPrx.self)! output.writeLine("ok") output.write("testing id@AdapterId indirect proxy... ") - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj2.ice_ping() + try await obj2.ice_ping() } catch { try test(false) } output.writeLine("ok") output.write("testing id@ReplicaGroupId indirect proxy... ") - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj6.ice_ping() + try await obj6.ice_ping() } catch { try test(false) } output.writeLine("ok") output.write("testing identity indirect proxy... ") - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj3.ice_ping() + try await obj3.ice_ping() } catch { try test(false) } do { - try obj2.ice_ping() + try await obj2.ice_ping() } catch { try test(false) } - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj2.ice_ping() + try await obj2.ice_ping() } catch { try test(false) } do { - try obj3.ice_ping() + try await obj3.ice_ping() } catch { try test(false) } - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj2.ice_ping() + try await obj2.ice_ping() } catch { try test(false) } - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - try obj3.ice_ping() + try await obj3.ice_ping() } catch { try test(false) } - try obj.shutdown() - try manager.startServer() + try await obj.shutdown() + try await manager.startServer() do { - let obj5 = try checkedCast(prx: base5, type: TestIntfPrx.self)! - try obj5.ice_ping() + let obj5 = try await checkedCast(prx: base5, type: TestIntfPrx.self)! + try await obj5.ice_ping() } catch { try test(false) } @@ -165,7 +165,7 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing proxy with unknown identity... ") do { base = try communicator.stringToProxy("unknown/unknown")! - try base.ice_ping() + try await base.ice_ping() try test(false) } catch let ex as Ice.NotRegisteredException { try test(ex.kindOfObject == "object") @@ -176,7 +176,7 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing proxy with unknown adapter... ") do { base = try communicator.stringToProxy("test @ TestAdapterUnknown")! - try base.ice_ping() + try await base.ice_ping() try test(false) } catch let ex as Ice.NotRegisteredException { try test(ex.kindOfObject == "object adapter") @@ -186,39 +186,39 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing locator cache timeout... ") let basencc = try communicator.stringToProxy("test@TestAdapter")!.ice_connectionCached(false) - var count = try locator.getRequestCount() - try basencc.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. + var count = try await locator.getRequestCount() + try await basencc.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. count += 1 - try test(count == locator.getRequestCount()) - try basencc.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. + try await test(count == locator.getRequestCount()) + try await basencc.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. count += 1 - try test(count == locator.getRequestCount()) - try basencc.ice_locatorCacheTimeout(2).ice_ping() // 2s timeout. - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) + try await basencc.ice_locatorCacheTimeout(2).ice_ping() // 2s timeout. + try await test(count == locator.getRequestCount()) try await Task.sleep(for: .milliseconds(1300)) - try basencc.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. + try await basencc.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. count += 1 - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) // No locator cache. - try communicator.stringToProxy("test")!.ice_locatorCacheTimeout(0).ice_ping() + try await communicator.stringToProxy("test")!.ice_locatorCacheTimeout(0).ice_ping() count += 2 - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test")!.ice_locatorCacheTimeout(2).ice_ping() // 2s timeout - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test")!.ice_locatorCacheTimeout(2).ice_ping() // 2s timeout + try await test(count == locator.getRequestCount()) try await Task.sleep(for: .milliseconds(1300)) - try communicator.stringToProxy("test")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout + try await communicator.stringToProxy("test")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout count += 2 - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) - try communicator.stringToProxy("test@TestAdapter")!.ice_locatorCacheTimeout(-1).ice_ping() - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test")!.ice_locatorCacheTimeout(-1).ice_ping() - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test@TestAdapter")!.ice_ping() - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test")!.ice_ping() - try test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test@TestAdapter")!.ice_locatorCacheTimeout(-1).ice_ping() + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test")!.ice_locatorCacheTimeout(-1).ice_ping() + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test@TestAdapter")!.ice_ping() + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test")!.ice_ping() + try await test(count == locator.getRequestCount()) try test( communicator.stringToProxy("test")!.ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() @@ -228,25 +228,25 @@ func allTests(_ helper: TestHelper) async throws { output.write("testing proxy from server... ") obj = try makeProxy(communicator: communicator, proxyString: "test@TestAdapter", type: TestIntfPrx.self) - var hello = try obj.getHello()! + var hello = try await obj.getHello()! try test(hello.ice_getAdapterId() == "TestAdapter") - try hello.sayHello() - hello = try obj.getReplicatedHello()! + try await hello.sayHello() + hello = try await obj.getReplicatedHello()! try test(hello.ice_getAdapterId() == "ReplicatedAdapter") - try hello.sayHello() + try await hello.sayHello() output.writeLine("ok") output.write("testing locator request queuing... ") - hello = try obj.getReplicatedHello()!.ice_locatorCacheTimeout(0).ice_connectionCached(false) - count = try locator.getRequestCount() - try hello.ice_ping() + hello = try await obj.getReplicatedHello()!.ice_locatorCacheTimeout(0).ice_connectionCached(false) + count = try await locator.getRequestCount() + try await hello.ice_ping() count += 1 - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) try await withThrowingTaskGroup(of: Void.self) { [hello] taskGroup in for _ in 0..<1000 { taskGroup.addTask { - try await hello.sayHelloAsync() + try await hello.sayHello() } } @@ -254,20 +254,20 @@ func allTests(_ helper: TestHelper) async throws { try await taskGroup.waitForAll() } - try test(locator.getRequestCount() > count && locator.getRequestCount() < count + 999) + try await test(count...count + 1999 ~= locator.getRequestCount()) - if try locator.getRequestCount() > count + 800 { - try output.write("queuing = \(locator.getRequestCount() - count)") + if try await locator.getRequestCount() > count + 800 { + try await output.write("queuing = \(locator.getRequestCount() - count)") } - count = try locator.getRequestCount() + count = try await locator.getRequestCount() hello = hello.ice_adapterId("unknown") try await withThrowingTaskGroup(of: Void.self) { [hello] taskGroup in for _ in 0..<1000 { taskGroup.addTask { do { - try await hello.sayHelloAsync() + try await hello.sayHello() try test(false) } catch is Ice.NotRegisteredException {} } @@ -278,116 +278,116 @@ func allTests(_ helper: TestHelper) async throws { } // TODO: Take into account the retries. - try test(locator.getRequestCount() > count && locator.getRequestCount() < count + 1999) + try await test(count...count + 1999 ~= locator.getRequestCount()) - if try locator.getRequestCount() > count + 800 { - try output.write("queuing = \(locator.getRequestCount() - count)") + if try await locator.getRequestCount() > count + 800 { + try await output.write("queuing = \(locator.getRequestCount() - count)") } output.writeLine("ok") output.write("testing adapter locator cache... ") do { - try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() + try await communicator.stringToProxy("test@TestAdapter3")!.ice_ping() try test(false) } catch let ex as Ice.NotRegisteredException { try test(ex.kindOfObject == "object adapter") try test(ex.id == "TestAdapter3") } - try registry.setAdapterDirectProxy( + try await registry.setAdapterDirectProxy( id: "TestAdapter3", proxy: locator.findAdapterById("TestAdapter")) do { - try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() - try registry.setAdapterDirectProxy( + try await communicator.stringToProxy("test@TestAdapter3")!.ice_ping() + try await registry.setAdapterDirectProxy( id: "TestAdapter3", proxy: communicator.stringToProxy("dummy:\(helper.getTestEndpoint(num: 99))") ) - try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() + try await communicator.stringToProxy("test@TestAdapter3")!.ice_ping() } catch { try test(false) } do { - try communicator.stringToProxy("test@TestAdapter3")!.ice_locatorCacheTimeout(0).ice_ping() + try await communicator.stringToProxy("test@TestAdapter3")!.ice_locatorCacheTimeout(0).ice_ping() try test(false) } catch is Ice.LocalException {} do { - try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() + try await communicator.stringToProxy("test@TestAdapter3")!.ice_ping() try test(false) } catch is Ice.LocalException {} - try registry.setAdapterDirectProxy( + try await registry.setAdapterDirectProxy( id: "TestAdapter3", proxy: locator.findAdapterById("TestAdapter")) do { - try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() + try await communicator.stringToProxy("test@TestAdapter3")!.ice_ping() } catch { try test(false) } output.writeLine("ok") output.write("testing well-known object locator cache... ") - try registry.addObject(communicator.stringToProxy("test3@TestUnknown")) + try await registry.addObject(communicator.stringToProxy("test3@TestUnknown")) do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() try test(false) } catch let ex as Ice.NotRegisteredException { try test(ex.kindOfObject == "object adapter") try test(ex.id == "TestUnknown") } - try registry.addObject(communicator.stringToProxy("test3@TestAdapter4")) // Update - try registry.setAdapterDirectProxy( + try await registry.addObject(communicator.stringToProxy("test3@TestAdapter4")) // Update + try await registry.setAdapterDirectProxy( id: "TestAdapter4", proxy: communicator.stringToProxy("dummy:\(helper.getTestEndpoint(num: 99))")) do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() try test(false) } catch is Ice.LocalException {} - try registry.setAdapterDirectProxy( + try await registry.setAdapterDirectProxy( id: "TestAdapter4", proxy: locator.findAdapterById("TestAdapter")) do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() } catch { try test(false) } - try registry.setAdapterDirectProxy( + try await registry.setAdapterDirectProxy( id: "TestAdapter4", proxy: communicator.stringToProxy("dummy:\(helper.getTestEndpoint(num: 99))")) do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() } catch { try test(false) } do { - try communicator.stringToProxy("test@TestAdapter4")!.ice_locatorCacheTimeout(0).ice_ping() + try await communicator.stringToProxy("test@TestAdapter4")!.ice_locatorCacheTimeout(0).ice_ping() try test(false) } catch is Ice.LocalException {} do { - try communicator.stringToProxy("test@TestAdapter4")!.ice_ping() + try await communicator.stringToProxy("test@TestAdapter4")!.ice_ping() try test(false) } catch is Ice.LocalException {} do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() try test(false) } catch is Ice.LocalException {} - try registry.addObject(communicator.stringToProxy("test3@TestAdapter")) + try await registry.addObject(communicator.stringToProxy("test3@TestAdapter")) do { - try communicator.stringToProxy("test3")!.ice_ping() + try await communicator.stringToProxy("test3")!.ice_ping() } catch { try test(false) } - try registry.addObject(communicator.stringToProxy("test4")) + try await registry.addObject(communicator.stringToProxy("test4")) do { - try communicator.stringToProxy("test4")!.ice_ping() + try await communicator.stringToProxy("test4")!.ice_ping() try test(false) } catch is Ice.NoEndpointException {} output.writeLine("ok") @@ -401,24 +401,24 @@ func allTests(_ helper: TestHelper) async throws { let ic = try helper.initialize(initData) - try registry.setAdapterDirectProxy( + try await registry.setAdapterDirectProxy( id: "TestAdapter5", proxy: locator.findAdapterById("TestAdapter")) - try registry.addObject(communicator.stringToProxy("test3@TestAdapter")) + try await registry.addObject(communicator.stringToProxy("test3@TestAdapter")) - count = try locator.getRequestCount() + count = try await locator.getRequestCount() // No locator cache. - try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(0).ice_ping() - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. + try await ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(0).ice_ping() + try await ic.stringToProxy("test3")!.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. count += 3 - try test(count == locator.getRequestCount()) - try registry.setAdapterDirectProxy(id: "TestAdapter5", proxy: nil) - try registry.addObject(communicator.stringToProxy("test3:" + helper.getTestEndpoint(num: 99))) + try await test(count == locator.getRequestCount()) + try await registry.setAdapterDirectProxy(id: "TestAdapter5", proxy: nil) + try await registry.addObject(communicator.stringToProxy("test3:" + helper.getTestEndpoint(num: 99))) // 10s timeout. - try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(10).ice_ping() - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(10).ice_ping() // 10s timeout. - try test(count == locator.getRequestCount()) + try await ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(10).ice_ping() + try await ic.stringToProxy("test3")!.ice_locatorCacheTimeout(10).ice_ping() // 10s timeout. + try await test(count == locator.getRequestCount()) try await Task.sleep(for: .milliseconds(1200)) // The following request should trigger the background @@ -426,13 +426,13 @@ func allTests(_ helper: TestHelper) async throws { // therefore succeed. // 1s timeout. - try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(1).ice_ping() - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. + try await ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(1).ice_ping() + try await ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. do { while true { // 1s timeout. - try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(1).ice_ping() + try await ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(1).ice_ping() try await Task.sleep(for: .milliseconds(100)) } } catch is Ice.LocalException { @@ -441,7 +441,7 @@ func allTests(_ helper: TestHelper) async throws { do { while true { - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. + try await ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. try await Task.sleep(for: .milliseconds(100)) } } catch is Ice.LocalException { @@ -452,55 +452,55 @@ func allTests(_ helper: TestHelper) async throws { output.writeLine("ok") output.write("testing proxy from server after shutdown... ") - hello = try obj.getReplicatedHello()! - try obj.shutdown() - try manager.startServer() - try hello.sayHello() + hello = try await obj.getReplicatedHello()! + try await obj.shutdown() + try await manager.startServer() + try await hello.sayHello() output.writeLine("ok") output.write("testing object migration... ") hello = try makeProxy(communicator: communicator, proxyString: "hello", type: HelloPrx.self) - try obj.migrateHello() + try await obj.migrateHello() try await hello.ice_getConnection()!.close(.GracefullyWithWait) - try hello.sayHello() - try obj.migrateHello() - try hello.sayHello() - try obj.migrateHello() - try hello.sayHello() + try await hello.sayHello() + try await obj.migrateHello() + try await hello.sayHello() + try await obj.migrateHello() + try await hello.sayHello() output.writeLine("ok") output.write("testing locator encoding resolution... ") hello = try makeProxy(communicator: communicator, proxyString: "hello", type: HelloPrx.self) - count = try locator.getRequestCount() - try communicator.stringToProxy("test@TestAdapter")!.ice_encodingVersion(Ice.Encoding_1_1) + count = try await locator.getRequestCount() + try await communicator.stringToProxy("test@TestAdapter")!.ice_encodingVersion(Ice.Encoding_1_1) .ice_ping() - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test@TestAdapter10")!.ice_encodingVersion(Ice.Encoding_1_0) + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test@TestAdapter10")!.ice_encodingVersion(Ice.Encoding_1_0) .ice_ping() count += 1 - try test(count == locator.getRequestCount()) - try communicator.stringToProxy("test -e 1.0@TestAdapter10-2")!.ice_ping() + try await test(count == locator.getRequestCount()) + try await communicator.stringToProxy("test -e 1.0@TestAdapter10-2")!.ice_ping() count += 1 - try test(count == locator.getRequestCount()) + try await test(count == locator.getRequestCount()) output.writeLine("ok") output.write("shutdown server... ") - try obj.shutdown() + try await obj.shutdown() output.writeLine("ok") output.write("testing whether server is gone... ") do { - try obj2.ice_ping() + try await obj2.ice_ping() try test(false) } catch is Ice.LocalException {} do { - try obj3.ice_ping() + try await obj3.ice_ping() try test(false) } catch is Ice.LocalException {} do { - try obj5.ice_ping() + try await obj5.ice_ping() try test(false) } catch is Ice.LocalException {} output.writeLine("ok") @@ -522,23 +522,23 @@ func allTests(_ helper: TestHelper) async throws { do { let helloPrx = try makeProxy( communicator: communicator, proxyString: "\(communicator.identityToString(ident))", type: HelloPrx.self) - try helloPrx.ice_ping() + try await helloPrx.ice_ping() try test(false) } catch is Ice.NotRegisteredException { // Calls on the well-known proxy are not collocated because of issue #507 } // Ensure that calls on the indirect proxy (with adapter ID) is collocated - var helloPrx = try checkedCast(prx: adapter.createIndirectProxy(ident), type: HelloPrx.self)! + var helloPrx = try await checkedCast(prx: adapter.createIndirectProxy(ident), type: HelloPrx.self)! try await test(helloPrx.ice_getConnection() == nil) // Ensure that calls on the direct proxy is collocated - helloPrx = try checkedCast(prx: adapter.createDirectProxy(ident), type: HelloPrx.self)! + helloPrx = try await checkedCast(prx: adapter.createDirectProxy(ident), type: HelloPrx.self)! try await test(helloPrx.ice_getConnection() == nil) output.writeLine("ok") output.write("shutdown server manager... ") - try manager.shutdown() + try await manager.shutdown() output.writeLine("ok") } diff --git a/swift/test/Ice/middleware/AllTests.swift b/swift/test/Ice/middleware/AllTests.swift index 3d233c48d00..92641849d23 100644 --- a/swift/test/Ice/middleware/AllTests.swift +++ b/swift/test/Ice/middleware/AllTests.swift @@ -3,7 +3,7 @@ import Ice import TestCommon -func allTests(_ helper: TestHelper) throws { +func allTests(_ helper: TestHelper) async throws { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -11,10 +11,10 @@ func allTests(_ helper: TestHelper) throws { let communicator = helper.communicator() let output = helper.getWriter() - try testMiddlewareExecutionOrder(communicator, output) + try await testMiddlewareExecutionOrder(communicator, output) // Verifies the middleware execute in installation order. - func testMiddlewareExecutionOrder(_ communicator: Communicator, _ output: TextWriter) throws { + func testMiddlewareExecutionOrder(_ communicator: Communicator, _ output: TextWriter) async throws { output.write("testing middleware execution order... ") // Arrange @@ -35,7 +35,7 @@ func allTests(_ helper: TestHelper) throws { let p = uncheckedCast(prx: objPrx, type: MyObjectPrx.self) // Act - try p.ice_ping() + try await p.ice_ping() // Assert try test(log.inLog == ["A", "B", "C"]) diff --git a/swift/test/Ice/middleware/Client.swift b/swift/test/Ice/middleware/Client.swift index 8c6c84de105..39cc845eb57 100644 --- a/swift/test/Ice/middleware/Client.swift +++ b/swift/test/Ice/middleware/Client.swift @@ -9,6 +9,6 @@ class Client: TestHelperI { defer { communicator.destroy() } - try allTests(self) + try await allTests(self) } } diff --git a/swift/test/Ice/objects/AllTests.swift b/swift/test/Ice/objects/AllTests.swift index e3dcfee9318..3b53d15afc2 100644 --- a/swift/test/Ice/objects/AllTests.swift +++ b/swift/test/Ice/objects/AllTests.swift @@ -48,24 +48,24 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.writeLine("ok") output.write("testing checked cast... ") - let initial = try checkedCast(prx: base, type: InitialPrx.self)! + let initial = try await checkedCast(prx: base, type: InitialPrx.self)! try test(initial == base) output.writeLine("ok") output.write("getting B1... ") - var b1 = try initial.getB1()! + var b1 = try await initial.getB1()! output.writeLine("ok") output.write("getting B2... ") - let b2 = try initial.getB2()! + let b2 = try await initial.getB2()! output.writeLine("ok") output.write("getting C... ") - let c = try initial.getC()! + let c = try await initial.getC()! output.writeLine("ok") output.write("getting D... ") - let d = try initial.getD()! + let d = try await initial.getD()! output.writeLine("ok") output.write("checking consistency... ") @@ -102,7 +102,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.writeLine("ok") output.write("getting B1, B2, C, and D all at once... ") - let (b1out, b2out, cout, dout) = try initial.getAll() + let (b1out, b2out, cout, dout) = try await initial.getAll() try test(b1out !== nil) try test(b2out !== nil) try test(cout !== nil) @@ -138,24 +138,24 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.writeLine("ok") output.write("getting K... ") - let k = try initial.getK()! + let k = try await initial.getK()! let l = k.value as! L try test(l.data == "l") output.writeLine("ok") output.write("testing Value as parameter... ") do { - let (v3, v2) = try initial.opValue(L(data: "l")) + let (v3, v2) = try await initial.opValue(L(data: "l")) try test((v2 as! L).data == "l") try test((v3 as! L).data == "l") } do { - let (v3, v2) = try initial.opValueSeq([L(data: "l")]) + let (v3, v2) = try await initial.opValueSeq([L(data: "l")]) try test((v2[0] as! L).data == "l") try test((v3[0] as! L).data == "l") } do { - let (v3, v2) = try initial.opValueMap(["l": L(data: "l")]) + let (v3, v2) = try await initial.opValueMap(["l": L(data: "l")]) try test((v2["l"]! as! L).data == "l") try test((v3["l"]! as! L).data == "l") } @@ -168,7 +168,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { a2: A1(name: "a2"), a3: A1(name: "a3"), a4: A1(name: "a4")) - d1 = try initial.getD1(d1)! + d1 = try await initial.getD1(d1)! try test(d1.a1!.name == "a1") try test(d1.a2!.name == "a2") try test(d1.a3!.name == "a3") @@ -178,7 +178,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("throw EDerived... ") do { - try initial.throwEDerived() + try await initial.throwEDerived() try test(false) } catch let ederived as EDerived { try test(ederived.a1!.name == "a1") @@ -190,14 +190,14 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("setting G... ") do { - try initial.setG(G(theS: S(str: "hello"), str: "g")) + try await initial.setG(G(theS: S(str: "hello"), str: "g")) } catch is Ice.OperationNotExistException {} output.writeLine("ok") output.write("testing sequences...") do { - var (retS, outS) = try initial.opBaseSeq([Base]()) - (retS, outS) = try initial.opBaseSeq([Base(theS: S(), str: "")]) + var (retS, outS) = try await initial.opBaseSeq([Base]()) + (retS, outS) = try await initial.opBaseSeq([Base(theS: S(), str: "")]) try test(retS.count == 1 && outS.count == 1) } catch is Ice.OperationNotExistException {} output.writeLine("ok") @@ -209,31 +209,31 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { bottom.v = Recursive() bottom = bottom.v! } - try initial.setRecursive(top) + try await initial.setRecursive(top) // Adding one more level would exceed the max class graph depth bottom.v = Recursive() bottom = bottom.v! do { - try initial.setRecursive(top) + try await initial.setRecursive(top) try test(false) } catch is Ice.UnknownLocalException { // Expected marshal exception from the server(max class graph depth reached) } - try initial.setRecursive(Recursive()) + try await initial.setRecursive(Recursive()) output.writeLine("ok") output.write("testing compact ID...") do { - try test(initial.getCompact() != nil) + try await test(initial.getCompact() != nil) } catch is Ice.OperationNotExistException {} output.writeLine("ok") output.write("testing marshaled results...") - b1 = try initial.getMB()! + b1 = try await initial.getMB()! try test(b1.theB === b1) breakRetainCycleB(b1) - b1 = try await initial.getAMDMBAsync()! + b1 = try await initial.getAMDMB()! try test(b1.theB === b1) breakRetainCycleB(b1) output.writeLine("ok") @@ -243,7 +243,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { base = try communicator.stringToProxy(ref)! let uoet = uncheckedCast(prx: base, type: UnexpectedObjectExceptionTestPrx.self) do { - _ = try uoet.op() + _ = try await uoet.op() try test(false) } catch let ex as Ice.MarshalException { try test(ex.message.contains("::Test::AlsoEmpty")) @@ -258,7 +258,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { do { let k1 = StructKey(i: 1, s: "1") let k2 = StructKey(i: 2, s: "2") - let (m2, m1) = try initial.opM(M(v: [k1: L(data: "one"), k2: L(data: "two")])) + let (m2, m1) = try await initial.opM(M(v: [k1: L(data: "one"), k2: L(data: "two")])) try test(m1!.v.count == 2) try test(m2!.v.count == 2) @@ -272,21 +272,21 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("testing forward declarations... ") do { - let (f11, f12) = try initial.opF1(F1(name: "F11")) + let (f11, f12) = try await initial.opF1(F1(name: "F11")) try test(f11!.name == "F11") try test(f12!.name == "F12") ref = "F21:\(helper.getTestEndpoint(num: 0))" - let (f21, f22) = try initial.opF2( + let (f21, f22) = try await initial.opF2( uncheckedCast( prx: communicator.stringToProxy(ref)!, type: F2Prx.self)) try test(f21!.ice_getIdentity().name == "F21") - try f21!.op() + try await f21!.op() try test(f22!.ice_getIdentity().name == "F22") - if try initial.hasF3() { - let (f31, f32) = try initial.opF3(F3(f1: f11, f2: f21)) + if try await initial.hasF3() { + let (f31, f32) = try await initial.opF3(F3(f1: f11, f2: f21)) try test(f31!.f1!.name == "F11") try test(f31!.f2!.ice_getIdentity().name == "F21") @@ -300,9 +300,9 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { do { let rec = Recursive(v: nil) rec.v = rec - let acceptsCycles = try initial.acceptsClassCycles() + let acceptsCycles = try await initial.acceptsClassCycles() do { - try initial.setCycle(rec) + try await initial.setCycle(rec) try test(acceptsCycles) } catch is Ice.UnknownLocalException { try test(!acceptsCycles) diff --git a/swift/test/Ice/objects/Client.swift b/swift/test/Ice/objects/Client.swift index 22aadd7d2f5..8dbd314dae9 100644 --- a/swift/test/Ice/objects/Client.swift +++ b/swift/test/Ice/objects/Client.swift @@ -21,6 +21,6 @@ public class Client: TestHelperI { try communicator.getValueFactoryManager().add(factory: { _ in FI() }, id: "::Test::F") let initial = try await allTests(self) - try initial.shutdown() + try await initial.shutdown() } } diff --git a/swift/test/Ice/objects/Collocated.swift b/swift/test/Ice/objects/Collocated.swift index 139de4b85e9..a995815c01e 100644 --- a/swift/test/Ice/objects/Collocated.swift +++ b/swift/test/Ice/objects/Collocated.swift @@ -35,6 +35,6 @@ class Collocated: TestHelperI { let initial = try await allTests(self) // We must call shutdown even in the collocated case for cyclic dependency cleanup - try initial.shutdown() + try await initial.shutdown() } } diff --git a/swift/test/Ice/operations/AllTests.swift b/swift/test/Ice/operations/AllTests.swift index 673e4b77c9b..cab860889c2 100644 --- a/swift/test/Ice/operations/AllTests.swift +++ b/swift/test/Ice/operations/AllTests.swift @@ -12,29 +12,18 @@ func allTests(helper: TestHelper) async throws -> MyClassPrx { let communicator = helper.communicator() let baseProxy = try communicator.stringToProxy("test:\(helper.getTestEndpoint(num: 0))")! - let cl = try checkedCast(prx: baseProxy, type: MyClassPrx.self)! - let derivedProxy = try checkedCast(prx: cl, type: MyDerivedClassPrx.self)! + let cl = try await checkedCast(prx: baseProxy, type: MyClassPrx.self)! + let derivedProxy = try await checkedCast(prx: cl, type: MyDerivedClassPrx.self)! output.write("testing twoway operations... ") try await twoways(helper, cl) try await twoways(helper, derivedProxy) - try derivedProxy.opDerived() + try await derivedProxy.opDerived() output.writeLine("ok") output.write("testing oneway operations... ") - try oneways(helper, cl) - try oneways(helper, derivedProxy) - output.writeLine("ok") - - output.write("testing twoway operations with AMI... ") - try await twowaysAMI(helper, cl) - try await twowaysAMI(helper, derivedProxy) - try derivedProxy.opDerived() - output.writeLine("ok") - - output.write("testing oneway operations with AMI... ") - try await onewaysAMI(helper, cl) - try await onewaysAMI(helper, derivedProxy) + try await oneways(helper, cl) + try await oneways(helper, derivedProxy) output.writeLine("ok") output.write("testing batch oneway operations... ") @@ -42,10 +31,5 @@ func allTests(helper: TestHelper) async throws -> MyClassPrx { try await batchOneways(helper, derivedProxy) output.writeLine("ok") - output.write("testing batch oneway operations with AMI... ") - try await batchOneways(helper, cl) - try await batchOneways(helper, derivedProxy) - output.writeLine("ok") - return cl } diff --git a/swift/test/Ice/operations/BatchOneways.swift b/swift/test/Ice/operations/BatchOneways.swift index f7efffb5b05..e39f09e667e 100644 --- a/swift/test/Ice/operations/BatchOneways.swift +++ b/swift/test/Ice/operations/BatchOneways.swift @@ -13,11 +13,11 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let batch = p.ice_batchOneway() try await batch.ice_flushBatchRequests() // Empty flush - _ = try p.opByteSOnewayCallCount() // Reset the call count + _ = try await p.opByteSOnewayCallCount() // Reset the call count for _ in 0..<30 { do { - try batch.opByteSOneway(bs1) + try await batch.opByteSOneway(bs1) } catch is Ice.MarshalException { try test(false) } @@ -25,7 +25,7 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) async throws { var count: Int32 = 0 while count < 27 { // 3 * 9 requests auto-flushed. - count += try p.opByteSOnewayCallCount() + count += try await p.opByteSOnewayCallCount() usleep(100) } @@ -34,39 +34,39 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let batch1 = p.ice_batchOneway() let batch2 = p.ice_batchOneway() - try batch1.ice_ping() - try batch2.ice_ping() + try await batch1.ice_ping() + try await batch2.ice_ping() try await batch1.ice_flushBatchRequests() try await batch1.ice_getConnection()!.close(Ice.ConnectionClose.GracefullyWithWait) - try batch1.ice_ping() - try batch2.ice_ping() + try await batch1.ice_ping() + try await batch2.ice_ping() _ = try await batch1.ice_getConnection() _ = try await batch2.ice_getConnection() - try batch1.ice_ping() + try await batch1.ice_ping() try await batch1.ice_getConnection()!.close(Ice.ConnectionClose.GracefullyWithWait) - try batch1.ice_ping() - try batch2.ice_ping() + try await batch1.ice_ping() + try await batch2.ice_ping() } var identity = Ice.Identity() identity.name = "invalid" let batch3 = batch.ice_identity(identity) - try batch3.ice_ping() + try await batch3.ice_ping() try await batch3.ice_flushBatchRequests() // Make sure that a bogus batch request doesn't cause troubles to other ones. - try batch3.ice_ping() - try batch.ice_ping() + try await batch3.ice_ping() + try await batch.ice_ping() try await batch.ice_flushBatchRequests() - try batch.ice_ping() + try await batch.ice_ping() - try p.ice_ping() + try await p.ice_ping() var supportsCompress = true do { - supportsCompress = try p.supportsCompress() + supportsCompress = try await p.supportsCompress() } catch is Ice.OperationNotExistException {} conn = try await p.ice_getConnection() @@ -80,29 +80,29 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let batchC2 = uncheckedCast(prx: prx.ice_compress(true), type: MyClassPrx.self) let batchC3 = uncheckedCast(prx: prx.ice_identity(identity), type: MyClassPrx.self) - try batchC1.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) try await batchC1.ice_getConnection()!.flushBatchRequests(Ice.CompressBatch.Yes) - try batchC2.opByteSOneway(bs1) - try batchC2.opByteSOneway(bs1) - try batchC2.opByteSOneway(bs1) + try await batchC2.opByteSOneway(bs1) + try await batchC2.opByteSOneway(bs1) + try await batchC2.opByteSOneway(bs1) try await batchC1.ice_getConnection()!.flushBatchRequests(Ice.CompressBatch.No) - try batchC1.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) try await batchC1.ice_getConnection()!.flushBatchRequests(Ice.CompressBatch.BasedOnProxy) - try batchC1.opByteSOneway(bs1) - try batchC2.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC2.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) try await batchC1.ice_getConnection()!.flushBatchRequests(Ice.CompressBatch.BasedOnProxy) - try batchC1.opByteSOneway(bs1) - try batchC3.opByteSOneway(bs1) - try batchC1.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) + try await batchC3.opByteSOneway(bs1) + try await batchC1.opByteSOneway(bs1) try await batchC1.ice_getConnection()!.flushBatchRequests(Ice.CompressBatch.BasedOnProxy) } } diff --git a/swift/test/Ice/operations/BatchOnewaysAMI.swift b/swift/test/Ice/operations/BatchOnewaysAMI.swift deleted file mode 100644 index 4d75bff920c..00000000000 --- a/swift/test/Ice/operations/BatchOnewaysAMI.swift +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) ZeroC, Inc. - -import Darwin -import Ice -import TestCommon - -func batchOnewaysAMI(_ helper: TestHelper, _ p: MyClassPrx) async throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { - try helper.test(value, file: file, line: line) - } - - let bs1 = ByteSeq(repeating: 0, count: 10 * 1024) - let batch = p.ice_batchOneway() - - try await batch.ice_flushBatchRequests() - - for _ in 0..<30 { - async let _ = try batch.opByteSOnewayAsync(bs1) - } - - var count: Int32 = 0 - while count < 27 { // 3 * 9 requests auto-flushed. - count += try p.opByteSOnewayCallCount() - usleep(100) - } - - let conn = try await batch.ice_getConnection() - if conn != nil { - let batch1 = uncheckedCast(prx: p.ice_batchOneway(), type: MyClassPrx.self) - let batch2 = uncheckedCast(prx: p.ice_batchOneway(), type: MyClassPrx.self) - - async let _ = try batch1.ice_pingAsync() - async let _ = try batch2.ice_pingAsync() - try await batch1.ice_flushBatchRequests() - try await batch1.ice_getConnection()!.close(Ice.ConnectionClose.GracefullyWithWait) - async let _ = try batch1.ice_pingAsync() - async let _ = try batch2.ice_pingAsync() - - _ = try await batch1.ice_getConnection() - _ = try await batch2.ice_getConnection() - - async let _ = try batch1.ice_pingAsync() - try await batch1.ice_getConnection()!.close(Ice.ConnectionClose.GracefullyWithWait) - - async let _ = try batch1.ice_pingAsync() - async let _ = try batch2.ice_pingAsync() - } - - let batch3 = batch.ice_identity(Ice.Identity(name: "invalid", category: "")) - async let _ = try batch3.ice_pingAsync() - try await batch3.ice_flushBatchRequests() - - // Make sure that a bogus batch request doesn't cause troubles to other ones. - async let _ = try batch3.ice_pingAsync() - async let _ = try batch.ice_pingAsync() - try await batch.ice_flushBatchRequests() - async let _ = try batch.ice_pingAsync() -} diff --git a/swift/test/Ice/operations/Client.swift b/swift/test/Ice/operations/Client.swift index d301c549429..25f7bcec15b 100644 --- a/swift/test/Ice/operations/Client.swift +++ b/swift/test/Ice/operations/Client.swift @@ -17,6 +17,6 @@ public class Client: TestHelperI { communicator.destroy() } let cl = try await allTests(helper: self) - try cl.shutdown() + try await cl.shutdown() } } diff --git a/swift/test/Ice/operations/Oneways.swift b/swift/test/Ice/operations/Oneways.swift index cf474c880c4..c858d70566b 100644 --- a/swift/test/Ice/operations/Oneways.swift +++ b/swift/test/Ice/operations/Oneways.swift @@ -3,15 +3,15 @@ import Ice import TestCommon -func oneways(_ helper: TestHelper, _ prx: MyClassPrx) throws { +func oneways(_ helper: TestHelper, _ prx: MyClassPrx) async throws { let p = prx.ice_oneway() - try p.ice_ping() - try p.opVoid() - try p.opIdempotent() + try await p.ice_ping() + try await p.opVoid() + try await p.opIdempotent() do { - _ = try p.opByte(p1: 0xFF, p2: 0x0F) + _ = try await p.opByte(p1: 0xFF, p2: 0x0F) try helper.test(false) } catch is Ice.TwowayOnlyException {} } diff --git a/swift/test/Ice/operations/OnewaysAMI.swift b/swift/test/Ice/operations/OnewaysAMI.swift deleted file mode 100644 index 18f12d27d0f..00000000000 --- a/swift/test/Ice/operations/OnewaysAMI.swift +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) ZeroC, Inc. - -import Foundation -import Ice -import TestCommon - -func onewaysAMI(_ helper: TestHelper, _ proxy: MyClassPrx) async throws { - let p = uncheckedCast(prx: proxy.ice_oneway(), type: MyClassPrx.self) - - // - // NOTE: Oneway operations are completed when the request is sent - // - try await p.opVoidAsync() - - do { - let _ = try await p.ice_isAAsync(id: ice_staticId(MyClassPrx.self)) - try helper.test(false) - } catch is Ice.TwowayOnlyException {} - - do { - let _ = try await p.ice_idsAsync() - try helper.test(false) - } catch is Ice.TwowayOnlyException {} - - try await p.opVoidAsync() - - try await p.opIdempotentAsync() - - do { - let _ = try await p.opByteAsync(p1: 0xFF, p2: 0x0F) - try helper.test(false) - } catch is Ice.TwowayOnlyException {} - -} diff --git a/swift/test/Ice/operations/Twoways.swift b/swift/test/Ice/operations/Twoways.swift index 6db0db1e378..b0138dc7e4b 100644 --- a/swift/test/Ice/operations/Twoways.swift +++ b/swift/test/Ice/operations/Twoways.swift @@ -11,7 +11,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let communicator = helper.communicator() - let literals = try p.opStringLiterals() + let literals = try await p.opStringLiterals() try test(s0 == "\\" && s0 == sw0 && s0 == literals[0] && s0 == literals[11]) @@ -48,16 +48,16 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { try test( su0 == su1 && su0 == su2 && su0 == literals[28] && su0 == literals[29] && su0 == literals[30]) - try p.ice_ping() + try await p.ice_ping() try test(ice_staticId(MyClassPrx.self) == "::Test::MyClass") try test(ice_staticId(Ice.ObjectPrx.self) == "::Ice::Object") - try test(p.ice_isA(id: ice_staticId(MyClassPrx.self))) - try test(p.ice_id() == ice_staticId(MyDerivedClassPrx.self)) + try await test(p.ice_isA(id: ice_staticId(MyClassPrx.self))) + try await test(p.ice_id() == ice_staticId(MyDerivedClassPrx.self)) do { - let ids = try p.ice_ids() + let ids = try await p.ice_ids() try test(ids.count == 3) try test(ids[0] == "::Ice::Object") try test(ids[1] == "::Test::MyClass") @@ -65,35 +65,35 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { } do { - try p.opVoid() + try await p.opVoid() } do { - let (r, b) = try p.opByte(p1: 0xFF, p2: 0x0F) + let (r, b) = try await p.opByte(p1: 0xFF, p2: 0x0F) try test(b == 0xF0) try test(r == 0xFF) } do { - let (r, b) = try p.opBool(p1: true, p2: false) + let (r, b) = try await p.opBool(p1: true, p2: false) try test(b) try test(!r) } do { - var (r, s, i, l) = try p.opShortIntLong(p1: 10, p2: 11, p3: 12) + var (r, s, i, l) = try await p.opShortIntLong(p1: 10, p2: 11, p3: 12) try test(s == 10) try test(i == 11) try test(l == 12) try test(r == 12) - (r, s, i, l) = try p.opShortIntLong(p1: Int16.min, p2: Int32.min, p3: Int64.min) + (r, s, i, l) = try await p.opShortIntLong(p1: Int16.min, p2: Int32.min, p3: Int64.min) try test(s == Int16.min) try test(i == Int32.min) try test(l == Int64.min) try test(r == Int64.min) - (r, s, i, l) = try p.opShortIntLong(p1: Int16.max, p2: Int32.max, p3: Int64.max) + (r, s, i, l) = try await p.opShortIntLong(p1: Int16.max, p2: Int32.max, p3: Int64.max) try test(s == Int16.max) try test(i == Int32.max) try test(l == Int64.max) @@ -101,17 +101,17 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { } do { - var (r, f, d) = try p.opFloatDouble(p1: 3.14, p2: 1.1e10) + var (r, f, d) = try await p.opFloatDouble(p1: 3.14, p2: 1.1e10) try test(f == 3.14) try test(d == 1.1e10) try test(r == 1.1e10) - (r, f, d) = try p.opFloatDouble(p1: Float.ulpOfOne, p2: Double.leastNormalMagnitude) + (r, f, d) = try await p.opFloatDouble(p1: Float.ulpOfOne, p2: Double.leastNormalMagnitude) try test(f == Float.ulpOfOne) try test(d == Double.leastNormalMagnitude) try test(r == Double.leastNormalMagnitude) - (r, f, d) = try p.opFloatDouble( + (r, f, d) = try await p.opFloatDouble( p1: Float.greatestFiniteMagnitude, p2: Double.greatestFiniteMagnitude) try test(f == Float.greatestFiniteMagnitude) try test(d == Double.greatestFiniteMagnitude) @@ -119,35 +119,35 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { } do { - let (r, s) = try p.opString(p1: "hello", p2: "world") + let (r, s) = try await p.opString(p1: "hello", p2: "world") try test(s == "world hello") try test(r == "hello world") } do { - let (r, e) = try p.opMyEnum(MyEnum.enum2) + let (r, e) = try await p.opMyEnum(MyEnum.enum2) try test(e == MyEnum.enum2) try test(r == MyEnum.enum3) } do { - var (r, c1, c2) = try p.opMyClass(p) + var (r, c1, c2) = try await p.opMyClass(p) try test(c1!.ice_getIdentity() == Ice.stringToIdentity("test")) try test(c2!.ice_getIdentity() == Ice.stringToIdentity("noSuchIdentity")) try test(r!.ice_getIdentity() == Ice.stringToIdentity("test")) - try r!.opVoid() - try c1!.opVoid() + try await r!.opVoid() + try await c1!.opVoid() do { - try c2!.opVoid() + try await c2!.opVoid() try test(false) } catch is Ice.ObjectNotExistException {} - (r, c1, c2) = try p.opMyClass(nil) + (r, c1, c2) = try await p.opMyClass(nil) try test(c1 == nil) try test(c2 != nil) - try r!.opVoid() + try await r!.opVoid() } do { @@ -162,21 +162,21 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { si2.s = AnotherStruct() si2.s.s = "def" - let (rso, so) = try p.opStruct(p1: si1, p2: si2) + let (rso, so) = try await p.opStruct(p1: si1, p2: si2) try test(rso.p == nil) try test(rso.e == MyEnum.enum2) try test(rso.s.s == "def") try test(so.p == p) try test(so.e == MyEnum.enum3) try test(so.s.s == "a new string") - try so.p!.opVoid() + try await so.p!.opVoid() } do { let bsi1 = ByteSeq([0x01, 0x11, 0x12, 0x22]) let bsi2 = ByteSeq([0xF1, 0xF2, 0xF3, 0xF4]) - let (rso, bso) = try p.opByteS(p1: bsi1, p2: bsi2) + let (rso, bso) = try await p.opByteS(p1: bsi1, p2: bsi2) try test(bso.count == 4) try test(bso[0] == 0x22) try test(bso[1] == 0x12) @@ -197,7 +197,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let bsi1: [Bool] = [true, true, false] let bsi2 = [false] - let (rso, bso) = try p.opBoolS(p1: bsi1, p2: bsi2) + let (rso, bso) = try await p.opBoolS(p1: bsi1, p2: bsi2) try test(bso.count == 4) try test(bso[0]) try test(bso[1]) @@ -214,7 +214,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let isi: [Int32] = [5, 6, 7, 8] let lsi: [Int64] = [10, 30, 20] - let (rso, sso, iso, lso) = try p.opShortIntLongS(p1: ssi, p2: isi, p3: lsi) + let (rso, sso, iso, lso) = try await p.opShortIntLongS(p1: ssi, p2: isi, p3: lsi) try test(sso.count == 3) try test(sso[0] == 1) try test(sso[1] == 2) @@ -241,7 +241,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let fsi: [Float] = [3.14, 1.11] let dsi: [Double] = [1.1e10, 1.2e10, 1.3e10] - let (rso, fso, dso) = try p.opFloatDoubleS(p1: fsi, p2: dsi) + let (rso, fso, dso) = try await p.opFloatDoubleS(p1: fsi, p2: dsi) try test(fso.count == 2) try test(fso[0] == 3.14) try test(fso[1] == 1.11) @@ -261,7 +261,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let ssi1 = ["abc", "de", "fghi"] let ssi2 = ["xyz"] - let (rso, sso) = try p.opStringS(p1: ssi1, p2: ssi2) + let (rso, sso) = try await p.opStringS(p1: ssi1, p2: ssi2) try test(sso.count == 4) try test(sso[0] == "abc") try test(sso[1] == "de") @@ -282,7 +282,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let s22 = ByteSeq([0xF2, 0xF1]) let bsi2 = [s21, s22] - let (rso, bso) = try p.opByteSS(p1: bsi1, p2: bsi2) + let (rso, bso) = try await p.opByteSS(p1: bsi1, p2: bsi2) try test(bso.count == 2) try test(bso[0].count == 1) try test(bso[0][0] == 0xFF) @@ -313,7 +313,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let s21 = [false, false, true] let bsi2 = [s21] - let (rso, bso) = try p.opBoolSS(p1: bsi1, p2: bsi2) + let (rso, bso) = try await p.opBoolSS(p1: bsi1, p2: bsi2) try test(bso.count == 4) try test(bso[0].count == 1) try test(bso[0][0]) @@ -349,7 +349,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let l11: [Int64] = [496, 1729] let lsi = [l11] - let (rso, sso, iso, lso) = try p.opShortIntLongSS(p1: ssi, p2: isi, p3: lsi) + let (rso, sso, iso, lso) = try await p.opShortIntLongSS(p1: ssi, p2: isi, p3: lsi) try test(rso.count == 1) try test(rso[0].count == 2) @@ -387,7 +387,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let d11: [Double] = [1.1e10, 1.2e10, 1.3e10] let dsi = [d11] - let (rso, fso, dso) = try p.opFloatDoubleSS(p1: fsi, p2: dsi) + let (rso, fso, dso) = try await p.opFloatDoubleSS(p1: fsi, p2: dsi) try test(fso.count == 3) try test(fso[0].count == 1) try test(fso[0][0] == 3.14) @@ -420,7 +420,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let s23 = ["xyz"] let ssi2 = [s21, s22, s23] - let (rso, sso) = try p.opStringSS(p1: ssi1, p2: ssi2) + let (rso, sso) = try await p.opStringSS(p1: ssi1, p2: ssi2) try test(sso.count == 5) try test(sso[0].count == 1) try test(sso[0][0] == "abc") @@ -454,7 +454,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let ss23 = [[String]]() let sssi2 = [ss21, ss22, ss23] - let (rsso, ssso) = try p.opStringSSS(p1: sssi1, p2: sssi2) + let (rsso, ssso) = try await p.opStringSSS(p1: sssi1, p2: sssi2) try test(ssso.count == 5) try test(ssso[0].count == 2) try test(ssso[0][0].count == 2) @@ -492,7 +492,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1: [UInt8: Bool] = [10: true, 100: false] let di2: [UInt8: Bool] = [10: true, 11: false, 101: true] - let (ro, `do`) = try p.opByteBoolD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opByteBoolD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -505,7 +505,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1: [Int16: Int32] = [110: -1, 1100: 123_123] let di2: [Int16: Int32] = [110: -1, 111: -100, 1101: 0] - let (ro, `do`) = try p.opShortIntD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opShortIntD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -518,7 +518,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1: [Int64: Float] = [999_999_110: -1.1, 999_999_111: 123_123.2] let di2: [Int64: Float] = [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5] - let (ro, `do`) = try p.opLongFloatD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opLongFloatD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -531,7 +531,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1 = ["foo": "abc -1.1", "bar": "abc 123123.2"] let di2 = ["foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"] - let (ro, `do`) = try p.opStringStringD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opStringStringD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -544,7 +544,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1 = ["abc": MyEnum.enum1, "": MyEnum.enum2] let di2 = ["abc": MyEnum.enum1, "qwerty": MyEnum.enum3, "Hello!!": MyEnum.enum2] - let (ro, `do`) = try p.opStringMyEnumD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opStringMyEnumD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -557,7 +557,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { do { let di1 = [MyEnum.enum1: "abc"] let di2 = [MyEnum.enum2: "Hello!!", MyEnum.enum3: "qwerty"] - let (ro, `do`) = try p.opMyEnumStringD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opMyEnumStringD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 3) @@ -575,7 +575,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let s23 = MyStruct(i: 2, j: 3) let di2 = [s11: MyEnum.enum1, s22: MyEnum.enum3, s23: MyEnum.enum2] - let (ro, `do`) = try p.opMyStructMyEnumD(p1: di1, p2: di2) + let (ro, `do`) = try await p.opMyStructMyEnumD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) @@ -593,7 +593,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opByteBoolDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opByteBoolDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -625,7 +625,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opShortIntDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opShortIntDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -656,7 +656,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opLongFloatDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opLongFloatDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -687,7 +687,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opStringStringDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opStringStringDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -718,7 +718,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opStringMyEnumDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opStringMyEnumDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -749,7 +749,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opMyEnumStringDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opMyEnumStringDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 2) @@ -782,7 +782,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let dsi1 = [di1, di2] let dsi2 = [di3] - let (ro, `do`) = try p.opMyStructMyEnumDS(p1: dsi1, p2: dsi2) + let (ro, `do`) = try await p.opMyStructMyEnumDS(p1: dsi1, p2: dsi2) try test(ro.count == 2) try test(ro[0].count == 3) @@ -813,7 +813,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1: [UInt8: ByteSeq] = [0x01: si1, 0x22: si2] let sdi2: [UInt8: ByteSeq] = [0xF1: si3] - let (ro, `do`) = try p.opByteByteSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opByteByteSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[0xF1]!.count == 2) @@ -838,7 +838,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1 = [false: si1, true: si2] let sdi2 = [false: si1] - let (ro, `do`) = try p.opBoolBoolSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opBoolBoolSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[false]!.count == 2) @@ -862,7 +862,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1: [Int16: [Int16]] = [1: si1, 2: si2] let sdi2: [Int16: [Int16]] = [4: si3] - let (ro, `do`) = try p.opShortShortSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opShortShortSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[4]!.count == 2) @@ -890,7 +890,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1: [Int32: [Int32]] = [100: si1, 200: si2] let sdi2: [Int32: [Int32]] = [400: si3] - let (ro, `do`) = try p.opIntIntSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opIntIntSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[400]!.count == 2) @@ -918,7 +918,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1: [Int64: [Int64]] = [999_999_990: si1, 999_999_991: si2] let sdi2: [Int64: [Int64]] = [999_999_992: si3] - let (ro, `do`) = try p.opLongLongSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opLongLongSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[999_999_992]!.count == 2) @@ -945,7 +945,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1 = ["abc": si1, "ABC": si2] let sdi2 = ["aBc": si3] - let (ro, `do`) = try p.opStringFloatSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opStringFloatSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`["aBc"]!.count == 2) @@ -973,7 +973,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1 = ["Hello!!": si1, "Goodbye": si2] let sdi2 = ["": si3] - let (ro, `do`) = try p.opStringDoubleSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opStringDoubleSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[""]!.count == 2) @@ -1000,7 +1000,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1 = ["abc": si1, "def": si2] let sdi2 = ["ghi": si3] - let (ro, `do`) = try p.opStringStringSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opStringStringSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`["ghi"]!.count == 2) @@ -1028,7 +1028,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { let sdi1 = [MyEnum.enum3: si1, MyEnum.enum2: si2] let sdi2 = [MyEnum.enum1: si3] - let (ro, `do`) = try p.opMyEnumMyEnumSD(p1: sdi1, p2: sdi2) + let (ro, `do`) = try await p.opMyEnumMyEnumSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) try test(`do`[MyEnum.enum1]!.count == 2) @@ -1056,7 +1056,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx) async throws { s.append(i) } - let r = try p.opIntS(s) + let r = try await p.opIntS(s) try test(r.count == lengths[l]) for j in 0.. InitialPrx { output.writeLine("ok") output.write("testing checked cast... ") - let initial = try checkedCast(prx: base, type: InitialPrx.self)! + let initial = try await checkedCast(prx: base, type: InitialPrx.self)! try test(initial == base) output.writeLine("ok") @@ -285,19 +285,19 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("testing marshaling... ") - if let oo4 = try initial.pingPong(OneOptional()) as? OneOptional { + if let oo4 = try await initial.pingPong(OneOptional()) as? OneOptional { try test(oo4.a == nil) } else { try test(false) } - if let oo5 = try initial.pingPong(oo1) as? OneOptional { + if let oo5 = try await initial.pingPong(oo1) as? OneOptional { try test(oo1.a == oo5.a) } else { try test(false) } - if let mo4 = try initial.pingPong(MultiOptional()) as? MultiOptional { + if let mo4 = try await initial.pingPong(MultiOptional()) as? MultiOptional { try test(mo4.a == nil) try test(mo4.b == nil) try test(mo4.c == nil) @@ -336,7 +336,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { let mo6 = MultiOptional() let mo8 = MultiOptional() - if let mo5 = try initial.pingPong(mo1) as? MultiOptional { + if let mo5 = try await initial.pingPong(mo1) as? MultiOptional { try test(mo5.a == mo1.a) try test(mo5.b == mo1.b) try test(mo5.c == mo1.c) @@ -401,7 +401,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { try test(false) } - if let mo7 = try initial.pingPong(mo6) as? MultiOptional { + if let mo7 = try await initial.pingPong(mo6) as? MultiOptional { try test(mo7.a == nil) try test(mo7.b == mo1.b) try test(mo7.c == nil) @@ -436,7 +436,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { try test(false) } - if let mo9 = try initial.pingPong(mo8) as? MultiOptional { + if let mo9 = try await initial.pingPong(mo8) as? MultiOptional { try test(mo9.a == mo1.a) try test(mo9.b == nil) try test(mo9.c == mo1.c) @@ -473,7 +473,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { do { let owc1 = OptionalWithCustom() owc1.l = [SmallStruct(m: 5), SmallStruct(m: 6), SmallStruct(m: 7)] - if let owc2 = try initial.pingPong(owc1) as? OptionalWithCustom { + if let owc2 = try await initial.pingPong(owc1) as? OptionalWithCustom { try test(owc2.l != nil) try test(owc1.l == owc2.l) } else { @@ -493,7 +493,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(oo1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "pingPong", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) @@ -514,7 +514,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(mo1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "pingPong", mode: .Normal, inEncaps: inEncaps) @@ -534,13 +534,13 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { g.gg2 = G2(a: 10) g.gg2Opt = G2(a: 20) g.gg1 = G1(a: "gg1") - g = try initial.opG(g) + g = try await initial.opG(g) try test(g.gg1Opt!.a == "gg1Opt") try test(g.gg2.a == 10) try test(g.gg2Opt!.a == 20) try test(g.gg1.a == "gg1") - try initial.opVoid() + try await initial.opVoid() let ostr = OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -550,7 +550,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write("test") ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opVoid", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opVoid", mode: .Normal, inEncaps: inEncaps) try test(result.ok) } output.writeLine("ok") @@ -568,7 +568,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { mc.ifsd![i] = FixedStruct() } - mc = try initial.pingPong(mc) as! MultiOptional + mc = try await initial.pingPong(mc) as! MultiOptional try test(mc.bs?.count == 1000) try test(mc.shs?.count == 300) try test(mc.fss?.count == 300) @@ -580,7 +580,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(mc) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) try test(result.ok) let istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -595,7 +595,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("testing tag marshaling... ") do { let b = B() - var b2 = try initial.pingPong(b) as! B + var b2 = try await initial.pingPong(b) as! B try test(b2.ma == nil) try test(b2.mb == nil) try test(b2.mc == nil) @@ -605,7 +605,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { b.mc = 12 b.md = 13 - b2 = try initial.pingPong(b) as! B + b2 = try await initial.pingPong(b) as! B try test(b2.ma! == 10) try test(b2.mb! == 11) try test(b2.mc! == 12) @@ -617,7 +617,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(b) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) try test(result.ok) let istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -636,7 +636,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { f.fsf = FixedStruct() f.fse = f.fsf! - var rf = try initial.pingPong(f) as! F + var rf = try await initial.pingPong(f) as! F try test(rf.fse == rf.fsf) factory.setEnabled(enabled: true) @@ -658,12 +658,12 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("testing optional with default values... ") do { - var wd = try initial.pingPong(WD()) as! WD + var wd = try await initial.pingPong(WD()) as! WD try test(wd.a == 5) try test(wd.s == "test") wd.a = nil wd.s = nil - wd = try initial.pingPong(wd) as! WD + wd = try await initial.pingPong(wd) as! WD try test(wd.a == nil) try test(wd.s == nil) } @@ -681,7 +681,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.endEncapsulation() var inEncaps = ostr.finished() factory.setEnabled(enabled: true) - var result = try initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) + var result = try await initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) try test(result.ok) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -698,7 +698,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(d) ostr.endEncapsulation() inEncaps = ostr.finished() - result = try initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) + result = try await initial.ice_invoke(operation: "pingPong", mode: .Normal, inEncaps: inEncaps) try test(result.ok) istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -722,7 +722,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 1, value: ovs) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opClassAndUnknownOptional", mode: .Normal, inEncaps: inEncaps) @@ -741,35 +741,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: UInt8? var p3: UInt8? - (p2, p3) = try initial.opByte(p1) + (p2, p3) = try await initial.opByte(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opByte(nil) + (p2, p3) = try await initial.opByte(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opByte() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opByteAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opByteAsync() + (p2, p3) = try await initial.opByte() try test(p2 == nil && p3 == nil) p1 = 56 - (p2, p3) = try initial.opByte(p1) + (p2, p3) = try await initial.opByte(p1) try test(p2 == 56 && p3 == 56) - (p2, p3) = try await initial.opByteAsync(p1) + (p2, p3) = try await initial.opByte(56) try test(p2 == 56 && p3 == 56) - (p2, p3) = try initial.opByte(56) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try await initial.opByteAsync(56) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try initial.opByte(nil) + (p2, p3) = try await initial.opByte(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -777,7 +765,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opByte", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opByte", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .F1)) @@ -796,35 +784,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p3: Bool? var p2: Bool? - (p2, p3) = try initial.opBool(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opBool(nil) + (p2, p3) = try await initial.opBool(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opBool() + (p2, p3) = try await initial.opBool(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opBoolAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opBoolAsync() + (p2, p3) = try await initial.opBool() try test(p2 == nil && p3 == nil) p1 = true - (p2, p3) = try initial.opBool(p1) - try test(p2 == true && p3 == true) - - (p2, p3) = try await initial.opBoolAsync(p1) - try test(p2 == true && p3 == true) - - (p2, p3) = try initial.opBool(true) + (p2, p3) = try await initial.opBool(p1) try test(p2 == true && p3 == true) - (p2, p3) = try await initial.opBoolAsync(true) + (p2, p3) = try await initial.opBool(true) try test(p2 == true && p3 == true) - (p2, p3) = try initial.opBool(nil) + (p2, p3) = try await initial.opBool(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -832,7 +808,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opBool", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opBool", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .F1)) @@ -851,35 +827,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: Int16? var p3: Int16? - (p2, p3) = try initial.opShort(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opShort(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opShort() + (p2, p3) = try await initial.opShort(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opShortAsync(nil) + (p2, p3) = try await initial.opShort(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opShortAsync() + (p2, p3) = try await initial.opShort() try test(p2 == nil && p3 == nil) p1 = 56 - (p2, p3) = try initial.opShort(p1) + (p2, p3) = try await initial.opShort(p1) try test(p2 == 56 && p3 == 56) - (p2, p3) = try await initial.opShortAsync(p1) + (p2, p3) = try await initial.opShort(p1) try test(p2 == 56 && p3 == 56) - (p2, p3) = try initial.opShort(p1) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try await initial.opShortAsync(p1) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try initial.opShort(nil) + (p2, p3) = try await initial.opShort(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -887,7 +851,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opShort", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opShort", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .F2)) @@ -906,35 +870,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: Int32? var p3: Int32? - (p2, p3) = try initial.opInt(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opInt(nil) + (p2, p3) = try await initial.opInt(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opInt() + (p2, p3) = try await initial.opInt(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opIntAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opIntAsync() + (p2, p3) = try await initial.opInt() try test(p2 == nil && p3 == nil) p1 = 56 - (p2, p3) = try initial.opInt(p1) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try await initial.opIntAsync(p1) + (p2, p3) = try await initial.opInt(p1) try test(p2 == 56 && p3 == 56) - (p2, p3) = try initial.opInt(56) + (p2, p3) = try await initial.opInt(56) try test(p2 == 56 && p3 == 56) - (p2, p3) = try await initial.opIntAsync(56) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try initial.opInt(nil) + (p2, p3) = try await initial.opInt(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -942,7 +894,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opInt", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -962,35 +914,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: Int64? var p3: Int64? - (p2, p3) = try initial.opLong(p1) + (p2, p3) = try await initial.opLong(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opLong(nil) + (p2, p3) = try await initial.opLong(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opLong() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opLongAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opLongAsync() + (p2, p3) = try await initial.opLong() try test(p2 == nil && p3 == nil) p1 = 56 - (p2, p3) = try initial.opLong(p1) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try await initial.opLongAsync(p1) - try test(p2 == 56 && p3 == 56) - - (p2, p3) = try initial.opLong(56) + (p2, p3) = try await initial.opLong(p1) try test(p2 == 56 && p3 == 56) - (p2, p3) = try await initial.opLongAsync(56) + (p2, p3) = try await initial.opLong(56) try test(p2 == 56 && p3 == 56) - (p2, p3) = try initial.opLong(nil) + (p2, p3) = try await initial.opLong(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -998,7 +938,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 1, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opLong", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opLong", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 2, expectedFormat: .F8)) @@ -1017,35 +957,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: Float? var p3: Float? - (p2, p3) = try initial.opFloat(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opFloat(nil) + (p2, p3) = try await initial.opFloat(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFloat() + (p2, p3) = try await initial.opFloat(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opFloatAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opFloatAsync() + (p2, p3) = try await initial.opFloat() try test(p2 == nil && p3 == nil) p1 = 1.0 - (p2, p3) = try initial.opFloat(p1) - try test(p2 == 1.0 && p3 == 1.0) - - (p2, p3) = try await initial.opFloatAsync(p1) + (p2, p3) = try await initial.opFloat(p1) try test(p2 == 1.0 && p3 == 1.0) - (p2, p3) = try initial.opFloat(1.0) + (p2, p3) = try await initial.opFloat(1.0) try test(p2 == 1.0 && p3 == 1.0) - (p2, p3) = try await initial.opFloatAsync(1.0) - try test(p2 == 1.0 && p3 == 1.0) - - (p2, p3) = try initial.opFloat(nil) + (p2, p3) = try await initial.opFloat(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1053,7 +981,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opFloat", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opFloat", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .F4)) @@ -1071,35 +999,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p1: Double? var p2: Double? var p3: Double? - (p2, p3) = try initial.opDouble(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opDouble(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opDouble() + (p2, p3) = try await initial.opDouble(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opDoubleAsync(nil) + (p2, p3) = try await initial.opDouble(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opDoubleAsync() + (p2, p3) = try await initial.opDouble() try test(p2 == nil && p3 == nil) p1 = 1.0 - (p2, p3) = try initial.opDouble(p1) + (p2, p3) = try await initial.opDouble(p1) try test(p2 == 1.0 && p3 == 1.0) - (p2, p3) = try await initial.opDoubleAsync(p1) + (p2, p3) = try await initial.opDouble(1.0) try test(p2 == 1.0 && p3 == 1.0) - (p2, p3) = try initial.opDouble(1.0) - try test(p2 == 1.0 && p3 == 1.0) - - (p2, p3) = try await initial.opDoubleAsync(1.0) - try test(p2 == 1.0 && p3 == 1.0) - - (p2, p3) = try initial.opDouble(nil) + (p2, p3) = try await initial.opDouble(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1107,7 +1023,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opDouble", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opDouble", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .F8)) @@ -1125,35 +1041,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p1: String? var p2: String? var p3: String? - (p2, p3) = try initial.opString(p1) + (p2, p3) = try await initial.opString(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opString(nil) + (p2, p3) = try await initial.opString(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opString() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opStringAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opStringAsync() + (p2, p3) = try await initial.opString() try test(p2 == nil && p3 == nil) p1 = "test" - (p2, p3) = try initial.opString(p1) - try test(p2 == "test" && p3 == "test") - - (p2, p3) = try await initial.opStringAsync(p1) + (p2, p3) = try await initial.opString(p1) try test(p2 == "test" && p3 == "test") - (p2, p3) = try initial.opString(p1) + (p2, p3) = try await initial.opString(p1) try test(p2 == "test" && p3 == "test") - (p2, p3) = try await initial.opStringAsync(p1) - try test(p2 == "test" && p3 == "test") - - (p2, p3) = try initial.opString(nil) + (p2, p3) = try await initial.opString(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1161,7 +1065,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opString", mode: .Normal, inEncaps: inEncaps) @@ -1183,35 +1087,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: MyEnum? var p3: MyEnum? - (p2, p3) = try initial.opMyEnum(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opMyEnum(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opMyEnum() + (p2, p3) = try await initial.opMyEnum(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opMyEnumAsync(nil) + (p2, p3) = try await initial.opMyEnum(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opMyEnumAsync() + (p2, p3) = try await initial.opMyEnum() try test(p2 == nil && p3 == nil) p1 = .MyEnumMember - (p2, p3) = try initial.opMyEnum(p1) - try test(p2 == .MyEnumMember && p3 == .MyEnumMember) - - (p2, p3) = try await initial.opMyEnumAsync(p1) - try test(p2 == .MyEnumMember && p3 == .MyEnumMember) - - (p2, p3) = try initial.opMyEnum(p1) + (p2, p3) = try await initial.opMyEnum(p1) try test(p2 == .MyEnumMember && p3 == .MyEnumMember) - (p2, p3) = try await initial.opMyEnumAsync(.MyEnumMember) + (p2, p3) = try await initial.opMyEnum(p1) try test(p2 == .MyEnumMember && p3 == .MyEnumMember) - (p2, p3) = try initial.opMyEnum(nil) + (p2, p3) = try await initial.opMyEnum(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1219,7 +1111,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opMyEnum", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opMyEnum", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.readOptional(tag: 1, expectedFormat: .Size)) @@ -1237,34 +1129,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p1: SmallStruct? var p2: SmallStruct? var p3: SmallStruct? - (p2, p3) = try initial.opSmallStruct(p1) + (p2, p3) = try await initial.opSmallStruct(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opSmallStruct(nil) + (p2, p3) = try await initial.opSmallStruct(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opSmallStruct() + (p2, p3) = try await initial.opSmallStruct() try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opSmallStructAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opSmallStructAsync() - try test(p2 == nil && p3 == nil) p1 = SmallStruct(m: 56) - (p2, p3) = try initial.opSmallStruct(p1) - try test(p2!.m == 56 && p3!.m == 56) - - (p2, p3) = try await initial.opSmallStructAsync(p1) - try test(p2!.m == 56 && p3!.m == 56) - - (p2, p3) = try initial.opSmallStruct(SmallStruct(m: 56)) + (p2, p3) = try await initial.opSmallStruct(p1) try test(p2!.m == 56 && p3!.m == 56) - (p2, p3) = try await initial.opSmallStructAsync(SmallStruct(m: 56)) + (p2, p3) = try await initial.opSmallStruct(SmallStruct(m: 56)) try test(p2!.m == 56 && p3!.m == 56) - (p2, p3) = try initial.opSmallStruct(nil) + (p2, p3) = try await initial.opSmallStruct(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1272,7 +1153,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opSmallStruct", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -1292,35 +1173,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: FixedStruct? var p3: FixedStruct? - (p2, p3) = try initial.opFixedStruct(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opFixedStruct(nil) + (p2, p3) = try await initial.opFixedStruct(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFixedStruct() + (p2, p3) = try await initial.opFixedStruct(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opFixedStructAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opFixedStructAsync() + (p2, p3) = try await initial.opFixedStruct() try test(p2 == nil && p3 == nil) p1 = FixedStruct(m: 56) - (p2, p3) = try initial.opFixedStruct(p1) - try test(p2!.m == 56 && p3!.m == 56) - - (p2, p3) = try await initial.opFixedStructAsync(p1) + (p2, p3) = try await initial.opFixedStruct(p1) try test(p2!.m == 56 && p3!.m == 56) - (p2, p3) = try initial.opFixedStruct(FixedStruct(m: 56)) + (p2, p3) = try await initial.opFixedStruct(FixedStruct(m: 56)) try test(p2!.m == 56 && p3!.m == 56) - (p2, p3) = try await initial.opFixedStructAsync(FixedStruct(m: 56)) - try test(p2!.m == 56 && p3!.m == 56) - - (p2, p3) = try initial.opFixedStruct(nil) + (p2, p3) = try await initial.opFixedStruct(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1328,7 +1197,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opFixedStruct", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) @@ -1348,39 +1217,27 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: VarStruct? var p3: VarStruct? - (p2, p3) = try initial.opVarStruct(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opVarStruct(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opVarStruct() + (p2, p3) = try await initial.opVarStruct(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opVarStructAsync(nil) + (p2, p3) = try await initial.opVarStruct(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opVarStructAsync() + (p2, p3) = try await initial.opVarStruct() try test(p2 == nil && p3 == nil) p1 = VarStruct(m: "test") - (p2, p3) = try initial.opVarStruct(p1) + (p2, p3) = try await initial.opVarStruct(p1) try test(p2!.m == "test" && p3!.m == "test") // Test null struct - (p2, p3) = try initial.opVarStruct(nil) + (p2, p3) = try await initial.opVarStruct(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opVarStructAsync(p1) + (p2, p3) = try await initial.opVarStruct(VarStruct(m: "test")) try test(p2!.m == "test" && p3!.m == "test") - (p2, p3) = try initial.opVarStruct(VarStruct(m: "test")) - try test(p2!.m == "test" && p3!.m == "test") - - (p2, p3) = try await initial.opVarStructAsync(VarStruct(m: "test")) - try test(p2!.m == "test" && p3!.m == "test") - - (p2, p3) = try initial.opVarStruct(nil) + (p2, p3) = try await initial.opVarStruct(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1388,7 +1245,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opVarStruct", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opVarStruct", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() var v: VarStruct = try istr.read(tag: 1)! @@ -1408,20 +1265,14 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p3: OneOptional? p1 = OneOptional() - (p2, p3) = try initial.opOneOptional(p1) - try test(p2!.a == nil && p3!.a == nil) - - (p2, p3) = try await initial.opOneOptionalAsync(p1) + (p2, p3) = try await initial.opOneOptional(p1) try test(p2!.a == nil && p3!.a == nil) p1 = OneOptional(a: 58) - (p2, p3) = try initial.opOneOptional(p1) + (p2, p3) = try await initial.opOneOptional(p1) try test(p2!.a! == 58 && p3!.a! == 58) - (p2, p3) = try await initial.opOneOptionalAsync(p1) - try test(p2!.a! == 58 && p3!.a! == 58) - - (p2, p3) = try initial.opOneOptional(OneOptional()) + (p2, p3) = try await initial.opOneOptional(OneOptional()) try test(p2!.a == nil && p3!.a == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1429,7 +1280,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opOneOptional", mode: .Normal, inEncaps: inEncaps) let istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -1445,29 +1296,20 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p1: MyInterfacePrx? var p2: MyInterfacePrx? var p3: MyInterfacePrx? - (p2, p3) = try initial.opMyInterfaceProxy(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opMyInterfaceProxy(nil) + (p2, p3) = try await initial.opMyInterfaceProxy(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opMyInterfaceProxy() + (p2, p3) = try await initial.opMyInterfaceProxy(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opMyInterfaceProxyAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opMyInterfaceProxyAsync() + (p2, p3) = try await initial.opMyInterfaceProxy() try test(p2 == nil && p3 == nil) p1 = try uncheckedCast(prx: communicator.stringToProxy("test")!, type: MyInterfacePrx.self) - (p2, p3) = try initial.opMyInterfaceProxy(p1) + (p2, p3) = try await initial.opMyInterfaceProxy(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opMyInterfaceProxyAsync(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opMyInterfaceProxy(nil) + (p2, p3) = try await initial.opMyInterfaceProxy(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1475,7 +1317,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opMyInterfaceProxy", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -1495,35 +1337,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: ByteSeq? var p3: ByteSeq? - (p2, p3) = try initial.opByteSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opByteSeq(nil) + (p2, p3) = try await initial.opByteSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opByteSeq() + (p2, p3) = try await initial.opByteSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opByteSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opByteSeqAsync() + (p2, p3) = try await initial.opByteSeq() try test(p2 == nil && p3 == nil) p1 = ByteSeq(repeating: 56, count: 100) - (p2, p3) = try initial.opByteSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opByteSeqAsync(p1) + (p2, p3) = try await initial.opByteSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opByteSeq(ByteSeq(repeating: 56, count: 100)) + (p2, p3) = try await initial.opByteSeq(ByteSeq(repeating: 56, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opByteSeqAsync(ByteSeq(repeating: 56, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opByteSeq(nil) + (p2, p3) = try await initial.opByteSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1531,7 +1361,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opByteSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opByteSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1548,35 +1378,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Bool]? var p3: [Bool]? - (p2, p3) = try initial.opBoolSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opBoolSeq(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opBoolSeq() + (p2, p3) = try await initial.opBoolSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opBoolSeqAsync(nil) + (p2, p3) = try await initial.opBoolSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opBoolSeqAsync() + (p2, p3) = try await initial.opBoolSeq() try test(p2 == nil && p3 == nil) p1 = [Bool](repeating: true, count: 100) - (p2, p3) = try initial.opBoolSeq(p1) + (p2, p3) = try await initial.opBoolSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opBoolSeqAsync(p1) + (p2, p3) = try await initial.opBoolSeq([Bool](repeating: true, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opBoolSeq([Bool](repeating: true, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opBoolSeqAsync([Bool](repeating: true, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opBoolSeq(nil) + (p2, p3) = try await initial.opBoolSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1584,7 +1402,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opBoolSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opBoolSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1601,35 +1419,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Int16]? var p3: [Int16]? - (p2, p3) = try initial.opShortSeq(p1) + (p2, p3) = try await initial.opShortSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opShortSeq(nil) + (p2, p3) = try await initial.opShortSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opShortSeq() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opShortSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opShortSeqAsync() + (p2, p3) = try await initial.opShortSeq() try test(p2 == nil && p3 == nil) p1 = [Int16](repeating: 56, count: 100) - (p2, p3) = try initial.opShortSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opShortSeqAsync(p1) + (p2, p3) = try await initial.opShortSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opShortSeq([Int16](repeating: 56, count: 100)) + (p2, p3) = try await initial.opShortSeq([Int16](repeating: 56, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opShortSeqAsync([Int16](repeating: 56, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opShortSeq(nil) + (p2, p3) = try await initial.opShortSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1637,7 +1443,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opShortSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opShortSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1654,35 +1460,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Int32]? var p3: [Int32]? - (p2, p3) = try initial.opIntSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opIntSeq(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opIntSeq() + (p2, p3) = try await initial.opIntSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opIntSeqAsync(nil) + (p2, p3) = try await initial.opIntSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opIntSeqAsync() + (p2, p3) = try await initial.opIntSeq() try test(p2 == nil && p3 == nil) p1 = [Int32](repeating: 56, count: 100) - (p2, p3) = try initial.opIntSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opIntSeqAsync(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opIntSeq([Int32](repeating: 56, count: 100)) + (p2, p3) = try await initial.opIntSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opIntSeqAsync([Int32](repeating: 56, count: 100)) + (p2, p3) = try await initial.opIntSeq([Int32](repeating: 56, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opIntSeq(nil) + (p2, p3) = try await initial.opIntSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1690,7 +1484,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opIntSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opIntSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1707,35 +1501,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Int64]? var p3: [Int64]? - (p2, p3) = try initial.opLongSeq(p1) + (p2, p3) = try await initial.opLongSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opLongSeq(nil) + (p2, p3) = try await initial.opLongSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opLongSeq() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opLongSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opLongSeqAsync() + (p2, p3) = try await initial.opLongSeq() try test(p2 == nil && p3 == nil) p1 = [Int64](repeating: 56, count: 100) - (p2, p3) = try initial.opLongSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opLongSeqAsync(p1) + (p2, p3) = try await initial.opLongSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opLongSeq([Int64](repeating: 56, count: 100)) + (p2, p3) = try await initial.opLongSeq([Int64](repeating: 56, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opLongSeqAsync([Int64](repeating: 56, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opLongSeq(nil) + (p2, p3) = try await initial.opLongSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1743,7 +1525,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opLongSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opLongSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1760,35 +1542,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Float]? var p3: [Float]? - (p2, p3) = try initial.opFloatSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opFloatSeq(nil) + (p2, p3) = try await initial.opFloatSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFloatSeq() + (p2, p3) = try await initial.opFloatSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opFloatSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opFloatSeqAsync() + (p2, p3) = try await initial.opFloatSeq() try test(p2 == nil && p3 == nil) p1 = [Float](repeating: 1.0, count: 100) - (p2, p3) = try initial.opFloatSeq(p1) + (p2, p3) = try await initial.opFloatSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opFloatSeqAsync(p1) + (p2, p3) = try await initial.opFloatSeq([Float](repeating: 1.0, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opFloatSeq([Float](repeating: 1.0, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opFloatSeqAsync([Float](repeating: 1.0, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opFloatSeq(nil) + (p2, p3) = try await initial.opFloatSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1796,7 +1566,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opFloatSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opFloatSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1813,35 +1583,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Double]? var p3: [Double]? - (p2, p3) = try initial.opDoubleSeq(p1) + (p2, p3) = try await initial.opDoubleSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opDoubleSeq(nil) + (p2, p3) = try await initial.opDoubleSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opDoubleSeq() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opDoubleSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opDoubleSeqAsync() + (p2, p3) = try await initial.opDoubleSeq() try test(p2 == nil && p3 == nil) p1 = [Double](repeating: 1.0, count: 100) - (p2, p3) = try initial.opDoubleSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opDoubleSeqAsync(p1) + (p2, p3) = try await initial.opDoubleSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opDoubleSeq([Double](repeating: 1.0, count: 100)) + (p2, p3) = try await initial.opDoubleSeq([Double](repeating: 1.0, count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opDoubleSeqAsync([Double](repeating: 1.0, count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opDoubleSeq(nil) + (p2, p3) = try await initial.opDoubleSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1849,7 +1607,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opDoubleSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opDoubleSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1866,35 +1624,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [String]? var p3: [String]? - (p2, p3) = try initial.opStringSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opStringSeq(nil) + (p2, p3) = try await initial.opStringSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opStringSeq() + (p2, p3) = try await initial.opStringSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opStringSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opStringSeqAsync() + (p2, p3) = try await initial.opStringSeq() try test(p2 == nil && p3 == nil) p1 = [String](repeating: "test", count: 100) - (p2, p3) = try initial.opStringSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opStringSeqAsync(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opStringSeq([String](repeating: "test", count: 100)) + (p2, p3) = try await initial.opStringSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opStringSeqAsync([String](repeating: "test", count: 100)) + (p2, p3) = try await initial.opStringSeq([String](repeating: "test", count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opStringSeq(nil) + (p2, p3) = try await initial.opStringSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1902,7 +1648,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { ostr.write(tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke(operation: "opStringSeq", mode: .Normal, inEncaps: inEncaps) + let result = try await initial.ice_invoke(operation: "opStringSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try test(istr.read(tag: 1) == p1) @@ -1919,35 +1665,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: SmallStructSeq? var p3: SmallStructSeq? - (p2, p3) = try initial.opSmallStructSeq(p1) + (p2, p3) = try await initial.opSmallStructSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opSmallStructSeq(nil) + (p2, p3) = try await initial.opSmallStructSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opSmallStructSeq() - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opSmallStructSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opSmallStructSeqAsync() + (p2, p3) = try await initial.opSmallStructSeq() try test(p2 == nil && p3 == nil) p1 = SmallStructSeq(repeating: SmallStruct(), count: 100) - (p2, p3) = try initial.opSmallStructSeq(p1) + (p2, p3) = try await initial.opSmallStructSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opSmallStructSeqAsync(p1) + (p2, p3) = try await initial.opSmallStructSeq(SmallStructSeq(repeating: SmallStruct(), count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opSmallStructSeq(SmallStructSeq(repeating: SmallStruct(), count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opSmallStructSeqAsync(SmallStructSeq(repeating: SmallStruct(), count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opSmallStructSeq(nil) + (p2, p3) = try await initial.opSmallStructSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -1955,7 +1689,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { SmallStructSeqHelper.write(to: ostr, tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opSmallStructSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -1973,32 +1707,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: FixedStructSeq? var p3: FixedStructSeq? - (p2, p3) = try initial.opFixedStructSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opFixedStructSeq(nil) + (p2, p3) = try await initial.opFixedStructSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFixedStructSeq() + (p2, p3) = try await initial.opFixedStructSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opFixedStructSeqAsync(p1) + (p2, p3) = try await initial.opFixedStructSeq() try test(p2 == nil && p3 == nil) p1 = FixedStructSeq(repeating: FixedStruct(), count: 100) - (p2, p3) = try initial.opFixedStructSeq(p1) + (p2, p3) = try await initial.opFixedStructSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opFixedStructSeqAsync(p1) + (p2, p3) = try await initial.opFixedStructSeq(FixedStructSeq(repeating: FixedStruct(), count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opFixedStructSeq(FixedStructSeq(repeating: FixedStruct(), count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opFixedStructSeqAsync(FixedStructSeq(repeating: FixedStruct(), count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opFixedStructSeq(nil) + (p2, p3) = try await initial.opFixedStructSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -2006,7 +1731,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { FixedStructSeqHelper.write(to: ostr, tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opFixedStructSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -2024,35 +1749,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: VarStructSeq? var p3: VarStructSeq? - (p2, p3) = try initial.opVarStructSeq(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opVarStructSeq(nil) + (p2, p3) = try await initial.opVarStructSeq(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opVarStructSeq() + (p2, p3) = try await initial.opVarStructSeq(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opVarStructSeqAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opVarStructSeqAsync() + (p2, p3) = try await initial.opVarStructSeq() try test(p2 == nil && p3 == nil) p1 = VarStructSeq(repeating: VarStruct(), count: 100) - (p2, p3) = try initial.opVarStructSeq(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opVarStructSeqAsync(p1) + (p2, p3) = try await initial.opVarStructSeq(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opVarStructSeq(VarStructSeq(repeating: VarStruct(), count: 100)) + (p2, p3) = try await initial.opVarStructSeq(VarStructSeq(repeating: VarStruct(), count: 100)) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opVarStructSeqAsync(VarStructSeq(repeating: VarStruct(), count: 100)) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opVarStructSeq(nil) + (p2, p3) = try await initial.opVarStructSeq(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -2060,7 +1773,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { VarStructSeqHelper.write(to: ostr, tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opVarStructSeq", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -2078,35 +1791,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [Int32: Int32]? var p3: [Int32: Int32]? - (p2, p3) = try initial.opIntIntDict(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opIntIntDict(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opIntIntDict() + (p2, p3) = try await initial.opIntIntDict(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opIntIntDictAsync(nil) + (p2, p3) = try await initial.opIntIntDict(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opIntIntDictAsync() + (p2, p3) = try await initial.opIntIntDict() try test(p2 == nil && p3 == nil) p1 = [1: 2, 2: 3] - (p2, p3) = try initial.opIntIntDict(p1) + (p2, p3) = try await initial.opIntIntDict(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opIntIntDictAsync(p1) + (p2, p3) = try await initial.opIntIntDict([1: 2, 2: 3]) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opIntIntDict([1: 2, 2: 3]) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opIntIntDictAsync([1: 2, 2: 3]) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opIntIntDict(nil) + (p2, p3) = try await initial.opIntIntDict(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) @@ -2114,7 +1815,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { IntIntDictHelper.write(to: ostr, tag: 2, value: p1) ostr.endEncapsulation() let inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opIntIntDict", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -2132,35 +1833,23 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { var p2: [String: Int32]? var p3: [String: Int32]? - (p2, p3) = try initial.opStringIntDict(p1) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try initial.opStringIntDict(nil) + (p2, p3) = try await initial.opStringIntDict(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opStringIntDict() + (p2, p3) = try await initial.opStringIntDict(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try await initial.opStringIntDictAsync(nil) - try test(p2 == nil && p3 == nil) - - (p2, p3) = try await initial.opStringIntDictAsync() + (p2, p3) = try await initial.opStringIntDict() try test(p2 == nil && p3 == nil) p1 = ["1": 1, "2": 2] - (p2, p3) = try initial.opStringIntDict(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try await initial.opStringIntDictAsync(p1) - try test(p2 == p1 && p3 == p1) - - (p2, p3) = try initial.opStringIntDict(["1": 1, "2": 2]) + (p2, p3) = try await initial.opStringIntDict(p1) try test(p2 == p1 && p3 == p1) - (p2, p3) = try await initial.opStringIntDictAsync(["1": 1, "2": 2]) + (p2, p3) = try await initial.opStringIntDict(["1": 1, "2": 2]) try test(p2 == p1 && p3 == p1) - (p2, p3) = try initial.opStringIntDict(nil) + (p2, p3) = try await initial.opStringIntDict(nil) try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. var ostr = Ice.OutputStream(communicator: communicator) @@ -2168,7 +1857,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { StringIntDictHelper.write(to: ostr, tag: 2, value: p1) ostr.endEncapsulation() var inEncaps = ostr.finished() - let result = try initial.ice_invoke( + let result = try await initial.ice_invoke( operation: "opStringIntDict", mode: .Normal, inEncaps: inEncaps) var istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() @@ -2201,35 +1890,35 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { output.write("testing exception optionals... ") do { - try initial.opOptionalException(a: nil, b: nil) + try await initial.opOptionalException(a: nil, b: nil) } catch let ex as OptionalException { try test(ex.a == nil) try test(ex.b == nil) } do { - try initial.opOptionalException() + try await initial.opOptionalException() } catch let ex as OptionalException { try test(ex.a == nil) try test(ex.b == nil) } do { - try initial.opOptionalException(b: nil) + try await initial.opOptionalException(b: nil) } catch let ex as OptionalException { try test(ex.a == nil) try test(ex.b == nil) } do { - try initial.opOptionalException() + try await initial.opOptionalException() } catch let ex as OptionalException { try test(ex.a == nil) try test(ex.b == nil) } do { - try initial.opOptionalException(a: 30, b: "test") + try await initial.opOptionalException(a: 30, b: "test") } catch let ex as OptionalException { try test(ex.a == 30) try test(ex.b == "test") @@ -2240,14 +1929,14 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { // Use the 1.0 encoding with an exception whose only data members are optional. // let initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0) - try initial2.opOptionalException(a: 30, b: "test") + try await initial2.opOptionalException(a: 30, b: "test") } catch let ex as OptionalException { try test(ex.a == nil) try test(ex.b == nil) } do { - try initial.opDerivedException(a: nil, b: nil) + try await initial.opDerivedException(a: nil, b: nil) } catch let ex as DerivedException { try test(ex.a == nil) try test(ex.b == nil) @@ -2257,7 +1946,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opDerivedException(a: 30, b: "test2") + try await initial.opDerivedException(a: 30, b: "test2") } catch let ex as DerivedException { try test(ex.a == 30) try test(ex.b == "test2") @@ -2267,7 +1956,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opRequiredException(a: nil, b: nil) + try await initial.opRequiredException(a: nil, b: nil) } catch let ex as RequiredException { try test(ex.a == nil) try test(ex.b == nil) @@ -2275,7 +1964,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opRequiredException(b: nil) + try await initial.opRequiredException(b: nil) } catch let ex as RequiredException { try test(ex.a == nil) try test(ex.b == nil) @@ -2283,7 +1972,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opRequiredException() + try await initial.opRequiredException() } catch let ex as RequiredException { try test(ex.a == nil) try test(ex.b == nil) @@ -2291,7 +1980,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opRequiredException() + try await initial.opRequiredException() } catch let ex as RequiredException { try test(ex.a == nil) try test(ex.b == nil) @@ -2299,7 +1988,7 @@ func allTests(_ helper: TestHelper) async throws -> InitialPrx { } do { - try initial.opRequiredException(a: 30, b: "test2") + try await initial.opRequiredException(a: 30, b: "test2") } catch let ex as RequiredException { try test(ex.a == 30) try test(ex.b == "test2") diff --git a/swift/test/Ice/optional/Client.swift b/swift/test/Ice/optional/Client.swift index 01ef54d22cd..8dd0c613eb6 100644 --- a/swift/test/Ice/optional/Client.swift +++ b/swift/test/Ice/optional/Client.swift @@ -14,6 +14,6 @@ public class Client: TestHelperI { communicator.destroy() } let initial = try await allTests(self) - try initial.shutdown() + try await initial.shutdown() } } diff --git a/swift/test/Ice/proxy/AllTests.swift b/swift/test/Ice/proxy/AllTests.swift index 10577eb99b3..3e27e5f1ea8 100644 --- a/swift/test/Ice/proxy/AllTests.swift +++ b/swift/test/Ice/proxy/AllTests.swift @@ -665,19 +665,19 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { writer.writeLine("ok") writer.write("testing checked cast... ") - var cl = try checkedCast(prx: baseProxy, type: MyClassPrx.self)! - let derived = try checkedCast(prx: cl, type: MyDerivedClassPrx.self)! + var cl = try await checkedCast(prx: baseProxy, type: MyClassPrx.self)! + let derived = try await checkedCast(prx: cl, type: MyDerivedClassPrx.self)! try test(cl == baseProxy) try test(derived == baseProxy) try test(cl == derived) writer.writeLine("ok") writer.write("testing checked cast with context... ") - var c = try cl.getContext() + var c = try await cl.getContext() try test(c.isEmpty) c = ["one": "hello", "two": "world"] - cl = try checkedCast(prx: baseProxy, type: MyClassPrx.self, context: c)! - let c2 = try cl.getContext() + cl = try await checkedCast(prx: baseProxy, type: MyClassPrx.self, context: c)! + let c2 = try await cl.getContext() try test(c == c2) writer.writeLine("ok") @@ -686,7 +686,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { let connection = try await cl.ice_getConnection() if connection != nil { let prx = cl.ice_fixed(connection!) - try prx.ice_ping() + try await prx.ice_ping() try test(cl.ice_secure(true).ice_fixed(connection!).ice_isSecure()) try test(cl.ice_facet("facet").ice_fixed(connection!).ice_getFacet() == "facet") try test(cl.ice_oneway().ice_fixed(connection!).ice_isOneway()) @@ -703,12 +703,12 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { cl.ice_fixed(connection!).ice_fixed(fixedConnection!).ice_getConnection() === fixedConnection) do { - try cl.ice_secure(!connection!.getEndpoint().getInfo()!.secure()).ice_fixed(connection!) + try await cl.ice_secure(!connection!.getEndpoint().getInfo()!.secure()).ice_fixed(connection!) .ice_ping() } catch is Ice.NoEndpointException {} do { - try cl.ice_datagram().ice_fixed(connection!).ice_ping() + try await cl.ice_datagram().ice_fixed(connection!).ice_ping() } catch is Ice.NoEndpointException {} } } @@ -718,7 +718,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { var ref20 = "test -e 2.0:\(helper.getTestEndpoint(num: 0))" var cl20 = try uncheckedCast(prx: communicator.stringToProxy(ref20)!, type: MyClassPrx.self) do { - try cl20.ice_ping() + try await cl20.ice_ping() try test(false) } catch is Ice.MarshalException { // Server 2.0 endpoint doesn't support 1.1 version. @@ -726,9 +726,9 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { var ref10 = "test -e 1.0:\(helper.getTestEndpoint(num: 0))" var cl10 = try uncheckedCast(prx: communicator.stringToProxy(ref10)!, type: MyClassPrx.self) - try cl10.ice_ping() - try cl10.ice_encodingVersion(Ice.Encoding_1_0).ice_ping() - try cl.ice_encodingVersion(Ice.Encoding_1_0).ice_ping() + try await cl10.ice_ping() + try await cl10.ice_encodingVersion(Ice.Encoding_1_0).ice_ping() + try await cl.ice_encodingVersion(Ice.Encoding_1_0).ice_ping() do { // Send request with bogus 1.2 encoding. @@ -740,7 +740,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { inEncaps[4] = version.major inEncaps[5] = version.minor - _ = try cl.ice_invoke(operation: "ice_ping", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) + _ = try await cl.ice_invoke(operation: "ice_ping", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) try test(false) } catch let ex as Ice.UnknownLocalException { // TODO: remove UnsupportedEncodingException @@ -758,7 +758,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { var inEncaps = os.finished() inEncaps[4] = version.major inEncaps[5] = version.minor - _ = try cl.ice_invoke(operation: "ice_ping", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) + _ = try await cl.ice_invoke(operation: "ice_ping", mode: Ice.OperationMode.Normal, inEncaps: inEncaps) try test(false) } catch let ex as Ice.UnknownLocalException { // TODO: remove UnsupportedEncodingException @@ -772,7 +772,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { ref20 = "test -p 2.0:\(helper.getTestEndpoint(num: 0))" cl20 = try uncheckedCast(prx: communicator.stringToProxy(ref20)!, type: MyClassPrx.self) do { - try cl20.ice_ping() + try await cl20.ice_ping() try test(false) } catch is Ice.FeatureNotSupportedException { // Server 2.0 proxy doesn't support 1.0 version. @@ -780,7 +780,7 @@ public func allTests(_ helper: TestHelper) async throws -> MyClassPrx { ref10 = "test -p 1.0:\(helper.getTestEndpoint(num: 0))" cl10 = try uncheckedCast(prx: communicator.stringToProxy(ref10)!, type: MyClassPrx.self) - try cl10.ice_ping() + try await cl10.ice_ping() writer.write("testing opaque endpoints... ") do { diff --git a/swift/test/Ice/proxy/Client.swift b/swift/test/Ice/proxy/Client.swift index e6ec3dcf4b9..c40a9159476 100644 --- a/swift/test/Ice/proxy/Client.swift +++ b/swift/test/Ice/proxy/Client.swift @@ -11,7 +11,7 @@ class Client: TestHelperI { communicator.destroy() } let cl = try await allTests(self) - try cl.shutdown() + try await cl.shutdown() } } } diff --git a/swift/test/Ice/retry/AllTests.swift b/swift/test/Ice/retry/AllTests.swift index e12e16014ce..3eba1a9969c 100644 --- a/swift/test/Ice/retry/AllTests.swift +++ b/swift/test/Ice/retry/AllTests.swift @@ -19,19 +19,19 @@ public func allTests(helper: TestHelper, communicator2: Ice.Communicator, ref: S output.writeLine("ok") output.write("testing checked cast... ") - let retry1 = try checkedCast(prx: base1, type: RetryPrx.self)! + let retry1 = try await checkedCast(prx: base1, type: RetryPrx.self)! try test(retry1 == base1) - var retry2 = try checkedCast(prx: base2, type: RetryPrx.self)! + var retry2 = try await checkedCast(prx: base2, type: RetryPrx.self)! try test(retry2 == base2) output.writeLine("ok") output.write("calling regular operation with first proxy... ") - try retry1.op(false) + try await retry1.op(false) output.writeLine("ok") output.write("calling operation to kill connection with second proxy... ") do { - try retry2.op(true) + try await retry2.op(true) try test(false) } catch is Ice.UnknownLocalException { // Expected with collocation @@ -39,59 +39,31 @@ public func allTests(helper: TestHelper, communicator2: Ice.Communicator, ref: S output.writeLine("ok") output.write("calling regular operation with first proxy again... ") - try retry1.op(false) - output.writeLine("ok") - - output.write("calling regular AMI operation with first proxy... ") - try await retry1.opAsync(false) - output.writeLine("ok") - - output.write("calling AMI operation to kill connection with second proxy... ") - do { - try await retry2.opAsync(true) - } catch is Ice.ConnectionLostException {} catch is Ice.UnknownLocalException {} - output.writeLine("ok") - - output.write("calling regular AMI operation with first proxy again... ") - try await retry1.opAsync(false) + try await retry1.op(false) output.writeLine("ok") output.write("testing idempotent operation... ") - try test(retry1.opIdempotent(4) == 4) - try await test(retry1.opIdempotentAsync(4) == 4) + try await test(retry1.opIdempotent(4) == 4) output.writeLine("ok") output.write("testing non-idempotent operation... ") do { - try retry1.opNotIdempotent() - try test(false) - } catch is Ice.LocalException {} - - do { - try await retry1.opNotIdempotentAsync() + try await retry1.opNotIdempotent() try test(false) } catch is Ice.LocalException {} output.writeLine("ok") output.write("testing invocation timeout and retries... ") - retry2 = try checkedCast( + retry2 = try await checkedCast( prx: communicator2.stringToProxy(retry1.ice_toString())!, type: RetryPrx.self)! do { // No more than 2 retries before timeout kicks-in - _ = try retry2.ice_invocationTimeout(500).opIdempotent(4) - try test(false) - } catch is Ice.InvocationTimeoutException { - _ = try retry2.opIdempotent(-1) // Reset the counter - } - - do { - // No more than 2 retries before timeout kicks-in - _ = try await retry2.ice_invocationTimeout(500).opIdempotentAsync(4) + _ = try await retry2.ice_invocationTimeout(500).opIdempotent(4) try test(false) } catch is Ice.InvocationTimeoutException { - _ = try retry2.opIdempotent(-1) // Reset the counter + _ = try await retry2.opIdempotent(-1) // Reset the counter } output.writeLine("ok") diff --git a/swift/test/Ice/retry/Client.swift b/swift/test/Ice/retry/Client.swift index db6cab2f1cc..83134de2c52 100644 --- a/swift/test/Ice/retry/Client.swift +++ b/swift/test/Ice/retry/Client.swift @@ -34,7 +34,7 @@ class Client: TestHelperI { helper: self, communicator2: communicator2, ref: "retry:\(getTestEndpoint(num: 0))") - try r.shutdown() + try await r.shutdown() } } } diff --git a/swift/test/Ice/scope/AllTests.swift b/swift/test/Ice/scope/AllTests.swift index 409ec52f1f3..48d0608b1c7 100644 --- a/swift/test/Ice/scope/AllTests.swift +++ b/swift/test/Ice/scope/AllTests.swift @@ -13,303 +13,198 @@ func allTests(helper: TestHelper) async throws { do { let obj = try communicator.stringToProxy("i1:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: IPrx.self)! + let i = try await checkedCast(prx: obj, type: IPrx.self)! let s1 = S(v: 0) - let (s3, s2) = try i.opS(s1) + let (s3, s2) = try await i.opS(s1) try test(s2 == s1) try test(s3 == s1) let sseq1 = [s1] - let (sseq3, sseq2) = try i.opSSeq(sseq1) + let (sseq3, sseq2) = try await i.opSSeq(sseq1) try test(sseq2 == sseq1) try test(sseq3 == sseq1) let smap1 = ["a": s1] - let (smap3, smap2) = try i.opSMap(smap1) + let (smap3, smap2) = try await i.opSMap(smap1) try test(smap2 == smap1) try test(smap3 == smap1) let c1 = C(s: s1) - let (c3, c2) = try i.opC(c1) + let (c3, c2) = try await i.opC(c1) try test(c2!.s == s1) try test(c3!.s == s1) let cseq1 = [c1] - let (cseq3, cseq2) = try i.opCSeq(cseq1) + let (cseq3, cseq2) = try await i.opCSeq(cseq1) try test(cseq2[0]!.s == s1) try test(cseq3[0]!.s == s1) let cmap1 = ["a": c1] - let (cmap3, cmap2) = try i.opCMap(cmap1) + let (cmap3, cmap2) = try await i.opCMap(cmap1) try test(cmap2["a"]!!.s == s1) try test(cmap3["a"]!!.s == s1) - let e = try i.opE1(.v1) + let e = try await i.opE1(.v1) try test(e == .v1) - let s = try i.opS1(S1(s: "S1")) + let s = try await i.opS1(S1(s: "S1")) try test(s.s == "S1") - let c = try i.opC1(C1(s: "C1"))! + let c = try await i.opC1(C1(s: "C1"))! try test(c.s == "C1") - let ss = try i.opS1Seq([S1(s: "S1")]) + let ss = try await i.opS1Seq([S1(s: "S1")]) try test(ss[0].s == "S1") - let sm = try i.opS1Map(["s1": S1(s: "S1")]) + let sm = try await i.opS1Map(["s1": S1(s: "S1")]) try test(sm["s1"]!.s == "S1") } do { let obj = try communicator.stringToProxy("i1:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: IPrx.self)! + let i = try await checkedCast(prx: obj, type: IPrx.self)! let s1 = S(v: 0) - let (s3, s2) = try await i.opSAsync(s1) + let (s3, s2) = try await i.opS(s1) try test(s2 == s1) try test(s3 == s1) let sseq1 = [s1] - let (sseq3, sseq2) = try await i.opSSeqAsync(sseq1) + let (sseq3, sseq2) = try await i.opSSeq(sseq1) try test(sseq2 == sseq1) try test(sseq3 == sseq1) let smap1 = ["a": s1] - let (smap3, smap2) = try await i.opSMapAsync(smap1) + let (smap3, smap2) = try await i.opSMap(smap1) try test(smap2 == smap1) try test(smap3 == smap1) let c1 = C(s: s1) - let (c3, c2) = try await i.opCAsync(c1) + let (c3, c2) = try await i.opC(c1) try test(c2!.s == s1) try test(c3!.s == s1) let cseq1 = [c1] - let (cseq3, cseq2) = try await i.opCSeqAsync(cseq1) + let (cseq3, cseq2) = try await i.opCSeq(cseq1) try test(cseq2[0]!.s == s1) try test(cseq3[0]!.s == s1) let cmap1 = ["a": c1] - let (cmap3, cmap2) = try await i.opCMapAsync(cmap1) + let (cmap3, cmap2) = try await i.opCMap(cmap1) try test(cmap2["a"]!!.s == s1) try test(cmap3["a"]!!.s == s1) } do { let obj = try communicator.stringToProxy("i2:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerIPrx.self)! + let i = try await checkedCast(prx: obj, type: InnerIPrx.self)! let s1 = InnerInner2S(v: 0) - let (s3, s2) = try i.opS(s1) + let (s3, s2) = try await i.opS(s1) try test(s2 == s1) try test(s3 == s1) let sseq1 = [s1] - let (sseq3, sseq2) = try i.opSSeq(sseq1) + let (sseq3, sseq2) = try await i.opSSeq(sseq1) try test(sseq2 == sseq1) try test(sseq3 == sseq1) let smap1 = ["a": s1] - let (smap3, smap2) = try i.opSMap(smap1) + let (smap3, smap2) = try await i.opSMap(smap1) try test(smap2 == smap1) try test(smap3 == smap1) let c1 = InnerInner2C(s: s1) - let (c3, c2) = try i.opC(c1) + let (c3, c2) = try await i.opC(c1) try test(c2!.s == c1.s) try test(c3!.s == c1.s) let cseq1 = [c1] - let (cseq3, cseq2) = try i.opCSeq(cseq1) + let (cseq3, cseq2) = try await i.opCSeq(cseq1) try test(cseq2[0]!.s == s1) try test(cseq3[0]!.s == s1) let cmap1 = ["a": c1] - let (cmap3, cmap2) = try i.opCMap(cmap1) - try test(cmap2["a"]!!.s == s1) - try test(cmap3["a"]!!.s == s1) - } - - do { - let obj = try communicator.stringToProxy("i2:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerIPrx.self)! - - let s1 = InnerInner2S(v: 0) - let (s3, s2) = try await i.opSAsync(s1) - try test(s2 == s1) - try test(s3 == s1) - - let sseq1 = [s1] - let (sseq3, sseq2) = try await i.opSSeqAsync(sseq1) - try test(sseq2 == sseq1) - try test(sseq3 == sseq1) - - let smap1 = ["a": s1] - let (smap3, smap2) = try await i.opSMapAsync(smap1) - try test(smap2 == smap1) - try test(smap3 == smap1) - - let c1 = InnerInner2C(s: s1) - let (c3, c2) = try await i.opCAsync(c1) - try test(c2!.s == c1.s) - try test(c3!.s == c1.s) - - let cseq1 = [c1] - let (cseq3, cseq2) = try await i.opCSeqAsync(cseq1) - try test(cseq2[0]!.s == s1) - try test(cseq3[0]!.s == s1) - - let cmap1 = ["a": c1] - let (cmap3, cmap2) = try await i.opCMapAsync(cmap1) - try test(cmap2["a"]!!.s == s1) - try test(cmap3["a"]!!.s == s1) - } - - do { - let obj = try communicator.stringToProxy("i3:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerInner2IPrx.self)! - - let s1 = InnerInner2S(v: 0) - let (s3, s2) = try i.opS(s1) - try test(s2 == s1) - try test(s3 == s1) - - let sseq1 = [s1] - let (sseq3, sseq2) = try i.opSSeq(sseq1) - try test(sseq2[0] == s1) - try test(sseq3[0] == s1) - - let smap1 = ["a": s1] - let (smap3, smap2) = try i.opSMap(smap1) - try test(smap2 == smap1) - try test(smap3 == smap1) - - let c1 = InnerInner2C(s: s1) - let (c3, c2) = try i.opC(c1) - try test(c2!.s == s1) - try test(c3!.s == s1) - - let cseq1 = [c1] - let (cseq3, cseq2) = try i.opCSeq(cseq1) - try test(cseq2[0]!.s == s1) - try test(cseq3[0]!.s == s1) - - let cmap1 = ["a": c1] - let (cmap3, cmap2) = try i.opCMap(cmap1) + let (cmap3, cmap2) = try await i.opCMap(cmap1) try test(cmap2["a"]!!.s == s1) try test(cmap3["a"]!!.s == s1) } do { let obj = try communicator.stringToProxy("i3:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerInner2IPrx.self)! + let i = try await checkedCast(prx: obj, type: InnerInner2IPrx.self)! let s1 = InnerInner2S(v: 0) - let (s3, s2) = try await i.opSAsync(s1) + let (s3, s2) = try await i.opS(s1) try test(s2 == s1) try test(s3 == s1) let sseq1 = [s1] - let (sseq3, sseq2) = try await i.opSSeqAsync(sseq1) + let (sseq3, sseq2) = try await i.opSSeq(sseq1) try test(sseq2[0] == s1) try test(sseq3[0] == s1) let smap1 = ["a": s1] - let (smap3, smap2) = try await i.opSMapAsync(smap1) + let (smap3, smap2) = try await i.opSMap(smap1) try test(smap2 == smap1) try test(smap3 == smap1) let c1 = InnerInner2C(s: s1) - let (c3, c2) = try await i.opCAsync(c1) - try test(c2!.s == s1) - try test(c3!.s == s1) - - let cseq1 = [c1] - let (cseq3, cseq2) = try await i.opCSeqAsync(cseq1) - try test(cseq2[0]!.s == s1) - try test(cseq3[0]!.s == s1) - - let cmap1 = ["a": c1] - let (cmap3, cmap2) = try await i.opCMapAsync(cmap1) - try test(cmap2["a"]!!.s == s1) - try test(cmap3["a"]!!.s == s1) - } - - do { - let obj = try communicator.stringToProxy("i4:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerTestInner2IPrx.self)! - - let s1 = S(v: 0) - let (s3, s2) = try i.opS(s1) - try test(s2 == s1) - try test(s3 == s1) - - let sseq1 = [s1] - let (sseq3, sseq2) = try i.opSSeq(sseq1) - try test(sseq2[0] == s1) - try test(sseq3[0] == s1) - - let smap1 = ["a": s1] - let (smap3, smap2) = try i.opSMap(smap1) - try test(smap2 == smap1) - try test(smap3 == smap1) - - let c1 = C(s: s1) - let (c3, c2) = try i.opC(c1) + let (c3, c2) = try await i.opC(c1) try test(c2!.s == s1) try test(c3!.s == s1) let cseq1 = [c1] - let (cseq3, cseq2) = try i.opCSeq(cseq1) + let (cseq3, cseq2) = try await i.opCSeq(cseq1) try test(cseq2[0]!.s == s1) try test(cseq3[0]!.s == s1) let cmap1 = ["a": c1] - let (cmap3, cmap2) = try i.opCMap(cmap1) + let (cmap3, cmap2) = try await i.opCMap(cmap1) try test(cmap2["a"]!!.s == s1) try test(cmap3["a"]!!.s == s1) } do { let obj = try communicator.stringToProxy("i4:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: InnerTestInner2IPrx.self)! + let i = try await checkedCast(prx: obj, type: InnerTestInner2IPrx.self)! let s1 = S(v: 0) - let (s3, s2) = try await i.opSAsync(s1) + let (s3, s2) = try await i.opS(s1) try test(s2 == s1) try test(s3 == s1) let sseq1 = [s1] - let (sseq3, sseq2) = try await i.opSSeqAsync(sseq1) + let (sseq3, sseq2) = try await i.opSSeq(sseq1) try test(sseq2[0] == s1) try test(sseq3[0] == s1) let smap1 = ["a": s1] - let (smap3, smap2) = try await i.opSMapAsync(smap1) + let (smap3, smap2) = try await i.opSMap(smap1) try test(smap2 == smap1) try test(smap3 == smap1) let c1 = C(s: s1) - let (c3, c2) = try i.opC(c1) + let (c3, c2) = try await i.opC(c1) try test(c2!.s == s1) try test(c3!.s == s1) let cseq1 = [c1] - let (cseq3, cseq2) = try await i.opCSeqAsync(cseq1) + let (cseq3, cseq2) = try await i.opCSeq(cseq1) try test(cseq2[0]!.s == s1) try test(cseq3[0]!.s == s1) let cmap1 = ["a": c1] - let (cmap3, cmap2) = try await i.opCMapAsync(cmap1) + let (cmap3, cmap2) = try await i.opCMap(cmap1) try test(cmap2["a"]!!.s == s1) try test(cmap3["a"]!!.s == s1) } do { let obj = try communicator.stringToProxy("i1:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: IPrx.self)! - try i.shutdown() + let i = try await checkedCast(prx: obj, type: IPrx.self)! + try await i.shutdown() } output.writeLine("ok") } diff --git a/swift/test/Ice/servantLocator/AllTests.swift b/swift/test/Ice/servantLocator/AllTests.swift index 27c49a34898..433907af5e5 100644 --- a/swift/test/Ice/servantLocator/AllTests.swift +++ b/swift/test/Ice/servantLocator/AllTests.swift @@ -3,9 +3,9 @@ import Ice import TestCommon -func testExceptions(_ obj: TestIntfPrx, _ helper: TestHelper) throws { +func testExceptions(_ obj: TestIntfPrx, _ helper: TestHelper) async throws { do { - try obj.requestFailedException() + try await obj.requestFailedException() try helper.test(false) } catch let ex as Ice.ObjectNotExistException { try helper.test(ex.id == obj.ice_getIdentity()) @@ -14,35 +14,35 @@ func testExceptions(_ obj: TestIntfPrx, _ helper: TestHelper) throws { } do { - try obj.unknownUserException() + try await obj.unknownUserException() try helper.test(false) } catch let ex as Ice.UnknownUserException { try helper.test(ex.message.contains("::Foo::BarException")) } do { - try obj.unknownLocalException() + try await obj.unknownLocalException() try helper.test(false) } catch let ex as Ice.UnknownLocalException { try helper.test(ex.message == "reason") } do { - try obj.unknownException() + try await obj.unknownException() try helper.test(false) } catch let ex as Ice.UnknownException { try helper.test(ex.message == "reason") } do { - try obj.userException() + try await obj.userException() try helper.test(false) } catch let ex as Ice.UnknownUserException { try helper.test(ex.message.contains("Test::TestIntfUserException")) } catch is Ice.OperationNotExistException {} do { - try obj.localException() + try await obj.localException() try helper.test(false) } catch let ex as Ice.UnknownLocalException { try helper.test( @@ -50,42 +50,42 @@ func testExceptions(_ obj: TestIntfPrx, _ helper: TestHelper) throws { } do { - try obj.unknownExceptionWithServantException() + try await obj.unknownExceptionWithServantException() try helper.test(false) } catch let ex as Ice.UnknownException { try helper.test(ex.message == "reason") } do { - _ = try obj.impossibleException(false) + _ = try await obj.impossibleException(false) try helper.test(false) } catch is Ice.UnknownUserException { // Operation doesn't throw, but locate() and finished() throw TestIntfUserException. } do { - _ = try obj.impossibleException(true) + _ = try await obj.impossibleException(true) try helper.test(false) } catch is Ice.UnknownUserException { // Operation throws TestImpossibleException, but locate() and finished() throw TestIntfUserException. } do { - _ = try obj.intfUserException(false) + _ = try await obj.intfUserException(false) try helper.test(false) } catch is TestImpossibleException { // Operation doesn't throw, but locate() and finished() throw TestImpossibleException. } do { - _ = try obj.intfUserException(true) + _ = try await obj.intfUserException(true) try helper.test(false) } catch is TestImpossibleException { // Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException. } } -func allTests(_ helper: TestHelper) throws -> TestIntfPrx { +func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -98,14 +98,14 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.writeLine("ok") output.write("testing checked cast... ") - var obj = try checkedCast(prx: base, type: TestIntfPrx.self)! + var obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! try test(obj == base) output.writeLine("ok") output.write("testing ice_ids... ") do { let o = try communicator.stringToProxy("category/locate:\(helper.getTestEndpoint(num: 0))")! - _ = try o.ice_ids() + _ = try await o.ice_ids() try test(false) } catch let ex as Ice.UnknownUserException { try test(ex.message.contains("::Test::TestIntfUserException")) @@ -113,7 +113,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { do { let o = try communicator.stringToProxy("category/finished:\(helper.getTestEndpoint(num: 0))")! - _ = try o.ice_ids() + _ = try await o.ice_ids() try test(false) } catch let ex as Ice.UnknownUserException { try test(ex.message.contains("::Test::TestIntfUserException")) @@ -122,9 +122,9 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("testing servant locator...") base = try communicator.stringToProxy("category/locate:\(helper.getTestEndpoint(num: 0))")! - obj = try checkedCast(prx: base, type: TestIntfPrx.self)! + obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! do { - _ = try checkedCast( + _ = try await checkedCast( prx: communicator.stringToProxy("category/unknown:\(helper.getTestEndpoint(num: 0))")!, type: TestIntfPrx.self) } catch is Ice.ObjectNotExistException {} @@ -132,18 +132,18 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("testing default servant locator...") base = try communicator.stringToProxy("anothercat/locate:\(helper.getTestEndpoint(num: 0))")! - obj = try checkedCast(prx: base, type: TestIntfPrx.self)! + obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! base = try communicator.stringToProxy("locate:\(helper.getTestEndpoint(num: 0))")! - obj = try checkedCast(prx: base, type: TestIntfPrx.self)! + obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! do { - _ = try checkedCast( + _ = try await checkedCast( prx: communicator.stringToProxy("anothercat/unknown:\(helper.getTestEndpoint(num: 0))")!, type: TestIntfPrx.self) } catch is Ice.ObjectNotExistException {} do { - _ = try checkedCast( + _ = try await checkedCast( prx: communicator.stringToProxy("unknown:\(helper.getTestEndpoint(num: 0))")!, type: TestIntfPrx.self) } catch is Ice.ObjectNotExistException {} @@ -151,20 +151,20 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("testing locate exceptions... ") base = try communicator.stringToProxy("category/locate:\(helper.getTestEndpoint(num: 0))")! - obj = try checkedCast(prx: base, type: TestIntfPrx.self)! - try testExceptions(obj, helper) + obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! + try await testExceptions(obj, helper) output.writeLine("ok") output.write("testing finished exceptions... ") base = try communicator.stringToProxy("category/finished:\(helper.getTestEndpoint(num: 0))")! - obj = try checkedCast(prx: base, type: TestIntfPrx.self)! - try testExceptions(obj, helper) + obj = try await checkedCast(prx: base, type: TestIntfPrx.self)! + try await testExceptions(obj, helper) // // Only call these for category/finished. // do { - try obj.asyncResponse() + try await obj.asyncResponse() } catch is TestIntfUserException { try test(false) } catch is TestImpossibleException { @@ -177,7 +177,7 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // Only call these for category/finished. // do { - try obj.asyncException() + try await obj.asyncException() } catch is TestIntfUserException { try test(false) } catch is TestImpossibleException { @@ -189,19 +189,19 @@ func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("testing servant locator removal... ") base = try communicator.stringToProxy("test/activation:\(helper.getTestEndpoint(num: 0))")! - let activation = try checkedCast(prx: base, type: TestActivationPrx.self)! - try activation.activateServantLocator(false) + let activation = try await checkedCast(prx: base, type: TestActivationPrx.self)! + try await activation.activateServantLocator(false) do { - try obj.ice_ping() + try await obj.ice_ping() try test(false) } catch is Ice.ObjectNotExistException { output.writeLine("ok") } output.write("testing servant locator addition... ") - try activation.activateServantLocator(true) + try await activation.activateServantLocator(true) do { - try obj.ice_ping() + try await obj.ice_ping() output.writeLine("ok") } catch { try test(false) diff --git a/swift/test/Ice/servantLocator/Client.swift b/swift/test/Ice/servantLocator/Client.swift index fde71b927b7..d8150d49db1 100644 --- a/swift/test/Ice/servantLocator/Client.swift +++ b/swift/test/Ice/servantLocator/Client.swift @@ -12,7 +12,7 @@ public class Client: TestHelperI { defer { communicator.destroy() } - let obj = try allTests(self) - try obj.shutdown() + let obj = try await allTests(self) + try await obj.shutdown() } } diff --git a/swift/test/Ice/servantLocator/Collocated.swift b/swift/test/Ice/servantLocator/Collocated.swift index e7602342cf6..b11ec20c35d 100644 --- a/swift/test/Ice/servantLocator/Collocated.swift +++ b/swift/test/Ice/servantLocator/Collocated.swift @@ -26,6 +26,6 @@ class Collocated: TestHelperI { servant: TestActivationDisp(TestActivationI(self)), id: Ice.stringToIdentity("test/activation")) // try adapter.activate() // Don't activate OA to ensure collocation is used. - _ = try allTests(self) + _ = try await allTests(self) } } diff --git a/swift/test/Ice/services/Client.swift b/swift/test/Ice/services/Client.swift index f4b97fbda08..8de48eab2f7 100644 --- a/swift/test/Ice/services/Client.swift +++ b/swift/test/Ice/services/Client.swift @@ -22,7 +22,7 @@ public class Client: TestHelperI { prx: communicator.stringToProxy("test:\(getTestEndpoint(num: 0))")!, type: Glacier2.RouterPrx.self) do { - _ = try router.createSession(userId: "foo", password: "bar") + _ = try await router.createSession(userId: "foo", password: "bar") try test(false) } catch is LocalException { // expected @@ -39,7 +39,7 @@ public class Client: TestHelperI { let topicName = "time" var topic: TopicPrx? do { - topic = try manager.retrieve(topicName) + topic = try await manager.retrieve(topicName) try test(false) } catch is NoSuchTopic { try test(false) @@ -48,7 +48,7 @@ public class Client: TestHelperI { } // topic is always nil, we're just checking the API compiling/linking here - let publisher = try topic?.subscribeAndGetPublisher(theQoS: QoS(), subscriber: nil) + let publisher = try await topic?.subscribeAndGetPublisher(theQoS: QoS(), subscriber: nil) try test(publisher == nil) out.writeLine("ok") } @@ -61,14 +61,14 @@ public class Client: TestHelperI { var session: AdminSessionPrx? do { - session = try registry.createAdminSession(userId: "foo", password: "bar") + session = try await registry.createAdminSession(userId: "foo", password: "bar") try test(false) } catch is LocalException { // expected } // session is always nil, we're just checking the API - let admin = try session?.getAdmin() + let admin = try await session?.getAdmin() try test(admin == nil) out.writeLine("ok") } diff --git a/swift/test/Ice/slicing/exceptions/AllTests.swift b/swift/test/Ice/slicing/exceptions/AllTests.swift index 9d2c23675b8..4bb9dc3c413 100644 --- a/swift/test/Ice/slicing/exceptions/AllTests.swift +++ b/swift/test/Ice/slicing/exceptions/AllTests.swift @@ -17,22 +17,13 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.writeLine("ok") output.write("testing checked cast... ") - let testPrx = try checkedCast(prx: base, type: TestIntfPrx.self)! + let testPrx = try await checkedCast(prx: base, type: TestIntfPrx.self)! try test(testPrx == base) output.writeLine("ok") output.write("base... ") do { - try testPrx.baseAsBase() - try test(false) - } catch let b as Base { - try test(b.b == "Base.b") - } - output.writeLine("ok") - - output.write("base (AMI)... ") - do { - try await testPrx.baseAsBaseAsync() + try await testPrx.baseAsBase() try test(false) } catch let b as Base { try test(b.b == "Base.b") @@ -41,16 +32,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of unknown derived... ") do { - try testPrx.unknownDerivedAsBase() - try test(false) - } catch let b as Base { - try test(b.b == "UnknownDerived.b") - } - output.writeLine("ok") - - output.write("slicing of unknown derived (AMI)... ") - do { - try await testPrx.unknownDerivedAsBaseAsync() + try await testPrx.unknownDerivedAsBase() try test(false) } catch let b as Base { try test(b.b == "UnknownDerived.b") @@ -59,17 +41,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("non-slicing of known derived as base... ") do { - try testPrx.knownDerivedAsBase() - try test(false) - } catch let k as KnownDerived { - try test(k.b == "KnownDerived.b") - try test(k.kd == "KnownDerived.kd") - } - output.writeLine("ok") - - output.write("non-slicing of known derived as base (AMI)... ") - do { - try await testPrx.knownDerivedAsBaseAsync() + try await testPrx.knownDerivedAsBase() try test(false) } catch let k as KnownDerived { try test(k.b == "KnownDerived.b") @@ -79,17 +51,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("non-slicing of known derived as derived... ") do { - try testPrx.knownDerivedAsKnownDerived() - try test(false) - } catch let k as KnownDerived { - try test(k.b == "KnownDerived.b") - try test(k.kd == "KnownDerived.kd") - } - output.writeLine("ok") - - output.write("non-slicing of known derived as derived (AMI)... ") - do { - try await testPrx.knownDerivedAsKnownDerivedAsync() + try await testPrx.knownDerivedAsKnownDerived() try test(false) } catch let k as KnownDerived { try test(k.b == "KnownDerived.b") @@ -99,16 +61,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of unknown intermediate as base... ") do { - try testPrx.unknownIntermediateAsBase() - try test(false) - } catch let b as Base { - try test(b.b == "UnknownIntermediate.b") - } - output.writeLine("ok") - - output.write("slicing of unknown intermediate as base (AMI)... ") - do { - try await testPrx.unknownIntermediateAsBaseAsync() + try await testPrx.unknownIntermediateAsBase() try test(false) } catch let b as Base { try test(b.b == "UnknownIntermediate.b") @@ -117,17 +70,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of known intermediate as base... ") do { - try testPrx.knownIntermediateAsBase() - try test(false) - } catch let ki as KnownIntermediate { - try test(ki.b == "KnownIntermediate.b") - try test(ki.ki == "KnownIntermediate.ki") - } - output.writeLine("ok") - - output.write("slicing of known intermediate as base (AMI)... ") - do { - try await testPrx.knownIntermediateAsBaseAsync() + try await testPrx.knownIntermediateAsBase() try test(false) } catch let ki as KnownIntermediate { try test(ki.b == "KnownIntermediate.b") @@ -137,18 +80,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of known most derived as base... ") do { - try testPrx.knownMostDerivedAsBase() - try test(false) - } catch let kmd as KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } - output.writeLine("ok") - - output.write("slicing of known most derived as base (AMI)... ") - do { - try await testPrx.knownMostDerivedAsBaseAsync() + try await testPrx.knownMostDerivedAsBase() try test(false) } catch let kmd as KnownMostDerived { try test(kmd.b == "KnownMostDerived.b") @@ -159,17 +91,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("non-slicing of known intermediate as intermediate... ") do { - try testPrx.knownIntermediateAsKnownIntermediate() - try test(false) - } catch let ki as KnownIntermediate { - try test(ki.b == "KnownIntermediate.b") - try test(ki.ki == "KnownIntermediate.ki") - } - output.writeLine("ok") - - output.write("non-slicing of known intermediate as intermediate (AMI)... ") - do { - try await testPrx.knownIntermediateAsKnownIntermediateAsync() + try await testPrx.knownIntermediateAsKnownIntermediate() try test(false) } catch let ki as KnownIntermediate { try test(ki.b == "KnownIntermediate.b") @@ -179,18 +101,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("non-slicing of known most derived as intermediate... ") do { - try testPrx.knownMostDerivedAsKnownIntermediate() - try test(false) - } catch let kmd as KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } - output.writeLine("ok") - - output.write("non-slicing of known most derived as intermediate (AMI)... ") - do { - try await testPrx.knownMostDerivedAsKnownIntermediateAsync() + try await testPrx.knownMostDerivedAsKnownIntermediate() try test(false) } catch let kmd as KnownMostDerived { try test(kmd.b == "KnownMostDerived.b") @@ -201,18 +112,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("non-slicing of known most derived as most derived... ") do { - try testPrx.knownMostDerivedAsKnownMostDerived() - try test(false) - } catch let kmd as KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } - output.writeLine("ok") - - output.write("non-slicing of known most derived as most derived (AMI)... ") - do { - try await testPrx.knownMostDerivedAsKnownMostDerivedAsync() + try await testPrx.knownMostDerivedAsKnownMostDerived() try test(false) } catch let kmd as KnownMostDerived { try test(kmd.b == "KnownMostDerived.b") @@ -223,17 +123,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of unknown most derived, known intermediate as base... ") do { - try testPrx.unknownMostDerived1AsBase() - try test(false) - } catch let ki as KnownIntermediate { - try test(ki.b == "UnknownMostDerived1.b") - try test(ki.ki == "UnknownMostDerived1.ki") - } - output.writeLine("ok") - - output.write("slicing of unknown most derived, known intermediate as base (AMI)... ") - do { - try await testPrx.unknownMostDerived1AsBaseAsync() + try await testPrx.unknownMostDerived1AsBase() try test(false) } catch let ki as KnownIntermediate { try test(ki.b == "UnknownMostDerived1.b") @@ -243,17 +133,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of unknown most derived, known intermediate as intermediate... ") do { - try testPrx.unknownMostDerived1AsKnownIntermediate() - try test(false) - } catch let ki as KnownIntermediate { - try test(ki.b == "UnknownMostDerived1.b") - try test(ki.ki == "UnknownMostDerived1.ki") - } - output.writeLine("ok") - - output.write("slicing of unknown most derived, known intermediate as intermediate (AMI)... ") - do { - try await testPrx.unknownMostDerived1AsKnownIntermediateAsync() + try await testPrx.unknownMostDerived1AsKnownIntermediate() try test(false) } catch let ki as KnownIntermediate { try test(ki.b == "UnknownMostDerived1.b") @@ -263,16 +143,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("slicing of unknown most derived, unknown intermediate thrown as base... ") do { - try testPrx.unknownMostDerived2AsBase() - try test(false) - } catch let b as Base { - try test(b.b == "UnknownMostDerived2.b") - } - output.writeLine("ok") - - output.write("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... ") - do { - try await testPrx.unknownMostDerived2AsBaseAsync() + try await testPrx.unknownMostDerived2AsBase() try test(false) } catch let b as Base { try test(b.b == "UnknownMostDerived2.b") diff --git a/swift/test/Ice/slicing/exceptions/Client.swift b/swift/test/Ice/slicing/exceptions/Client.swift index 6e9e8135b6a..50c2fc89adf 100644 --- a/swift/test/Ice/slicing/exceptions/Client.swift +++ b/swift/test/Ice/slicing/exceptions/Client.swift @@ -13,6 +13,6 @@ public class Client: TestHelperI { communicator.destroy() } let testIntf = try await allTests(self) - try testIntf.shutdown() + try await testIntf.shutdown() } } diff --git a/swift/test/Ice/slicing/objects/AllTests.swift b/swift/test/Ice/slicing/objects/AllTests.swift index ac67ec3267d..3455f6ed6ee 100644 --- a/swift/test/Ice/slicing/objects/AllTests.swift +++ b/swift/test/Ice/slicing/objects/AllTests.swift @@ -109,23 +109,13 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.writeLine("ok") output.write("testing checked cast... ") - let testPrx = try checkedCast(prx: basePrx, type: TestIntfPrx.self)! + let testPrx = try await checkedCast(prx: basePrx, type: TestIntfPrx.self)! try test(testPrx == basePrx) output.writeLine("ok") output.write("base as Object... ") do { - let o = try testPrx.SBaseAsObject() - let sb = o as! SBase - try test(sb.ice_id() == "::Test::SBase") - try test(sb.sb == "SBase.sb") - breakCycles(sb) - } - output.writeLine("ok") - - output.write("base as Object (AMI)... ") - do { - let o = try await testPrx.SBaseAsObjectAsync() + let o = try await testPrx.SBaseAsObject() let sb = o as! SBase try test(sb.ice_id() == "::Test::SBase") try test(sb.sb == "SBase.sb") @@ -135,15 +125,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("base as base... ") do { - let sb = try testPrx.SBaseAsSBase()! - try test(sb.sb == "SBase.sb") - breakCycles(sb) - } - output.writeLine("ok") - - output.write("base as base (AMI)... ") - do { - let sb = try await testPrx.SBaseAsSBaseAsync()! + let sb = try await testPrx.SBaseAsSBase()! try test(sb.sb == "SBase.sb") breakCycles(sb) } @@ -151,17 +133,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("base with known derived as base... ") do { - let sb = try testPrx.SBSKnownDerivedAsSBase()! - try test(sb.sb == "SBSKnownDerived.sb") - let sbskd = sb as! SBSKnownDerived - try test(sbskd.sbskd == "SBSKnownDerived.sbskd") - breakCycles(sbskd) - } - output.writeLine("ok") - - output.write("base with known derived as base (AMI)... ") - do { - let sb = try await testPrx.SBSKnownDerivedAsSBaseAsync()! + let sb = try await testPrx.SBSKnownDerivedAsSBase()! try test(sb.sb == "SBSKnownDerived.sb") let sbskd = sb as! SBSKnownDerived try test(sbskd.sbskd == "SBSKnownDerived.sbskd") @@ -171,15 +143,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("base with known derived as known derived... ") do { - let sbskd = try testPrx.SBSKnownDerivedAsSBSKnownDerived()! - try test(sbskd.sbskd == "SBSKnownDerived.sbskd") - breakCycles(sbskd) - } - output.writeLine("ok") - - output.write("base with known derived as known derived (AMI)... ") - do { - let sbskd = try await testPrx.SBSKnownDerivedAsSBSKnownDerivedAsync()! + let sbskd = try await testPrx.SBSKnownDerivedAsSBSKnownDerived()! try test(sbskd.sbskd == "SBSKnownDerived.sbskd") breakCycles(sbskd) } @@ -187,14 +151,14 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("base with unknown derived as base... ") do { - let sb = try testPrx.SBSUnknownDerivedAsSBase()! + let sb = try await testPrx.SBSUnknownDerivedAsSBase()! try test(sb.sb == "SBSUnknownDerived.sb") breakCycles(sb) } if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { do { - let sb = try testPrx.SBSUnknownDerivedAsSBaseCompact()! + let sb = try await testPrx.SBSUnknownDerivedAsSBaseCompact()! try test(sb.sb == "SBSUnknownDerived.sb") breakCycles(sb) } @@ -204,36 +168,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { // This test fails when using the compact format because the instance cannot // be sliced to a known type. // - _ = try testPrx.SBSUnknownDerivedAsSBaseCompact() - try test(false) - } catch is Ice.MarshalException { // Expected. - } - } - output.writeLine("ok") - - output.write("base with unknown derived as base (AMI)... ") - do { - let sb = try await testPrx.SBSUnknownDerivedAsSBaseAsync()! - try test(sb.sb == "SBSUnknownDerived.sb") - breakCycles(sb) - } - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - // - // This test succeeds for the 1.0 encoding. - // - do { - let sb = try await testPrx.SBSUnknownDerivedAsSBaseCompactAsync()! - try test(sb.sb == "SBSUnknownDerived.sb") - breakCycles(sb) - } - } else { - // - // This test fails when using the compact format because the instance cannot - // be sliced to a known type. - // - do { - _ = try await testPrx.SBSUnknownDerivedAsSBaseCompactAsync() + _ = try await testPrx.SBSUnknownDerivedAsSBaseCompact() try test(false) } catch is Ice.MarshalException { // Expected. } @@ -242,54 +177,21 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("unknown with Object as Object... ") do { - let o = try testPrx.SUnknownAsObject()! + let o = try await testPrx.SUnknownAsObject()! try test(testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0) try test(o is Ice.UnknownSlicedValue) try test((o as! Ice.UnknownSlicedValue).ice_id() == "::Test::SUnknown") try test((o as! Ice.UnknownSlicedValue).ice_getSlicedData() != nil) - try testPrx.checkSUnknown(o) + try await testPrx.checkSUnknown(o) (o as! Ice.UnknownSlicedValue).ice_getSlicedData()!.clear() } catch is Ice.MarshalException { try test(testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0) } output.writeLine("ok") - output.write("unknown with Object as Object (AMI)... ") - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - do { - _ = try await testPrx.SUnknownAsObjectAsync() - try test(false) - } catch is Ice.MarshalException { // Expected. - } - - } else { - do { - let o = try await testPrx.SUnknownAsObjectAsync()! - if let unknown = o as? Ice.UnknownSlicedValue { - try test(unknown.ice_id() == "::Test::SUnknown") - unknown.ice_getSlicedData()!.clear() - } else { - try test(false) - } - } catch is Ice.MarshalException { - try test(false) - } - } - output.writeLine("ok") - output.write("one-element cycle... ") do { - let b = try testPrx.oneElementCycle()! - try test(b.ice_id() == "::Test::B") - try test(b.sb == "B1.sb") - try test(b.pb === b) - breakCycles(b) - } - output.writeLine("ok") - - output.write("one-element cycle (AMI)... ") - do { - let b = try await testPrx.oneElementCycleAsync()! + let b = try await testPrx.oneElementCycle()! try test(b.ice_id() == "::Test::B") try test(b.sb == "B1.sb") try test(b.pb === b) @@ -299,20 +201,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("two-element cycle... ") do { - let b1 = try testPrx.twoElementCycle()! - try test(b1.ice_id() == "::Test::B") - try test(b1.sb == "B1.sb") - let b2 = b1.pb! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "B2.sb") - try test(b2.pb === b1) - breakCycles(b1) - } - output.writeLine("ok") - - output.write("two-element cycle (AMI)... ") - do { - let b1 = try await testPrx.twoElementCycleAsync()! + let b1 = try await testPrx.twoElementCycle()! try test(b1.ice_id() == "::Test::B") try test(b1.sb == "B1.sb") let b2 = b1.pb! @@ -325,36 +214,11 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("known derived pointer slicing as base... ") do { - let b1 = try testPrx.D1AsB()! - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb !== nil) - try test(b1.pb !== b1) - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 !== nil) - try test(d1.pd1 !== b1) - try test(b1.pb === d1.pd1) - } else { - try test(false) - } - - let b2 = b1.pb! - try test(b2.pb === b1) - try test(b2.sb == "D2.sb") - try test(b2.ice_id() == "::Test::B") - breakCycles(b1) - } - output.writeLine("ok") - - output.write("known derived pointer slicing as base (AMI)... ") - do { - let b1 = try await testPrx.D1AsBAsync()! + let b1 = try await testPrx.D1AsB()! try test(b1.ice_id() == "::Test::D1") try test(b1.sb == "D1.sb") try test(b1.pb !== nil) try test(b1.pb !== b1) - if let d1 = b1 as? D1 { try test(d1.sd1 == "D1.sd1") try test(d1.pd1 !== nil) @@ -374,23 +238,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("known derived pointer slicing as derived... ") do { - let d1 = try testPrx.D1AsD1()! - try test(d1.ice_id() == "::Test::D1") - try test(d1.sb == "D1.sb") - try test(d1.pb !== nil) - try test(d1.pb !== d1) - - let b2 = d1.pb! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb === d1) - breakCycles(d1) - } - output.writeLine("ok") - - output.write("known derived pointer slicing as derived (AMI)... ") - do { - let d1 = try await testPrx.D1AsD1Async()! + let d1 = try await testPrx.D1AsD1()! try test(d1.ice_id() == "::Test::D1") try test(d1.sb == "D1.sb") try test(d1.pb !== nil) @@ -406,29 +254,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("unknown derived pointer slicing as base... ") do { - let b2 = try testPrx.D2AsB()! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb !== nil) - try test(b2.pb !== b2) - - let b1 = b2.pb! - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb === b2) - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - breakCycles(b2) - } else { - try test(false) - } - } - output.writeLine("ok") - - output.write("unknown derived pointer slicing as base (AMI)... ") - do { - let b2 = try await testPrx.D2AsBAsync()! + let b2 = try await testPrx.D2AsB()! try test(b2.ice_id() == "::Test::B") try test(b2.sb == "D2.sb") try test(b2.pb !== nil) @@ -450,28 +276,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("param ptr slicing with known first... ") do { - let (b1, b2) = try testPrx.paramTest1() - try test(b1 !== nil) - try test(b1!.ice_id() == "::Test::D1") - try test(b1!.sb == "D1.sb") - try test(b1!.pb === b2) - let d1 = b1 as! D1 - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - - try test(b2 !== nil) - // No factory, must be sliced - try test(b2!.ice_id() == "::Test::B") - try test(b2!.sb == "D2.sb") - try test(b2!.pb === b1) - breakCycles(b1!) - breakCycles(b2!) - } - output.writeLine("ok") - - output.write("param ptr slicing with known first (AMI)... ") - do { - let (b1, b2) = try await testPrx.paramTest1Async() + let (b1, b2) = try await testPrx.paramTest1() try test(b1 !== nil) try test(b1!.ice_id() == "::Test::D1") try test(b1!.sb == "D1.sb") @@ -492,34 +297,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("param ptr slicing with unknown first... ") do { - let (o2, o1) = try testPrx.paramTest2() - try test(o1 != nil && o2 != nil) - - let b1 = o1! - let b2 = o2! - - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb === b2) - - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - } else { - try test(false) - } - // No factory, must be sliced - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb === b1) - breakCycles(b1) - breakCycles(b2) - } - output.writeLine("ok") - - output.write("param ptr slicing with unknown first (AMI)... ") - do { - let (o2, o1) = try await testPrx.paramTest2Async() + let (o2, o1) = try await testPrx.paramTest2() try test(o1 != nil && o2 != nil) let b1 = o1! @@ -546,16 +324,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("return value identity with known first... ") do { - let (ret, p1, p2) = try testPrx.returnTest1() - try test(ret === p1) - breakCycles(ret!) - breakCycles(p2!) - } - output.writeLine("ok") - - output.write("return value identity with known first (AMI)... ") - do { - let (ret, p1, p2) = try await testPrx.returnTest1Async() + let (ret, p1, p2) = try await testPrx.returnTest1() try test(ret === p1) breakCycles(ret!) breakCycles(p2!) @@ -564,15 +333,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("return value identity with unknown first... ") do { - let (ret, p1, _) = try testPrx.returnTest2() - try test(ret === p1) - breakCycles(ret!) - } - output.writeLine("ok") - - output.write("return value identity with unknown first (AMI)... ") - do { - let (ret, p1, _) = try await testPrx.returnTest2Async() + let (ret, p1, _) = try await testPrx.returnTest2() try test(ret === p1) breakCycles(ret!) } @@ -591,7 +352,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { d1.pb = d3 d1.pd1 = d3 - let b1 = try testPrx.returnTest3(p1: d1, p2: d3)! + let b1 = try await testPrx.returnTest3(p1: d1, p2: d3)! try test(b1.sb == "D1.sb") try test(b1.ice_id() == "::Test::D1") @@ -628,58 +389,6 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { } output.writeLine("ok") - output.write("return value identity for input params known first (AMI)... ") - do { - let d1 = D1() - d1.sb = "D1.sb" - d1.sd1 = "D1.sd1" - let d3 = D3() - d3.pb = d1 - d3.sb = "D3.sb" - d3.sd3 = "D3.sd3" - d3.pd3 = d1 - d1.pb = d3 - d1.pd1 = d3 - - do { - let b1 = try await testPrx.returnTest3Async(p1: d1, p2: d3)! - try test(b1.sb == "D1.sb") - try test(b1.ice_id() == "::Test::D1") - - let p1 = b1 as? D1 - if p1 !== nil { - try test(p1!.sd1 == "D1.sd1") - try test(p1!.pd1 === b1.pb) - } else { - try test(false) - } - - let b2 = b1.pb! - try test(b2.sb == "D3.sb") - try test(b2.pb === b1) - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(b2 is D3)) - } else { - if let p3 = b2 as? D3 { - try test(p3.pd3 === p1!) - try test(p3.sd3 == "D3.sd3") - } else { - try test(false) - } - } - - try test(b1 !== d1) - try test(b1 !== d3) - try test(b2 !== d1) - try test(b2 !== d3) - breakCycles(b1) - breakCycles(d1) - breakCycles(d3) - } - output.writeLine("ok") - } - output.write("return value identity for input params unknown first... ") do { let d1 = D1() @@ -693,7 +402,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { d1.pb = d3 d1.pd1 = d3 - let b1 = try testPrx.returnTest3(p1: d3, p2: d1)! + let b1 = try await testPrx.returnTest3(p1: d3, p2: d1)! try test(b1.sb == "D3.sb") @@ -729,134 +438,35 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { } output.writeLine("ok") - output.write("return value identity for input params unknown first (AMI)... ") + output.write("remainder unmarshaling (3 instances)... ") do { - let d1 = D1() - d1.sb = "D1.sb" - d1.sd1 = "D1.sd1" - let d3 = D3() - d3.pb = d1 - d3.sb = "D3.sb" - d3.sd3 = "D3.sd3" - d3.pd3 = d1 - d1.pb = d3 - d1.pd1 = d3 + let (ret1, o1, o2) = try await testPrx.paramTest3() + try test(o1 != nil) + let p1 = o1! + try test(p1.sb == "D2.sb (p1 1)") + try test(p1.pb == nil) + try test(p1.ice_id() == "::Test::B") - let b = try await testPrx.returnTest3Async(p1: d3, p2: d1) - try test(b != nil) + try test(o2 != nil) + let p2 = o2! + try test(p2.sb == "D2.sb (p2 1)") + try test(p2.pb == nil) + try test(p2.ice_id() == "::Test::B") - let b1 = b! - - try test(b1.sb == "D3.sb") - - let b2 = b1.pb! - try test(b2.sb == "D1.sb") - try test(b2.ice_id() == "::Test::D1") - try test(b2.pb === b1) - if let p3 = b2 as? D1 { - try test(p3.sd1 == "D1.sd1") - try test(p3.pd1 === b1) - } else { - try test(false) - } - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(b1 is D3)) - } else { - if let p1 = b1 as? D3 { - try test(p1.sd3 == "D3.sd3") - try test(p1.pd3 === b2) - } else { - try test(false) - } - } - - try test(b1 !== d1) - try test(b1 !== d3) - try test(b2 !== d1) - try test(b2 !== d3) - breakCycles(b1) - breakCycles(d1) - breakCycles(d3) - } - output.writeLine("ok") - - output.write("remainder unmarshaling (3 instances)... ") - do { - let (ret1, o1, o2) = try testPrx.paramTest3() - try test(o1 != nil) - let p1 = o1! - try test(p1.sb == "D2.sb (p1 1)") - try test(p1.pb == nil) - try test(p1.ice_id() == "::Test::B") - - try test(o2 != nil) - let p2 = o2! - try test(p2.sb == "D2.sb (p2 1)") - try test(p2.pb == nil) - try test(p2.ice_id() == "::Test::B") - - try test(ret1 != nil) - let ret = ret1! - try test(ret.sb == "D1.sb (p2 2)") - try test(ret.pb == nil) - try test(ret.ice_id() == "::Test::D1") - breakCycles(ret) - breakCycles(p1) - breakCycles(p2) - } - output.writeLine("ok") - - output.write("remainder unmarshaling (3 instances) (AMI)... ") - do { - let (ret1, o1, o2) = try await testPrx.paramTest3Async() - - try test(o1 != nil) - let p1 = o1! - try test(p1.sb == "D2.sb (p1 1)") - try test(p1.pb == nil) - try test(p1.ice_id() == "::Test::B") - - try test(o2 != nil) - let p2 = o2! - try test(p2.sb == "D2.sb (p2 1)") - try test(p2.pb == nil) - try test(p2.ice_id() == "::Test::B") - - try test(ret1 != nil) - let ret = ret1! - try test(ret.sb == "D1.sb (p2 2)") - try test(ret.pb == nil) - try test(ret.ice_id() == "::Test::D1") - breakCycles(ret) - breakCycles(p1) - breakCycles(p2) - } - output.writeLine("ok") + try test(ret1 != nil) + let ret = ret1! + try test(ret.sb == "D1.sb (p2 2)") + try test(ret.pb == nil) + try test(ret.ice_id() == "::Test::D1") + breakCycles(ret) + breakCycles(p1) + breakCycles(p2) + } + output.writeLine("ok") output.write("remainder unmarshaling (4 instances)... ") do { - let (ret1, b1) = try testPrx.paramTest4() - - try test(b1 != nil) - let b = b1! - try test(b.sb == "D4.sb (1)") - try test(b.pb == nil) - try test(b.ice_id() == "::Test::B") - - try test(ret1 != nil) - let ret = ret1! - try test(ret.sb == "B.sb (2)") - try test(ret.pb == nil) - try test(ret.ice_id() == "::Test::B") - breakCycles(ret) - breakCycles(b) - } - output.writeLine("ok") - - output.write("remainder unmarshaling (4 instances) (AMI)... ") - do { - let (ret1, b1) = try await testPrx.paramTest4Async() + let (ret1, b1) = try await testPrx.paramTest4() try test(b1 != nil) let b = b1! @@ -872,7 +482,6 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { breakCycles(ret) breakCycles(b) } - output.writeLine("ok") output.write("param ptr slicing, instance marshaled in unknown derived as base... ") @@ -891,7 +500,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { b2.sb = "B.sb(2)" b2.pb = b1 - let ret = try testPrx.returnTest3(p1: d3, p2: b2)! + let ret = try await testPrx.returnTest3(p1: d3, p2: b2)! try test(ret.sb == "D3.sb") try test(ret.pb === ret) @@ -915,47 +524,6 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { } output.writeLine("ok") - output.write("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ") - do { - let b1 = B() - b1.sb = "B.sb(1)" - b1.pb = b1 - - let d3 = D3() - d3.sb = "D3.sb" - d3.pb = d3 - d3.sd3 = "D3.sd3" - d3.pd3 = b1 - - let b2 = B() - b2.sb = "B.sb(2)" - b2.pb = b1 - - let r = try await testPrx.returnTest3Async(p1: d3, p2: b2) - try test(r != nil) - let ret = r! - try test(ret.sb == "D3.sb") - try test(ret.pb === ret) - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(ret is D3)) - } else { - if let p3 = ret as? D3 { - try test(p3.sd3 == "D3.sd3") - try test(p3.pd3!.ice_id() == "::Test::B") - try test(p3.pd3!.sb == "B.sb(1)") - try test(p3.pd3!.pb === p3.pd3) - } else { - try test(false) - } - } - - breakCycles(ret) - breakCycles(b1) - breakCycles(d3) - } - output.writeLine("ok") - output.write("param ptr slicing, instance marshaled in unknown derived as derived... ") do { let d11 = D1() @@ -975,38 +543,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { d12.sd1 = "D1.sd1(2)" d12.pd1 = d11 - let ret = try testPrx.returnTest3(p1: d3, p2: d12)! - try test(ret.sb == "D3.sb") - try test(ret.pb === ret) - breakCycles(d3) - breakCycles(d11) - breakCycles(d12) - breakCycles(ret) - } - output.writeLine("ok") - - output.write("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ") - do { - let d11 = D1() - d11.sb = "D1.sb(1)" - d11.pb = d11 - d11.sd1 = "D1.sd1(1)" - - let d3 = D3() - d3.sb = "D3.sb" - d3.pb = d3 - d3.sd3 = "D3.sd3" - d3.pd3 = d11 - - let d12 = D1() - d12.sb = "D1.sb(2)" - d12.pb = d12 - d12.sd1 = "D1.sd1(2)" - d12.pd1 = d11 - - let r = try await testPrx.returnTest3Async(p1: d3, p2: d12) - try test(r != nil) - let ret = r! + let ret = try await testPrx.returnTest3(p1: d3, p2: d12)! try test(ret.sb == "D3.sb") try test(ret.pb === ret) breakCycles(d3) @@ -1058,7 +595,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { let ss2 = SS2() ss2.s = [ss2b, ss2d1, ss2d3] - let ss = try testPrx.sequenceTest(p1: ss1, p2: ss2) + let ss = try await testPrx.sequenceTest(p1: ss1, p2: ss2) breakCycles(ss1) breakCycles(ss2) @@ -1084,166 +621,23 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { try test(ss1b2!.ice_id() == "::Test::B") try test(ss1d2!.ice_id() == "::Test::D1") - try test(ss2b2!.ice_id() == "::Test::B") - try test(ss2d2!.ice_id() == "::Test::D1") - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(ss1d4!.ice_id() == "::Test::B") - try test(ss2d4!.ice_id() == "::Test::B") - } else { - try test(ss1d4!.ice_id() == "::Test::D3") - try test(ss2d4!.ice_id() == "::Test::D3") - } - - breakCycles(ss.c1!) - breakCycles(ss.c2!) - } - output.writeLine("ok") - - output.write("sequence slicing (AMI)... ") - do { - let ss1b = B() - ss1b.sb = "B.sb" - ss1b.pb = ss1b - - let ss1d1 = D1() - ss1d1.sb = "D1.sb" - ss1d1.sd1 = "D1.sd1" - ss1d1.pb = ss1b - - let ss1d3 = D3() - ss1d3.sb = "D3.sb" - ss1d3.sd3 = "D3.sd3" - ss1d3.pb = ss1b - - let ss2b = B() - ss2b.sb = "B.sb" - ss2b.pb = ss1b - - let ss2d1 = D1() - ss2d1.sb = "D1.sb" - ss2d1.sd1 = "D1.sd1" - ss2d1.pb = ss2b - - let ss2d3 = D3() - ss2d3.sb = "D3.sb" - ss2d3.sd3 = "D3.sd3" - ss2d3.pb = ss2b - - ss1d1.pd1 = ss2b - ss1d3.pd3 = ss2d1 - - ss2d1.pd1 = ss1d3 - ss2d3.pd3 = ss1d1 - - let ss1 = SS1() - ss1.s = [ss1b, ss1d1, ss1d3] - - let ss2 = SS2() - ss2.s = [ss2b, ss2d1, ss2d3] - - let ss = try await testPrx.sequenceTestAsync(p1: ss1, p2: ss2) - - breakCycles(ss1) - breakCycles(ss2) - - try test(ss.c1 != nil) - let ss1b2 = ss.c1!.s[0] - let ss1d2 = ss.c1!.s[1] - try test(ss.c2 != nil) - let ss1d4 = ss.c1!.s[2] - - try test(ss.c2 != nil) - let ss2b2 = ss.c2!.s[0] - let ss2d2 = ss.c2!.s[1] - let ss2d4 = ss.c2!.s[2] - - try test(ss1b2!.pb === ss1b2) - try test(ss1d2!.pb === ss1b2) - try test(ss1d4!.pb === ss1b2) - - try test(ss2b2!.pb === ss1b2) - try test(ss2d2!.pb === ss2b2) - try test(ss2d4!.pb === ss2b2) - - try test(ss1b2!.ice_id() == "::Test::B") - try test(ss1d2!.ice_id() == "::Test::D1") - - try test(ss2b2!.ice_id() == "::Test::B") - try test(ss2d2!.ice_id() == "::Test::D1") - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(ss1d4!.ice_id() == "::Test::B") - try test(ss2d4!.ice_id() == "::Test::B") - } else { - try test(ss1d4!.ice_id() == "::Test::D3") - try test(ss2d4!.ice_id() == "::Test::D3") - } - - breakCycles(ss.c1!) - breakCycles(ss.c2!) - } - output.writeLine("ok") - - output.write("dictionary slicing... ") - do { - var bin = [Int32: B]() - - for i: Int32 in 0..<10 { - let s = "D1.\(i)" - let d1 = D1() - d1.sb = s - d1.pb = d1 - d1.sd1 = s - bin[i] = d1 - } - - let (ret, bout) = try testPrx.dictionaryTest(bin) - - try test(bout.count == 10) - for i: Int32 in 0..<10 { - let b = bout[i * 10]!! - let s = "D1.\(i)" - try test(b.sb == s) - try test(b.pb !== nil) - try test(b.pb !== b) - try test(b.pb!.sb == s) - try test(b.pb!.pb === b.pb) - } - - try test(ret.count == 10) - for i: Int32 in 0..<10 { - let b = ret[i * 20]!! - let s = "D1.\(i * 20)" - try test(b.sb == s) - - if i == 0 { - try test(b.pb == nil) - } else { - try test(b.pb === ret[(i - 1) * 20]!) - } - - if let d1 = b as? D1 { - try test(d1.sd1 == s) - try test(d1.pd1 === d1) - } else { - try test(false) - } - } + try test(ss2b2!.ice_id() == "::Test::B") + try test(ss2d2!.ice_id() == "::Test::D1") - for i in bin { - breakCycles(i.value) - } - for i in bout where i.value != nil { - breakCycles(i.value!) - } - for i in ret where i.value != nil { - breakCycles(i.value!) + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(ss1d4!.ice_id() == "::Test::B") + try test(ss2d4!.ice_id() == "::Test::B") + } else { + try test(ss1d4!.ice_id() == "::Test::D3") + try test(ss2d4!.ice_id() == "::Test::D3") } + + breakCycles(ss.c1!) + breakCycles(ss.c2!) } output.writeLine("ok") - output.write("dictionary slicing (AMI)... ") + output.write("dictionary slicing... ") do { var bin = [Int32: B]() @@ -1256,7 +650,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { bin[i] = d1 } - let (ret, bout) = try await testPrx.dictionaryTestAsync(bin) + let (ret, bout) = try await testPrx.dictionaryTest(bin) try test(bout.count == 10) for i: Int32 in 0..<10 { @@ -1288,6 +682,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { try test(false) } } + for i in bin { breakCycles(i.value) } @@ -1302,20 +697,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("base exception thrown as base exception... ") do { - try testPrx.throwBaseAsBase() - try test(false) - } catch let e as BaseException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb") - try test(e.pb!.pb === e.pb) - breakCycles(e.pb!) - } - output.writeLine("ok") - - output.write("base exception thrown as base exception (AMI)... ") - do { - try await testPrx.throwBaseAsBaseAsync() + try await testPrx.throwBaseAsBase() try test(false) } catch let e as BaseException { try test(e.sbe == "sbe") @@ -1328,27 +710,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("derived exception thrown as base exception... ") do { - try testPrx.throwDerivedAsBase() - try test(false) - } catch let e as DerivedException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb1") - try test(e.pb!.pb === e.pb) - try test(e.sde == "sde1") - try test(e.pd1 != nil) - try test(e.pd1!.sb == "sb2") - try test(e.pd1!.pb === e.pd1) - try test(e.pd1!.sd1 == "sd2") - try test(e.pd1!.pd1 === e.pd1) - breakCycles(e.pb!) - breakCycles(e.pd1!) - } - output.writeLine("ok") - - output.write("derived exception thrown as base exception (AMI)... ") - do { - try await testPrx.throwDerivedAsBaseAsync() + try await testPrx.throwDerivedAsBase() try test(false) } catch let e as DerivedException { try test(e.sbe == "sbe") @@ -1368,27 +730,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("derived exception thrown as derived exception... ") do { - try testPrx.throwDerivedAsDerived() - try test(false) - } catch let e as DerivedException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb1") - try test(e.pb!.pb === e.pb) - try test(e.sde == "sde1") - try test(e.pd1 != nil) - try test(e.pd1!.sb == "sb2") - try test(e.pd1!.pb === e.pd1) - try test(e.pd1!.sd1 == "sd2") - try test(e.pd1!.pd1 === e.pd1) - breakCycles(e.pb!) - breakCycles(e.pd1!) - } - output.writeLine("ok") - - output.write("derived exception thrown as derived exception (AMI)... ") - do { - try await testPrx.throwDerivedAsDerivedAsync() + try await testPrx.throwDerivedAsDerived() try test(false) } catch let e as DerivedException { try test(e.sbe == "sbe") @@ -1408,20 +750,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("unknown derived exception thrown as base exception... ") do { - try testPrx.throwUnknownDerivedAsBase() - try test(false) - } catch let e as BaseException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb d2") - try test(e.pb!.pb === e.pb) - breakCycles(e.pb!) - } - output.writeLine("ok") - - output.write("unknown derived exception thrown as base exception (AMI)... ") - do { - try await testPrx.throwUnknownDerivedAsBaseAsync() + try await testPrx.throwUnknownDerivedAsBase() try test(false) } catch let e as BaseException { try test(e.sbe == "sbe") @@ -1434,15 +763,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { output.write("forward-declared class... ") do { - let f = try testPrx.useForward() - try test(f != nil) - breakCycles(f!) - } - output.writeLine("ok") - - output.write("forward-declared class (AMI)... ") - do { - let f = try await testPrx.useForwardAsync() + let f = try await testPrx.useForward() try test(f != nil) breakCycles(f!) } @@ -1470,7 +791,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { pd.ps = "preserved" pd.pb = pd - let r = try testPrx.exchangePBase(pd) + let r = try await testPrx.exchangePBase(pd) if let p2 = r as? PDerived { try test(p2.pi == 3) try test(p2.ps == "preserved") @@ -1490,7 +811,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { pu.pi = 3 pu.pu = "preserved" - let r = try testPrx.exchangePBase(pu)! + let r = try await testPrx.exchangePBase(pu)! try test(r.pi == 3) if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { @@ -1515,7 +836,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { pcd.pi = 3 pcd.pbs = [pcd] - let r = try testPrx.exchangePBase(pcd)! + let r = try await testPrx.exchangePBase(pcd)! if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { try test(!(r is PCDerived)) try test(r.pi == 3) @@ -1540,7 +861,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { pcd.pi = 3 pcd.pbs = [pcd] - let r = try testPrx.exchangePBase(pcd)! + let r = try await testPrx.exchangePBase(pcd)! if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { try test(!(r is CompactPCDerived)) try test(r.pi == 3) @@ -1578,7 +899,7 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { pcd.pcd2 = pcd.pi pcd.pcd3 = pcd.pbs[10] - let r = try testPrx.exchangePBase(pcd)! + let r = try await testPrx.exchangePBase(pcd)! if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { try test(!(r is PCDerived3)) try test(r is Preserved) @@ -1612,12 +933,12 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { // The preserved slices should be excluded for the 1.0 encoding, otherwise // they should be included. // - let p = try testPrx.PBSUnknownAsPreserved()! - try testPrx.checkPBSUnknown(p) + let p = try await testPrx.PBSUnknownAsPreserved()! + try await testPrx.checkPBSUnknown(p) if testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0 { let slicedData = p.ice_getSlicedData()! try test(slicedData.slices.count == 1) - try testPrx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p) + try await testPrx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p) } else { try test(p.ice_getSlicedData() == nil) } @@ -1625,186 +946,5 @@ public func allTests(_ helper: TestHelper) async throws -> TestIntfPrx { } catch is Ice.OperationNotExistException {} output.writeLine("ok") - output.write("preserved classes (AMI)... ") - // - // Register a factory in order to substitute our own subclass of Preserved. This provides - // an easy way to determine how many unmarshaled instances currently exist. - // - // We have to install this now (even though it's not necessary yet), because otherwise - // the Ice run time will install its own internal factory for Preserved upon receiving the - // first instance. - - do { - // - // Server knows the most-derived class PDerived. - // - let pd = PDerived() - pd.pi = 3 - pd.ps = "preserved" - pd.pb = pd - let r = try await testPrx.exchangePBaseAsync(pd) - - if let p2 = r as? PDerived { - try test(p2.pi == 3) - try test(p2.ps == "preserved") - try test(p2.pb === p2) - } else { - try test(false) - } - breakCycles(r!) - breakCycles(pd) - } catch is Ice.OperationNotExistException {} - - do { - // - // Server only knows the base (non-preserved) type, so the object is sliced. - // - let pu = PCUnknown() - pu.pi = 3 - pu.pu = "preserved" - - let ret = try await testPrx.exchangePBaseAsync(pu) - let r = ret! - - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is PCUnknown)) - } else { - if let p2 = r as? PCUnknown { - try test(p2.pu == "preserved") - } else { - try test(false) - } - } - - breakCycles(r) - } catch is Ice.OperationNotExistException {} - - do { - // - // Server only knows the intermediate type Preserved. The object will be sliced to - // Preserved for the 1.0 encoding; otherwise it should be returned intact. - // - let pcd = PCDerived() - pcd.pi = 3 - pcd.pbs = [pcd] - - let ret = try await testPrx.exchangePBaseAsync(pcd) - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is PCDerived)) - try test(r.pi == 3) - } else { - if let p2 = r as? PCDerived { - try test(p2.pi == 3) - try test(p2.pbs[0] === p2) - } else { - try test(false) - } - } - breakCycles(r) - breakCycles(pcd) - } catch is Ice.OperationNotExistException {} - - do { - // - // Server only knows the intermediate type Preserved. The object will be sliced to - // Preserved for the 1.0 encoding; otherwise it should be returned intact. - // - let pcd = CompactPCDerived() - pcd.pi = 3 - pcd.pbs = [pcd] - - let ret = try await testPrx.exchangePBaseAsync(pcd) - - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is CompactPCDerived)) - try test(r.pi == 3) - } else { - if let p2 = r as? CompactPCDerived { - try test(p2.pi == 3) - try test(p2.pbs[0] === p2) - } else { - try test(false) - } - } - breakCycles(r) - breakCycles(pcd) - } catch is Ice.OperationNotExistException {} - - do { - // - // Send an object that will have multiple preserved slices in the server. - // The object will be sliced to Preserved for the 1.0 encoding. - // - let pcd = PCDerived3() - pcd.pi = 3 - // - // Sending more than 254 objects exercises the encoding for object ids. - // - pcd.pbs = [PBase]() - for i: Int32 in 0..<300 { - let p2 = PCDerived2() - p2.pi = i - p2.pbs = [nil] // Nil reference. This slice should not have an indirection table. - p2.pcd2 = i - pcd.pbs.append(p2) - } - pcd.pcd2 = pcd.pi - pcd.pcd3 = pcd.pbs[10] - - let ret = try await testPrx.exchangePBaseAsync(pcd) - - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is PCDerived3)) - try test(r is Preserved) - try test(r.pi == 3) - } else { - if let p3 = r as? PCDerived3 { - try test(p3.pi == 3) - for i in 0..<300 { - if let p2 = p3.pbs[i] as? PCDerived2 { - try test(p2.pi == i) - try test(p2.pbs.count == 1) - try test(p2.pbs[0] == nil) - try test(p2.pcd2 == i) - } else { - try test(false) - } - } - try test(p3.pcd2 == p3.pi) - try test(p3.pcd3 === p3.pbs[10]) - } else { - try test(false) - } - } - breakCycles(r) - breakCycles(pcd) - } catch is Ice.OperationNotExistException {} - - do { - // - // Obtain an object with preserved slices and send it back to the server. - // The preserved slices should be excluded for the 1.0 encoding, otherwise - // they should be included. - // - - let p1 = try await testPrx.PBSUnknownAsPreservedAsync() - - let p = p1! - try testPrx.checkPBSUnknown(p) - if testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0 { - let slicedData = p.ice_getSlicedData()! - try test(slicedData.slices.count == 1) - try test(slicedData.slices[0].typeId == "::Test::PSUnknown") - try testPrx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p) - } else { - try test(p.ice_getSlicedData() == nil) - } - breakCycles(p) - - } catch is Ice.OperationNotExistException {} - output.writeLine("ok") return testPrx } diff --git a/swift/test/Ice/slicing/objects/Client.swift b/swift/test/Ice/slicing/objects/Client.swift index b111dcb5b0e..542ef626424 100644 --- a/swift/test/Ice/slicing/objects/Client.swift +++ b/swift/test/Ice/slicing/objects/Client.swift @@ -41,6 +41,6 @@ public class Client: TestHelperI { communicator.destroy() } let testPrx = try await allTests(self) - try testPrx.shutdown() + try await testPrx.shutdown() } } diff --git a/swift/test/Ice/timeout/AllTests.swift b/swift/test/Ice/timeout/AllTests.swift index 211a8edcb47..26288e69ba6 100644 --- a/swift/test/Ice/timeout/AllTests.swift +++ b/swift/test/Ice/timeout/AllTests.swift @@ -17,7 +17,7 @@ func connect(_ prx: Ice.ObjectPrx) async throws -> Ice.Connection { } public func allTests(helper: TestHelper) async throws { - let controller = try checkedCast( + let controller = try await checkedCast( prx: helper.communicator().stringToProxy("controller:\(helper.getTestEndpoint(num: 1))")!, type: ControllerPrx.self )! @@ -26,7 +26,7 @@ public func allTests(helper: TestHelper) async throws { } catch { // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent // the test from hanging on exit in case a connection which disables timeouts is still opened. - try controller.resumeAdapter() + try await controller.resumeAdapter() throw error } } @@ -40,7 +40,7 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx let sref = "timeout:\(helper.getTestEndpoint(num: 0))" let obj = try communicator.stringToProxy(sref)! - let timeout = try checkedCast(prx: obj, type: TimeoutPrx.self)! + let timeout = try await checkedCast(prx: obj, type: TimeoutPrx.self)! let output = helper.getWriter() output.write("testing connect timeout... ") @@ -49,15 +49,15 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx // Expect ConnectTimeoutException. // let to = timeout.ice_connectionId("con1") - try controller.holdAdapter(-1) + try await controller.holdAdapter(-1) do { - try to.op() + try await to.op() try test(false) } catch is Ice.ConnectTimeoutException { // Expected. } - try controller.resumeAdapter() - try timeout.op() // Ensure adapter is active. + try await controller.resumeAdapter() + try await timeout.op() // Ensure adapter is active. } do { @@ -65,9 +65,9 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx // Expect success. // let to = timeout.ice_connectionId("con2") - try controller.holdAdapter(100) + try await controller.holdAdapter(100) do { - try to.op() + try await to.op() } catch is Ice.ConnectTimeoutException { try test(false) } @@ -80,14 +80,14 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx var to = timeout.ice_invocationTimeout(100) try await test(connection === to.ice_getConnection()) do { - try to.sleep(1000) + try await to.sleep(1000) try test(false) } catch is Ice.InvocationTimeoutException {} - try obj.ice_ping() + try await obj.ice_ping() to = timeout.ice_invocationTimeout(1000) try await test(connection === to.ice_getConnection()) do { - try to.sleep(100) + try await to.sleep(100) } catch is Ice.InvocationTimeoutException { try test(false) } @@ -100,10 +100,10 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx // let to = timeout.ice_invocationTimeout(100) do { - try await to.sleepAsync(500) + try await to.sleep(500) try test(false) } catch is Ice.InvocationTimeoutException {} - try timeout.ice_ping() + try await timeout.ice_ping() } do { @@ -112,7 +112,7 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx // let to = timeout.ice_invocationTimeout(1000) do { - try await to.sleepAsync(100) + try await to.sleep(100) } catch { try test(false) } @@ -123,7 +123,7 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx do { let to = timeout let connection = try await connect(to) - try controller.holdAdapter(-1) + try await controller.holdAdapter(-1) try connection.close(.GracefullyWithWait) do { _ = try connection.getInfo() // getInfo() doesn't throw in the closing state. @@ -141,8 +141,8 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx break } } - try controller.resumeAdapter() - try timeout.op() // Ensure adapter is active. + try await controller.resumeAdapter() + try await timeout.op() // Ensure adapter is active. } output.writeLine("ok") @@ -159,29 +159,17 @@ public func allTestsWithController(helper: TestHelper, controller: ControllerPrx type: TimeoutPrx.self ).ice_invocationTimeout(100) do { - try proxy.sleep(500) + try await proxy.sleep(500) try test(false) } catch is Ice.InvocationTimeoutException {} do { - try await proxy.sleepAsync(500) + try await proxy.sleep(500) try test(false) } catch is Ice.InvocationTimeoutException {} - // let batchTimeout = proxy.ice_batchOneway() - // try batchTimeout.ice_ping() - // try batchTimeout.ice_ping() - // try batchTimeout.ice_ping() - - // async let _ = proxy.ice_invocationTimeout(-1).sleepAsync(500) // Keep the server thread pool busy. - - // do { - // try await batchTimeout.ice_flushBatchRequestsAsync() - // try test(false) - // } catch is Ice.InvocationTimeoutException {} - adapter.destroy() } output.writeLine("ok") - try controller.shutdown() + try await controller.shutdown() } diff --git a/swift/test/Ice/udp/AllTests.swift b/swift/test/Ice/udp/AllTests.swift index 1b7d309ec27..7bbfc071d88 100644 --- a/swift/test/Ice/udp/AllTests.swift +++ b/swift/test/Ice/udp/AllTests.swift @@ -65,9 +65,9 @@ public func allTests(_ helper: TestHelper) async throws { var ret = false for _ in 0..<5 { replyI.reset() - try obj.ping(reply) - try obj.ping(reply) - try obj.ping(reply) + try await obj.ping(reply) + try await obj.ping(reply) + try await obj.ping(reply) ret = replyI.waitReply(expectedReplies: 3, timeout: 2000) if ret { break // Success @@ -94,7 +94,7 @@ public func allTests(_ helper: TestHelper) async throws { while true { seq = ByteSeq(repeating: 0, count: seq.count * 2 + 10) replyI.reset() - try obj.sendByteSeq(seq: seq, reply: reply) + try await obj.sendByteSeq(seq: seq, reply: reply) _ = replyI.waitReply(expectedReplies: 1, timeout: 10000) } } catch is Ice.DatagramLimitException { @@ -109,7 +109,7 @@ public func allTests(_ helper: TestHelper) async throws { seq = ByteSeq(repeating: 0, count: 50000) do { replyI.reset() - try obj.sendByteSeq(seq: seq, reply: reply) + try await obj.sendByteSeq(seq: seq, reply: reply) let b = replyI.waitReply(expectedReplies: 1, timeout: 500) // // The server's Ice.UDP.RcvSize property is set to 16384, which means this packet @@ -138,7 +138,7 @@ public func allTests(_ helper: TestHelper) async throws { for _ in 0..<5 { replyI.reset() do { - try objMcast.ping(reply) + try await objMcast.ping(reply) ret = replyI.waitReply(expectedReplies: 5, timeout: 5000) } catch is Ice.SocketException where communicator.getProperties().getProperty("Ice.IPv6") == "1" { output.write("(not supported) ") @@ -165,9 +165,9 @@ public func allTests(_ helper: TestHelper) async throws { try await obj.ice_getConnection()!.setAdapter(adapter) for _ in 0..<5 { replyI.reset() - try obj.pingBiDir(reply.ice_getIdentity()) - try obj.pingBiDir(reply.ice_getIdentity()) - try obj.pingBiDir(reply.ice_getIdentity()) + try await obj.pingBiDir(reply.ice_getIdentity()) + try await obj.pingBiDir(reply.ice_getIdentity()) + try await obj.pingBiDir(reply.ice_getIdentity()) ret = replyI.waitReply(expectedReplies: 3, timeout: 2000) if ret { break // Success @@ -180,34 +180,4 @@ public func allTests(_ helper: TestHelper) async throws { } try test(ret) output.writeLine("ok") - - // - // Sending the replies back on the multicast UDP connection doesn't work for most - // platform(it works for macOS Leopard but not Snow Leopard, doesn't work on SLES, - // Windows...). For Windows, see UdpTransceiver constructor for the details. So - // we don't run this test. - // - // Console.Out.Write("testing udp bi-dir connection... "); - // nRetry = 5; - // while(nRetry-- > 0) - // { - // replyI.reset(); - // objMcast.pingBiDir(reply.ice_getIdentity()); - // ret = replyI.waitReply(5, 2000); - // if(ret) - // { - // break; // Success - // } - // replyI = new PingReplyI(); - // reply =(PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram(); - // } - - // if(!ret) - // { - // Console.Out.WriteLine("failed(is a firewall enabled?)"); - // } - // else - // { - // Console.Out.WriteLine("ok"); - // } } diff --git a/swift/test/Ice/udp/Client.swift b/swift/test/Ice/udp/Client.swift index de9ae1d9a01..335ce2dea9e 100644 --- a/swift/test/Ice/udp/Client.swift +++ b/swift/test/Ice/udp/Client.swift @@ -21,7 +21,7 @@ class Client: TestHelperI { for i in 0..<(num ?? 1) { let prx = try communicator.stringToProxy( "control:\(getTestEndpoint(num: Int32(i), prot: "tcp"))")! - try uncheckedCast(prx: prx, type: TestIntfPrx.self).shutdown() + try await uncheckedCast(prx: prx, type: TestIntfPrx.self).shutdown() } } } diff --git a/swift/test/Ice/udp/TestI.swift b/swift/test/Ice/udp/TestI.swift index af707206702..a62d9c417c6 100644 --- a/swift/test/Ice/udp/TestI.swift +++ b/swift/test/Ice/udp/TestI.swift @@ -5,7 +5,7 @@ import Ice class TestIntfI: TestIntf { func ping(reply: PingReplyPrx?, current _: Current) async throws { do { - try reply!.reply() + try await reply!.reply() } catch { preconditionFailure() } @@ -13,7 +13,7 @@ class TestIntfI: TestIntf { func sendByteSeq(seq _: ByteSeq, reply: PingReplyPrx?, current _: Current) async throws { do { - try reply!.reply() + try await reply!.reply() } catch { preconditionFailure() } @@ -28,11 +28,11 @@ class TestIntfI: TestIntf { do { let seq = Ice.ByteSeq(repeating: 0, count: 32 * 1024) let prx = try uncheckedCast(prx: current.con!.createProxy(reply), type: TestIntfPrx.self) - try prx.sendByteSeq(seq: seq, reply: nil) + try await prx.sendByteSeq(seq: seq, reply: nil) } catch is Ice.DatagramLimitException { // Expected. } - try uncheckedCast( + try await uncheckedCast( prx: current.con!.createProxy(reply), type: PingReplyPrx.self ).reply() diff --git a/swift/test/IceSSL/configuration/AllTests.swift b/swift/test/IceSSL/configuration/AllTests.swift index f8dbe25ea2b..0fcdf010fa6 100644 --- a/swift/test/IceSSL/configuration/AllTests.swift +++ b/swift/test/IceSSL/configuration/AllTests.swift @@ -78,7 +78,7 @@ func createClientProps(defaultProperties: Ice.Properties, cert: String, ca: Stri return properties } -public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLServerFactoryPrx { +public func allTests(_ helper: TestHelper, _ defaultDir: String) async throws -> SSLServerFactoryPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -87,7 +87,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe let output = helper.getWriter() let factoryRef = "factory:\(helper.getTestEndpoint(num: 0, prot: "tcp"))" let b = try communicator.stringToProxy(factoryRef)! - let factory = try checkedCast(prx: b, type: SSLServerFactoryPrx.self)! + let factory = try await checkedCast(prx: b, type: SSLServerFactoryPrx.self)! let defaultHost = communicator.getProperties().getProperty("Ice.Default.Host") let defaultProperties = communicator.getProperties() @@ -105,22 +105,22 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe // let properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "") let comm = try helper.initialize(properties) - let fact = try checkedCast( + let fact = try await checkedCast( prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! var d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "0" - let server = try fact.createServer(d)! + let server = try await fact.createServer(d)! do { - try server.noCert() + try await server.noCert() try test(false) } catch is SecurityException { // Expected, if reported as an SSL alert by the server. } catch is ConnectionLostException { // Expected. } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() } @@ -132,24 +132,24 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe var properties = createClientProps( defaultProperties: defaultProperties, cert: "", ca: "cacert1") var comm = try helper.initialize(properties) - var fact = try checkedCast( + var fact = try await checkedCast( prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! var d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "0" - var server = try fact.createServer(d)! + var server = try await fact.createServer(d)! do { - try server.noCert() + try await server.noCert() } - try fact.destroyServer(server) + try await fact.destroyServer(server) // // Test IceSSL.VerifyPeer=1. Client does not have a certificate. // d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "1" - server = try fact.createServer(d)! - try server.noCert() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.noCert() + try await fact.destroyServer(server) // // Test IceSSL.VerifyPeer=2. This should fail because the client @@ -157,16 +157,16 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe // d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "2" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is ProtocolException { // Expected, if reported as an SSL alert by the server. } catch is ConnectionLostException { // Expected. } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() @@ -177,17 +177,17 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "") properties.setProperty(key: "IceSSL.VerifyPeer", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.VerifyPeer"] = "0" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is SecurityException { // Expected. } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -197,17 +197,17 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca2", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is ConnectionLostException { // Expected. } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -216,12 +216,12 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe // properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "cacert2") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "cacert2", ca: "") d["IceSSL.VerifyPeer"] = "0" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() // @@ -230,17 +230,17 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe // properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "cacert2", ca: "") d["IceSSL.VerifyPeer"] = "0" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is SecurityException { // Expected. } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -249,12 +249,12 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() // @@ -276,11 +276,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: props, cert: "s_rsa_ca1_cn1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() // @@ -291,17 +291,17 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: props, cert: "s_rsa_ca1_cn2", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is Ice.SecurityException { // Expected } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -313,19 +313,19 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: props, cert: "s_rsa_ca1_cn3", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() } catch is Ice.SecurityException { // // macOS catalina does not check the certificate common name // try test(isCatalinaOrGreater) } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -337,17 +337,17 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: props, cert: "s_rsa_ca1_cn4", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is Ice.SecurityException { // Expected } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -359,18 +359,18 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: props, cert: "s_rsa_ca1_cn5", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is Ice.SecurityException { // Expected } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -388,13 +388,13 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps( defaultProperties: defaultProperties, cert: "s_rsa_ca1_cn6", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() // @@ -404,18 +404,18 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") properties.setProperty(key: "IceSSL.CheckCertName", value: "1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps( defaultProperties: defaultProperties, cert: "s_rsa_ca1_cn7", ca: "cacert1") d["IceSSL.CheckCertName"] = "1" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is Ice.SecurityException { // Expected } - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() } } @@ -425,12 +425,12 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe var properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacerts") var comm = try helper.initialize(properties) - var fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + var fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! var d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca2", ca: "cacerts") d["IceSSL.VerifyPeer"] = "2" - var server = try fact.createServer(d)! - _ = try server.ice_ping() - try fact.destroyServer(server) + var server = try await fact.createServer(d)! + _ = try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") @@ -438,13 +438,13 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties = createClientProps(defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "") properties.setProperty(key: "IceSSL.CAs", value: "cacert1.der") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "") d["IceSSL.VerifyPeer"] = "2" d["IceSSL.CAs"] = "cacert1.der" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") @@ -460,11 +460,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -474,14 +474,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -491,42 +491,42 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "C=US, ST=Florida, O=\"ZeroC, Inc.\", OU=Ice, emailAddress=info@zeroc.com, CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,CN=Client" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -534,11 +534,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -546,41 +546,41 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "!CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "CN=Client" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "!CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -588,29 +588,29 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "CN=Client") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "CN=Server" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -618,14 +618,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "C=Canada,CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -633,11 +633,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "!C=Canada,CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -645,11 +645,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "C=Canada;CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -657,14 +657,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "!C=Canada;!CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -674,40 +674,40 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly", value: "!CN=Server1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "!CN=Client1" // Should not match "Client" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "") properties.setProperty(key: "IceSSL.VerifyPeer", value: "0") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.VerifyPeer"] = "0" d["IceSSL.TrustOnly"] = "CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -717,16 +717,16 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.VerifyPeer", value: "0") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "!CN=Client" d["IceSSL.VerifyPeer"] = "0" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -736,14 +736,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") properties.setProperty(key: "IceSSL.TrustOnly", value: "ST=Florida;!CN=Server;C=US") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() // @@ -753,16 +753,16 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly"] = "C=US;!CN=Client;ST=Florida" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") @@ -774,14 +774,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") // Should have no effect. d["IceSSL.TrustOnly.Client"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -791,27 +791,27 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") // Should have no effect. d["IceSSL.TrustOnly.Client"] = "!CN=Client" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -819,14 +819,14 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly.Client", value: "CN=Client") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -834,11 +834,11 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly.Client", value: "!CN=Client") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") @@ -852,30 +852,30 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe value: "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,CN=Client") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server"] = "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( @@ -884,41 +884,41 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe properties.setProperty(key: "IceSSL.TrustOnly.Server", value: "!CN=Server") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server"] = "CN=Server" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server"] = "!CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") @@ -928,57 +928,57 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server.ServerAdapter"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,CN=Client" d["IceSSL.TrustOnly.Server"] = "CN=bogus" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server.ServerAdapter"] = "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server.ServerAdapter"] = "CN=bogus" - server = try fact.createServer(d)! + server = try await fact.createServer(d)! do { - try server.ice_ping() + try await server.ice_ping() try test(false) } catch is LocalException {} - try fact.destroyServer(server) + try await fact.destroyServer(server) comm.destroy() properties = createClientProps( defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1") comm = try helper.initialize(properties) - fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! + fact = try await checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") d["IceSSL.TrustOnly.Server.ServerAdapter"] = "!CN=bogus" - server = try fact.createServer(d)! - try server.ice_ping() - try fact.destroyServer(server) + server = try await fact.createServer(d)! + try await server.ice_ping() + try await fact.destroyServer(server) comm.destroy() output.writeLine("ok") diff --git a/swift/test/IceSSL/configuration/Client.swift b/swift/test/IceSSL/configuration/Client.swift index e9b8dc7180a..65713d27aae 100644 --- a/swift/test/IceSSL/configuration/Client.swift +++ b/swift/test/IceSSL/configuration/Client.swift @@ -18,8 +18,8 @@ class Client: TestHelperI { let certsDir = resourcePath.appending("/ice-test_IceSSL_configuration.bundle/certs") - let factory = try allTests(self, certsDir) - try factory.shutdown() + let factory = try await allTests(self, certsDir) + try await factory.shutdown() } } } diff --git a/swift/test/Package.swift b/swift/test/Package.swift index da72a443862..7f8a966f361 100644 --- a/swift/test/Package.swift +++ b/swift/test/Package.swift @@ -53,8 +53,7 @@ let testDirectories: [String: TestConfig] = [ ), "Ice/operations": TestConfig( sources: defaultSources + [ - "BatchOneways.swift", "BatchOnewaysAMI.swift", "Oneways.swift", "OnewaysAMI.swift", "Twoways.swift", - "TwowaysAMI.swift", + "BatchOneways.swift", "Oneways.swift", "Twoways.swift", ] ), "Ice/optional": TestConfig( diff --git a/swift/test/Slice/escape/Client.swift b/swift/test/Slice/escape/Client.swift index 2924335957c..31319d17d85 100644 --- a/swift/test/Slice/escape/Client.swift +++ b/swift/test/Slice/escape/Client.swift @@ -37,9 +37,9 @@ public class Client: TestHelperI { let out = getWriter() out.write("testing operation name... ") - let p = try checkedCast( + let p = try await checkedCast( prx: adapter.createProxy(Ice.stringToIdentity("test")), type: breakPrx.self)! - _ = try p.case(0) + _ = try await p.case(0) out.writeLine("ok") out.write("testing types... ")