[hydra-commits] kpfleming: branch ice/skipped-slice-recovery r576 - in /ice/branches/skipped-...

SVN commits to the Hydra project hydra-commits at lists.digium.com
Mon Apr 12 11:52:48 CDT 2010


Author: kpfleming
Date: Mon Apr 12 11:52:48 2010
New Revision: 576

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=576
Log:
import work so far in adding tests for explicit unsliceability

Added:
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice
      - copied unchanged from r575, techdemo/team/kpfleming/slicing/exceptions/ClientPrivate.ice
Modified:
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Client.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile.mak
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Client.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Forward.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivate.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.h   (contents, props changed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp Mon Apr 12 11:52:48 2010
@@ -10,6 +10,7 @@
 #include <Ice/Ice.h>
 #include <TestCommon.h>
 #include <Test.h>
+#include <ClientPrivate.h>
 
 using namespace std;
 using namespace Test;
@@ -325,11 +326,44 @@
 
 typedef IceUtil::Handle<Callback> CallbackPtr;
 
+class ClientI : virtual public Test::ClientIntf
+{
+public:
+	virtual void baseAsBase(const Ice::Current&)
+	{
+		Base ex;
+		ex.b = "Base";
+		throw ex;
+	}
+
+	virtual void unknownDerivedAsBase(const Ice::Current&)
+	{
+		ClientUnknownDerived ex;
+		ex.ud = "UnknownDerived";
+		ex.b = "Base";
+		throw ex;
+	}
+
+	virtual void unsliceableDerivedAsBase(const Ice::Current&)
+	{
+		ClientUnsliceableDerived ex;
+		ex.ud = "UnsliceableDerived";
+		ex.b = "Base";
+		throw ex;
+	}
+};
+
 TestIntfPrx
 allTests(const Ice::CommunicatorPtr& communicator)
 {
+    Ice::PropertiesPtr properties(communicator->getProperties());
+    properties->setProperty("Ice.Warn.Dispatch", "0");
+    properties->setProperty("ClientAdapter.Endpoints", "default -p 12020 -t 2000");
     Ice::ObjectPrx obj = communicator->stringToProxy("Test:default -p 12010");
     TestIntfPrx test = TestIntfPrx::checkedCast(obj);
+    Ice::ObjectAdapterPtr adapter(communicator->createObjectAdapter("ClientAdapter"));
+    ClientIntfPrx client = ClientIntfPrx::uncheckedCast(adapter->addWithUUID(new ClientI()));
+    adapter->activate();
 
     cout << "base... " << flush;
     {
@@ -369,7 +403,8 @@
         catch(const Base& b)
         {
             test(b.b == "UnknownDerived.b");
-            test(b.ice_name() =="Test::Base");
+	    cout << "ice_name is " << b.ice_name() << endl;
+            test(b.ice_name() == "Test::Base");
         }
         catch(...)
         {
@@ -718,5 +753,119 @@
     }
     cout << "ok" << endl;
 
+    cout << "base pass through server... " << flush;
+    {
+        try
+	{
+            test->clientBaseAsBasePass(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::Base");
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "base rethrown by server... " << flush;
+    {
+        try
+	{
+            test->clientBaseAsBaseRethrow(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::Base");
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "unknown derived pass through server... " << flush;
+    {
+        try
+	{
+            test->clientUnknownDerivedAsBasePass(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::Base");	// sliced by server
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "unknown derived rethrown by server... " << flush;
+    {
+        try
+	{
+            test->clientUnknownDerivedAsBaseRethrow(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::Base");	// sliced by server
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "unsliceable derived pass through server... " << flush;
+    {
+        try
+	{
+            test->clientUnsliceableDerivedAsBasePass(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::ClientUnsliceableDerived");	// *NOT* sliced by server
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
+    cout << "unsliceable derived rethrown by server... " << flush;
+    {
+        try
+	{
+            test->clientUnsliceableDerivedAsBaseRethrow(client);
+	    test(false);
+	}
+        catch(const Base& b)
+        {
+	    test(b.b == "Base");
+            test(b.ice_name() =="Test::ClientUnsliceableDerived");	// *NOT* sliced by server
+        }
+	catch(...)
+	{
+            test(false);
+        }
+    }
+    cout << "ok" << endl;
+
     return test;
 }

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/AllTests.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/AllTests.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/AllTests.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Client.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/Client.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/Client.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/Client.cpp:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile Mon Apr 12 11:52:48 2010
@@ -17,15 +17,16 @@
 
 COBJS		= Test.o \
 		  Client.o \
+		  ClientPrivate.o \
 		  AllTests.o
 
 SOBJS		= Test.o \
-    		  ServerPrivate.o \
+		  ServerPrivate.o \
 		  TestI.o \
 		  Server.o
 
 SAMDOBJS	= TestAMD.o \
-    		  ServerPrivateAMD.o \
+		  ServerPrivateAMD.o \
 		  TestAMDI.o \
 		  ServerAMD.o
 
@@ -33,7 +34,7 @@
 		  $(SOBJS:.o=.cpp) \
 		  $(SAMDOBJS:.o=.cpp)
 
-SLICE_SRCS	= Test.ice TestAMD.ice ServerPrivate.ice ServerPrivateAMD.ice
+SLICE_SRCS	= Test.ice TestAMD.ice ServerPrivate.ice ServerPrivateAMD.ice ClientPrivate.ice
 
 include $(top_srcdir)/config/Make.rules
 

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile.mak
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile.mak?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile.mak (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Makefile.mak Mon Apr 12 11:52:48 2010
@@ -17,6 +17,7 @@
 
 COBJS		= Test.obj \
 		  Client.obj \
+		  ClientPrivate.o \
 		  AllTests.obj
 
 SOBJS		= Test.obj \
@@ -63,6 +64,7 @@
 clean::
 	del /q Test.cpp Test.h
 	del /q TestAMD.cpp TestAMD.h
+	del /q ClientPrivate.cpp ClientPrivate.h
 	del /q ServerPrivate.cpp ServerPrivate.h
 	del /q ServerPrivateAMD.cpp ServerPrivateAMD.h
 

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp Mon Apr 12 11:52:48 2010
@@ -15,11 +15,11 @@
 int
 run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
 {
-    Ice::PropertiesPtr properties = communicator->getProperties();
+    Ice::PropertiesPtr properties(communicator->getProperties());
     properties->setProperty("Ice.Warn.Dispatch", "0");
-    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
-    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
-    Ice::ObjectPtr object = new TestI();
+    properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+    Ice::ObjectAdapterPtr adapter(communicator->createObjectAdapter("TestAdapter"));
+    Ice::ObjectPtr object(new TestI(communicator));
     adapter->add(object, communicator->stringToIdentity("Test"));
     adapter->activate();
     communicator->waitForShutdown();

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/Server.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/Server.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/Server.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/ServerAMD.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice:509-510
+/techdemo/team/kpfleming/slicing/exceptions/ServerPrivate.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice:509-510
+/techdemo/team/kpfleming/slicing/exceptions/ServerPrivateAMD.ice:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice Mon Apr 12 11:52:48 2010
@@ -33,6 +33,17 @@
     string kmd;
 };
 
+exception BaseUnsliceable extends Base
+{
+};
+
+interface ClientIntf
+{
+    void baseAsBase() throws Base;
+    void unknownDerivedAsBase() throws Base;
+    void unsliceableDerivedAsBase() throws Base;
+};
+
 ["ami"] interface TestIntf
 {
     void baseAsBase() throws Base;
@@ -51,6 +62,13 @@
     void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate;
     void unknownMostDerived2AsBase() throws Base;
 
+    void clientBaseAsBasePass(ClientIntf* client) throws Base;
+    void clientUnknownDerivedAsBasePass(ClientIntf* client) throws Base;
+    void clientUnsliceableDerivedAsBasePass(ClientIntf* client) throws Base;
+    void clientBaseAsBaseRethrow(ClientIntf* client) throws Base;
+    void clientUnknownDerivedAsBaseRethrow(ClientIntf* client) throws Base;
+    void clientUnsliceableDerivedAsBaseRethrow(ClientIntf* client) throws Base;
+
     void shutdown();
 };
 

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/Test.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/Test.ice:509-510
+/techdemo/team/kpfleming/slicing/exceptions/Test.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/TestAMD.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/TestAMD.ice:509-510
+/techdemo/team/kpfleming/slicing/exceptions/TestAMD.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/TestAMDI.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/TestAMDI.h:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/TestAMDI.h:509-510
+/techdemo/team/kpfleming/slicing/exceptions/TestAMDI.h:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp Mon Apr 12 11:52:48 2010
@@ -10,10 +10,49 @@
 #include <TestI.h>
 #include <Ice/Ice.h>
 
+using namespace std;
 using namespace Test;
 
-TestI::TestI()
-{
+template <typename T>
+class PreserverFactory : public IceInternal::UserExceptionFactory
+{
+public:
+	void createAndThrow() {
+		throw Preserver();
+	}
+private:
+	class Preserver : virtual public T
+	{
+	public:
+		vector< ::Ice::Byte > __skippedSlices;
+		void __write(IceInternal::BasicStream* stream) const
+		{
+			stream->writeBlob(__skippedSlices);
+			T::__write(stream);
+		}
+		void __read(IceInternal::BasicStream* stream, bool rid)
+		{
+			stream->readSkippedSlicesBlob(__skippedSlices);
+			T::__read(stream, rid);
+		}
+		void ice_throw() const
+		{
+		    throw *this;
+		}
+		~Preserver() throw() {}
+	};
+};
+
+TestI::TestI(const Ice::CommunicatorPtr& communicator)
+{
+	// the factoryTable interface is... interesting. if you add an exception factory
+	// with the same name as one already in the table, it just increments the reference
+	// count  on the existing factory, without even comparing the factory object
+	// handles to see if it is in fact the same factory being added. so for now we
+	// need to explicitly remove the factory that the slice2cpp translator generated
+	// before adding our own
+	IceInternal::factoryTable->removeExceptionFactory("::Test::BaseUnsliceable");
+	IceInternal::factoryTable->addExceptionFactory("::Test::BaseUnsliceable", new PreserverFactory<BaseUnsliceable>);
 }
 
 void
@@ -140,6 +179,63 @@
 }
 
 void
+TestI::clientBaseAsBasePass(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	client->baseAsBase();
+}
+
+void
+TestI::clientUnknownDerivedAsBasePass(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	client->unknownDerivedAsBase();
+}
+
+void
+TestI::clientUnsliceableDerivedAsBasePass(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	client->unsliceableDerivedAsBase();
+}
+
+void
+TestI::clientBaseAsBaseRethrow(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	try
+	{
+		client->baseAsBase();
+	}
+	catch (const Base& ex)
+	{
+		throw;
+	}
+}
+
+void
+TestI::clientUnknownDerivedAsBaseRethrow(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	try
+	{
+		client->unknownDerivedAsBase();
+	}
+	catch (const Base& ex)
+	{
+		throw;
+	}
+}
+
+void
+TestI::clientUnsliceableDerivedAsBaseRethrow(const ClientIntfPrx& client, const ::Ice::Current&)
+{
+	try
+	{
+		client->unsliceableDerivedAsBase();
+	}
+	catch (const Base& ex)
+	{
+		throw;
+	}
+}
+
+void
 TestI::shutdown(const ::Ice::Current& current)
 {
     current.adapter->getCommunicator()->shutdown();

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/TestI.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/TestI.cpp:509-510
+/techdemo/team/kpfleming/slicing/exceptions/TestI.cpp:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h Mon Apr 12 11:52:48 2010
@@ -16,7 +16,7 @@
 {
 public:
 
-    TestI();
+    TestI(const Ice::CommunicatorPtr&);
     virtual void baseAsBase(const ::Ice::Current&);
     virtual void unknownDerivedAsBase(const ::Ice::Current&);
     virtual void knownDerivedAsBase(const ::Ice::Current&);
@@ -33,6 +33,13 @@
     virtual void unknownMostDerived1AsKnownIntermediate(const ::Ice::Current&);
     virtual void unknownMostDerived2AsBase(const ::Ice::Current&);
 
+    virtual void clientBaseAsBasePass(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientUnknownDerivedAsBasePass(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientUnsliceableDerivedAsBasePass(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientBaseAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientUnknownDerivedAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
+    virtual void clientUnsliceableDerivedAsBaseRethrow(const Test::ClientIntfPrx&, const ::Ice::Current&);
+
     virtual void shutdown(const ::Ice::Current&);
 };
 

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/exceptions/TestI.h:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/exceptions/TestI.h:509-510
+/techdemo/team/kpfleming/slicing/exceptions/TestI.h:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp Mon Apr 12 11:52:48 2010
@@ -1016,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(...)
         {

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/AllTests.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/AllTests.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/AllTests.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Client.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/Client.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/Client.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/Client.cpp:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice Mon Apr 12 11:52:48 2010
@@ -21,6 +21,12 @@
     B pd3;
 };
 
+class D5 extends BU
+{
+    string sd5;
+    B pd5;
+};
+
 };
 
 #endif

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/ClientPrivate.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/ClientPrivate.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/ClientPrivate.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Forward.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/Forward.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/Forward.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/Forward.ice:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp Mon Apr 12 11:52:48 2010
@@ -15,11 +15,11 @@
 int
 run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
 {
-    Ice::PropertiesPtr properties = communicator->getProperties();
+    Ice::PropertiesPtr properties(communicator->getProperties());
     properties->setProperty("Ice.Warn.Dispatch", "0");
     communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
-    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
-    Ice::ObjectPtr object = new TestI();
+    Ice::ObjectAdapterPtr adapter(communicator->createObjectAdapter("TestAdapter"));
+    Ice::ObjectPtr object(new TestI(communicator));
     adapter->add(object, communicator->stringToIdentity("Test"));
     adapter->activate();
     communicator->waitForShutdown();

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/Server.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/Server.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/Server.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/ServerAMD.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/ServerAMD.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/ServerAMD.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivate.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/ServerPrivate.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/ServerPrivate.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/ServerPrivate.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/ServerPrivateAMD.ice:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice Mon Apr 12 11:52:48 2010
@@ -27,6 +27,10 @@
 {
     string sb;
     B pb;
+};
+
+class BU extends B
+{
 };
 
 class D1 extends B

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/Test.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/Test.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/Test.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/TestAMD.ice:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/TestAMD.ice:509-510
+/techdemo/team/kpfleming/slicing/objects/TestAMD.ice:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/TestAMDI.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/TestAMDI.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/TestAMDI.cpp:564-575

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/TestAMDI.h:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/TestAMDI.h:509-510
+/techdemo/team/kpfleming/slicing/objects/TestAMDI.h:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp?view=diff&rev=576&r1=575&r2=576
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp Mon Apr 12 11:52:48 2010
@@ -11,10 +11,38 @@
 #include <Ice/Ice.h>
 #include <sstream>
 
+using namespace std;
 using namespace Test;
 
-TestI::TestI()
-{
+template <typename T>
+class PreserverFactory : public Ice::ObjectFactory
+{
+public:
+	Ice::ObjectPtr create(const string& type) {
+		return new Preserver();
+	}
+	void destroy() {}
+private:
+	class Preserver : virtual public T
+	{
+	public:
+		vector< ::Ice::Byte > __skippedSlices;
+		void __write(IceInternal::BasicStream* stream) const
+		{
+			stream->writeBlob(__skippedSlices);
+			T::__write(stream);
+		}
+		void __read(IceInternal::BasicStream* stream, bool rid)
+		{
+			stream->readSkippedSlicesBlob(__skippedSlices);
+			T::__read(stream, rid);
+		}
+	};
+};
+
+TestI::TestI(const Ice::CommunicatorPtr& communicator)
+{
+	communicator->addObjectFactory(new PreserverFactory<BU>, BU::ice_staticId());
 }
 
 Ice::ObjectPtr
@@ -255,7 +283,7 @@
     BDict r;
     for(i = 0; i < 10; ++i)
     {
-        std::ostringstream s;
+        ostringstream s;
         s << "D1." << i * 20;
         D1Ptr d1 = new D1;
         d1->sb = s.str();

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Apr 12 11:52:48 2010
@@ -1,0 +1,3 @@
+/ice/branches/icebox-local/cpp/test/Ice/slicing/objects/TestI.cpp:149-423
+/ice/upstream/3.4.0/cpp/test/Ice/slicing/objects/TestI.cpp:509-510
+/techdemo/team/kpfleming/slicing/objects/TestI.cpp:564-575

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.h?view=diff&rev=576&r1=575&r2=576
==============================================================================

[... 27 lines stripped ...]




More information about the asterisk-scf-commits mailing list