You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by br...@apache.org on 2007/05/01 12:46:03 UTC

svn commit: r534042 - in /incubator/yoko/trunk: bindings/src/test/java/org/apache/yoko/bindings/corba/ bindings/src/test/resources/wsdl/type_test/ tools/src/main/java/org/apache/yoko/tools/processors/idl/ tools/src/test/java/org/apache/yoko/tools/ tool...

Author: bravi
Date: Tue May  1 05:46:02 2007
New Revision: 534042

URL: http://svn.apache.org/viewvc?view=rev&rev=534042
Log:
[YOKO-363] - Fixed the issue with the exception message not referencing the proper namespace & also updated the name of the Enum type.

Added:
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl   (with props)
Modified:
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient.java
    incubator/yoko/trunk/bindings/src/test/resources/wsdl/type_test/type_test.xsd
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
    incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/IDLToWSDLTest.java

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient.java?view=diff&rev=534042&r1=534041&r2=534042
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractTypeTestClient.java Tue May  1 05:46:02 2007
@@ -36,7 +36,7 @@
 import org.apache.type_test.corba.TypeTestCORBAService;
 
 import org.apache.type_test.types1.NMTokenEnum;
-import org.apache.type_test.types1.StringEnum;
+import org.apache.type_test.types1.SimpleEnum;
 
 import junit.framework.TestCase;
 
@@ -871,24 +871,24 @@
         */
     }    
     
