incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r544170 - in /incubator/yoko/trunk/bindings/src/test: java/org/apache/yoko/bindings/corba/ resources/idl/type_test/
Date Mon, 04 Jun 2007 15:45:56 GMT
Author: bravi
Date: Mon Jun  4 08:45:53 2007
New Revision: 544170

URL: http://svn.apache.org/viewvc?view=rev&rev=544170
Log:
[YOKO-373] - Adding ArrayWithChoice type testing in both the wsdltoidl & idltowsdl type
test.

Modified:
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient1.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTestImpl.java
    incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java?view=diff&rev=544170&r1=544169&r2=544170
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
Mon Jun  4 08:45:53 2007
@@ -19,6 +19,8 @@
 
 package org.apache.yoko.bindings.corba;
 
+import java.util.List;
+
 import javax.xml.ws.Holder;
 
 import junit.framework.TestCase;
@@ -28,6 +30,7 @@
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestSeqLong;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStruct1;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnionSet;
 
 import org.apache.yoko.orb.CORBA.Any;
 
@@ -608,4 +611,64 @@
             assertEquals("testEnum(): Incorrect return value", in, ret);
         }
     }
+
+    public void testUnionSet() {
+        IdltowsdlTypeTestUnion1 u0 = new IdltowsdlTypeTestUnion1();
+        u0.setU11(Integer.MAX_VALUE);
+        IdltowsdlTypeTestUnion1 u1 = new IdltowsdlTypeTestUnion1();
+        u1.setU12(new String("foo"));
+        IdltowsdlTypeTestUnion1 u2 = new IdltowsdlTypeTestUnion1();
+        u2.setU12(new String("bar"));
+        IdltowsdlTypeTestUnion1 u3 = new IdltowsdlTypeTestUnion1();
+        u3.setU13(Short.MAX_VALUE);
+
+        IdltowsdlTypeTestUnionSet s0 = new IdltowsdlTypeTestUnionSet();
+        s0.getItem().add(u0);
+        //commented because of the same issue as testSeqLong()
+        //s0.getItem().add(u1);
+        IdltowsdlTypeTestUnionSet s1 = new IdltowsdlTypeTestUnionSet();        
+        s1.getItem().add(u2);
+        IdltowsdlTypeTestUnionSet s2 = new IdltowsdlTypeTestUnionSet();
+        s2.getItem().add(u3);
+        
+        IdltowsdlTypeTestUnionSet valueSets[][] = {
+            {s0, s0},
+            {s0, s1},
+            {s1, s0},
+            {s1, s2},
+            {s2, s2}
+        };
+        
+        for (int i = 0; i < valueSets.length; i++) {
+            IdltowsdlTypeTestUnionSet in = valueSets[i][0];
+            Holder<IdltowsdlTypeTestUnionSet> inoutOrig = new Holder<IdltowsdlTypeTestUnionSet>(valueSets[i][1]);
+            Holder<IdltowsdlTypeTestUnionSet> inout = new Holder<IdltowsdlTypeTestUnionSet>(valueSets[i][1]);
+            Holder<IdltowsdlTypeTestUnionSet> out = new Holder<IdltowsdlTypeTestUnionSet>();
+
+            IdltowsdlTypeTestUnionSet ret = client.testUnionSet(in, inout, out);
+
+            assertTrue("testUnionSet(): Incorrect value for out param", equals(inoutOrig.value,
+                                                                               out.value));
+            assertTrue("testUnionSet(): Incorrect value for inout param", equals(in,
+                                                                                 inout.value));
+            assertTrue("testUnionSet(): Incorrect return value", equals(in,
+                                                                        ret));
+        }                    
+    }
+
+    private boolean equals(IdltowsdlTypeTestUnionSet x, IdltowsdlTypeTestUnionSet y) {
+        List<IdltowsdlTypeTestUnion1> xx = x.getItem();
+        List<IdltowsdlTypeTestUnion1> yy = y.getItem();
+        if (xx.size() != yy.size()) {
+            return false;
+        }
+        for (int i = 0; i < xx.size(); i++) {
+            if (!compareUnion(xx.get(i), yy.get(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
 }

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient1.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient1.java?view=diff&rev=544170&r1=544169&r2=544170
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient1.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient1.java
Mon Jun  4 08:45:53 2007
@@ -27,6 +27,7 @@
 import javax.xml.ws.Holder;
 
 import org.apache.type_test.types1.AnonymousStruct;
+import org.apache.type_test.types1.ArrayWithChoice;
 import org.apache.type_test.types1.BinaryChoice;
 import org.apache.type_test.types1.BinaryStruct;
 import org.apache.type_test.types1.BoundedArray;
@@ -710,6 +711,46 @@
             assertTrue("testChoiceWithEnum(): Incorrect value for out param",
                        equals(yOrig, z.value));
             assertTrue("testChoiceWithEnum(): Incorrect return value", equals(x, ret));
+        }
+    }
+
+    protected boolean equals(ArrayWithChoice x, ArrayWithChoice y) {
+        List<SimpleChoice> xx = x.getSubarray();
+        List<SimpleChoice> yy = y.getSubarray();
+        if (xx.size() != yy.size()) {
+            return false;
+        }
+        for (int i = 0; i < xx.size(); i++) {
+            if (!equals(xx.get(i), yy.get(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    public void testArrayWithChoice() throws Exception {
+        ArrayWithChoice x = new ArrayWithChoice();
+
+        SimpleChoice choicex = new SimpleChoice();
+        choicex.setVarFloat(-3.14f);
+
+        x.getSubarray().add(choicex);
+
+        ArrayWithChoice yOrig = new ArrayWithChoice();
+        SimpleChoice choicey = new SimpleChoice();
+        choicey.setVarString("Cheerio");
+        yOrig.getSubarray().add(choicey);
+
+        Holder<ArrayWithChoice> y = new Holder<ArrayWithChoice>(yOrig);
+        Holder<ArrayWithChoice> z = new Holder<ArrayWithChoice>();
+        ArrayWithChoice ret = client.testArrayWithChoice(x, y, z);
+
+        if (!perfTestOnly) {
+            assertTrue("testArrayWithChoice(): Incorrect value for inout param",
+                       equals(x, y.value));
+            assertTrue("testArrayWithChoice(): Incorrect value for out param",
+                       equals(yOrig, z.value));
+            assertTrue("testArrayWithChoice(): Incorrect return value", equals(x, ret));
         }
     }
 

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java?view=diff&rev=544170&r1=544169&r2=544170
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
Mon Jun  4 08:45:53 2007
@@ -79,6 +79,7 @@
     }
 
     public void testArrayWithChoice() throws Exception {
+        super.testArrayWithChoice();
     }
 
         

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTestImpl.java?view=diff&rev=544170&r1=544169&r2=544170
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTestImpl.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTestImpl.java
Mon Jun  4 08:45:53 2007
@@ -26,6 +26,7 @@
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestSeqLong;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStruct1;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnionSet;
 
 @WebService(serviceName = "idltowsdlTypeTestCORBAService", portName = "idltowsdlTypeTestCORBAPort",
             endpointInterface = "org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTest",
@@ -217,6 +218,14 @@
         outEnum1.value = inoutEnum1.value;
         inoutEnum1.value = inEnum1;
         return inEnum1;
+    }
+
+    public IdltowsdlTypeTestUnionSet testUnionSet(IdltowsdlTypeTestUnionSet inUnionSet,
+						  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet> inoutUnionSet,
+						  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet> outUnionSet) {
+        outUnionSet.value = inoutUnionSet.value;
+        inoutUnionSet.value = inUnionSet;
+        return inUnionSet;
     }
 
 }

Modified: incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl?view=diff&rev=544170&r1=544169&r2=544170
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl
(original)
+++ incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl
Mon Jun  4 08:45:53 2007
@@ -147,7 +147,14 @@
     // enum
     enum1 testEnum(in enum1 inEnum1,
                    inout enum1 inoutEnum1,
-                   out enum1 outEnum1);
+                   out enum1 outEnum1);
+
+    typedef sequence <union1> unionSet;
+
+    unionSet testUnionSet(in unionSet inUnionSet,
+                          inout unionSet inoutUnionSet,
+                          out unionSet outUnionSet);
+
 
 
     ////



Mime
View raw message