incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r544897 - in /incubator/yoko/trunk/bindings/src: main/java/org/apache/yoko/bindings/corba/utils/ test/java/org/apache/yoko/bindings/corba/ test/resources/idl/type_test/
Date Wed, 06 Jun 2007 17:44:44 GMT
Author: bravi
Date: Wed Jun  6 10:44:43 2007
New Revision: 544897

URL: http://svn.apache.org/viewvc?view=rev&rev=544897
Log:
[YOKO-373] - committing Complex Choice testcase.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java
    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/IdlToWsdlTypeTestImpl.java
    incubator/yoko/trunk/bindings/src/test/resources/idl/type_test/idltowsdl_type_test.idl

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java?view=diff&rev=544897&r1=544896&r2=544897
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java
Wed Jun  6 10:44:43 2007
@@ -499,14 +499,16 @@
 
     //Change this method to access the XmlSchemaCollection.
     public static boolean isElementFormQualified(ServiceInfo serviceInfo, String uri) {
-        SchemaInfo schemaInfo = serviceInfo.getSchema(uri);
-        if (schemaInfo != null) {
-            return schemaInfo.isElementFormQualified();
-        }
-        Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
-        while (it.hasNext()) {
-            XmlSchema schema = it.next().getSchema();
-            return isElementFormQualified(schema, uri);
+        if (uri != null) {
+            SchemaInfo schemaInfo = serviceInfo.getSchema(uri);
+            if (schemaInfo != null) {
+                return schemaInfo.isElementFormQualified();
+            }
+            Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
+            while (it.hasNext()) {
+                XmlSchema schema = it.next().getSchema();
+                return isElementFormQualified(schema, uri);
+            }
         }
         return false;
     }
@@ -526,14 +528,16 @@
 
     //Change this method to access the XmlSchemaCollection.
     public static boolean isAttributeFormQualified(ServiceInfo serviceInfo, String uri) {
-        SchemaInfo schemaInfo = serviceInfo.getSchema(uri);
-        if (schemaInfo != null) {
-            return schemaInfo.isAttributeFormQualified();
-        }
-        Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
-        while (it.hasNext()) {
-            XmlSchema schema = it.next().getSchema();
-            return isAttributeFormQualified(schema, uri);
+        if (uri != null) {
+            SchemaInfo schemaInfo = serviceInfo.getSchema(uri);
+            if (schemaInfo != null) {
+                return schemaInfo.isAttributeFormQualified();
+            }
+            Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
+            while (it.hasNext()) {
+                XmlSchema schema = it.next().getSchema();
+                return isAttributeFormQualified(schema, uri);
+            }
         }
         return false;
     }

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=544897&r1=544896&r2=544897
==============================================================================
--- 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
Wed Jun  6 10:44:43 2007
@@ -27,9 +27,14 @@
 
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTest;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestEnum1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestEnumSet;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestSeqLong;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStringSet;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStruct1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStruct2;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestStructSet;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion2;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnionSet;
 
 import org.apache.yoko.orb.CORBA.Any;
@@ -572,9 +577,9 @@
 
             IdltowsdlTypeTestUnion1 ret = client.testUnion(in, inout, out);
 
-            assertTrue("testStruct(): Incorrect value for out param", compareUnion(inoutOrig.value,
out.value));
-            assertTrue("testStruct(): Incorrect value for inout param", compareUnion(in,inout.value));
-            assertTrue("testStruct(): Incorrect return value", compareUnion(in, ret));
+            assertTrue("testUnion(): Incorrect value for out param", compareUnion(inoutOrig.value,
out.value));
+            assertTrue("testUnion(): Incorrect value for inout param", compareUnion(in,inout.value));
+            assertTrue("testUnion(): Incorrect return value", compareUnion(in, ret));
         }                        
     }
 
@@ -647,16 +652,16 @@
 
             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));
+            assertTrue("testUnionSet(): Incorrect value for out param", compareUnionSet(inoutOrig.value,
+                                                                                        out.value));
+            assertTrue("testUnionSet(): Incorrect value for inout param", compareUnionSet(in,
+                                                                                        
 inout.value));
+            assertTrue("testUnionSet(): Incorrect return value", compareUnionSet(in,
+                                                                                 ret));
         }                    
     }
 
