diff options
author | Jose <jose@zeroc.com> | 2015-11-19 16:27:16 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-11-19 16:27:16 +0100 |
commit | 87fc4e46d3108554762c44aa2fc46cb3a151f7e6 (patch) | |
tree | c3bc9f31e465fbc2d092100a63e7cf00abe963ed | |
parent | Fixed bug in Java/C# class data member generated patcher (diff) | |
download | ice-87fc4e46d3108554762c44aa2fc46cb3a151f7e6.tar.bz2 ice-87fc4e46d3108554762c44aa2fc46cb3a151f7e6.tar.xz ice-87fc4e46d3108554762c44aa2fc46cb3a151f7e6.zip |
Objects test updates to sync with Java/C#
-rw-r--r-- | cpp/test/Ice/objects/AllTests.cpp | 24 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Test.ice | 32 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.cpp | 12 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.h | 3 | ||||
-rw-r--r-- | js/test/Ice/objects/Client.js | 31 | ||||
-rw-r--r-- | js/test/Ice/objects/Test.ice | 33 | ||||
-rw-r--r-- | php/test/Ice/objects/Client.php | 25 | ||||
-rw-r--r-- | php/test/Ice/objects/Test.ice | 32 | ||||
-rw-r--r-- | python/test/Ice/objects/AllTests.py | 21 | ||||
-rw-r--r-- | python/test/Ice/objects/Test.ice | 32 | ||||
-rw-r--r-- | python/test/Ice/objects/TestI.py | 6 | ||||
-rw-r--r-- | ruby/test/Ice/objects/AllTests.rb | 22 | ||||
-rw-r--r-- | ruby/test/Ice/objects/Test.ice | 32 |
13 files changed, 305 insertions, 0 deletions
diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index 04643d44427..ea7feee2778 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -206,6 +206,30 @@ allTests(const Ice::CommunicatorPtr& communicator) IPtr h = initial->getH(); test(h && HPtr::dynamicCast(h)); cout << "ok" << endl; + + cout << "getting D1... " << flush; + D1Ptr d1 = new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4")); + d1 = initial->getD1(d1); + test(d1->a1->name == "a1"); + test(d1->a2->name == "a2"); + test(d1->a3->name == "a3"); + test(d1->a4->name == "a4"); + cout << "ok" << endl; + + cout << "throw EDerived... " << flush; + try + { + initial->throwEDerived(); + test(false); + } + catch(const EDerived& ederived) + { + test(ederived.a1->name == "a1"); + test(ederived.a2->name == "a2"); + test(ederived.a3->name == "a3"); + test(ederived.a4->name == "a4"); + } + cout << "ok" << endl; cout << "setting I... " << flush; initial->setI(i); diff --git a/cpp/test/Ice/objects/Test.ice b/cpp/test/Ice/objects/Test.ice index abbc1b87dc2..a082598c123 100644 --- a/cpp/test/Ice/objects/Test.ice +++ b/cpp/test/Ice/objects/Test.ice @@ -135,6 +135,35 @@ exception Ex }; +class A1 +{ + string name; +}; + +class B1 +{ + A1 a1; + A1 a2; +}; + +class D1 extends B1 +{ + A1 a3; + A1 a4; +}; + +exception EBase +{ + A1 a1; + A1 a2; +}; + +exception EDerived extends EBase +{ + A1 a3; + A1 a4; +}; + class Initial { void shutdown(); @@ -150,6 +179,9 @@ class Initial I getI(); I getJ(); I getH(); + + D1 getD1(D1 d1); + void throwEDerived() throws EDerived; void setI(I theI); diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp index fd86c6c3dac..5c4814ffab2 100644 --- a/cpp/test/Ice/objects/TestI.cpp +++ b/cpp/test/Ice/objects/TestI.cpp @@ -268,6 +268,18 @@ InitialI::getH(const Ice::Current&) return new HI(); } +D1Ptr +InitialI::getD1(const Test::D1Ptr& d1, const Ice::Current&) +{ + return d1; +} + +void +InitialI::throwEDerived(const Ice::Current&) +{ + throw EDerived(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4")); +} + bool UnexpectedObjectExceptionTestI::ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>& outParams, diff --git a/cpp/test/Ice/objects/TestI.h b/cpp/test/Ice/objects/TestI.h index 46d6835948e..127d5ad821e 100644 --- a/cpp/test/Ice/objects/TestI.h +++ b/cpp/test/Ice/objects/TestI.h @@ -108,6 +108,9 @@ public: virtual Test::IPtr getI(const Ice::Current&); virtual Test::IPtr getJ(const Ice::Current&); virtual Test::IPtr getH(const Ice::Current&); + + virtual Test::D1Ptr getD1(const Test::D1Ptr&, const Ice::Current&); + virtual void throwEDerived(const Ice::Current&); virtual void setI(const Test::IPtr&, const Ice::Current&); diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js index 9357c8e8c03..c67ed7bb28a 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -379,6 +379,37 @@ { h = obj; test(h); + out.writeLine("ok"); + out.write("getting D1... "); + return initial.getD1(new Test.D1(new Test.A1("a1"), + new Test.A1("a2"), + new Test.A1("a3"), + new Test.A1("a4"))); + } + ).then( + function(d1) + { + test(d1.a1.name == "a1"); + test(d1.a2.name == "a2"); + test(d1.a3.name == "a3"); + test(d1.a4.name == "a4"); + out.writeLine("ok"); + out.write("throw EDerived... "); + return initial.throwEDerived(); + } + ).then( + function() + { + test(false); + }, + function(ex) + { + test(ex instanceof Test.EDerived); + test(ex.a1.name == "a1"); + test(ex.a2.name == "a2"); + test(ex.a3.name == "a3"); + test(ex.a4.name == "a4"); + out.writeLine("ok"); out.write("setting I... "); return initial.setI(i); } diff --git a/js/test/Ice/objects/Test.ice b/js/test/Ice/objects/Test.ice index 3253877694e..2c229c25bbe 100644 --- a/js/test/Ice/objects/Test.ice +++ b/js/test/Ice/objects/Test.ice @@ -109,6 +109,36 @@ class CompactExt(CompactExtId) extends Compact { }; + +class A1 +{ + string name; +}; + +class B1 +{ + A1 a1; + A1 a2; +}; + +class D1 extends B1 +{ + A1 a3; + A1 a4; +}; + +exception EBase +{ + A1 a1; + A1 a2; +}; + +exception EDerived extends EBase +{ + A1 a3; + A1 a4; +}; + module Inner { @@ -155,6 +185,9 @@ class Initial I getJ(); I getH(); + D1 getD1(D1 d1); + void throwEDerived() throws EDerived; + void setI(I theI); BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php index e9e33a01739..b57d585093b 100644 --- a/php/test/Ice/objects/Client.php +++ b/php/test/Ice/objects/Client.php @@ -346,6 +346,31 @@ function allTests($communicator) $h = $initial->getH(); test($h != null and $h instanceof Test_H); echo "ok\n"; + + echo "getting D1... "; + flush(); + $d1 = $initial->getD1(new Test_D1(new Test_A1("a1"), new Test_A1("a2"), new Test_A1("a3"), new Test_A1("a4"))); + test($d1->a1->name == "a1"); + test($d1->a2->name == "a2"); + test($d1->a3->name == "a3"); + test($d1->a4->name == "a4"); + echo "ok\n"; + + echo "throw EDerived... "; + flush(); + try + { + $initial->throwEDerived(); + test(false); + } + catch(Test_EDerived $e) + { + test($e->a1->name == "a1"); + test($e->a2->name == "a2"); + test($e->a3->name == "a3"); + test($e->a4->name == "a4"); + } + echo "ok\n"; echo "setting I... "; flush(); diff --git a/php/test/Ice/objects/Test.ice b/php/test/Ice/objects/Test.ice index 9416490c825..0baceedbf46 100644 --- a/php/test/Ice/objects/Test.ice +++ b/php/test/Ice/objects/Test.ice @@ -105,6 +105,35 @@ class CompactExt(CompactExtId) extends Compact { }; +class A1 +{ + string name; +}; + +class B1 +{ + A1 a1; + A1 a2; +}; + +class D1 extends B1 +{ + A1 a3; + A1 a4; +}; + +exception EBase +{ + A1 a1; + A1 a2; +}; + +exception EDerived extends EBase +{ + A1 a3; + A1 a4; +}; + class Initial { void shutdown(); @@ -121,6 +150,9 @@ class Initial I getJ(); I getH(); + D1 getD1(D1 d1); + void throwEDerived() throws EDerived; + void setI(I theI); BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); diff --git a/python/test/Ice/objects/AllTests.py b/python/test/Ice/objects/AllTests.py index d7de69b901c..3d46a6ca643 100644 --- a/python/test/Ice/objects/AllTests.py +++ b/python/test/Ice/objects/AllTests.py @@ -107,6 +107,27 @@ def allTests(communicator): h = initial.getH() test(isinstance(h, Test.H)) print("ok") + + sys.stdout.write("getting D1... ") + sys.stdout.flush() + d1 = initial.getD1(Test.D1(Test.A1("a1"), Test.A1("a2"), Test.A1("a3"), Test.A1("a4"))); + test(d1.a1.name == "a1") + test(d1.a2.name == "a2") + test(d1.a3.name == "a3") + test(d1.a4.name == "a4") + print("ok") + + sys.stdout.write("throw EDerived... ") + sys.stdout.flush() + try: + initial.throwEDerived() + test(false) + except Test.EDerived as e: + test(e.a1.name == "a1") + test(e.a2.name == "a2") + test(e.a3.name == "a3") + test(e.a4.name == "a4") + print("ok") sys.stdout.write("setting I... ") sys.stdout.flush() diff --git a/python/test/Ice/objects/Test.ice b/python/test/Ice/objects/Test.ice index 42852d1f75c..484cfdee59a 100644 --- a/python/test/Ice/objects/Test.ice +++ b/python/test/Ice/objects/Test.ice @@ -105,6 +105,35 @@ class CompactExt(CompactExtId) extends Compact { }; +class A1 +{ + string name; +}; + +class B1 +{ + A1 a1; + A1 a2; +}; + +class D1 extends B1 +{ + A1 a3; + A1 a4; +}; + +exception EBase +{ + A1 a1; + A1 a2; +}; + +exception EDerived extends EBase +{ + A1 a3; + A1 a4; +}; + class Initial { void shutdown(); @@ -121,6 +150,9 @@ class Initial I getJ(); I getH(); + D1 getD1(D1 d1); + void throwEDerived() throws EDerived; + void setI(I theI); BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); diff --git a/python/test/Ice/objects/TestI.py b/python/test/Ice/objects/TestI.py index 5fc8b0cedca..d75af432c32 100644 --- a/python/test/Ice/objects/TestI.py +++ b/python/test/Ice/objects/TestI.py @@ -147,6 +147,12 @@ class InitialI(Test.Initial): def getH(self, current=None): return HI() + + def getD1(self, d1, current=None): + return d1 + + def throwEDerived(self, current=None): + raise Test.EDerived(Test.A1("a1"), Test.A1("a2"), Test.A1("a3"), Test.A1("a4")) def setI(self, i, current=None): pass diff --git a/ruby/test/Ice/objects/AllTests.rb b/ruby/test/Ice/objects/AllTests.rb index cb009438b80..56fb00a02b1 100644 --- a/ruby/test/Ice/objects/AllTests.rb +++ b/ruby/test/Ice/objects/AllTests.rb @@ -192,6 +192,28 @@ def allTests(communicator) h = initial.getH() test(i) puts "ok" + + print "getting D1... " + STDOUT.flush + d1 = initial.getD1(Test::D1.new(Test::A1.new("a1"), Test::A1.new("a2"), Test::A1.new("a3"), Test::A1.new("a4"))) + test(d1.a1.name == "a1") + test(d1.a2.name == "a2") + test(d1.a3.name == "a3") + test(d1.a4.name == "a4") + puts "ok" + + print "throw EDerived... " + STDOUT.flush + begin + initial.throwEDerived() + test(false) + rescue Test::EDerived => e + test(e.a1.name == "a1") + test(e.a2.name == "a2") + test(e.a3.name == "a3") + test(e.a4.name == "a4") + end + puts "ok" print "setting I... " STDOUT.flush diff --git a/ruby/test/Ice/objects/Test.ice b/ruby/test/Ice/objects/Test.ice index 42852d1f75c..484cfdee59a 100644 --- a/ruby/test/Ice/objects/Test.ice +++ b/ruby/test/Ice/objects/Test.ice @@ -105,6 +105,35 @@ class CompactExt(CompactExtId) extends Compact { }; +class A1 +{ + string name; +}; + +class B1 +{ + A1 a1; + A1 a2; +}; + +class D1 extends B1 +{ + A1 a3; + A1 a4; +}; + +exception EBase +{ + A1 a1; + A1 a2; +}; + +exception EDerived extends EBase +{ + A1 a3; + A1 a4; +}; + class Initial { void shutdown(); @@ -121,6 +150,9 @@ class Initial I getJ(); I getH(); + D1 getD1(D1 d1); + void throwEDerived() throws EDerived; + void setI(I theI); BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); |