[hydra-commits] beagles: branch ice/slice-preserving-translators r597 - in /ice/branches/slic...

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


Author: beagles
Date: Mon Apr 26 11:52:06 2010
New Revision: 597

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=597
Log:
Ported a basic non-AMI non-slicing test throughout

Modified:
    ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp
    ice/branches/slice-preserving-translators/cpp/src/slice2cs/Gen.cpp
    ice/branches/slice-preserving-translators/cpp/src/slice2java/Gen.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMD.ice
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.h
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp
    ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.h
    ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/AllTests.cs
    ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ClientPrivate.ice
    ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ServerPrivate.ice
    ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/TestAMD.ice
    ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/AllTests.java
    ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ClientPrivate.ice
    ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivate.ice
    ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivateAMD.ice
    ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/TestI.java

Modified: ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/src/slice2cpp/Gen.cpp Mon Apr 26 11:52:06 2010
@@ -3751,15 +3751,6 @@
     DataMemberList dataMembers = p->dataMembers();
     DataMemberList allDataMembers = p->allDataMembers();
 
-    std::string dummy;
-    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
-    bool switchWrites = false;
-    if(!preserving)
-    {
-	switchWrites = p->findMetaData(preserveTag, dummy);
-	preserving = switchWrites;
-    }
-
     H << sp << nl << "class " << _dllExport << name << " : ";
     H.useCurrentPosAsIndent();
     if(bases.empty())
@@ -4091,14 +4082,6 @@
 
     if(!p->isLocal())
     {
-	std::string dummy;
-	bool preserving = scanParentsMetaData(p, "preserve", dummy);
-	if(!preserving)
-	{
-	    switchWrites = p->findMetaData("preserve", dummy);
-	    preserving = switchWrites;
-	}
-
         ClassList bases = p->bases();
         ClassDefPtr base;
         if(!bases.empty() && !bases.front()->isInterface())
@@ -4242,6 +4225,14 @@
                 C << eb;
             }
         }
+
+	std::string dummy;
+	bool preserving = scanParentsMetaData(p, "preserve", dummy);
+	if(!preserving)
+	{
+	    switchWrites = p->findMetaData("preserve", dummy);
+	    preserving = switchWrites;
+	}
 
         H << sp;
         H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";

Modified: ice/branches/slice-preserving-translators/cpp/src/slice2cs/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/slice2cs/Gen.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/slice2cs/Gen.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/src/slice2cs/Gen.cpp Mon Apr 26 11:52:06 2010
@@ -202,15 +202,6 @@
     other.sort();
     ids.merge(other);
     ids.unique();
-
-    string dummy;
-    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
-    bool switchWrites = false;
-    if(!preserving)
-    {
-	switchWrites = p->findMetaData(preserveTag, dummy);
-	preserving = switchWrites;
-    }
 
     StringList::const_iterator firstIter = ids.begin();
     StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
@@ -690,6 +681,15 @@
     bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
 
     _out << sp << nl << "#region Marshaling support";
+
+    string dummy;
+    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
+    bool switchWrites = false;
+    if(!preserving)
+    {
+	switchWrites = p->findMetaData(preserveTag, dummy);
+	preserving = switchWrites;
+    }
 
     if(switchWrites)
     {

Modified: ice/branches/slice-preserving-translators/cpp/src/slice2java/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/src/slice2java/Gen.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/src/slice2java/Gen.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/src/slice2java/Gen.cpp Mon Apr 26 11:52:06 2010
@@ -418,15 +418,6 @@
     StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
     assert(scopedIter != ids.end());
     StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter);
-
-    std::string dummy;
-    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
-    bool switchWrites = false;
-    if(!preserving)
-    {
-	switchWrites = p->findMetaData(preserveTag, dummy);
-	preserving = switchWrites;
-    }
 
     out << sp << nl << "public static final String[] __ids =";
     out << sb;
@@ -1046,6 +1037,15 @@
     int iter;
     DataMemberList members = p->dataMembers();
     DataMemberList::const_iterator d;