-    private boolean equals(IdltowsdlTypeTestUnionSet x, IdltowsdlTypeTestUnionSet y) {
+    private boolean compareUnionSet(IdltowsdlTypeTestUnionSet x, IdltowsdlTypeTestUnionSet
y) {
         List<IdltowsdlTypeTestUnion1> xx = x.getItem();
         List<IdltowsdlTypeTestUnion1> yy = y.getItem();
         if (xx.size() != yy.size()) {
@@ -668,6 +673,125 @@
             }
         }
         return true;
+    }
+
+
+    public void testUnionVariants() {
+        IdltowsdlTypeTestUnion1 u0 = new IdltowsdlTypeTestUnion1();
+        u0.setU11(Integer.MAX_VALUE);
+        IdltowsdlTypeTestUnion2 u20 = new IdltowsdlTypeTestUnion2();
+        u20.setU21(u0);
+        IdltowsdlTypeTestUnion2 u21 = new IdltowsdlTypeTestUnion2();
+        u21.setU22(IdltowsdlTypeTestEnum1.E_1_1);
+        IdltowsdlTypeTestUnionSet unionSet = new IdltowsdlTypeTestUnionSet();
+        unionSet.getItem().add(u0);
+        IdltowsdlTypeTestUnion2 u22 = new IdltowsdlTypeTestUnion2();
+        u22.setU23(unionSet);
+        IdltowsdlTypeTestEnumSet enumSet = new IdltowsdlTypeTestEnumSet();
+        enumSet.getItem().add(IdltowsdlTypeTestEnum1.E_1_2);
+        IdltowsdlTypeTestUnion2 u23 = new IdltowsdlTypeTestUnion2();
+        u23.setU24(enumSet);
+        IdltowsdlTypeTestStringSet stringSet = new IdltowsdlTypeTestStringSet();
+        stringSet.getItem().add("Hello There");
+        IdltowsdlTypeTestUnion2 u24 = new IdltowsdlTypeTestUnion2();
+        u24.setU25(stringSet);
+        IdltowsdlTypeTestStruct1 struct1 = new IdltowsdlTypeTestStruct1();
+        struct1.setStruct1Long(Integer.MAX_VALUE);
+        struct1.setStruct1Short(Short.MAX_VALUE);
+        IdltowsdlTypeTestStruct2 struct2 = new IdltowsdlTypeTestStruct2();
+        struct2.setStruct2Long(10);
+        struct2.setStruct2Struct(struct1);
+        IdltowsdlTypeTestStructSet structSet = new IdltowsdlTypeTestStructSet();
+        structSet.getItem().add(struct2);
+        IdltowsdlTypeTestUnion2 u25 = new IdltowsdlTypeTestUnion2();
+        u25.setU26(structSet);
+        
+        IdltowsdlTypeTestUnion2 valueSets[][] = {
+            {u20, u21},
+            {u21, u22},
+            {u22, u23},
+            {u23, u24},
+            {u24, u25}
+        };
+        
+        for (int i = 0; i < valueSets.length; i++) {
+            IdltowsdlTypeTestUnion2 in = valueSets[i][0];
+            Holder<IdltowsdlTypeTestUnion2> inoutOrig = new Holder<IdltowsdlTypeTestUnion2>(valueSets[i][1]);
+            Holder<IdltowsdlTypeTestUnion2> inout = new Holder<IdltowsdlTypeTestUnion2>(valueSets[i][1]);
+            Holder<IdltowsdlTypeTestUnion2> out = new Holder<IdltowsdlTypeTestUnion2>();
+
+            IdltowsdlTypeTestUnion2 ret = client.testUnionVariants(in, inout, out);
+            assertTrue("testUnionVariants(): Incorrect value for out param", compareUnionVariants(inoutOrig.value,
out.value));
+            assertTrue("testUnionVariants(): Incorrect value for inout param", compareUnionVariants(in,inout.value));
+            assertTrue("testUnionVariants(): Incorrect return value", compareUnionVariants(in,
ret));
+        }                        
+    }
+
+    private boolean compareUnionVariants(IdltowsdlTypeTestUnion2 left, IdltowsdlTypeTestUnion2
right) {
+        boolean result = false;
+        if ((left.getU21() != null) && (right.getU21() != null)) {
+            result = compareUnion(left.getU21(), right.getU21());
+        } else if ((left.getU22() != null) && (right.getU22() != null)) {
+            result = left.getU22().value().equals(right.getU22().value());
+        } else if ((left.getU23() != null) && (right.getU23() != null)) {
+            result = compareUnionSet(left.getU23(), right.getU23());
+        } else if ((left.getU24() != null) && (right.getU24() != null)) {
+            result = compareEnumSet(left.getU24(), right.getU24());
+        } else if ((left.getU25() != null) && (right.getU25() != null)) {
+            result = compareStringSet(left.getU25(), right.getU25());
+        } else {
+            result = compareStructSet(left.getU26(), right.getU26());
+        }
+        return result;
+    }
+
+    private boolean compareStructSet(IdltowsdlTypeTestStructSet x, IdltowsdlTypeTestStructSet
y) {
+        boolean result = false;
+        List<IdltowsdlTypeTestStruct2> xx = x.getItem();
+        List<IdltowsdlTypeTestStruct2> yy = y.getItem();
+        if (xx.size() != yy.size()) {
+            return result;
+        }
+        for (int i = 0; i < xx.size(); i++) {
+            IdltowsdlTypeTestStruct2 structx = xx.get(i);
+            IdltowsdlTypeTestStruct2 structy = yy.get(i);
+            if ((structx.getStruct2Long() == structy.getStruct2Long())
+                && (structx.getStruct2Struct().getStruct1Long() == structy.getStruct2Struct().getStruct1Long())
+                && (structx.getStruct2Struct().getStruct1Short() == structy.getStruct2Struct().getStruct1Short()))
{
+                result = true;
+            }
+        }
+        return result;
+    }
+
+    private boolean compareEnumSet(IdltowsdlTypeTestEnumSet x, IdltowsdlTypeTestEnumSet y)
{
+        boolean result = true;
+        List<IdltowsdlTypeTestEnum1> xx = x.getItem();
+        List<IdltowsdlTypeTestEnum1> yy = y.getItem();
+        if (xx.size() != yy.size()) {
+            return false;
+        }
+        for (int i = 0; i < xx.size(); i++) {
+            if (!xx.get(i).value().equals(yy.get(i).value())) {
+                return false;
+            }
+        }
+        return result;
+    }
+
+    private boolean compareStringSet(IdltowsdlTypeTestStringSet x, IdltowsdlTypeTestStringSet
y) {
+        boolean result = true;
+        List<String> xx = x.getItem();
+        List<String> yy = y.getItem();
+        if (xx.size() != yy.size()) {
+            return false;
+        }
+        for (int i = 0; i < xx.size(); i++) {
+            if (!xx.get(i).equals(yy.get(i))) {
+                return false;
+            }
+        }
+        return result;
     }
 
 

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=544897&r1=544896&r2=544897
==============================================================================
--- 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
Wed Jun  6 10:44:43 2007
@@ -25,7 +25,9 @@
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestEnum1;
 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.IdltowsdlTypeTestStructSet;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion1;
