diff options
author | Jose <jose@zeroc.com> | 2019-06-06 19:24:20 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-06-06 19:24:20 +0200 |
commit | 2dc0a8799e913bb37db8c5895f00f4dda920df62 (patch) | |
tree | 6dd9fe720314d92fecedb703132c5cf73082ca3f /python/test | |
parent | Do not set WindowsTargetPlatformVersion, use the default (diff) | |
download | ice-2dc0a8799e913bb37db8c5895f00f4dda920df62.tar.bz2 ice-2dc0a8799e913bb37db8c5895f00f4dda920df62.tar.xz ice-2dc0a8799e913bb37db8c5895f00f4dda920df62.zip |
Fix Incorrect generated code for class implements interface
Close #406
Diffstat (limited to 'python/test')
-rw-r--r-- | python/test/Ice/operations/AllTests.py | 7 | ||||
-rwxr-xr-x | python/test/Ice/operations/Collocated.py | 1 | ||||
-rwxr-xr-x | python/test/Ice/operations/Server.py | 1 | ||||
-rwxr-xr-x | python/test/Ice/operations/ServerAMD.py | 2 | ||||
-rw-r--r-- | python/test/Ice/operations/Test.ice | 25 | ||||
-rwxr-xr-x | python/test/Ice/operations/TestAMDCoroI.py | 2 | ||||
-rwxr-xr-x | python/test/Ice/operations/TestAMDI.py | 10 | ||||
-rw-r--r-- | python/test/Ice/operations/TestI.py | 12 | ||||
-rw-r--r-- | python/test/Ice/operations/Twoways.py | 5 |
9 files changed, 58 insertions, 7 deletions
diff --git a/python/test/Ice/operations/AllTests.py b/python/test/Ice/operations/AllTests.py index 457dbceaf96..3f9decd88f2 100644 --- a/python/test/Ice/operations/AllTests.py +++ b/python/test/Ice/operations/AllTests.py @@ -2,7 +2,7 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice, Test, Twoways, TwowaysFuture, TwowaysAMI, Oneways, OnewaysFuture, OnewaysAMI, BatchOneways, sys +import Ice, Test, M, Twoways, TwowaysFuture, TwowaysAMI, Oneways, OnewaysFuture, OnewaysAMI, BatchOneways, sys import BatchOnewaysAMI, BatchOnewaysFuture def test(b): @@ -14,11 +14,12 @@ def allTests(helper, communicator): base = communicator.stringToProxy(ref) cl = Test.MyClassPrx.checkedCast(base) derived = Test.MyDerivedClassPrx.checkedCast(cl) + bprx = M.BPrx.checkedCast(communicator.stringToProxy("b:{0}".format(helper.getTestEndpoint()))) sys.stdout.write("testing twoway operations... ") sys.stdout.flush() - Twoways.twoways(helper, cl) - Twoways.twoways(helper, derived) + Twoways.twoways(helper, cl, bprx) + Twoways.twoways(helper, derived, bprx) derived.opDerived() print("ok") diff --git a/python/test/Ice/operations/Collocated.py b/python/test/Ice/operations/Collocated.py index fc758b63767..06f23dbc30a 100755 --- a/python/test/Ice/operations/Collocated.py +++ b/python/test/Ice/operations/Collocated.py @@ -19,6 +19,7 @@ class Collocated(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") prx = adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(TestI.BI(), Ice.stringToIdentity("b")) # adapter.activate() // Don't activate OA to ensure collocation is used. if prx.ice_getConnection(): raise RuntimeError("collocation doesn't work") diff --git a/python/test/Ice/operations/Server.py b/python/test/Ice/operations/Server.py index fcfd76a0c11..c909fd0be2d 100755 --- a/python/test/Ice/operations/Server.py +++ b/python/test/Ice/operations/Server.py @@ -24,5 +24,6 @@ class Server(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(TestI.BI(), Ice.stringToIdentity("b")) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/operations/ServerAMD.py b/python/test/Ice/operations/ServerAMD.py index b0c61270b0c..da0d55ba0bb 100755 --- a/python/test/Ice/operations/ServerAMD.py +++ b/python/test/Ice/operations/ServerAMD.py @@ -14,6 +14,7 @@ if sys.version_info >= (3, 5): else: from TestAMDI import MyDerivedClassI +from TestAMDI import BI from TestHelper import TestHelper TestHelper.loadSlice("Test.ice") @@ -35,5 +36,6 @@ class ServerAMD(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(BI(), Ice.stringToIdentity("b")) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/operations/Test.ice b/python/test/Ice/operations/Test.ice index 4eb1f2c7d97..78caa951346 100644 --- a/python/test/Ice/operations/Test.ice +++ b/python/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -362,3 +364,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/python/test/Ice/operations/TestAMDCoroI.py b/python/test/Ice/operations/TestAMDCoroI.py index 1f337e134c8..b1bc54ff448 100755 --- a/python/test/Ice/operations/TestAMDCoroI.py +++ b/python/test/Ice/operations/TestAMDCoroI.py @@ -11,7 +11,7 @@ if not slice_dir: sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") -import Test +import Test, M def test(b): if not b: diff --git a/python/test/Ice/operations/TestAMDI.py b/python/test/Ice/operations/TestAMDI.py index 9e89185ece0..305b8e79faa 100755 --- a/python/test/Ice/operations/TestAMDI.py +++ b/python/test/Ice/operations/TestAMDI.py @@ -11,7 +11,7 @@ if not slice_dir: sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") -import Test +import Test, M def test(b): if not b: @@ -27,6 +27,14 @@ class FutureThread(threading.Thread): time.sleep(0.01) self.future.set_result(self.result) + +class BI(M.BDisp): + def opB(self, current=None): + return Ice.Future.completed(()) + + def opIntf(self, current=None): + return Ice.Future.completed(()) + class MyDerivedClassI(Test.MyDerivedClass): def __init__(self): self.threads = [] diff --git a/python/test/Ice/operations/TestI.py b/python/test/Ice/operations/TestI.py index fc1d3e8bb1e..287985df157 100644 --- a/python/test/Ice/operations/TestI.py +++ b/python/test/Ice/operations/TestI.py @@ -2,12 +2,22 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice, Test, sys, threading +import Ice, Test, M, sys, threading def test(b): if not b: raise RuntimeError('test assertion failed') + +class BI(M.BDisp): + + def opB(self, current=None): + pass + + def opIntf(self, current=None): + pass + + class MyDerivedClassI(Test.MyDerivedClass): def __init__(self): self.lock = threading.Lock() diff --git a/python/test/Ice/operations/Twoways.py b/python/test/Ice/operations/Twoways.py index bc138341c2c..03f0a2f479d 100644 --- a/python/test/Ice/operations/Twoways.py +++ b/python/test/Ice/operations/Twoways.py @@ -9,7 +9,7 @@ def test(b): if not b: raise RuntimeError('test assertion failed') -def twoways(helper, p): +def twoways(helper, p, bprx): communicator = helper.communicator() literals = p.opStringLiterals() @@ -1431,3 +1431,6 @@ def twoways(helper, p): p1 = { "test": "test" } (p3, p2) = p.opMDict2(p1) test(p3["test"] == "test" and p2["test"] == "test") + + bprx.opB() + bprx.opIntf() |