+
+    std::string dummy;
+    bool preserving = scanParentsMetaData(p, preserveTag, dummy);
+    bool switchWrites = false;
+    if(!preserving)
+    {
+	switchWrites = p->findMetaData(preserveTag, dummy);
+	preserving = switchWrites;
+    }
     if(switchWrites)
     {
 	out << sp << nl << "protected byte[] __preserved = null;";
@@ -2692,6 +2692,15 @@
 
     if(!p->isLocal())
     {
+        string name = fixKwd(p->name());
+        string scoped = p->scoped();
+        string package = getPackage(p);
+        ExceptionPtr base = p->base();
+
+        DataMemberList members = p->dataMembers();
+        DataMemberList::const_iterator d;
+        int iter;
+
 	std::string dummy;
 	bool preserving = scanParentsMetaData(p, preserveTag, dummy);
 	bool switchWrites = false;
@@ -2700,15 +2709,6 @@
 	    switchWrites = p->findMetaData(preserveTag, dummy);
 	    preserving = switchWrites;
 	}
-
-        string name = fixKwd(p->name());
-        string scoped = p->scoped();
-        string package = getPackage(p);
-        ExceptionPtr base = p->base();
-
-        DataMemberList members = p->dataMembers();
-        DataMemberList::const_iterator d;
-        int iter;
 
 	if(switchWrites)
 	{

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/AllTests.cpp Mon Apr 26 11:52:06 2010
@@ -269,6 +269,13 @@
         test(ret->sb == "B.sb (2)");
         test(ret->pb == 0);
         test(ret->ice_id() == "::Test::B");
+        called();
+    }
+
+    void
+    response_echoSeq(const BSeq& r)
+    {
+        rseq = r;
         called();
     }
 
@@ -365,7 +372,8 @@
     {
         test(false);
     }
- 
+
+    BSeq rseq;
     BPtr rb;
     SS3 rss3;
     BDict rbdict;
@@ -1281,6 +1289,59 @@
         test->begin_paramTest4(
             newCallback_TestIntf_paramTest4(cb, &Callback::response_paramTest4, &Callback::exception));
         cb->check();
+    }
+    cout << "ok" << endl;
+
+    cout << "sequence of slice-preserved objects... " << flush;
+    {
+        BSeq seq;
+        D5Ptr current = new D5;
+        current->sd5 = "0";
+        seq.push_back(current);
+        
+        current = new D5;
+        current->sd5 = "1";
+        seq.push_back(current);
+        current = new D5;
+        current->sd5 = "2";
+        seq.push_back(current);
+        current = new D5;
+        current->sd5 = "3";
+        seq.push_back(current);
+
+        try
+        {
+            BSeq out;
+            BSeq ret = test->echoSeq(seq, out);
+
+            test(out.size() == seq.size());
+            test(ret.size() == seq.size());
+
+            test(out.back()->ice_id() == "::Test::D5");
+            test(ret.back()->ice_id() == "::Test::D5");
+            BSeq::const_iterator outi = out.begin();
+            BSeq::const_iterator reti = ret.begin();
+            for(BSeq::const_iterator i = seq.begin(); i != seq.end(); ++i)
+            {
+                test(outi != out.end());
+                test(reti != ret.end());
+
+                D5Ptr reference = D5Ptr::dynamicCast(*i);
+                D5Ptr outValue = D5Ptr::dynamicCast(*outi);
+                D5Ptr retValue = D5Ptr::dynamicCast(*reti);
+            
+                test(reference->sd5 == outValue->sd5);
+                ++outi;
+            
+                test(reference->sd5 == retValue->sd5);
+                ++reti;
+            }
+        }
+        catch(const Ice::Exception& ex)
+        {
+            throw;
+        }
+
     }
     cout << "ok" << endl;
 

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice Mon Apr 26 11:52:06 2010
@@ -58,6 +58,11 @@
     SS2 c2;
 };
 
+class BGraph
+{
+    BSeq children;
+};
+
 dictionary<int, B> BDict;
 
 exception BaseException
@@ -100,6 +105,9 @@
     B returnTest2(out B p2, out B p1);
     B returnTest3(B p1, B p2);
 
