Author: rr
Date: Wed Feb 10 13:38:04 2010
New Revision: 908497
URL: http://svn.apache.org/viewvc?rev=908497&view=rev
Log:
ODE-761: Wrong fault type is returned when invoking operation with mutliple
fault types (test + fix)
Added:
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java
(with props)
ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml (with props)
ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml (with props)
ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl (with props)
Modified:
ode/branches/APACHE_ODE_1.X/Rakefile
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapper.java
Modified: ode/branches/APACHE_ODE_1.X/Rakefile
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/Rakefile?rev=908497&r1=908496&r2=908497&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.X/Rakefile Wed Feb 10 13:38:04 2010
@@ -532,7 +532,7 @@
test.using :properties=>{ "java.naming.factory.initial" =>
"org.apache.xbean.spring.jndi.SpringInitialContextFactory"},
:java_args=>ENV['TEST_JVM_ARGS']
test.with projects("dao-jpa", "dao-hibernate", "bpel-compiler",
"bpel-api-jca", "jca-ra",
"jca-server", "jacob"),
- BACKPORT, COMMONS.lang, COMMONS.collections, DERBY, GERONIMO.connector,
GERONIMO.kernel,
+ BACKPORT, COMMONS.lang, COMMONS.io, COMMONS.collections, DERBY,
GERONIMO.connector, GERONIMO.kernel,
GERONIMO.transaction, JAVAX.connector, JAVAX.ejb, JAVAX.persistence,
JAVAX.stream,
JAVAX.transaction, JAXEN, JBI, OPENJPA, SAXON, SERVICEMIX, SPRING,
TRANQL,
XALAN, XBEAN, XMLBEANS,
Modified:
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapper.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapper.java?rev=908497&r1=908496&r2=908497&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapper.java
(original)
+++
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapper.java
Wed Feb 10 13:38:04 2010
@@ -204,8 +204,8 @@
if (etype == null && p.getElementName() == null)
continue;
- if (etype.equals(p.getElementName()))
- continue;
+ if (!etype.equals(p.getElementName()))
+ continue fltiter;
}
return f;
Added:
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java?rev=908497&view=auto
==============================================================================
---
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java
(added)
+++
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java
Wed Feb 10 13:38:04 2010
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.jbi.msgmap;
+
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.jbi.messaging.Fault;
+import javax.jbi.messaging.MessagingException;
+import javax.security.auth.Subject;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.utils.DOMUtils;
+
+public class JbiWsdl11WrapperMapperTest extends junit.framework.TestCase {
+ private static Log __log =
LogFactory.getLog(JbiWsdl11WrapperMapperTest.class);
+
+ public static class MockJbiFault implements javax.jbi.messaging.Fault {
+ private String resourceName;
+
+ public MockJbiFault(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public void addAttachment(String id, DataHandler content) throws
MessagingException {
+ // TODO Auto-generated method stub
+ __log.debug("addAttachment");
+
+ }
+
+ public DataHandler getAttachment(String id) {
+ // TODO Auto-generated method stub
+ __log.debug("getAttachment");
+ return null;
+ }
+
+ public Set getAttachmentNames() {
+ // TODO Auto-generated method stub
+ __log.debug("getAttachmentNames");
+ return null;
+ }
+
+ public Source getContent() {
+ try {
+ return new
DOMSource(DOMUtils.stringToDOM(IOUtils.toString(getClass().getResourceAsStream(resourceName))));
+ } catch (Exception e) {
+ throw new RuntimeException("", e);
+ }
+ }
+
+ public Object getProperty(String name) {
+ // TODO Auto-generated method stub
+ __log.debug("getProperty");
+ return null;
+ }
+
+ public Set getPropertyNames() {
+ // TODO Auto-generated method stub
+ __log.debug("getPropertyNames");
+ return null;
+ }
+
+ public Subject getSecuritySubject() {
+ // TODO Auto-generated method stub
+ __log.debug("getSecuritySubject");
+ return null;
+ }
+
+ public void removeAttachment(String id) throws MessagingException {
+ // TODO Auto-generated method stub
+ __log.debug("removeAttachment");
+
+ }
+
+ public void setContent(Source content) throws MessagingException {
+ // TODO Auto-generated method stub
+ __log.debug("setContent");
+
+ }
+
+ public void setProperty(String name, Object value) {
+ // TODO Auto-generated method stub
+ __log.debug("setProperty");
+
+ }
+
+ public void setSecuritySubject(Subject subject) {
+ // TODO Auto-generated method stub
+ __log.debug("setSecuritySubject");
+
+ }
+
+ };
+
+ public void testFault() throws Exception {
+ JbiWsdl11WrapperMapper m = new JbiWsdl11WrapperMapper();
+ Definition w =
javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(getClass().getResource("/test.wsdl").getFile());
+ {
+ Fault f = new MockJbiFault("/fault.xml");
+ javax.wsdl.Fault k = m.toFaultType(f, ((Operation)
w.getPortType(QName.valueOf("{http://www.example.org/test/}test")).getOperations().get(0)).getFaults().values());
+ assertEquals("fault", k.getName());
+ }
+ {
+ Fault f = new MockJbiFault("/fault1.xml");
+ javax.wsdl.Fault k = m.toFaultType(f, ((Operation)
w.getPortType(QName.valueOf("{http://www.example.org/test/}test")).getOperations().get(0)).getFaults().values());
+ assertEquals("fault1", k.getName());
+ }
+ }
+}
Propchange:
ode/branches/APACHE_ODE_1.X/jbi/src/test/java/org/apache/ode/jbi/msgmap/JbiWsdl11WrapperMapperTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml?rev=908497&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml (added)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml Wed Feb 10
13:38:04 2010
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+<fault xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper">
+ <part xmlns:t="http://www.example.org/test/">
+ <t:NewOperationFault>
+ <t:NewOperationFault>abc</t:NewOperationFault>
+ </t:NewOperationFault>
+ </part>
+</fault>
Propchange: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml?rev=908497&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml (added)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml Wed Feb 10
13:38:04 2010
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+<fault xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper">
+ <part xmlns:t="http://www.example.org/test/">
+ <t:NewOperationFault1>
+ <t:NewOperationFault1>abc1</t:NewOperationFault1>
+ </t:NewOperationFault1>
+ </part>
+</fault>
Propchange: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/fault1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl?rev=908497&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl Wed Feb 10
13:38:04 2010
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/test/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test"
targetNamespace="http://www.example.org/test/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/test/">
+ <xsd:element name="NewOperation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="NewOperationResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="NewOperationFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NewOperationFault"
type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="NewOperationFault1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NewOperationFault1"
type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="NewOperationRequest">
+ <wsdl:part element="tns:NewOperation" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="NewOperationResponse">
+ <wsdl:part element="tns:NewOperationResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="NewOperationFault">
+ <wsdl:part name="parameters" element="tns:NewOperationFault"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="NewOperationFault1">
+ <wsdl:part name="parameters" element="tns:NewOperationFault1"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="test">
+ <wsdl:operation name="NewOperation">
+ <wsdl:input message="tns:NewOperationRequest"/>
+ <wsdl:output message="tns:NewOperationResponse"/>
+ <wsdl:fault name="fault"
message="tns:NewOperationFault"></wsdl:fault>
+ <wsdl:fault name="fault1"
message="tns:NewOperationFault1"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="testSOAP" type="tns:test">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="NewOperation">
+ <soap:operation soapAction="http://www.example.org/test/NewOperation"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="test">
+ <wsdl:port binding="tns:testSOAP" name="testSOAP">
+ <soap:address location="http://www.example.org/"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: ode/branches/APACHE_ODE_1.X/jbi/src/test/resources/test.wsdl
------------------------------------------------------------------------------
svn:eol-style = native