-    public void testStringEnum() throws Exception {
+    public void testSimpleEnum() throws Exception {
         String[] xx = {"abc", "def", "ghi"};
         String[] yy = {"ghi", "abc", "def"};
 
-        Holder<StringEnum> z = new Holder<StringEnum>();
+        Holder<SimpleEnum> z = new Holder<SimpleEnum>();
         for (int i = 0; i < 3; i++) {
-            StringEnum x = StringEnum.fromValue(xx[i]);
-            StringEnum yOrig = StringEnum.fromValue(yy[i]);
-            Holder<StringEnum> y = new Holder<StringEnum>(yOrig);
+            SimpleEnum x = SimpleEnum.fromValue(xx[i]);
+            SimpleEnum yOrig = SimpleEnum.fromValue(yy[i]);
+            Holder<SimpleEnum> y = new Holder<SimpleEnum>(yOrig);
 
-            StringEnum ret = client.testStringEnum(x, y, z);
+            SimpleEnum ret = client.testSimpleEnum(x, y, z);
 
             if (!perfTestOnly) {
-                assertEquals("testStringEnum(): Incorrect value for inout param",
+                assertEquals("testSimpleEnum(): Incorrect value for inout param",
                              x.value(), y.value.value());
-                assertEquals("testStringEnum(): Incorrect value for out param",
+                assertEquals("testSimpleEnum(): Incorrect value for out param",
                              yOrig.value(), z.value.value());
-                assertEquals("testStringEnum(): Incorrect return value",
+                assertEquals("testSimpleEnum(): Incorrect return value",
                              x.value(), ret.value());
             }
         }

Modified: incubator/yoko/trunk/bindings/src/test/resources/wsdl/type_test/type_test.xsd
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/resources/wsdl/type_test/type_test.xsd?view=diff&rev=534042&r1=534041&r2=534042
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/resources/wsdl/type_test/type_test.xsd (original)
+++ incubator/yoko/trunk/bindings/src/test/resources/wsdl/type_test/type_test.xsd Tue May  1 05:46:02 2007
@@ -185,7 +185,7 @@
             <enumeration value="BLUE"/>
         </restriction>
     </simpleType>
-    <simpleType name="StringEnum">
+    <simpleType name="SimpleEnum">
         <restriction base="string">
             <enumeration value="abc"/>
             <enumeration value="def"/>

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java?view=diff&rev=534042&r1=534041&r2=534042
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java Tue May  1 05:46:02 2007
@@ -386,7 +386,7 @@
         // message - part
         Part part = definition.createPart();
         part.setName("exception");            
-        part.setElementName(new QName(definition.getTargetNamespace(), exceptionName));        
+        part.setElementName(new QName(schema.getTargetNamespace(), exceptionName));        
         faultMsg.addPart(part);
 
         // porttype - operation - fault

Modified: incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/IDLToWSDLTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/IDLToWSDLTest.java?view=diff&rev=534042&r1=534041&r2=534042
==============================================================================
--- incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/IDLToWSDLTest.java (original)
+++ incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/IDLToWSDLTest.java Tue May  1 05:46:02 2007
@@ -308,4 +308,18 @@
         assertEquals("IDLToWSDL Failed", noError, exc);
         doTestGeneratedWsdl(expected, actual);        
     }
+
+    public void testExceptionsWithSchemasInDifferentNS() throws Exception {
+        File input = new File(getClass().getResource("/idl/Exception.idl").getFile());
+        File actual = new File(output, "Exception.wsdl");
+        File expected = new File(getClass().getResource("/idl/expected_Exception_DiffNS.wsdl").getFile());
+        
+        String[] args = new String[] {"-x", "http://schemas.apache.org/yoko/idl/Exception/types",
+                                      "-o", output.toString(),
+                                      input.toString()
+        };
+        int exc = execute(args);
+        assertEquals("IDLToWSDL Failed", noError, exc);
+        doTestGeneratedWsdl(expected, actual);
+    }
 }

Added: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl?view=auto&rev=534042
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl (added)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl Tue May  1 05:46:02 2007
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://schemas.apache.org/yoko/idl/Exception" xmlns:tns="http://schemas.apache.org/yoko/idl/Exception" xmlns:corba="http://schemas.apache.org/yoko/bindings/corba" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd1="http://schemas.apache.org/yoko/idl/Exception/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <corba:typeMapping targetNamespace="http://schemas.apache.org/yoko/idl/Exception/typemap">
+    <corba:exception xmlns:ns4="http://schemas.apache.org/yoko/idl/Exception" xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" repositoryID="IDL:ExternalException:1.0" name="ExternalException" type="ns4:ExternalExceptionType">
+      <corba:member name="description" idltype="corba:string" />
+    </corba:exception>
+    <corba:exception xmlns:ns4="http://schemas.apache.org/yoko/idl/Exception" xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" repositoryID="IDL:InterfaceWithExceptions/EmptyException:1.0" name="InterfaceWithExceptions.EmptyException" type="ns4:InterfaceWithExceptions.EmptyExceptionType" />
+    <corba:exception xmlns:ns4="http://schemas.apache.org/yoko/idl/Exception" xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" repositoryID="IDL:InterfaceWithExceptions/LongException:1.0" name="InterfaceWithExceptions.LongException" type="ns4:InterfaceWithExceptions.LongExceptionType">
+      <corba:member name="error" idltype="corba:string" />
+      <corba:member name="code" idltype="corba:long" />
+    </corba:exception>
+  </corba:typeMapping>
+  <wsdl:types>
+    <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/Exception/types" xmlns="http://schemas.apache.org/yoko/idl/Exception/types" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+      <xs:element name="ExternalException" type="ExternalExceptionType">
+      </xs:element>
+      <xs:complexType name="ExternalExceptionType">
+        <xs:sequence>
+          <xs:element name="description" type="xs:string">
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+      <xs:element name="InterfaceWithExceptions.EmptyException" type="InterfaceWithExceptions.EmptyExceptionType">
+      </xs:element>
+      <xs:complexType name="InterfaceWithExceptions.EmptyExceptionType">
+        <xs:sequence>
+        </xs:sequence>
+      </xs:complexType>
+      <xs:element name="InterfaceWithExceptions.LongException" type="InterfaceWithExceptions.LongExceptionType">
+      </xs:element>
+      <xs:complexType name="InterfaceWithExceptions.LongExceptionType">
+        <xs:sequence>
+          <xs:element name="error" type="xs:string">
+          </xs:element>
+          <xs:element name="code" type="xs:int">
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+      <xs:element name="method">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="in_string" type="xs:string">
+            </xs:element>
+            <xs:element name="inout_short" type="xs:short">
+            </xs:element>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="methodResponse">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="return" type="xs:string">
+            </xs:element>
+            <xs:element name="out_long" type="xs:int">
+            </xs:element>
+            <xs:element name="inout_short" type="xs:short">
+            </xs:element>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="raiseExternalException">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="aString" type="xs:string">
+            </xs:element>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="raiseExternalExceptionResponse">
+        <xs:complexType>
+          <xs:sequence>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="InterfaceWithExceptions.LongException">
+    <wsdl:part name="exception" element="xsd1:InterfaceWithExceptions.LongException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="method">
+    <wsdl:part name="inparameter" element="xsd1:method">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="ExternalException">
+    <wsdl:part name="exception" element="xsd1:ExternalException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="methodResponse">
+    <wsdl:part name="outparameter" element="xsd1:methodResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="raiseExternalExceptionResponse">
+    <wsdl:part name="outparameter" element="xsd1:raiseExternalExceptionResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="InterfaceWithExceptions.EmptyException">
+    <wsdl:part name="exception" element="xsd1:InterfaceWithExceptions.EmptyException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="raiseExternalException">
+    <wsdl:part name="inparameter" element="xsd1:raiseExternalException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="InterfaceWithExceptions">
+    <wsdl:operation name="method">
+      <wsdl:input name="methodRequest" message="tns:method">
+    </wsdl:input>
+      <wsdl:output name="methodResponse" message="tns:methodResponse">
+    </wsdl:output>
+      <wsdl:fault name="InterfaceWithExceptions.EmptyException" message="tns:InterfaceWithExceptions.EmptyException">
+    </wsdl:fault>
+      <wsdl:fault name="InterfaceWithExceptions.LongException" message="tns:InterfaceWithExceptions.LongException">
+    </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="raiseExternalException">
+      <wsdl:input name="raiseExternalExceptionRequest" message="tns:raiseExternalException">
+    </wsdl:input>
+      <wsdl:output name="raiseExternalExceptionResponse" message="tns:raiseExternalExceptionResponse">
+    </wsdl:output>
+      <wsdl:fault name="ExternalException" message="tns:ExternalException">
+    </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="InterfaceWithExceptionsCORBABinding" type="tns:InterfaceWithExceptions">
+    <corba:binding repositoryID="IDL:InterfaceWithExceptions:1.0" />
+    <wsdl:operation name="method">
+      <corba:operation name="method">
+        <corba:param mode="in" name="in_string" idltype="corba:string" />
+        <corba:param mode="out" name="out_long" idltype="corba:long" />
+        <corba:param mode="inout" name="inout_short" idltype="corba:short" />
+        <corba:return name="return" idltype="corba:string" />
+        <corba:raises xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" exception="InterfaceWithExceptions.LongException" />
+        <corba:raises xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" exception="InterfaceWithExceptions.EmptyException" />
+      </corba:operation>
+      <wsdl:input name="methodRequest">
+      </wsdl:input>
+      <wsdl:output name="methodResponse">
+      </wsdl:output>
+      <wsdl:fault name="InterfaceWithExceptions.EmptyException">
+      </wsdl:fault>
+      <wsdl:fault name="InterfaceWithExceptions.LongException">
+      </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="raiseExternalException">
+      <corba:operation name="raiseExternalException">
+        <corba:param mode="in" name="aString" idltype="corba:string" />
+        <corba:raises xmlns="http://schemas.apache.org/yoko/idl/Exception/typemap" exception="ExternalException" />
+      </corba:operation>
+      <wsdl:input name="raiseExternalExceptionRequest">
+      </wsdl:input>
+      <wsdl:output name="raiseExternalExceptionResponse">
+      </wsdl:output>
+      <wsdl:fault name="ExternalException">
+      </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="InterfaceWithExceptionsCORBAService">
+    <wsdl:port name="InterfaceWithExceptionsCORBAPort" binding="tns:InterfaceWithExceptionsCORBABinding">
+      <corba:address location="IOR:" />
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Exception_DiffNS.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml