[hydra-commits] kpfleming: branch techdemo/kpfleming/slicing r569 - /techdemo/team/kpfleming/...
SVN commits to the Hydra project
hydra-commits at lists.digium.com
Fri Apr 9 11:01:57 CDT 2010
Author: kpfleming
Date: Fri Apr 9 11:01:56 2010
New Revision: 569
URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=569
Log:
extend unit test to test passing and receiving a class that will not be sliced
Modified:
techdemo/team/kpfleming/slicing/objects/AllTests.cpp
techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice
techdemo/team/kpfleming/slicing/objects/Test.ice
techdemo/team/kpfleming/slicing/objects/TestI.cpp
Modified: techdemo/team/kpfleming/slicing/objects/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/techdemo/team/kpfleming/slicing/objects/AllTests.cpp?view=diff&rev=569&r1=568&r2=569
==============================================================================
--- techdemo/team/kpfleming/slicing/objects/AllTests.cpp (original)
+++ techdemo/team/kpfleming/slicing/objects/AllTests.cpp Fri Apr 9 11:01:56 2010
@@ -864,7 +864,6 @@
BPtr b2 = b1->pb;
test(b2);
test(b2->sb == "D3.sb");
- cout << "returned object is of type " << b2->ice_id() << endl;
test(b2->ice_id() == "::Test::B"); // Sliced by server
test(b2->pb == b1);
D3Ptr p3 = D3Ptr::dynamicCast(b2);
@@ -1017,6 +1016,194 @@
test(b1 != d3);
test(b2 != d1);
test(b2 != d3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ }
+ cout << "ok" << endl;
+
+ cout << "return value unsliced for input params known first... " << flush;
+ {
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D5Ptr d5 = new D5;
+ d5->pb = d1;
+ d5->sb = "D5.sb";
+ d5->sd5 = "D5.sd5";
+ d5->pd5 = d1;
+ d1->pb = d5;
+ d1->pd1 = d5;
+
+ BPtr b1 = test->returnTest3(d1, d5);
+
+ test(b1);
+ test(b1->sb == "D1.sb");
+ test(b1->ice_id() == "::Test::D1");
+ D1Ptr p1 = D1Ptr::dynamicCast(b1);
+ test(p1);
+ test(p1->sd1 == "D1.sd1");
+ test(p1->pd1 == b1->pb);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D5.sb");
+ test(b2->ice_id() == "::Test::D5"); // *NOT* sliced by server
+ test(b2->pb == b1);
+ D5Ptr p5 = D5Ptr::dynamicCast(b2);
+ test(p5);
+
+ test(b1 != d1);
+ test(b1 != d5);
+ test(b2 != d1);
+ test(b2 != d5);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ }
+ cout << "ok" << endl;
+
+ cout << "return value unsliced for input params known first (AMI)... " << flush;
+ {
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D5Ptr d5 = new D5;
+ d5->pb = d1;
+ d5->sb = "D5.sb";
+ d5->sd5 = "D5.sd5";
+ d5->pd5 = d1;
+ d1->pb = d5;
+ d1->pd1 = d5;
+
+ CallbackPtr cb = new Callback;
+ test->begin_returnTest3(d1, d5,
+ newCallback_TestIntf_returnTest3(cb, &Callback::response_returnTest3, &Callback::exception));
+ cb->check();
+ BPtr b1 = cb->rb;
+
+ test(b1);
+ test(b1->sb == "D1.sb");
+ test(b1->ice_id() == "::Test::D1");
+ D1Ptr p1 = D1Ptr::dynamicCast(b1);
+ test(p1);
+ test(p1->sd1 == "D1.sd1");
+ test(p1->pd1 == b1->pb);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D5.sb");
+ test(b2->ice_id() == "::Test::D5"); // *NOT* sliced by server
+ test(b2->pb == b1);
+ D5Ptr p5 = D5Ptr::dynamicCast(b2);
+ test(p5);
+
+ test(b1 != d1);
+ test(b1 != d5);
+ test(b2 != d1);
+ test(b2 != d5);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ }
+ cout << "ok" << endl;
+
+ cout << "return value unsliced for input params unknown first... " << flush;
+ {
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D5Ptr d5 = new D5;
+ d5->pb = d1;
+ d5->sb = "D5.sb";
+ d5->sd5 = "D5.sd5";
+ d5->pd5 = d1;
+ d1->pb = d5;
+ d1->pd1 = d5;
+
+ BPtr b1 = test->returnTest3(d5, d1);
+
+ test(b1);
+ test(b1->sb == "D5.sb");
+ test(b1->ice_id() == "::Test::D5"); // *NOT* sliced by server
+ D5Ptr p1 = D5Ptr::dynamicCast(b1);
+ test(p1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D1.sb");
+ test(b2->ice_id() == "::Test::D1");
+ test(b2->pb == b1);
+ D1Ptr p3 = D1Ptr::dynamicCast(b2);
+ test(p3);
+ test(p3->sd1 == "D1.sd1");
+ test(p3->pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d5);
+ test(b2 != d1);
+ test(b2 != d5);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ }
+ cout << "ok" << endl;
+
+ cout << "return value unsliced for input params unknown first (AMI)... " << flush;
+ {
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D5Ptr d5 = new D5;
+ d5->pb = d1;
+ d5->sb = "D5.sb";
+ d5->sd5 = "D5.sd5";
+ d5->pd5 = d1;
+ d1->pb = d5;
+ d1->pd1 = d5;
+
+ CallbackPtr cb = new Callback;
+ test->begin_returnTest3(d5, d1,
+ newCallback_TestIntf_returnTest3(cb, &Callback::response_returnTest3, &Callback::exception));
+ cb->check();
+ BPtr b1 = cb->rb;
+
+ test(b1);
+ test(b1->sb == "D5.sb");
+ test(b1->ice_id() == "::Test::D5"); // *NOT* sliced by server
+ D5Ptr p1 = D5Ptr::dynamicCast(b1);
+ test(p1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D1.sb");
+ test(b2->ice_id() == "::Test::D1");
+ test(b2->pb == b1);
+ D1Ptr p3 = D1Ptr::dynamicCast(b2);
+ test(p3);
+ test(p3->sd1 == "D1.sd1");
+ test(p3->pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d5);
+ test(b2 != d1);
+ test(b2 != d5);
}
catch(...)
{
Modified: techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice?view=diff&rev=569&r1=568&r2=569
==============================================================================
--- techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice (original)
+++ techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice Fri Apr 9 11:01:56 2010
@@ -21,10 +21,10 @@
B pd3;
};
-class D5 extends B
+class D5 extends BU
{
- string sd3;
- B pd3;
+ string sd5;
+ B pd5;
};
};
Modified: techdemo/team/kpfleming/slicing/objects/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/techdemo/team/kpfleming/slicing/objects/Test.ice?view=diff&rev=569&r1=568&r2=569
==============================================================================
--- techdemo/team/kpfleming/slicing/objects/Test.ice (original)
+++ techdemo/team/kpfleming/slicing/objects/Test.ice Fri Apr 9 11:01:56 2010
@@ -27,6 +27,10 @@
{
string sb;
B pb;
+};
+
+class BU extends B
+{
};
class D1 extends B
Modified: techdemo/team/kpfleming/slicing/objects/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/techdemo/team/kpfleming/slicing/objects/TestI.cpp?view=diff&rev=569&r1=568&r2=569
==============================================================================
--- techdemo/team/kpfleming/slicing/objects/TestI.cpp (original)
+++ techdemo/team/kpfleming/slicing/objects/TestI.cpp Fri Apr 9 11:01:56 2010
@@ -41,7 +41,7 @@
TestI::TestI(const Ice::CommunicatorPtr& communicator)
{
- communicator->addObjectFactory(new PreserverFactory<B>, B::ice_staticId());
+ communicator->addObjectFactory(new PreserverFactory<BU>, BU::ice_staticId());
}
Ice::ObjectPtr
More information about the asterisk-scf-commits
mailing list