+import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnion2;
 import org.apache.schemas.yoko.idl.idltowsdl_type_test.IdltowsdlTypeTestUnionSet;
 
 @WebService(serviceName = "idltowsdlTypeTestCORBAService", portName = "idltowsdlTypeTestCORBAPort",
@@ -42,8 +44,8 @@
     // base       
 
     public int testAlias(int inDuration,
-			 javax.xml.ws.Holder<java.lang.Integer> inoutDuration,
-			 javax.xml.ws.Holder<java.lang.Integer> outDuration) {
+                         javax.xml.ws.Holder<java.lang.Integer> inoutDuration,
+                         javax.xml.ws.Holder<java.lang.Integer> outDuration) {
         outDuration.value = inoutDuration.value;
         inoutDuration.value = inDuration;
         return inDuration;
@@ -221,11 +223,19 @@
     }
 
     public IdltowsdlTypeTestUnionSet testUnionSet(IdltowsdlTypeTestUnionSet inUnionSet,
-						  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet> inoutUnionSet,
-						  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet> outUnionSet) {
+                                                  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet>
inoutUnionSet,
+                                                  javax.xml.ws.Holder<IdltowsdlTypeTestUnionSet>
outUnionSet) {
         outUnionSet.value = inoutUnionSet.value;
         inoutUnionSet.value = inUnionSet;
         return inUnionSet;
+    }
+
+    public IdltowsdlTypeTestUnion2 testUnionVariants(IdltowsdlTypeTestUnion2 inUnion2,
+                                                     javax.xml.ws.Holder<IdltowsdlTypeTestUnion2>
inoutUnion2,
+                                                     javax.xml.ws.Holder<IdltowsdlTypeTestUnion2>
outUnion2) {
+        outUnion2.value = inoutUnion2.value;
+        inoutUnion2.value = inUnion2;
+        return inUnion2;
     }
 
 }

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=544897&r1=544896&r2=544897
==============================================================================
--- 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
Wed Jun  6 10:44:43 2007
@@ -124,13 +124,17 @@
     struct struct1 {
         long struct1long;
         short struct1short;
+    };
+	struct struct2 {
+        long struct2long;
+        struct1 struct2struct;
     };
     struct1 testStruct(in struct1 inStruct1,
                        inout struct1 inoutStruct1,
                        out struct1 outStruct1);
 
     // union
-    enum enum1 {e1_1,e1_2,e1_3,e1_4};
+    enum enum1 {e1_1,e1_2,e1_3,e1_4,e1_5,e1_6};
     union union1 switch (enum1) {
       case e1_1:
 	long u1_1;
@@ -155,7 +159,22 @@
                           inout unionSet inoutUnionSet,
                           out unionSet outUnionSet);
 
-
+    typedef sequence <struct2> structSet;
+	typedef sequence <enum1> enumSet;
+	typedef sequence <string> stringSet;
+
+    union union2 switch(enum1) {
+	    case e1_1: union1 u2_1;
+		case e1_2: enum1 u2_2;
+		case e1_3: unionSet u2_3;
+		case e1_4: enumSet u2_4;
+		case e1_5: stringSet u2_5;
+		default: structSet u2_6;
+	};
+
+	union2 testUnionVariants(in union2 inUnion2,
+	                         inout union2 inoutUnion2,
+			  	             out union2 outUnion2);
 
     ////
     // const_type



Mime
View raw message