diff options
author | Jose <jose@zeroc.com> | 2017-05-22 11:17:24 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-05-22 11:17:24 +0200 |
commit | af8386af5b3a88730db7deceeda0fa0698be8c48 (patch) | |
tree | 3604c4a196c09c5e5a10c43f590a090d3cfccab7 | |
parent | Added check for Android SDK installation (diff) | |
download | ice-af8386af5b3a88730db7deceeda0fa0698be8c48.tar.bz2 ice-af8386af5b3a88730db7deceeda0fa0698be8c48.tar.xz ice-af8386af5b3a88730db7deceeda0fa0698be8c48.zip |
Result struct test
22 files changed, 213 insertions, 1 deletions
diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index 35fe85d9638..da4b801009c 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -1298,7 +1298,6 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { } } - } cout << "ok" << endl; @@ -2386,6 +2385,32 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) } } + { + cout << "testing result struct... " << flush; + + auto q = Ice::uncheckedCast<Test::Outer::Inner::TestIntfPrx>( + communicator->stringToProxy("test2:" + getTestEndpoint(communicator, 0))); + + promise<void> promise; + q->opAsync(1, + [&promise](int i, int j) + { + test(i == j); + promise.set_value(); + }, + [](const exception_ptr& ex) + { + test(false); + }); + promise.get_future().get(); + + auto f = q->opAsync(1); + auto r = f.get(); + test(r.returnValue == r.j); + test(r.returnValue == 1); + cout << "ok" << endl; + } + p->shutdown(); #else diff --git a/cpp/test/Ice/ami/Collocated.cpp b/cpp/test/Ice/ami/Collocated.cpp index a21d5a2f324..3d887510dd1 100644 --- a/cpp/test/Ice/ami/Collocated.cpp +++ b/cpp/test/Ice/ami/Collocated.cpp @@ -28,6 +28,7 @@ run(int, char**, const Ice::CommunicatorPtr& communicator) TestIntfControllerIPtr testController = ICE_MAKE_SHARED(TestIntfControllerI, adapter); adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(TestIntfII), Ice::stringToIdentity("test2")); //adapter->activate(); // Collocated test doesn't need to activate the OA adapter2->add(testController, Ice::stringToIdentity("testController")); diff --git a/cpp/test/Ice/ami/Server.cpp b/cpp/test/Ice/ami/Server.cpp index e153cd12b5e..6e1eba0d663 100644 --- a/cpp/test/Ice/ami/Server.cpp +++ b/cpp/test/Ice/ami/Server.cpp @@ -28,6 +28,7 @@ run(int, char**, const Ice::CommunicatorPtr& communicator) TestIntfControllerIPtr testController = ICE_MAKE_SHARED(TestIntfControllerI, adapter); adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(TestIntfII), Ice::stringToIdentity("test2")); adapter->activate(); adapter2->add(testController, Ice::stringToIdentity("testController")); diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice index 8ef2be51924..ccbe33822ca 100644 --- a/cpp/test/Ice/ami/Test.ice +++ b/cpp/test/Ice/ami/Test.ice @@ -64,4 +64,19 @@ interface TestIntfController void resumeAdapter(); } +module Outer +{ + +module Inner +{ + +interface TestIntf +{ + int op(int i, out int j); +} + +} + +} + } diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp index c9d2869e80a..c9eddb8283d 100644 --- a/cpp/test/Ice/ami/TestI.cpp +++ b/cpp/test/Ice/ami/TestI.cpp @@ -194,3 +194,10 @@ TestIntfControllerI::resumeAdapter(const Ice::Current&) TestIntfControllerI::TestIntfControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter) { } + +Ice::Int +TestIntfII::op(Ice::Int i, Ice::Int& j, const Ice::Current&) +{ + j = i; + return i; +} diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h index 1748f89284a..2f6c75e1438 100644 --- a/cpp/test/Ice/ami/TestI.h +++ b/cpp/test/Ice/ami/TestI.h @@ -72,4 +72,11 @@ private: Ice::ObjectAdapterPtr _adapter; }; +class TestIntfII : public virtual Test::Outer::Inner::TestIntf +{ +public: + + Ice::Int op(Ice::Int, Ice::Int&, const Ice::Current&); +}; + #endif diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs index 2f5d3e12473..985c1f77eed 100644 --- a/csharp/test/Ice/ami/AllTests.cs +++ b/csharp/test/Ice/ami/AllTests.cs @@ -3820,6 +3820,20 @@ public class AllTests : TestCommon.AllTests } WriteLine("ok"); + Write("testing result struct... "); + Flush(); + { + var q = Test.Outer.Inner.TestIntfPrxHelper.uncheckedCast( + communicator.stringToProxy("test2:" + app.getTestEndpoint(0))); + q.opAsync(1).ContinueWith(t => + { + var r = t.Result; + test(r.returnValue == 1); + test(r.j == 1); + }).Wait(); + } + WriteLine("ok"); + p.shutdown(); } } diff --git a/csharp/test/Ice/ami/Collocated.cs b/csharp/test/Ice/ami/Collocated.cs index 9a069dde732..767727ee8ac 100644 --- a/csharp/test/Ice/ami/Collocated.cs +++ b/csharp/test/Ice/ami/Collocated.cs @@ -28,6 +28,7 @@ public class Collocated : TestCommon.Application Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); + adapter.add(new TestII(), Ice.Util.stringToIdentity("test2")); //adapter.activate(); // Collocated test doesn't need to activate the OA adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Collocated test doesn't need to activate the OA diff --git a/csharp/test/Ice/ami/Server.cs b/csharp/test/Ice/ami/Server.cs index 6dfdfd12c61..1e71acb2819 100644 --- a/csharp/test/Ice/ami/Server.cs +++ b/csharp/test/Ice/ami/Server.cs @@ -28,6 +28,7 @@ public class Server : TestCommon.Application Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); + adapter.add(new TestII(), Ice.Util.stringToIdentity("test2")); adapter.activate(); adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); adapter2.activate(); diff --git a/csharp/test/Ice/ami/Test.ice b/csharp/test/Ice/ami/Test.ice index 0ba929e94b9..d6006190001 100644 --- a/csharp/test/Ice/ami/Test.ice +++ b/csharp/test/Ice/ami/Test.ice @@ -64,4 +64,19 @@ interface TestIntfController void resumeAdapter(); } +module Outer +{ + +module Inner +{ + +interface TestIntf +{ + int op(int i, out int j); +} + +} + +} + } diff --git a/csharp/test/Ice/ami/TestI.cs b/csharp/test/Ice/ami/TestI.cs index 4f7ec7fbe79..61377d11ef3 100644 --- a/csharp/test/Ice/ami/TestI.cs +++ b/csharp/test/Ice/ami/TestI.cs @@ -186,6 +186,16 @@ public class TestI : TestIntfDisp_ private List<TaskCompletionSource<object>> _pending = new List<TaskCompletionSource<object>>(); } +public class TestII : Test.Outer.Inner.TestIntfDisp_ +{ + override public int + op(int i, out int j, Ice.Current current) + { + j = i; + return i; + } +} + public class TestControllerI : TestIntfControllerDisp_ { override public void diff --git a/java-compat/test/src/main/java/test/Ice/ami/Test.ice b/java-compat/test/src/main/java/test/Ice/ami/Test.ice index 15239f27288..d15fa7b4a9e 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Test.ice +++ b/java-compat/test/src/main/java/test/Ice/ami/Test.ice @@ -67,4 +67,19 @@ interface TestIntfController void resumeAdapter(); } +module Outer +{ + +module Inner +{ + +interface TestIntf +{ + int op(int i, out int j); +} + +} + +} + } diff --git a/java-compat/test/src/main/java/test/Ice/ami/TestII.java b/java-compat/test/src/main/java/test/Ice/ami/TestII.java new file mode 100644 index 00000000000..ac110447b71 --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/ami/TestII.java @@ -0,0 +1,21 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.ami; + +import test.Ice.ami.Test.Outer.Inner._TestIntfDisp; + +public class TestII extends _TestIntfDisp +{ + public int op(int i, Ice.IntHolder j, Ice.Current current) + { + j.value = i; + return i; + } +} diff --git a/java/test/src/main/java/test/Ice/ami/AMI.java b/java/test/src/main/java/test/Ice/ami/AMI.java index d8485572250..9c17144db3d 100644 --- a/java/test/src/main/java/test/Ice/ami/AMI.java +++ b/java/test/src/main/java/test/Ice/ami/AMI.java @@ -993,5 +993,22 @@ public class AMI } } out.println("ok"); + + out.print("testing result struct... "); + out.flush(); + { + test.Ice.ami.Test.Outer.Inner.TestIntfPrx q = + test.Ice.ami.Test.Outer.Inner.TestIntfPrx.uncheckedCast( + communicator.stringToProxy("test2:" + app.getTestEndpoint(0))); + + q.opAsync(1).whenComplete( + (result, ex) -> + { + test(result.returnValue == 1); + test(result.j == 1); + test(ex == null); + }); + } + out.println("ok"); } } diff --git a/java/test/src/main/java/test/Ice/ami/Collocated.java b/java/test/src/main/java/test/Ice/ami/Collocated.java index d374a619e4f..449f2e12a5b 100644 --- a/java/test/src/main/java/test/Ice/ami/Collocated.java +++ b/java/test/src/main/java/test/Ice/ami/Collocated.java @@ -18,6 +18,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test")); + adapter.add(new TestII(), com.zeroc.Ice.Util.stringToIdentity("test2")); //adapter.activate(); // Collocated test doesn't need to activate the OA adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Collocated test doesn't need to activate the OA diff --git a/java/test/src/main/java/test/Ice/ami/Server.java b/java/test/src/main/java/test/Ice/ami/Server.java index 3894c3aec85..9ebc7064ad6 100644 --- a/java/test/src/main/java/test/Ice/ami/Server.java +++ b/java/test/src/main/java/test/Ice/ami/Server.java @@ -18,6 +18,7 @@ public class Server extends test.Util.Application com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test")); + adapter.add(new TestII(), com.zeroc.Ice.Util.stringToIdentity("test2")); adapter.activate(); adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController")); adapter2.activate(); diff --git a/java/test/src/main/java/test/Ice/ami/Test.ice b/java/test/src/main/java/test/Ice/ami/Test.ice index 15239f27288..d15fa7b4a9e 100644 --- a/java/test/src/main/java/test/Ice/ami/Test.ice +++ b/java/test/src/main/java/test/Ice/ami/Test.ice @@ -67,4 +67,19 @@ interface TestIntfController void resumeAdapter(); } +module Outer +{ + +module Inner +{ + +interface TestIntf +{ + int op(int i, out int j); +} + +} + +} + } diff --git a/java/test/src/main/java/test/Ice/ami/TestII.java b/java/test/src/main/java/test/Ice/ami/TestII.java new file mode 100644 index 00000000000..399d440fad2 --- /dev/null +++ b/java/test/src/main/java/test/Ice/ami/TestII.java @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.ami; + +import test.Ice.ami.Test.CloseMode; +import test.Ice.ami.Test.Outer.Inner.TestIntf; + +public class TestII implements TestIntf +{ + public OpResult op(int i, com.zeroc.Ice.Current current) + { + OpResult result = new OpResult(); + result.returnValue = i; + result.j = i; + return result; + } +} diff --git a/python/test/Ice/ami/Collocated.py b/python/test/Ice/ami/Collocated.py index d349e62c1d5..c2b9bc85579 100755 --- a/python/test/Ice/ami/Collocated.py +++ b/python/test/Ice/ami/Collocated.py @@ -30,6 +30,7 @@ def run(args, communicator): testController = TestI.TestIntfControllerI(adapter) adapter.add(TestI.TestIntfI(), Ice.stringToIdentity("test")) + adapter.add(TestI.TestIntfII(), Ice.stringToIdentity("test2")) #adapter.activate() # Collocated test doesn't need to active the OA adapter2.add(testController, Ice.stringToIdentity("testController")) diff --git a/python/test/Ice/ami/Server.py b/python/test/Ice/ami/Server.py index c60a21bbb06..b667abf9fad 100755 --- a/python/test/Ice/ami/Server.py +++ b/python/test/Ice/ami/Server.py @@ -29,6 +29,7 @@ def run(args, communicator): testController = TestI.TestIntfControllerI(adapter) adapter.add(TestI.TestIntfI(), Ice.stringToIdentity("test")) + adapter.add(TestI.TestIntfII(), Ice.stringToIdentity("test2")) adapter.activate() adapter2.add(testController, Ice.stringToIdentity("testController")) diff --git a/python/test/Ice/ami/Test.ice b/python/test/Ice/ami/Test.ice index 1b7852dc1df..f3d7a873bfe 100644 --- a/python/test/Ice/ami/Test.ice +++ b/python/test/Ice/ami/Test.ice @@ -59,4 +59,19 @@ interface TestIntfController void resumeAdapter(); } +module Outer +{ + +module Inner +{ + +interface TestIntf +{ + int op(int i, out int j); +} + +} + +} + } diff --git a/python/test/Ice/ami/TestI.py b/python/test/Ice/ami/TestI.py index 0eb0675b721..1197976408b 100644 --- a/python/test/Ice/ami/TestI.py +++ b/python/test/Ice/ami/TestI.py @@ -80,6 +80,10 @@ class TestIntfI(Test.TestIntf): def pingBiDir(self, id, current = None): Test.PingReplyPrx.uncheckedCast(current.con.createProxy(id)).reply() +class TestIntfII(Test.Outer.Inner.TestIntf): + def op(self, i, current): + return (i, i) + class TestIntfControllerI(Test.TestIntfController): def __init__(self, adapter): self._adapter = adapter |