+    BSeq echoSeq(BSeq s1, out BSeq s2);
+//    BGraph echoGraph(BGraph s1, out BGraph s2);
+
     SS3 sequenceTest(SS1 p1, SS2 p2);
 
     BDict dictionaryTest(BDict bin, out BDict bout);

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMD.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMD.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMD.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMD.ice Mon Apr 26 11:52:06 2010
@@ -29,6 +29,7 @@
     B pb;
 };
 
+["preserve"]
 class BU extends B
 {
 };
@@ -99,6 +100,8 @@
     B returnTest2(out B p2, out B p1);
     B returnTest3(B p1, B p2);
 
+    BSeq echoSeq(BSeq s1, out BSeq s2);
+    
     SS3 sequenceTest(SS1 p1, SS2 p2);
 
     BDict dictionaryTest(BDict bin, out BDict bout);

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.cpp Mon Apr 26 11:52:06 2010
@@ -14,35 +14,8 @@
 using namespace std;
 using namespace Test;
 
-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
@@ -278,6 +251,16 @@
 {
     cb->ice_response(p1);
 }
+
+
+void
+TestI::echoSeq_async(const AMD_TestIntf_echoSeqPtr& cb, const BSeq& s1, const ::Ice::Current&)
+{
+    BSeq result(s1);
+    BSeq outresult(s1);
+    cb->ice_response(result, outresult);
+}
+
 
 void
 TestI::sequenceTest_async(const AMD_TestIntf_sequenceTestPtr& cb,

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.h?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.h (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestAMDI.h Mon Apr 26 11:52:06 2010
@@ -75,6 +75,10 @@
         const ::Test::BPtr&,
         const ::Test::BPtr&,
         const ::Ice::Current&);
+    virtual void  echoSeq_async(
+        const ::Test::AMD_TestIntf_echoSeqPtr&,
+        const ::Test::BSeq& s1,
+        const ::Ice::Current&);
     virtual void sequenceTest_async(
         const ::Test::AMD_TestIntf_sequenceTestPtr&,
         const ::Test::SS1Ptr&,

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp Mon Apr 26 11:52:06 2010
@@ -228,6 +228,14 @@
 TestI::returnTest3(const BPtr& p1, const BPtr& p2, const ::Ice::Current&)
 {
     return p1;
+}
+
+BSeq
+TestI::echoSeq(const BSeq& s1, BSeq& s2, const ::Ice::Current&)
+{
+    BSeq result(s1);
+    s2 = result;
+    return result;
 }
 
 SS3

Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.h?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.h (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.h Mon Apr 26 11:52:06 2010
@@ -46,6 +46,8 @@
     virtual ::Test::BPtr returnTest2(::Test::BPtr&, ::Test::BPtr&, const ::Ice::Current&);
     virtual ::Test::BPtr returnTest3(const ::Test::BPtr&, const ::Test::BPtr&, const ::Ice::Current&);
 
+    virtual ::Test::BSeq echoSeq(const ::Test::BSeq& s1, ::Test::BSeq& s2, const ::Ice::Current&);
+
     virtual ::Test::SS3 sequenceTest(const ::Test::SS1Ptr&, const ::Test::SS2Ptr&, const ::Ice::Current&);
 
     virtual ::Test::BDict dictionaryTest(const ::Test::BDict&, ::Test::BDict&, const ::Ice::Current&);

Modified: ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/AllTests.cs
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/AllTests.cs?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/AllTests.cs (original)
+++ ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/AllTests.cs Mon Apr 26 11:52:06 2010
@@ -1092,6 +1092,53 @@
             test(b1 != d3);
             test(b2 != d1);
             test(b2 != d3);
+        }
+        Console.Out.WriteLine("ok");
+
+        Console.Out.Write("return value unsliced for input params known first... ");
+        Console.Out.Flush();
+        {
+            try
+            {
+                D1 d1 = new D1();
+                d1.sb = "D1.sb";
+                d1.sd1 = "D1.sd1";
+                D5 d5 = new D5();
+                d5.pb = d1;
+                d5.sb = "D5.sb";
+                d5.sd5 = "D5.sd5";
+                d5.pd5 = d1;
+                d1.pb = d5;
+                d1.pd1 = d5;
+                
+                B b1 = testPrx.returnTest3(d1, d5);
+                
+                test(b1 != null);
+                test(b1.sb.Equals("D1.sb"));
+                test(b1.ice_id().Equals("::Test::D1")); // Sliced by server
+                
+                try
+                {
+                    D1 p1 = (D1) b1;
+		    test(p1 != null);
+                }
+                catch(InvalidCastException)
+                {
+		    test(false);
+                }
+                
+                B b2 = b1.pb;
+                test(b2 != null);
+                test(b2.sb.Equals("D5.sb"));
+                test(b2.ice_id().Equals("::Test::D5"));
+                test(b2.pb == b1);
+                D5 p5 = (D5) b2;
+		test(p5 != null);
+            }
+            catch(Exception)
+            {
+                test(false);
+            }
         }
         Console.Out.WriteLine("ok");
         

Modified: ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ClientPrivate.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ClientPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ClientPrivate.ice Mon Apr 26 11:52:06 2010
@@ -21,6 +21,16 @@
     B pd3;
 };
 
+class BU extends B
+{
+};
+
+class D5 extends BU
+{
+    string sd5;
+    B pd5;
+};
+    
 };
 
 #endif

