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

SVN commits to the Hydra project hydra-commits at lists.digium.com
Mon Apr 12 13:31:36 CDT 2010


Author: kpfleming
Date: Mon Apr 12 13:31:35 2010
New Revision: 579

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=579
Log:
add unsliceable support to AMD server implementations

remove extraneous merge properties


Modified:
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp   (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/Server.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp   (contents, 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   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp   (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   (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   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp   (contents, 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   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h   (contents, props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp   (props changed)
    ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.h   (props changed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/AllTests.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Client.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Server.cpp
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp Mon Apr 12 13:31:35 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/ServerAMD.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/Test.ice
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMD.ice Mon Apr 12 13:31:35 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", "amd"] 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/TestAMD.ice
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp Mon Apr 12 13:31:35 2010
@@ -10,10 +10,49 @@
 #include <TestAMDI.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
@@ -101,8 +140,7 @@
 }
 
 void
-TestI::
-knownMostDerivedAsKnownMostDerived_async(const AMD_TestIntf_knownMostDerivedAsKnownMostDerivedPtr& cb,
+TestI::knownMostDerivedAsKnownMostDerived_async(const AMD_TestIntf_knownMostDerivedAsKnownMostDerivedPtr& cb,
                                          const ::Ice::Current&)
 {
     KnownMostDerived kmd;
@@ -144,6 +182,81 @@
 }
 
 void
+TestI::clientBaseAsBasePass_async(
+	const Test::AMD_TestIntf_clientBaseAsBasePassPtr&,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	client->baseAsBase();
+}
+
+void
+TestI::clientUnknownDerivedAsBasePass_async(
+	const Test::AMD_TestIntf_clientUnknownDerivedAsBasePassPtr&,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	client->unknownDerivedAsBase();
+}
+
+void
+TestI::clientUnsliceableDerivedAsBasePass_async(
+	const Test::AMD_TestIntf_clientUnsliceableDerivedAsBasePassPtr&,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	client->unsliceableDerivedAsBase();
+}
+
+void
+TestI::clientBaseAsBaseRethrow_async(
+	const Test::AMD_TestIntf_clientBaseAsBaseRethrowPtr& cb,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	try
+	{
+		client->baseAsBase();
+	}
+	catch (const Base& ex)
+	{
+		cb->ice_exception(ex);
+	}
+}
+
+void
+TestI::clientUnknownDerivedAsBaseRethrow_async(
+	const Test::AMD_TestIntf_clientUnknownDerivedAsBaseRethrowPtr& cb,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	try
+	{
+		client->unknownDerivedAsBase();
+	}
+	catch (const Base& ex)
+	{
+		cb->ice_exception(ex);
+	}
+}
+ 
+void
+TestI::clientUnsliceableDerivedAsBaseRethrow_async(
+	const Test::AMD_TestIntf_clientUnsliceableDerivedAsBaseRethrowPtr& cb,
+	const Test::ClientIntfPrx& client,
+	const ::Ice::Current&)
+{
+	try
+	{
+		client->unsliceableDerivedAsBase();
+	}
+	catch (const Base& ex)
+	{
+		cb->ice_exception(ex);
+	}
+}
+
+void
 TestI::shutdown_async(const AMD_TestIntf_shutdownPtr& cb, const ::Ice::Current& current)
 {
     current.adapter->getCommunicator()->shutdown();

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h Mon Apr 12 13:31:35 2010
@@ -16,7 +16,7 @@
 {
 public:
 
-    TestI();
+    TestI(const Ice::CommunicatorPtr&);
     virtual void baseAsBase_async(const ::Test::AMD_TestIntf_baseAsBasePtr&, const ::Ice::Current&);
 
     virtual void unknownDerivedAsBase_async(const ::Test::AMD_TestIntf_unknownDerivedAsBasePtr&, const ::Ice::Current&);
@@ -50,6 +50,31 @@
                     const ::Test::AMD_TestIntf_unknownMostDerived2AsBasePtr&,
                     const ::Ice::Current&);
 
+    virtual void clientBaseAsBasePass_async(
+	    const Test::AMD_TestIntf_clientBaseAsBasePassPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+    virtual void clientUnknownDerivedAsBasePass_async(
+	    const Test::AMD_TestIntf_clientUnknownDerivedAsBasePassPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+    virtual void clientUnsliceableDerivedAsBasePass_async(
+	    const Test::AMD_TestIntf_clientUnsliceableDerivedAsBasePassPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+    virtual void clientBaseAsBaseRethrow_async(
+	    const Test::AMD_TestIntf_clientBaseAsBaseRethrowPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+    virtual void clientUnknownDerivedAsBaseRethrow_async(
+	    const Test::AMD_TestIntf_clientUnknownDerivedAsBaseRethrowPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+    virtual void clientUnsliceableDerivedAsBaseRethrow_async(
+	    const Test::AMD_TestIntf_clientUnsliceableDerivedAsBaseRethrowPtr&,
+	    const Test::ClientIntfPrx&,
+	    const ::Ice::Current&);
+
     virtual void shutdown_async(const ::Test::AMD_TestIntf_shutdownPtr&, const ::Ice::Current&);
 };
 

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestAMDI.h
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/exceptions/TestI.h
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/AllTests.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Client.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ClientPrivate.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Forward.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Server.cpp
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerAMD.cpp Mon Apr 12 13:31:35 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/objects/ServerAMD.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivate.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/Test.ice
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMD.ice Mon Apr 12 13:31:35 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/TestAMD.ice
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp Mon Apr 12 13:31:35 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());
 }
 
 void

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.cpp
            ('svn:mergeinfo' removed)

Modified: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h?view=diff&rev=579&r1=578&r2=579
==============================================================================
--- ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h (original)
+++ ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h Mon Apr 12 13:31:35 2010
@@ -17,7 +17,7 @@
 {
 public:
 
-    TestI();
+    TestI(const Ice::CommunicatorPtr& communicator);
 
     virtual void SBaseAsObject_async(const ::Test::AMD_TestIntf_SBaseAsObjectPtr&, const ::Ice::Current&);
     virtual void SBaseAsSBase_async(const ::Test::AMD_TestIntf_SBaseAsSBasePtr&, const ::Ice::Current&);

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestAMDI.h
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.cpp
            ('svn:mergeinfo' removed)

Propchange: ice/branches/skipped-slice-recovery/cpp/test/Ice/slicing/objects/TestI.h
            ('svn:mergeinfo' removed)





More information about the asterisk-scf-commits mailing list