summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/test/Ice/exceptions/AllTests.py364
-rw-r--r--py/test/Ice/exceptions/Test.ice4
-rw-r--r--py/test/Ice/exceptions/TestAMD.ice4
-rw-r--r--py/test/Ice/operations/AllTests.py10
-rw-r--r--py/test/Ice/operations/OnewaysAMI.py97
-rw-r--r--py/test/Ice/operations/OnewaysNewAMI.py85
-rw-r--r--py/test/Ice/operations/Test.ice4
-rw-r--r--py/test/Ice/operations/TestAMD.ice4
-rw-r--r--py/test/Ice/operations/TwowaysAMI.py642
-rw-r--r--py/test/Ice/operations/TwowaysNewAMI.py733
-rw-r--r--py/test/Ice/optional/Test.ice1
-rw-r--r--py/test/Ice/optional/TestAMD.ice2
-rwxr-xr-xpy/test/Slice/keyword/Client.py5
-rw-r--r--py/test/Slice/keyword/Key.ice2
14 files changed, 201 insertions, 1756 deletions
diff --git a/py/test/Ice/exceptions/AllTests.py b/py/test/Ice/exceptions/AllTests.py
index 9c3f347a6d5..e49b2dfcc9c 100644
--- a/py/test/Ice/exceptions/AllTests.py
+++ b/py/test/Ice/exceptions/AllTests.py
@@ -53,235 +53,6 @@ class CallbackBase:
self._cond.notify()
self._cond.release()
-class AMI_Thrower_throwAasAI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.A as ex:
- test(ex.aMem == 1)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwAasAObjectNotExistI(CallbackBase):
- def __init__(self, communicator):
- CallbackBase.__init__(self)
- self._communicator = communicator
-
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.ObjectNotExistException as ex:
- id = self._communicator.stringToIdentity("does not exist")
- test(ex.id == id)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwAasAFacetNotExistI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.FacetNotExistException as ex:
- test(ex.facet == "no such facet")
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwAorDasAorDI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.A as ex:
- test(ex.aMem == 1)
- except Test.D as ex:
- test(ex.dMem == -1)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwBasAI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.B as ex:
- test(ex.aMem == 1)
- test(ex.bMem == 2)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwCasAI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.C as ex:
- test(ex.aMem == 1)
- test(ex.bMem == 2)
- test(ex.cMem == 3)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwBasBI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.B as ex:
- test(ex.aMem == 1)
- test(ex.bMem == 2)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwCasBI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.C as ex:
- test(ex.aMem == 1)
- test(ex.bMem == 2)
- test(ex.cMem == 3)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwCasCI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.C as ex:
- test(ex.aMem == 1)
- test(ex.bMem == 2)
- test(ex.cMem == 3)
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwModAI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Test.Mod.A as ex:
- test(ex.aMem == 1)
- test(ex.a2Mem == 2)
- except Ice.OperationNotExistException:
- #
- # This operation is not supported in Java.
- #
- pass
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwUndeclaredAI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.UnknownUserException:
- pass
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwUndeclaredBI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.UnknownUserException:
- pass
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwUndeclaredCI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.UnknownUserException:
- pass
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwLocalExceptionI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.UnknownLocalException:
- pass
- except:
- test(False)
- self.called()
-
-class AMI_Thrower_throwNonIceExceptionI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.UnknownException:
- pass
- except:
- test(False)
- self.called()
-
-class AMI_WrongOperation_noSuchOperationI(CallbackBase):
- def ice_response(self):
- test(False)
-
- def ice_exception(self, ex):
- try:
- raise ex
- except Ice.OperationNotExistException as ex:
- test(ex.operation == "noSuchOperation")
- except:
- test(False)
- self.called()
-
class Callback(CallbackBase):
def __init__(self, communicator=None):
CallbackBase.__init__(self)
@@ -838,126 +609,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching exact types with AMI... ")
- sys.stdout.flush()
-
- cb = AMI_Thrower_throwAasAI()
- thrower.throwAasA_async(cb, 1)
- cb.check()
- # Let's check if we can reuse the same callback object for another call.
- thrower.throwAasA_async(cb, 1)
- cb.check()
-
- cb = AMI_Thrower_throwAorDasAorDI()
- thrower.throwAorDasAorD_async(cb, 1)
- cb.check()
-
- cb = AMI_Thrower_throwAorDasAorDI()
- thrower.throwAorDasAorD_async(cb, -1)
- cb.check()
-
- cb = AMI_Thrower_throwBasBI()
- thrower.throwBasB_async(cb, 1, 2)
- cb.check()
-
- cb = AMI_Thrower_throwCasCI()
- thrower.throwCasC_async(cb, 1, 2, 3)
- cb.check()
- # Let's check if we can reuse the same callback object for another call.
- thrower.throwCasC_async(cb, 1, 2, 3)
- cb.check()
-
- cb = AMI_Thrower_throwModAI()
- thrower.throwModA_async(cb, 1, 2)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching derived types... ")
- sys.stdout.flush()
-
- cb = AMI_Thrower_throwBasAI()
- thrower.throwBasA_async(cb, 1, 2)
- cb.check()
-
- cb = AMI_Thrower_throwCasAI()
- thrower.throwCasA_async(cb, 1, 2, 3)
- cb.check()
-
- cb = AMI_Thrower_throwCasBI()
- thrower.throwCasB_async(cb, 1, 2, 3)
- cb.check()
-
- print("ok")
-
- if thrower.supportsUndeclaredExceptions():
- sys.stdout.write("catching unknown user exception with AMI... ")
- sys.stdout.flush()
-
- cb = AMI_Thrower_throwUndeclaredAI()
- thrower.throwUndeclaredA_async(cb, 1)
- cb.check()
-
- cb = AMI_Thrower_throwUndeclaredBI()
- thrower.throwUndeclaredB_async(cb, 1, 2)
- cb.check()
-
- cb = AMI_Thrower_throwUndeclaredCI()
- thrower.throwUndeclaredC_async(cb, 1, 2, 3)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching object not exist exception with AMI... ")
- sys.stdout.flush()
-
- id = communicator.stringToIdentity("does not exist")
- thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id))
- cb = AMI_Thrower_throwAasAObjectNotExistI(communicator)
- thrower2.throwAasA_async(cb, 1)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching facet not exist exception with AMI... ")
- sys.stdout.flush()
-
- thrower2 = Test.ThrowerPrx.uncheckedCast(thrower, "no such facet")
- cb = AMI_Thrower_throwAasAFacetNotExistI()
- thrower2.throwAasA_async(cb, 1)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching operation not exist exception with AMI... ")
- sys.stdout.flush()
-
- cb = AMI_WrongOperation_noSuchOperationI()
- thrower4 = Test.WrongOperationPrx.uncheckedCast(thrower)
- thrower4.noSuchOperation_async(cb)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching unknown local exception with AMI... ")
- sys.stdout.flush()
-
- cb = AMI_Thrower_throwLocalExceptionI()
- thrower.throwLocalException_async(cb)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching unknown non-Ice exception with AMI... ")
- sys.stdout.flush()
-
- cb = AMI_Thrower_throwNonIceExceptionI()
- thrower.throwNonIceException_async(cb)
- cb.check()
-
- print("ok")
-
- sys.stdout.write("catching exact types with new AMI mapping... ")
+ sys.stdout.write("catching exact types with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
@@ -986,7 +638,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching derived types with new AMI mapping... ")
+ sys.stdout.write("catching derived types with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
@@ -1004,7 +656,7 @@ def allTests(communicator):
print("ok")
if thrower.supportsUndeclaredExceptions():
- sys.stdout.write("catching unknown user exception with new AMI mapping... ")
+ sys.stdout.write("catching unknown user exception with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
@@ -1021,7 +673,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching object not exist exception with new AMI mapping... ")
+ sys.stdout.write("catching object not exist exception with AMI mapping... ")
sys.stdout.flush()
id = communicator.stringToIdentity("does not exist")
@@ -1032,7 +684,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching facet not exist exception with new AMI mapping... ")
+ sys.stdout.write("catching facet not exist exception with AMI mapping... ")
sys.stdout.flush()
thrower2 = Test.ThrowerPrx.uncheckedCast(thrower, "no such facet")
@@ -1042,7 +694,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching operation not exist exception with new AMI mapping... ")
+ sys.stdout.write("catching operation not exist exception with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
@@ -1052,7 +704,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching unknown local exception with new AMI mapping... ")
+ sys.stdout.write("catching unknown local exception with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
@@ -1065,7 +717,7 @@ def allTests(communicator):
print("ok")
- sys.stdout.write("catching unknown non-Ice exception with new AMI mapping... ")
+ sys.stdout.write("catching unknown non-Ice exception with AMI mapping... ")
sys.stdout.flush()
cb = Callback()
diff --git a/py/test/Ice/exceptions/Test.ice b/py/test/Ice/exceptions/Test.ice
index 3806f9d8e20..93f6014afc6 100644
--- a/py/test/Ice/exceptions/Test.ice
+++ b/py/test/Ice/exceptions/Test.ice
@@ -48,7 +48,7 @@ module Mod
};
};
-["ami"] interface Thrower
+interface Thrower
{
void shutdown();
bool supportsUndeclaredExceptions();
@@ -78,7 +78,7 @@ module Mod
void throwAfterException() throws A;
};
-["ami"] interface WrongOperation
+interface WrongOperation
{
void noSuchOperation();
};
diff --git a/py/test/Ice/exceptions/TestAMD.ice b/py/test/Ice/exceptions/TestAMD.ice
index 38c500bef22..860a9a15cf1 100644
--- a/py/test/Ice/exceptions/TestAMD.ice
+++ b/py/test/Ice/exceptions/TestAMD.ice
@@ -45,7 +45,7 @@ module Mod
};
-["ami", "amd"] interface Thrower
+["amd"] interface Thrower
{
void shutdown();
bool supportsUndeclaredExceptions();
@@ -73,7 +73,7 @@ module Mod
void throwAfterException() throws A;
};
-["ami", "amd"] interface WrongOperation
+["amd"] interface WrongOperation
{
void noSuchOperation();
};
diff --git a/py/test/Ice/operations/AllTests.py b/py/test/Ice/operations/AllTests.py
index 62005a92cbc..e9533aa4ae1 100644
--- a/py/test/Ice/operations/AllTests.py
+++ b/py/test/Ice/operations/AllTests.py
@@ -37,21 +37,11 @@ def allTests(communicator):
TwowaysAMI.twowaysAMI(communicator, cl)
print("ok")
- sys.stdout.write("testing twoway operations with new AMI mapping... ")
- sys.stdout.flush()
- TwowaysNewAMI.twowaysNewAMI(communicator, cl)
- print("ok")
-
sys.stdout.write("testing oneway operations with AMI... ")
sys.stdout.flush()
OnewaysAMI.onewaysAMI(communicator, cl)
print("ok")
- sys.stdout.write("testing oneway operations with new AMI mapping... ")
- sys.stdout.flush()
- OnewaysNewAMI.onewaysNewAMI(communicator, cl)
- print("ok")
-
sys.stdout.write("testing batch oneway operations... ")
sys.stdout.flush()
BatchOneways.batchOneways(cl)
diff --git a/py/test/Ice/operations/OnewaysAMI.py b/py/test/Ice/operations/OnewaysAMI.py
index e96ed5f6183..671c1f1853d 100644
--- a/py/test/Ice/operations/OnewaysAMI.py
+++ b/py/test/Ice/operations/OnewaysAMI.py
@@ -7,7 +7,7 @@
#
# **********************************************************************
-import Ice, Test, math, threading
+import Ice, Test, threading
def test(b):
if not b:
@@ -33,86 +33,53 @@ class CallbackBase:
self._cond.notify()
self._cond.release()
-class AMI_MyClass_opVoidI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
+class Callback(CallbackBase):
+ def sent(self, sentSynchronously):
self.called()
- def ice_exception(self, ex):
+ def noException(self, ex):
test(False)
-class AMI_MyClass_opIdempotentI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
- self.called()
-
- def ice_exception(self, ex):
- test(False)
+def onewaysAMI(communicator, proxy):
-class AMI_MyClass_opNonmutatingI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
+ p = Test.MyClassPrx.uncheckedCast(proxy.ice_oneway())
- def ice_response(self):
- self.called()
+ cb = Callback()
+ p.begin_ice_ping(None, cb.noException, cb.sent)
+ cb.check()
- def ice_exception(self, ex):
+ try:
+ p.begin_ice_isA(Test.MyClass.ice_staticId())
test(False)
+ except RuntimeError:
+ pass
-class AMI_MyClass_opVoidExI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
+ try:
+ p.begin_ice_id()
test(False)
+ except RuntimeError:
+ pass
- def ice_exception(self, ex):
- test(isinstance(ex, Ice.NoEndpointException))
- self.called()
-
-class AMI_MyClass_opByteExI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, b):
+ try:
+ p.begin_ice_ids()
test(False)
+ except RuntimeError:
+ pass
- def ice_exception(self, ex):
- test(isinstance(ex, Ice.TwowayOnlyException))
- self.called()
-
-def onewaysAMI(communicator, p):
-
- p = Test.MyClassPrx.uncheckedCast(p.ice_oneway())
-
- cb = AMI_MyClass_opVoidI()
- p.opVoid_async(cb)
- # Let's check if we can reuse the same callback object for another call.
- p.opVoid_async(cb)
-
- cb = AMI_MyClass_opIdempotentI()
- p.opIdempotent_async(cb)
+ cb = Callback()
+ p.begin_opVoid(None, cb.noException, cb.sent)
+ cb.check()
- cb = AMI_MyClass_opNonmutatingI()
- p.opNonmutating_async(cb)
+ cb = Callback()
+ p.begin_opIdempotent(None, cb.noException, cb.sent)
+ cb.check()
- # Check that a call to a void operation raises NoEndpointException
- # in the ice_exception() callback instead of at the point of call.
- indirect = Test.MyClassPrx.uncheckedCast(p.ice_adapterId("dummy"))
- cb = AMI_MyClass_opVoidExI()
- try:
- indirect.opVoid_async(cb)
- except Ice.Exception:
- test(False)
+ cb = Callback()
+ p.begin_opNonmutating(None, cb.noException, cb.sent)
cb.check()
- cb = AMI_MyClass_opByteExI()
try:
- p.opByte_async(cb, 0, 0)
- except Ice.Exception:
+ p.begin_opByte(0xff, 0x0f)
test(False)
- cb.check()
+ except RuntimeError:
+ pass
diff --git a/py/test/Ice/operations/OnewaysNewAMI.py b/py/test/Ice/operations/OnewaysNewAMI.py
deleted file mode 100644
index 7ca1eac45dd..00000000000
--- a/py/test/Ice/operations/OnewaysNewAMI.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import Ice, Test, threading
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-class CallbackBase:
- def __init__(self):
- self._called = False
- self._cond = threading.Condition()
-
- def check(self):
- self._cond.acquire()
- try:
- while not self._called:
- self._cond.wait()
- self._called = False
- finally:
- self._cond.release()
-
- def called(self):
- self._cond.acquire()
- self._called = True
- self._cond.notify()
- self._cond.release()
-
-class Callback(CallbackBase):
- def sent(self, sentSynchronously):
- self.called()
-
- def noException(self, ex):
- test(False)
-
-def onewaysNewAMI(communicator, proxy):
-
- p = Test.MyClassPrx.uncheckedCast(proxy.ice_oneway())
-
- cb = Callback()
- p.begin_ice_ping(None, cb.noException, cb.sent)
- cb.check()
-
- try:
- p.begin_ice_isA(Test.MyClass.ice_staticId())
- test(False)
- except RuntimeError:
- pass
-
- try:
- p.begin_ice_id()
- test(False)
- except RuntimeError:
- pass
-
- try:
- p.begin_ice_ids()
- test(False)
- except RuntimeError:
- pass
-
- cb = Callback()
- p.begin_opVoid(None, cb.noException, cb.sent)
- cb.check()
-
- cb = Callback()
- p.begin_opIdempotent(None, cb.noException, cb.sent)
- cb.check()
-
- cb = Callback()
- p.begin_opNonmutating(None, cb.noException, cb.sent)
- cb.check()
-
- try:
- p.begin_opByte(0xff, 0x0f)
- test(False)
- except RuntimeError:
- pass
diff --git a/py/test/Ice/operations/Test.ice b/py/test/Ice/operations/Test.ice
index 5baa8bde82e..7839b36cd28 100644
--- a/py/test/Ice/operations/Test.ice
+++ b/py/test/Ice/operations/Test.ice
@@ -73,7 +73,7 @@ dictionary<string, MyEnum> StringMyEnumD;
dictionary<MyEnum, string> MyEnumStringD;
dictionary<MyStruct, MyEnum> MyStructMyEnumD;
-["ami"] class MyClass
+class MyClass
{
void shutdown();
@@ -169,7 +169,7 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD;
["nonmutating"] idempotent void opNonmutating();
};
-["ami"] class MyDerivedClass extends MyClass
+class MyDerivedClass extends MyClass
{
void opDerived();
};
diff --git a/py/test/Ice/operations/TestAMD.ice b/py/test/Ice/operations/TestAMD.ice
index 97ff66d4402..6866d6fb72b 100644
--- a/py/test/Ice/operations/TestAMD.ice
+++ b/py/test/Ice/operations/TestAMD.ice
@@ -71,7 +71,7 @@ dictionary<string, MyEnum> StringMyEnumD;
dictionary<MyEnum, string> MyEnumStringD;
dictionary<MyStruct, MyEnum> MyStructMyEnumD;
-["ami", "amd"] class MyClass
+["amd"] class MyClass
{
void shutdown();
@@ -167,7 +167,7 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD;
["nonmutating"] idempotent void opNonmutating();
};
-["ami", "amd"] class MyDerivedClass extends MyClass
+["amd"] class MyDerivedClass extends MyClass
{
void opDerived();
};
diff --git a/py/test/Ice/operations/TwowaysAMI.py b/py/test/Ice/operations/TwowaysAMI.py
index f92dc3513ce..618e3de769a 100644
--- a/py/test/Ice/operations/TwowaysAMI.py
+++ b/py/test/Ice/operations/TwowaysAMI.py
@@ -33,119 +33,63 @@ class CallbackBase:
self._cond.notify()
self._cond.release()
-class AMI_MyClass_opVoidI(CallbackBase):
- def __init__(self):
+class Callback(CallbackBase):
+ def __init__(self, communicator=None):
CallbackBase.__init__(self)
+ self._communicator = communicator
- def ice_response(self):
+ def ping(self):
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opVoidExI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
+ def isA(self, r):
+ test(r)
+ self.called()
- def ice_response(self):
- test(False)
+ def id(self, id):
+ test(id == "::Test::MyDerivedClass")
+ self.called()
- def ice_exception(self, ex):
- test(isinstance(ex, Ice.NoEndpointException))
+ def ids(self, ids):
+ test(len(ids) == 3)
self.called()
-class AMI_MyClass_opByteI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
+ def opVoid(self):
+ self.called()
- def ice_response(self, r, b):
+ def opByte(self, r, b):
test(b == 0xf0)
test(r == 0xff)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opByteExI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, b):
- test(False)
-
- def ice_exception(self, ex):
- test(isinstance(ex, Ice.NoEndpointException))
- self.called()
-
-class AMI_MyClass_opBoolI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, b):
+ def opBool(self, r, b):
test(b)
test(not r)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opShortIntLongI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, s, i, l):
+ def opShortIntLong(self, r, s, i, l):
test(s == 10)
test(i == 11)
test(l == 12)
test(r == 12)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opFloatDoubleI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, f, d):
+ def opFloatDouble(self, r, f, d):
test(f - 3.14 < 0.001)
test(d == 1.1E10)
test(r == 1.1E10)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStringI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, s):
+ def opString(self, r, s):
test(s == "world hello")
test(r == "hello world")
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opMyEnumI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, r, e):
+ def opMyEnum(self, r, e):
test(e == Test.MyEnum.enum2)
test(r == Test.MyEnum.enum3)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opMyClassI(CallbackBase):
- def __init__(self, communicator):
- CallbackBase.__init__(self)
- self._communicator = communicator
-
- def ice_response(self, r, c1, c2):
+ def opMyClass(self, r, c1, c2):
test(c1.ice_getIdentity() == self._communicator.stringToIdentity("test"))
test(c2.ice_getIdentity() == self._communicator.stringToIdentity("noSuchIdentity"))
test(r.ice_getIdentity() == self._communicator.stringToIdentity("test"))
@@ -160,16 +104,7 @@ class AMI_MyClass_opMyClassI(CallbackBase):
pass
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStructI(CallbackBase):
-
- def __init__(self, communicator):
- CallbackBase.__init__(self)
- self._communicator = communicator
-
- def ice_response(self, rso, so):
+ def opStruct(self, rso, so):
test(rso.p == None)
test(rso.e == Test.MyEnum.enum2)
test(rso.s.s == "def")
@@ -180,14 +115,7 @@ class AMI_MyClass_opStructI(CallbackBase):
so.p.opVoid()
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opByteSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, bso):
+ def opByteS(self, rso, bso):
test(len(bso) == 4)
test(len(rso) == 8)
if sys.version_info[0] == 2:
@@ -218,14 +146,7 @@ class AMI_MyClass_opByteSI(CallbackBase):
test(rso[7] == 0xf4)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opBoolSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, bso):
+ def opBoolS(self, rso, bso):
test(len(bso) == 4)
test(bso[0])
test(bso[1])
@@ -237,14 +158,7 @@ class AMI_MyClass_opBoolSI(CallbackBase):
test(rso[2])
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opShortIntLongSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, sso, iso, lso):
+ def opShortIntLongS(self, rso, sso, iso, lso):
test(len(sso) == 3)
test(sso[0] == 1)
test(sso[1] == 2)
@@ -267,14 +181,7 @@ class AMI_MyClass_opShortIntLongSI(CallbackBase):
test(rso[2] == 20)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opFloatDoubleSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, fso, dso):
+ def opFloatDoubleS(self, rso, fso, dso):
test(len(fso) == 2)
test(fso[0] - 3.14 < 0.001)
test(fso[1] - 1.11 < 0.001)
@@ -290,14 +197,7 @@ class AMI_MyClass_opFloatDoubleSI(CallbackBase):
test(rso[4] - 1.11 < 0.001)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStringSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, sso):
+ def opStringS(self, rso, sso):
test(len(sso) == 4)
test(sso[0] == "abc")
test(sso[1] == "de")
@@ -309,14 +209,7 @@ class AMI_MyClass_opStringSI(CallbackBase):
test(rso[2] == "abc")
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opByteSSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, bso):
+ def opByteSS(self, rso, bso):
test(len(bso) == 2)
test(len(bso[0]) == 1)
test(len(bso[1]) == 3)
@@ -351,14 +244,7 @@ class AMI_MyClass_opByteSSI(CallbackBase):
test(rso[3][1] == 0xf1)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opBoolSSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, bso):
+ def opBoolSS(self, rso, bso):
test(len(bso) == 4);
test(len(bso[0]) == 1);
test(bso[0][0]);
@@ -381,11 +267,7 @@ class AMI_MyClass_opBoolSSI(CallbackBase):
test(rso[2][0]);
self.called();
-class AMI_MyClass_opShortIntLongSSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, sso, iso, lso):
+ def opShortIntLongSS(self, rso, sso, iso, lso):
test(len(rso) == 1);
test(len(rso[0]) == 2);
test(rso[0][0] == 496);
@@ -413,11 +295,7 @@ class AMI_MyClass_opShortIntLongSSI(CallbackBase):
test(lso[1][1] == 1729);
self.called();
-class AMI_MyClass_opFloatDoubleSSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, fso, dso):
+ def opFloatDoubleSS(self, rso, fso, dso):
test(len(fso) == 3)
test(len(fso[0]) == 1)
test(fso[0][0] - 3.14 < 0.001)
@@ -440,14 +318,7 @@ class AMI_MyClass_opFloatDoubleSSI(CallbackBase):
test(rso[1][2] == 1.3E10)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStringSSI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, rso, sso):
+ def opStringSS(self, rso, sso):
test(len(sso) == 5)
test(len(sso[0]) == 1)
test(sso[0][0] == "abc")
@@ -465,14 +336,7 @@ class AMI_MyClass_opStringSSI(CallbackBase):
test(len(rso[2]) == 0)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opByteBoolDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opByteBoolD(self, ro, do):
di1 = {10: True, 100: False}
test(do == di1)
test(len(ro) == 4)
@@ -482,14 +346,7 @@ class AMI_MyClass_opByteBoolDI(CallbackBase):
test(ro[101])
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opShortIntDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opShortIntD(self, ro, do):
di1 = {110: -1, 1100: 123123}
test(do == di1)
test(len(ro) == 4)
@@ -499,14 +356,7 @@ class AMI_MyClass_opShortIntDI(CallbackBase):
test(ro[1101] == 0)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opLongFloatDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opLongFloatD(self, ro, do):
di1 = {999999110: -1.1, 999999111: 123123.2}
for k in do:
test(math.fabs(do[k] - di1[k]) < 0.01)
@@ -517,14 +367,7 @@ class AMI_MyClass_opLongFloatDI(CallbackBase):
test(ro[999999130] - 0.5 < 0.01)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStringStringDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opStringStringD(self, ro, do):
di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'}
test(do == di1)
test(len(ro) == 4)
@@ -534,14 +377,7 @@ class AMI_MyClass_opStringStringDI(CallbackBase):
test(ro["BAR"] == "abc 0.5")
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opStringMyEnumDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opStringMyEnumD(self, ro, do):
di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2}
test(do == di1)
test(len(ro) == 4)
@@ -551,14 +387,7 @@ class AMI_MyClass_opStringMyEnumDI(CallbackBase):
test(ro["Hello!!"] == Test.MyEnum.enum2)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opMyEnumStringDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opMyEnumStringD(self, ro, do):
di1 = {Test.MyEnum.enum1: 'abc'}
test(do == di1)
test(len(ro) == 3)
@@ -567,14 +396,7 @@ class AMI_MyClass_opMyEnumStringDI(CallbackBase):
test(ro[Test.MyEnum.enum3] == "qwerty")
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opMyStructMyEnumDI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self, ro, do):
+ def opMyStructMyEnumD(self, ro, do):
s11 = Test.MyStruct()
s11.i = 1
s11.j = 1
@@ -596,179 +418,80 @@ class AMI_MyClass_opMyStructMyEnumDI(CallbackBase):
test(ro[s23] == Test.MyEnum.enum2)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opIntSI(CallbackBase):
- def __init__(self, l):
- CallbackBase.__init__(self)
- self._l = l
-
- def ice_response(self, r):
- test(len(r) == self._l)
- for j in range(0, self._l):
+ def opIntS(self, r):
+ for j in range(0, len(r)):
test(r[j] == -j)
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opContextEqualI(CallbackBase):
- def __init__(self, d):
- CallbackBase.__init__(self)
- self._d = d
-
- def ice_response(self, r):
- test(r == self._d)
- self.called()
-
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opContextNotEqualI(CallbackBase):
- def __init__(self, d):
- CallbackBase.__init__(self)
- self._d = d
-
- def ice_response(self, r):
- test(r != self._d)
- self.called()
-
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opIdempotentI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
+ def opIdempotent(self):
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyClass_opNonmutatingI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
+ def opNonmutating(self):
self.called()
- def ice_exception(self, ex):
- test(False)
-
-class AMI_MyDerivedClass_opDerivedI(CallbackBase):
- def __init__(self):
- CallbackBase.__init__(self)
-
- def ice_response(self):
+ def opDerived(self):
self.called()
- def ice_exception(self, ex):
+ def exCB(self, ex):
test(False)
def twowaysAMI(communicator, p):
- # Check that a call to a void operation raises NoEndpointException
- # in the ice_exception() callback instead of at the point of call.
- indirect = Test.MyClassPrx.uncheckedCast(p.ice_adapterId("dummy"))
- cb = AMI_MyClass_opVoidExI()
- try:
- test(not indirect.opVoid_async(cb))
- except Ice.Exception:
- test(False)
+ cb = Callback()
+ p.begin_ice_ping(cb.ping, cb.exCB)
cb.check()
- # Check that a call to a twoway operation raises NoEndpointException
- # in the ice_exception() callback instead of at the point of call.
- indirect = Test.MyClassPrx.uncheckedCast(p.ice_adapterId("dummy"))
- cb = AMI_MyClass_opByteExI()
- try:
- test(not indirect.opByte_async(cb, 0, 0))
- except Ice.Exception:
- test(False)
+ cb = Callback()
+ p.begin_ice_isA(Test.MyClass.ice_staticId(), cb.isA, cb.exCB)
cb.check()
- #
- # opVoid
- #
- cb = AMI_MyClass_opVoidI()
- p.opVoid_async(cb)
+ cb = Callback()
+ p.begin_ice_id(cb.id, cb.exCB)
cb.check()
- # Let's check if we can reuse the same callback object for another call.
- p.opVoid_async(cb)
+
+ cb = Callback()
+ p.begin_ice_ids(cb.ids, cb.exCB)
cb.check()
- # Check that CommunicatorDestroyedException is raised directly.
- initData = Ice.InitializationData()
- initData.properties = communicator.getProperties().clone()
- ic = Ice.initialize(initData)
- obj = ic.stringToProxy(p.ice_toString())
- p2 = Test.MyClassPrx.checkedCast(obj)
+ r = p.begin_opVoid()
+ p.end_opVoid(r)
- ic.destroy()
+ cb = Callback()
+ p.begin_opVoid(cb.opVoid, cb.exCB)
+ cb.check()
- cb = AMI_MyClass_opVoidI()
- try:
- test(not p2.opVoid_async(cb))
- test(False)
- except Ice.CommunicatorDestroyedException:
- pass # Expected.
+ r = p.begin_opByte(0xff, 0x0f)
+ (ret, p3) = p.end_opByte(r)
+ test(p3 == 0xf0)
+ test(ret == 0xff)
- #
- # opByte
- #
- cb = AMI_MyClass_opByteI()
- p.opByte_async(cb, 0xff, 0x0f)
+ cb = Callback()
+ p.begin_opByte(0xff, 0x0f, cb.opByte, cb.exCB)
cb.check()
- #
- # opBool
- #
- cb = AMI_MyClass_opBoolI()
- p.opBool_async(cb, True, False)
+ cb = Callback()
+ p.begin_opBool(True, False, cb.opBool, cb.exCB)
cb.check()
- #
- # opShortIntLong
- #
- cb = AMI_MyClass_opShortIntLongI()
- p.opShortIntLong_async(cb, 10, 11, 12)
+ cb = Callback()
+ p.begin_opShortIntLong(10, 11, 12, cb.opShortIntLong, cb.exCB)
cb.check()
- #
- # opFloatDouble
- #
- cb = AMI_MyClass_opFloatDoubleI()
- p.opFloatDouble_async(cb, 3.14, 1.1E10)
- cb.check()
- # Let's check if we can reuse the same callback object for another call.
- p.opFloatDouble_async(cb, 3.14, 1.1E10)
+ cb = Callback()
+ p.begin_opFloatDouble(3.14, 1.1E10, cb.opFloatDouble, cb.exCB)
cb.check()
- #
- # opString
- #
- cb = AMI_MyClass_opStringI()
- p.opString_async(cb, "hello", "world")
+ cb = Callback()
+ p.begin_opString("hello", "world", cb.opString, cb.exCB)
cb.check()
- #
- # opMyEnum
- #
- cb = AMI_MyClass_opMyEnumI()
- p.opMyEnum_async(cb, Test.MyEnum.enum2)
+ cb = Callback()
+ p.begin_opMyEnum(Test.MyEnum.enum2, cb.opMyEnum, cb.exCB)
cb.check()
- #
- # opMyClass
- #
- cb = AMI_MyClass_opMyClassI(communicator)
- p.opMyClass_async(cb, p)
+ cb = Callback(communicator)
+ p.begin_opMyClass(p, cb.opMyClass, cb.exCB)
cb.check()
- #
- # opStruct
- #
si1 = Test.Structure()
si1.p = p
si1.e = Test.MyEnum.enum3
@@ -780,175 +503,124 @@ def twowaysAMI(communicator, p):
si2.s = Test.AnotherStruct()
si2.s.s = "def"
- cb = AMI_MyClass_opStructI(communicator)
- p.opStruct_async(cb, si1, si2)
+ cb = Callback(communicator)
+ p.begin_opStruct(si1, si2, cb.opStruct, cb.exCB)
cb.check()
- #
- # opByteS
- #
bsi1 = (0x01, 0x11, 0x12, 0x22)
bsi2 = (0xf1, 0xf2, 0xf3, 0xf4)
- cb = AMI_MyClass_opByteSI()
- p.opByteS_async(cb, bsi1, bsi2)
+ cb = Callback()
+ p.begin_opByteS(bsi1, bsi2, cb.opByteS, cb.exCB)
cb.check()
- #
- # opBoolS
- #
bsi1 = (True, True, False)
bsi2 = (False,)
- cb = AMI_MyClass_opBoolSI()
- p.opBoolS_async(cb, bsi1, bsi2)
+ cb = Callback()
+ p.begin_opBoolS(bsi1, bsi2, cb.opBoolS, cb.exCB)
cb.check()
- #
- # opShortIntLongS
- #
ssi = (1, 2, 3)
isi = (5, 6, 7, 8)
lsi = (10, 30, 20)
- cb = AMI_MyClass_opShortIntLongSI()
- p.opShortIntLongS_async(cb, ssi, isi, lsi)
+ cb = Callback()
+ p.begin_opShortIntLongS(ssi, isi, lsi, cb.opShortIntLongS, cb.exCB)
cb.check()
- #
- # opFloatDoubleS
- #
fsi = (3.14, 1.11)
dsi = (1.1E10, 1.2E10, 1.3E10)
- cb = AMI_MyClass_opFloatDoubleSI()
- p.opFloatDoubleS_async(cb, fsi, dsi)
+ cb = Callback()
+ p.begin_opFloatDoubleS(fsi, dsi, cb.opFloatDoubleS, cb.exCB)
cb.check()
- #
- # opStringS
- #
ssi1 = ('abc', 'de', 'fghi')
ssi2 = ('xyz',)
- cb = AMI_MyClass_opStringSI()
- p.opStringS_async(cb, ssi1, ssi2)
+ cb = Callback()
+ p.begin_opStringS(ssi1, ssi2, cb.opStringS, cb.exCB)
cb.check()
- #
- # opByteSS
- #
bsi1 = ((0x01, 0x11, 0x12), (0xff,))
bsi2 = ((0x0e,), (0xf2, 0xf1))
- cb = AMI_MyClass_opByteSSI()
- p.opByteSS_async(cb, bsi1, bsi2)
+ cb = Callback()
+ p.begin_opByteSS(bsi1, bsi2, cb.opByteSS, cb.exCB)
cb.check()
- #
- # opBoolSS
- #
bsi1 = ((True,), (False,), (True, True),)
bsi2 = ((False, False, True),)
- cb = AMI_MyClass_opBoolSSI()
- p.opBoolSS_async(cb, bsi1, bsi2)
- cb.check()
+ cb = Callback()
+ p.begin_opBoolSS(bsi1, bsi2, cb.opBoolSS, cb.exCB)
+ cb.check();
- #
- # opShortIntLongSS
- #
ssi = ((1,2,5), (13,), ())
isi = ((24, 98), (42,))
lsi = ((496, 1729),)
- cb = AMI_MyClass_opShortIntLongSSI()
- p.opShortIntLongSS_async(cb, ssi, isi, lsi)
+ cb = Callback()
+ p.begin_opShortIntLongSS(ssi, isi, lsi, cb.opShortIntLongSS, cb.exCB)
cb.check()
- #
- # opFloatDoubleSS
- #
fsi = ((3.14,), (1.11,), ())
dsi = ((1.1E10, 1.2E10, 1.3E10),)
- cb = AMI_MyClass_opFloatDoubleSSI()
- p.opFloatDoubleSS_async(cb, fsi, dsi)
+ cb = Callback()
+ p.begin_opFloatDoubleSS(fsi, dsi, cb.opFloatDoubleSS, cb.exCB)
cb.check()
- #
- # opStringSS
- #
ssi1 = (('abc',), ('de', 'fghi'))
ssi2 = ((), (), ('xyz',))
- cb = AMI_MyClass_opStringSSI()
- p.opStringSS_async(cb, ssi1, ssi2)
+ cb = Callback()
+ p.begin_opStringSS(ssi1, ssi2, cb.opStringSS, cb.exCB)
cb.check()
- #
- # opByteBoolD
- #
di1 = {10: True, 100: False}
di2 = {10: True, 11: False, 101: True}
- cb = AMI_MyClass_opByteBoolDI()
- p.opByteBoolD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opByteBoolD(di1, di2, cb.opByteBoolD, cb.exCB)
cb.check()
- #
- # opShortIntD
- #
di1 = {110: -1, 1100: 123123}
di2 = {110: -1, 111: -100, 1101: 0}
- cb = AMI_MyClass_opShortIntDI()
- p.opShortIntD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opShortIntD(di1, di2, cb.opShortIntD, cb.exCB)
cb.check()
- #
- # opLongFloatD
- #
di1 = {999999110: -1.1, 999999111: 123123.2}
di2 = {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}
- cb = AMI_MyClass_opLongFloatDI()
- p.opLongFloatD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opLongFloatD(di1, di2, cb.opLongFloatD, cb.exCB)
cb.check()
- #
- # opStringStringD
- #
di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'}
di2 = {'foo': 'abc -1.1', 'FOO': 'abc -100.4', 'BAR': 'abc 0.5'}
- cb = AMI_MyClass_opStringStringDI()
- p.opStringStringD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opStringStringD(di1, di2, cb.opStringStringD, cb.exCB)
cb.check()
- #
- # opStringMyEnumD
- #
di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2}
di2 = {'abc': Test.MyEnum.enum1, 'qwerty': Test.MyEnum.enum3, 'Hello!!': Test.MyEnum.enum2}
- cb = AMI_MyClass_opStringMyEnumDI()
- p.opStringMyEnumD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opStringMyEnumD(di1, di2, cb.opStringMyEnumD, cb.exCB)
cb.check()
- #
- # opMyEnumStringD
- #
di1 = {Test.MyEnum.enum1: 'abc'}
di2 = {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'}
- cb = AMI_MyClass_opMyEnumStringDI()
- p.opMyEnumStringD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opMyEnumStringD(di1, di2, cb.opMyEnumStringD, cb.exCB)
cb.check()
- #
- # opMyStructMyEnumD
- #
s11 = Test.MyStruct()
s11.i = 1
s11.j = 1
@@ -964,48 +636,40 @@ def twowaysAMI(communicator, p):
di1 = {s11: Test.MyEnum.enum1, s12: Test.MyEnum.enum2}
di2 = {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2}
- cb = AMI_MyClass_opMyStructMyEnumDI()
- p.opMyStructMyEnumD_async(cb, di1, di2)
+ cb = Callback()
+ p.begin_opMyStructMyEnumD(di1, di2, cb.opMyStructMyEnumD, cb.exCB)
cb.check()
- #
- # opIntS
- #
lengths = ( 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 )
for l in lengths:
s = []
for i in range(l):
s.append(i)
- cb = AMI_MyClass_opIntSI(l)
- p.opIntS_async(cb, s)
+ cb = Callback(l)
+ p.begin_opIntS(s, cb.opIntS, cb.exCB)
cb.check()
- #
- # opContext
- #
ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'}
test(len(p.ice_getContext()) == 0)
- cb = AMI_MyClass_opContextNotEqualI(ctx)
- p.opContext_async(cb)
- cb.check()
+ r = p.begin_opContext()
+ c = p.end_opContext(r)
+ test(c != ctx)
test(len(p.ice_getContext()) == 0)
- cb = AMI_MyClass_opContextEqualI(ctx)
- p.opContext_async(cb, ctx)
- cb.check()
+ r = p.begin_opContext(_ctx=ctx)
+ c = p.end_opContext(r)
+ test(c == ctx)
p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx))
test(p2.ice_getContext() == ctx)
- cb = AMI_MyClass_opContextEqualI(ctx)
- p2.opContext_async(cb)
- cb.check()
+ r = p2.begin_opContext()
+ c = p2.end_opContext(r)
+ test(c == ctx)
- p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx))
- test(p2.ice_getContext() == ctx)
- cb = AMI_MyClass_opContextEqualI(ctx)
- p2.opContext_async(cb, ctx)
- cb.check()
+ r = p2.begin_opContext(_ctx=ctx)
+ c = p2.end_opContext(r)
+ test(c == ctx)
#
# Test implicit context propagation
@@ -1023,55 +687,47 @@ def twowaysAMI(communicator, p):
ic.getImplicitContext().setContext(ctx)
test(ic.getImplicitContext().getContext() == ctx)
-
- cb = AMI_MyClass_opContextEqualI(ctx)
- p3.opContext_async(cb)
- cb.check()
+ r = p3.begin_opContext()
+ c = p3.end_opContext(r)
+ test(c == ctx)
ic.getImplicitContext().put('zero', 'ZERO')
- ctx = ic.getImplicitContext().getContext()
- cb = AMI_MyClass_opContextEqualI(ctx)
- p3.opContext_async(cb)
- cb.check()
+ ctx = ic.getImplicitContext().getContext()
+ r = p3.begin_opContext()
+ c = p3.end_opContext(r)
+ test(c == ctx)
prxContext = {'one': 'UN', 'four': 'QUATRE'}
- combined = ctx
+ combined = {}
+ combined.update(ctx)
combined.update(prxContext)
test(combined['one'] == 'UN')
p3 = Test.MyClassPrx.uncheckedCast(p3.ice_context(prxContext))
ic.getImplicitContext().setContext({})
-
- cb = AMI_MyClass_opContextEqualI(prxContext)
- p3.opContext_async(cb)
- cb.check()
+ r = p3.begin_opContext()
+ c = p3.end_opContext(r)
+ test(c == prxContext)
ic.getImplicitContext().setContext(ctx)
-
- cb = AMI_MyClass_opContextEqualI(combined)
- p3.opContext_async(cb)
- cb.check()
+ r = p3.begin_opContext()
+ c = p3.end_opContext(r)
+ test(c == combined)
ic.destroy()
- #
- # opIdempotent
- #
- cb = AMI_MyClass_opIdempotentI()
- p.opIdempotent_async(cb)
+ cb = Callback()
+ p.begin_opIdempotent(cb.opIdempotent, cb.exCB)
cb.check()
- #
- # opNonmutating
- #
- cb = AMI_MyClass_opNonmutatingI()
- p.opNonmutating_async(cb)
+ cb = Callback()
+ p.begin_opNonmutating(cb.opNonmutating, cb.exCB)
cb.check()
derived = Test.MyDerivedClassPrx.checkedCast(p)
test(derived)
- cb = AMI_MyDerivedClass_opDerivedI()
- derived.opDerived_async(cb)
+ cb = Callback()
+ derived.begin_opDerived(cb.opDerived, cb.exCB)
cb.check()
diff --git a/py/test/Ice/operations/TwowaysNewAMI.py b/py/test/Ice/operations/TwowaysNewAMI.py
deleted file mode 100644
index 8fd1c73f79a..00000000000
--- a/py/test/Ice/operations/TwowaysNewAMI.py
+++ /dev/null
@@ -1,733 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import Ice, Test, math, sys, threading
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-class CallbackBase:
- def __init__(self):
- self._called = False
- self._cond = threading.Condition()
-
- def check(self):
- self._cond.acquire()
- try:
- while not self._called:
- self._cond.wait()
- self._called = False
- finally:
- self._cond.release()
-
- def called(self):
- self._cond.acquire()
- self._called = True
- self._cond.notify()
- self._cond.release()
-
-class Callback(CallbackBase):
- def __init__(self, communicator=None):
- CallbackBase.__init__(self)
- self._communicator = communicator
-
- def ping(self):
- self.called()
-
- def isA(self, r):
- test(r)
- self.called()
-
- def id(self, id):
- test(id == "::Test::MyDerivedClass")
- self.called()
-
- def ids(self, ids):
- test(len(ids) == 3)
- self.called()
-
- def opVoid(self):
- self.called()
-
- def opByte(self, r, b):
- test(b == 0xf0)
- test(r == 0xff)
- self.called()
-
- def opBool(self, r, b):
- test(b)
- test(not r)
- self.called()
-
- def opShortIntLong(self, r, s, i, l):
- test(s == 10)
- test(i == 11)
- test(l == 12)
- test(r == 12)
- self.called()
-
- def opFloatDouble(self, r, f, d):
- test(f - 3.14 < 0.001)
- test(d == 1.1E10)
- test(r == 1.1E10)
- self.called()
-
- def opString(self, r, s):
- test(s == "world hello")
- test(r == "hello world")
- self.called()
-
- def opMyEnum(self, r, e):
- test(e == Test.MyEnum.enum2)
- test(r == Test.MyEnum.enum3)
- self.called()
-
- def opMyClass(self, r, c1, c2):
- test(c1.ice_getIdentity() == self._communicator.stringToIdentity("test"))
- test(c2.ice_getIdentity() == self._communicator.stringToIdentity("noSuchIdentity"))
- test(r.ice_getIdentity() == self._communicator.stringToIdentity("test"))
- # We can't do the callbacks below in serialize mode
- if self._communicator.getProperties().getPropertyAsInt("Ice.Client.ThreadPool.Serialize") == 0:
- r.opVoid()
- c1.opVoid()
- try:
- c2.opVoid()
- test(False)
- except Ice.ObjectNotExistException:
- pass
- self.called()
-
- def opStruct(self, rso, so):
- test(rso.p == None)
- test(rso.e == Test.MyEnum.enum2)
- test(rso.s.s == "def")
- test(so.e == Test.MyEnum.enum3)
- test(so.s.s == "a new string")
- # We can't do the callbacks below in serialize mode.
- if self._communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0:
- so.p.opVoid()
- self.called()
-
- def opByteS(self, rso, bso):
- test(len(bso) == 4)
- test(len(rso) == 8)
- if sys.version_info[0] == 2:
- test(bso[0] == '\x22')
- test(bso[1] == '\x12')
- test(bso[2] == '\x11')
- test(bso[3] == '\x01')
- test(rso[0] == '\x01')
- test(rso[1] == '\x11')
- test(rso[2] == '\x12')
- test(rso[3] == '\x22')
- test(rso[4] == '\xf1')
- test(rso[5] == '\xf2')
- test(rso[6] == '\xf3')
- test(rso[7] == '\xf4')
- else:
- test(bso[0] == 0x22)
- test(bso[1] == 0x12)
- test(bso[2] == 0x11)
- test(bso[3] == 0x01)
- test(rso[0] == 0x01)
- test(rso[1] == 0x11)
- test(rso[2] == 0x12)
- test(rso[3] == 0x22)
- test(rso[4] == 0xf1)
- test(rso[5] == 0xf2)
- test(rso[6] == 0xf3)
- test(rso[7] == 0xf4)
- self.called()
-
- def opBoolS(self, rso, bso):
- test(len(bso) == 4)
- test(bso[0])
- test(bso[1])
- test(not bso[2])
- test(not bso[3])
- test(len(rso) == 3)
- test(not rso[0])
- test(rso[1])
- test(rso[2])
- self.called()
-
- def opShortIntLongS(self, rso, sso, iso, lso):
- test(len(sso) == 3)
- test(sso[0] == 1)
- test(sso[1] == 2)
- test(sso[2] == 3)
- test(len(iso) == 4)
- test(iso[0] == 8)
- test(iso[1] == 7)
- test(iso[2] == 6)
- test(iso[3] == 5)
- test(len(lso) == 6)
- test(lso[0] == 10)
- test(lso[1] == 30)
- test(lso[2] == 20)
- test(lso[3] == 10)
- test(lso[4] == 30)
- test(lso[5] == 20)
- test(len(rso) == 3)
- test(rso[0] == 10)
- test(rso[1] == 30)
- test(rso[2] == 20)
- self.called()
-
- def opFloatDoubleS(self, rso, fso, dso):
- test(len(fso) == 2)
- test(fso[0] - 3.14 < 0.001)
- test(fso[1] - 1.11 < 0.001)
- test(len(dso) == 3)
- test(dso[0] == 1.3E10)
- test(dso[1] == 1.2E10)
- test(dso[2] == 1.1E10)
- test(len(rso) == 5)
- test(rso[0] == 1.1E10)
- test(rso[1] == 1.2E10)
- test(rso[2] == 1.3E10)
- test(rso[3] - 3.14 < 0.001)
- test(rso[4] - 1.11 < 0.001)
- self.called()
-
- def opStringS(self, rso, sso):
- test(len(sso) == 4)
- test(sso[0] == "abc")
- test(sso[1] == "de")
- test(sso[2] == "fghi")
- test(sso[3] == "xyz")
- test(len(rso) == 3)
- test(rso[0] == "fghi")
- test(rso[1] == "de")
- test(rso[2] == "abc")
- self.called()
-
- def opByteSS(self, rso, bso):
- test(len(bso) == 2)
- test(len(bso[0]) == 1)
- test(len(bso[1]) == 3)
- test(len(rso) == 4)
- test(len(rso[0]) == 3)
- test(len(rso[1]) == 1)
- test(len(rso[2]) == 1)
- test(len(rso[3]) == 2)
- if sys.version_info[0] == 2:
- test(bso[0][0] == '\xff')
- test(bso[1][0] == '\x01')
- test(bso[1][1] == '\x11')
- test(bso[1][2] == '\x12')
- test(rso[0][0] == '\x01')
- test(rso[0][1] == '\x11')
- test(rso[0][2] == '\x12')
- test(rso[1][0] == '\xff')
- test(rso[2][0] == '\x0e')
- test(rso[3][0] == '\xf2')
- test(rso[3][1] == '\xf1')
- else:
- test(bso[0][0] == 0xff)
- test(bso[1][0] == 0x01)
- test(bso[1][1] == 0x11)
- test(bso[1][2] == 0x12)
- test(rso[0][0] == 0x01)
- test(rso[0][1] == 0x11)
- test(rso[0][2] == 0x12)
- test(rso[1][0] == 0xff)
- test(rso[2][0] == 0x0e)
- test(rso[3][0] == 0xf2)
- test(rso[3][1] == 0xf1)
- self.called()
-
- def opBoolSS(self, rso, bso):
- test(len(bso) == 4);
- test(len(bso[0]) == 1);
- test(bso[0][0]);
- test(len(bso[1]) == 1);
- test(not bso[1][0]);
- test(len(bso[2]) == 2);
- test(bso[2][0]);
- test(bso[2][1]);
- test(len(bso[3]) == 3);
- test(not bso[3][0]);
- test(not bso[3][1]);
- test(bso[3][2]);
- test(len(rso) == 3);
- test(len(rso[0]) == 2);
- test(rso[0][0]);
- test(rso[0][1]);
- test(len(rso[1]) == 1);
- test(not rso[1][0]);
- test(len(rso[2]) == 1);
- test(rso[2][0]);
- self.called();
-
- def opShortIntLongSS(self, rso, sso, iso, lso):
- test(len(rso) == 1);
- test(len(rso[0]) == 2);
- test(rso[0][0] == 496);
- test(rso[0][1] == 1729);
- test(len(sso) == 3);
- test(len(sso[0]) == 3);
- test(sso[0][0] == 1);
- test(sso[0][1] == 2);
- test(sso[0][2] == 5);
- test(len(sso[1]) == 1);
- test(sso[1][0] == 13);
- test(len(sso[2]) == 0);
- test(len(iso) == 2);
- test(len(iso[0]) == 1);
- test(iso[0][0] == 42);
- test(len(iso[1]) == 2);
- test(iso[1][0] == 24);
- test(iso[1][1] == 98);
- test(len(lso) == 2);
- test(len(lso[0]) == 2);
- test(lso[0][0] == 496);
- test(lso[0][1] == 1729);
- test(len(lso[1]) == 2);
- test(lso[1][0] == 496);
- test(lso[1][1] == 1729);
- self.called();
-
- def opFloatDoubleSS(self, rso, fso, dso):
- test(len(fso) == 3)
- test(len(fso[0]) == 1)
- test(fso[0][0] - 3.14 < 0.001)
- test(len(fso[1]) == 1)
- test(fso[1][0] - 1.11 < 0.001)
- test(len(fso[2]) == 0)
- test(len(dso) == 1)
- test(len(dso[0]) == 3)
- test(dso[0][0] == 1.1E10)
- test(dso[0][1] == 1.2E10)
- test(dso[0][2] == 1.3E10)
- test(len(rso) == 2)
- test(len(rso[0]) == 3)
- test(rso[0][0] == 1.1E10)
- test(rso[0][1] == 1.2E10)
- test(rso[0][2] == 1.3E10)
- test(len(rso[1]) == 3)
- test(rso[1][0] == 1.1E10)
- test(rso[1][1] == 1.2E10)
- test(rso[1][2] == 1.3E10)
- self.called()
-
- def opStringSS(self, rso, sso):
- test(len(sso) == 5)
- test(len(sso[0]) == 1)
- test(sso[0][0] == "abc")
- test(len(sso[1]) == 2)
- test(sso[1][0] == "de")
- test(sso[1][1] == "fghi")
- test(len(sso[2]) == 0)
- test(len(sso[3]) == 0)
- test(len(sso[4]) == 1)
- test(sso[4][0] == "xyz")
- test(len(rso) == 3)
- test(len(rso[0]) == 1)
- test(rso[0][0] == "xyz")
- test(len(rso[1]) == 0)
- test(len(rso[2]) == 0)
- self.called()
-
- def opByteBoolD(self, ro, do):
- di1 = {10: True, 100: False}
- test(do == di1)
- test(len(ro) == 4)
- test(ro[10])
- test(not ro[11])
- test(not ro[100])
- test(ro[101])
- self.called()
-
- def opShortIntD(self, ro, do):
- di1 = {110: -1, 1100: 123123}
- test(do == di1)
- test(len(ro) == 4)
- test(ro[110] == -1)
- test(ro[111] == -100)
- test(ro[1100] == 123123)
- test(ro[1101] == 0)
- self.called()
-
- def opLongFloatD(self, ro, do):
- di1 = {999999110: -1.1, 999999111: 123123.2}
- for k in do:
- test(math.fabs(do[k] - di1[k]) < 0.01)
- test(len(ro) == 4)
- test(ro[999999110] - -1.1 < 0.01)
- test(ro[999999120] - -100.4 < 0.01)
- test(ro[999999111] - 123123.2 < 0.01)
- test(ro[999999130] - 0.5 < 0.01)
- self.called()
-
- def opStringStringD(self, ro, do):
- di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'}
- test(do == di1)
- test(len(ro) == 4)
- test(ro["foo"] == "abc -1.1")
- test(ro["FOO"] == "abc -100.4")
- test(ro["bar"] == "abc 123123.2")
- test(ro["BAR"] == "abc 0.5")
- self.called()
-
- def opStringMyEnumD(self, ro, do):
- di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2}
- test(do == di1)
- test(len(ro) == 4)
- test(ro["abc"] == Test.MyEnum.enum1)
- test(ro["qwerty"] == Test.MyEnum.enum3)
- test(ro[""] == Test.MyEnum.enum2)
- test(ro["Hello!!"] == Test.MyEnum.enum2)
- self.called()
-
- def opMyEnumStringD(self, ro, do):
- di1 = {Test.MyEnum.enum1: 'abc'}
- test(do == di1)
- test(len(ro) == 3)
- test(ro[Test.MyEnum.enum1] == "abc")
- test(ro[Test.MyEnum.enum2] == "Hello!!")
- test(ro[Test.MyEnum.enum3] == "qwerty")
- self.called()
-
- def opMyStructMyEnumD(self, ro, do):
- s11 = Test.MyStruct()
- s11.i = 1
- s11.j = 1
- s12 = Test.MyStruct()
- s12.i = 1
- s12.j = 2
- s22 = Test.MyStruct()
- s22.i = 2
- s22.j = 2
- s23 = Test.MyStruct()
- s23.i = 2
- s23.j = 3
- di1 = {s11: Test.MyEnum.enum1, s12: Test.MyEnum.enum2}
- test(do == di1)
- test(len(ro) == 4)
- test(ro[s11] == Test.MyEnum.enum1)
- test(ro[s12] == Test.MyEnum.enum2)
- test(ro[s22] == Test.MyEnum.enum3)
- test(ro[s23] == Test.MyEnum.enum2)
- self.called()
-
- def opIntS(self, r):
- for j in range(0, len(r)):
- test(r[j] == -j)
- self.called()
-
- def opIdempotent(self):
- self.called()
-
- def opNonmutating(self):
- self.called()
-
- def opDerived(self):
- self.called()
-
- def exCB(self, ex):
- test(False)
-
-def twowaysNewAMI(communicator, p):
- cb = Callback()
- p.begin_ice_ping(cb.ping, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_ice_isA(Test.MyClass.ice_staticId(), cb.isA, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_ice_id(cb.id, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_ice_ids(cb.ids, cb.exCB)
- cb.check()
-
- r = p.begin_opVoid()
- p.end_opVoid(r)
-
- cb = Callback()
- p.begin_opVoid(cb.opVoid, cb.exCB)
- cb.check()
-
- r = p.begin_opByte(0xff, 0x0f)
- (ret, p3) = p.end_opByte(r)
- test(p3 == 0xf0)
- test(ret == 0xff)
-
- cb = Callback()
- p.begin_opByte(0xff, 0x0f, cb.opByte, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opBool(True, False, cb.opBool, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opShortIntLong(10, 11, 12, cb.opShortIntLong, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opFloatDouble(3.14, 1.1E10, cb.opFloatDouble, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opString("hello", "world", cb.opString, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opMyEnum(Test.MyEnum.enum2, cb.opMyEnum, cb.exCB)
- cb.check()
-
- cb = Callback(communicator)
- p.begin_opMyClass(p, cb.opMyClass, cb.exCB)
- cb.check()
-
- si1 = Test.Structure()
- si1.p = p
- si1.e = Test.MyEnum.enum3
- si1.s = Test.AnotherStruct()
- si1.s.s = "abc"
- si2 = Test.Structure()
- si2.p = None
- si2.e = Test.MyEnum.enum2
- si2.s = Test.AnotherStruct()
- si2.s.s = "def"
-
- cb = Callback(communicator)
- p.begin_opStruct(si1, si2, cb.opStruct, cb.exCB)
- cb.check()
-
- bsi1 = (0x01, 0x11, 0x12, 0x22)
- bsi2 = (0xf1, 0xf2, 0xf3, 0xf4)
-
- cb = Callback()
- p.begin_opByteS(bsi1, bsi2, cb.opByteS, cb.exCB)
- cb.check()
-
- bsi1 = (True, True, False)
- bsi2 = (False,)
-
- cb = Callback()
- p.begin_opBoolS(bsi1, bsi2, cb.opBoolS, cb.exCB)
- cb.check()
-
- ssi = (1, 2, 3)
- isi = (5, 6, 7, 8)
- lsi = (10, 30, 20)
-
- cb = Callback()
- p.begin_opShortIntLongS(ssi, isi, lsi, cb.opShortIntLongS, cb.exCB)
- cb.check()
-
- fsi = (3.14, 1.11)
- dsi = (1.1E10, 1.2E10, 1.3E10)
-
- cb = Callback()
- p.begin_opFloatDoubleS(fsi, dsi, cb.opFloatDoubleS, cb.exCB)
- cb.check()
-
- ssi1 = ('abc', 'de', 'fghi')
- ssi2 = ('xyz',)
-
- cb = Callback()
- p.begin_opStringS(ssi1, ssi2, cb.opStringS, cb.exCB)
- cb.check()
-
- bsi1 = ((0x01, 0x11, 0x12), (0xff,))
- bsi2 = ((0x0e,), (0xf2, 0xf1))
-
- cb = Callback()
- p.begin_opByteSS(bsi1, bsi2, cb.opByteSS, cb.exCB)
- cb.check()
-
- bsi1 = ((True,), (False,), (True, True),)
- bsi2 = ((False, False, True),)
-
- cb = Callback()
- p.begin_opBoolSS(bsi1, bsi2, cb.opBoolSS, cb.exCB)
- cb.check();
-
- ssi = ((1,2,5), (13,), ())
- isi = ((24, 98), (42,))
- lsi = ((496, 1729),)
-
- cb = Callback()
- p.begin_opShortIntLongSS(ssi, isi, lsi, cb.opShortIntLongSS, cb.exCB)
- cb.check()
-
- fsi = ((3.14,), (1.11,), ())
- dsi = ((1.1E10, 1.2E10, 1.3E10),)
-
- cb = Callback()
- p.begin_opFloatDoubleSS(fsi, dsi, cb.opFloatDoubleSS, cb.exCB)
- cb.check()
-
- ssi1 = (('abc',), ('de', 'fghi'))
- ssi2 = ((), (), ('xyz',))
-
- cb = Callback()
- p.begin_opStringSS(ssi1, ssi2, cb.opStringSS, cb.exCB)
- cb.check()
-
- di1 = {10: True, 100: False}
- di2 = {10: True, 11: False, 101: True}
-
- cb = Callback()
- p.begin_opByteBoolD(di1, di2, cb.opByteBoolD, cb.exCB)
- cb.check()
-
- di1 = {110: -1, 1100: 123123}
- di2 = {110: -1, 111: -100, 1101: 0}
-
- cb = Callback()
- p.begin_opShortIntD(di1, di2, cb.opShortIntD, cb.exCB)
- cb.check()
-
- di1 = {999999110: -1.1, 999999111: 123123.2}
- di2 = {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}
-
- cb = Callback()
- p.begin_opLongFloatD(di1, di2, cb.opLongFloatD, cb.exCB)
- cb.check()
-
- di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'}
- di2 = {'foo': 'abc -1.1', 'FOO': 'abc -100.4', 'BAR': 'abc 0.5'}
-
- cb = Callback()
- p.begin_opStringStringD(di1, di2, cb.opStringStringD, cb.exCB)
- cb.check()
-
- di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2}
- di2 = {'abc': Test.MyEnum.enum1, 'qwerty': Test.MyEnum.enum3, 'Hello!!': Test.MyEnum.enum2}
-
- cb = Callback()
- p.begin_opStringMyEnumD(di1, di2, cb.opStringMyEnumD, cb.exCB)
- cb.check()
-
- di1 = {Test.MyEnum.enum1: 'abc'}
- di2 = {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'}
-
- cb = Callback()
- p.begin_opMyEnumStringD(di1, di2, cb.opMyEnumStringD, cb.exCB)
- cb.check()
-
- s11 = Test.MyStruct()
- s11.i = 1
- s11.j = 1
- s12 = Test.MyStruct()
- s12.i = 1
- s12.j = 2
- s22 = Test.MyStruct()
- s22.i = 2
- s22.j = 2
- s23 = Test.MyStruct()
- s23.i = 2
- s23.j = 3
- di1 = {s11: Test.MyEnum.enum1, s12: Test.MyEnum.enum2}
- di2 = {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2}
-
- cb = Callback()
- p.begin_opMyStructMyEnumD(di1, di2, cb.opMyStructMyEnumD, cb.exCB)
- cb.check()
-
- lengths = ( 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 )
- for l in lengths:
- s = []
- for i in range(l):
- s.append(i)
- cb = Callback(l)
- p.begin_opIntS(s, cb.opIntS, cb.exCB)
- cb.check()
-
- ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'}
-
- test(len(p.ice_getContext()) == 0)
- r = p.begin_opContext()
- c = p.end_opContext(r)
- test(c != ctx)
-
- test(len(p.ice_getContext()) == 0)
- r = p.begin_opContext(_ctx=ctx)
- c = p.end_opContext(r)
- test(c == ctx)
-
- p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx))
- test(p2.ice_getContext() == ctx)
- r = p2.begin_opContext()
- c = p2.end_opContext(r)
- test(c == ctx)
-
- r = p2.begin_opContext(_ctx=ctx)
- c = p2.end_opContext(r)
- test(c == ctx)
-
- #
- # Test implicit context propagation
- #
- impls = ( 'Shared', 'PerThread' )
- for i in impls:
- initData = Ice.InitializationData()
- initData.properties = communicator.getProperties().clone()
- initData.properties.setProperty('Ice.ImplicitContext', i)
- ic = Ice.initialize(data=initData)
-
- ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'}
-
- p3 = Test.MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010"))
-
- ic.getImplicitContext().setContext(ctx)
- test(ic.getImplicitContext().getContext() == ctx)
- r = p3.begin_opContext()
- c = p3.end_opContext(r)
- test(c == ctx)
-
- ic.getImplicitContext().put('zero', 'ZERO')
-
- ctx = ic.getImplicitContext().getContext()
- r = p3.begin_opContext()
- c = p3.end_opContext(r)
- test(c == ctx)
-
- prxContext = {'one': 'UN', 'four': 'QUATRE'}
-
- combined = {}
- combined.update(ctx)
- combined.update(prxContext)
- test(combined['one'] == 'UN')
-
- p3 = Test.MyClassPrx.uncheckedCast(p3.ice_context(prxContext))
- ic.getImplicitContext().setContext({})
- r = p3.begin_opContext()
- c = p3.end_opContext(r)
- test(c == prxContext)
-
- ic.getImplicitContext().setContext(ctx)
- r = p3.begin_opContext()
- c = p3.end_opContext(r)
- test(c == combined)
-
- ic.destroy()
-
- cb = Callback()
- p.begin_opIdempotent(cb.opIdempotent, cb.exCB)
- cb.check()
-
- cb = Callback()
- p.begin_opNonmutating(cb.opNonmutating, cb.exCB)
- cb.check()
-
- derived = Test.MyDerivedClassPrx.checkedCast(p)
- test(derived)
- cb = Callback()
- derived.begin_opDerived(cb.opDerived, cb.exCB)
- cb.check()
diff --git a/py/test/Ice/optional/Test.ice b/py/test/Ice/optional/Test.ice
index 3024fb8f23e..1b81ff320a4 100644
--- a/py/test/Ice/optional/Test.ice
+++ b/py/test/Ice/optional/Test.ice
@@ -178,7 +178,6 @@ class Recursive {
optional(0) RecursiveSeq value;
};
-["ami"]
class Initial
{
void shutdown();
diff --git a/py/test/Ice/optional/TestAMD.ice b/py/test/Ice/optional/TestAMD.ice
index 44a91bc4cdd..24fb8564401 100644
--- a/py/test/Ice/optional/TestAMD.ice
+++ b/py/test/Ice/optional/TestAMD.ice
@@ -178,7 +178,7 @@ class Recursive {
optional(0) RecursiveSeq value;
};
-["ami", "amd"]
+["amd"]
class Initial
{
void shutdown();
diff --git a/py/test/Slice/keyword/Client.py b/py/test/Slice/keyword/Client.py
index 9775c7f3c1a..d4f6ebc73c6 100755
--- a/py/test/Slice/keyword/Client.py
+++ b/py/test/Slice/keyword/Client.py
@@ -58,11 +58,10 @@ def testtypes():
d = _and.execPrx.uncheckedCast(None)
assert "_finally" in dir(_and.execPrx)
d1 = execI()
- e = _and.forPrx.uncheckedCast(None)
- assert "foo_async" in dir(_and.forPrx)
+
e1 = forI()
f = _and.ifPrx.uncheckedCast(None)
- assert "foo_async" in dir(_and.ifPrx)
+
assert "_finally" in dir(_and.ifPrx)
assert "_elif" in dir(_and.ifPrx)
f1 = ifI()
diff --git a/py/test/Slice/keyword/Key.ice b/py/test/Slice/keyword/Key.ice
index 572f2cfbc59..cce06c92576 100644
--- a/py/test/Slice/keyword/Key.ice
+++ b/py/test/Slice/keyword/Key.ice
@@ -32,7 +32,7 @@ module and
class for
{
int lambda;
- ["ami"] void foo(exec* from, out int global);
+ void foo(exec* from, out int global);
};
class if extends for implements exec, del