Modified: ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ServerPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ServerPrivate.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ServerPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/ServerPrivate.ice Mon Apr 26 11:52:06 2010
@@ -25,6 +25,11 @@
     string su;
 };
 
+["preserve"]
+class BU extends B
+{
+};
+
 class D2 extends B
 {
     string sd2;

Modified: ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/TestAMD.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/TestAMD.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/TestAMD.ice (original)
+++ ice/branches/slice-preserving-translators/cs/test/Ice/slicing/objects/TestAMD.ice Mon Apr 26 11:52:06 2010
@@ -27,6 +27,11 @@
 {
     string sb;
     B pb;
+};
+
+["preserve"]
+class BU extends B
+{
 };
 
 class D1 extends B

Modified: ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/AllTests.java
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/AllTests.java?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/AllTests.java (original)
+++ ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/AllTests.java Mon Apr 26 11:52:06 2010
@@ -38,11 +38,13 @@
 import test.Ice.slicing.objects.client.Test.Callback_TestIntf_twoElementCycle;
 import test.Ice.slicing.objects.client.Test.Callback_TestIntf_useForward;
 import test.Ice.slicing.objects.client.Test.B;
+import test.Ice.slicing.objects.client.Test.BU;
 import test.Ice.slicing.objects.client.Test.BDictHolder;
 import test.Ice.slicing.objects.client.Test.BHolder;
 import test.Ice.slicing.objects.client.Test.BaseException;
 import test.Ice.slicing.objects.client.Test.D1;
 import test.Ice.slicing.objects.client.Test.D3;
+import test.Ice.slicing.objects.client.Test.D5;
 import test.Ice.slicing.objects.client.Test.DerivedException;
 import test.Ice.slicing.objects.client.Test.SBSKnownDerived;
 import test.Ice.slicing.objects.client.Test.SBase;
@@ -1710,6 +1712,51 @@
         }
         out.println("ok");
 
+        out.print("return value unsliced for input params known first... ");
+        out.flush();
+        {
+            try
+            {
+                D1 d1 = new D1();
+                d1.sb = "D1.sb";
+                d1.sd1 = "D1.sd1";
+                D5 d5 = new D5();
+                d5.pb = d1;
+                d5.sb = "D5.sb";
+                d5.sd5 = "D5.sd5";
+                d5.pd5 = d1;
+                d1.pb = d5;
+                d1.pd1 = d5;
+
+                B b1 = test.returnTest3(d1, d5);
+
+                test(b1 != null);
+                test(b1.sb.equals("D1.sb"));
+                test(b1.ice_id().equals("::Test::D1"));  // Sliced by server
+
+                try
+                {
+                    D1 p1 = (D1)b1;
+                }
+                catch(ClassCastException ex)
+                {
+                    test(false);
+                }
+
+                B b2 = b1.pb;
+                test(b2 != null);
+                test(b2.sb.equals("D5.sb"));
+                test(b2.ice_id().equals("::Test::D5")); // Not sliced by server.
+                test(b2.pb == b1);
+                D5 p5 = (D5)b2;
+            }
+            catch(Exception ex)
+            {
+                test(false);
+            }
+        }
+        out.println("ok");
+
         out.print("remainder unmarshaling (3 instances)... ");
         out.flush();
         {

Modified: ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ClientPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ClientPrivate.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ClientPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ClientPrivate.ice Mon Apr 26 11:52:06 2010
@@ -30,6 +30,10 @@
 {
     string sb;
     B pb;
+};
+
+class BU extends B
+{
 };
 
 class D1 extends B
@@ -98,6 +102,8 @@
     B returnTest2(out B p2, out B p1);
     B returnTest3(B p1, B p2);
 
+    BSeq echoSeq(BSeq s1, out BSeq s2);
+    
     SS sequenceTest(SS1 p1, SS2 p2);
 
     BDict dictionaryTest(BDict bin, out BDict bout);
@@ -119,6 +125,13 @@
     B pd3;
 };
 
+// Preserved!
+class D5 extends BU
+{
+    string sd5;
+    B pd5;
+};
+
 class Forward;
 
 class Hidden

Modified: ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivate.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivate.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivate.ice (original)
+++ ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivate.ice Mon Apr 26 11:52:06 2010
@@ -30,6 +30,11 @@
 {
     string sb;
     B pb;
+};
+
+["preserve"]
+class BU extends B
+{
 };
 
 class D1 extends B
@@ -98,6 +103,8 @@
     B returnTest2(out B p2, out B p1);
     B returnTest3(B p1, B p2);
 
+    BSeq echoSeq(BSeq s1, out BSeq s2);
+
     SS sequenceTest(SS1 p1, SS2 p2);
 
     BDict dictionaryTest(BDict bin, out BDict bout);

Modified: ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivateAMD.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivateAMD.ice?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivateAMD.ice (original)
+++ ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/ServerPrivateAMD.ice Mon Apr 26 11:52:06 2010
@@ -32,6 +32,11 @@
     B pb;
 };
 
+["preserve"]
+class BU extends B
+{
+};
+    
 class D1 extends B
 {
     string sd1;

Modified: ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/TestI.java
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/TestI.java?view=diff&rev=597&r1=596&r2=597
==============================================================================
--- ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/TestI.java (original)
+++ ice/branches/slice-preserving-translators/java/test/Ice/slicing/objects/TestI.java Mon Apr 26 11:52:06 2010
@@ -10,8 +10,10 @@
 package test.Ice.slicing.objects;
 
 import test.Ice.slicing.objects.server.Test.B;
+import test.Ice.slicing.objects.server.Test.BU;
 import test.Ice.slicing.objects.server.Test.BDictHolder;
 import test.Ice.slicing.objects.server.Test.BHolder;
+import test.Ice.slicing.objects.server.Test.BSeqHolder;
 import test.Ice.slicing.objects.server.Test.BaseException;
 import test.Ice.slicing.objects.server.Test.D1;
 import test.Ice.slicing.objects.server.Test.D2;
@@ -252,6 +254,20 @@
     returnTest3(B p1, B p2, Ice.Current current)
     {
         return p1;
+    }
+
+    public B[]
+    echoSeq(B[] s1, BSeqHolder s2, Ice.Current current)
+    {
+        s2.value = new B[s1.length];
+        B[] result = new B[s1.length];
+        
+        for(int i = 0; i < s1.length; ++i)
+        {
+            s2.value[i] = (B)s1[i].clone();
+            result[i] = (B)s1[i].clone();
+        }
+        return result;
     }
 
     public SS





More information about the asterisk-scf-commits mailing list