You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/08/14 17:47:38 UTC
svn commit: r685947 - in /cxf/trunk: api/
common/schemas/src/main/resources/schemas/wsdl/
rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/
rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/
rt/ws/addr/src/test/java/org/apache/cxf/ws/addr...
Author: dkulp
Date: Thu Aug 14 08:47:37 2008
New Revision: 685947
URL: http://svn.apache.org/viewvc?rev=685947&view=rev
Log:
[CXF-1747] Add support for 2004/03 WS-Addressing version. Patch from Maciej Kwiecien applied!
Added:
cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb (with props)
cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd (with props)
Modified:
cxf/trunk/api/pom.xml
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/VersionTransformer.java
cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
Modified: cxf/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/api/pom.xml?rev=685947&r1=685946&r2=685947&view=diff
==============================================================================
--- cxf/trunk/api/pom.xml (original)
+++ cxf/trunk/api/pom.xml Thu Aug 14 08:47:37 2008
@@ -155,6 +155,10 @@
<bindingFile>${basedir}/target/schemas/schemas/wsdl/ws-addr-wsdl.xjb</bindingFile>
<extension>true</extension>
</xsdOption>
+ <xsdOption>
+ <xsd>${basedir}/target/schemas/schemas/wsdl/addressing200403.xsd</xsd>
+ <bindingFile>${basedir}/target/schemas/schemas/wsdl/addressing200403.xjb</bindingFile>
+ </xsdOption>
</xsdOptions>
</configuration>
<goals>
Added: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb?rev=685947&view=auto
==============================================================================
--- cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb (added)
+++ cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb Thu Aug 14 08:47:37 2008
@@ -0,0 +1,30 @@
+<?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.
+-->
+<jaxb:bindings version="1.0"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ jaxb:extensionBindingPrefixes="xjc">
+ <jaxb:bindings schemaLocation="addressing200403.xsd" node="/xs:schema">
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.apache.cxf.ws.addressing.v200403"/>
+ </jaxb:schemaBindings>
+ </jaxb:bindings>
+</jaxb:bindings>
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xjb
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd?rev=685947&view=auto
==============================================================================
--- cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd (added)
+++ cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd Thu Aug 14 08:47:37 2008
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--
+
+Legal Disclaimer
+
+The presentation, distribution or other dissemination of the information
+contained in this document is not a license, either expressly or impliedly,
+to any intellectual property owned or controlled by BEA or IBM or Microsoft
+and\or any other third party. BEA and IBM and Microsoft and\or any other
+third party may have patents, patent applications, trademarks, copyrights,
+or other intellectual property rights covering subject matter in this
+document. The furnishing of this document does not give you any license
+to BEA's and IBM's and Microsoft's or any other third party's patents,
+trademarks, copyrights, or other intellectual property.
+
+This document and the information contained herein is provided on an "AS IS"
+basis and to the maximum extent permitted by applicable law, BEA and IBM
+and Microsoft provide the document AS IS AND WITH ALL FAULTS, and hereby
+disclaims all other warranties and conditions, either express, implied or
+statutory, including, but not limited to, any (if any) implied warranties,
+duties or conditions of merchantability, of fitness for a particular
+purpose, of accuracy or completeness of responses, of results, of
+workmanlike effort, of lack of viruses, and of lack of negligence, all with
+regard to the document. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE
+DOCUMENT.
+
+IN NO EVENT WILL BEA or IBM or MICROSOFT BE LIABLE TO ANY OTHER PARTY FOR THE
+COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE,
+LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL
+DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS DOCUMENT, WHETHER OR
+NOT SUCH PARTY HAD ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Copyright Notice
+
+Copyright 2003,2004 BEA Systems Inc. and IBM Corporation and Microsoft Corporation. All rights reserved.
+
+-->
+<xs:schema targetNamespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" elementFormDefault="qualified" blockDefault="#all">
+ <!-- //////////////////// WS-Addressing //////////////////// -->
+ <!-- Endpoint reference -->
+ <xs:element name="EndpointReference" type="wsa:EndpointReferenceType"/>
+ <xs:complexType name="EndpointReferenceType">
+ <xs:sequence>
+ <xs:element name="Address" type="wsa:AttributedURI"/>
+ <xs:element name="ReferenceProperties" type="wsa:ReferencePropertiesType" minOccurs="0"/>
+ <xs:element name="PortType" type="wsa:AttributedQName" minOccurs="0"/>
+ <xs:element name="ServiceName" type="wsa:ServiceNameType" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ If "Policy" elements from namespace "http://schemas.xmlsoap.org/ws/2002/12/policy#policy" are used, they must appear first (before any extensibility elements).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:any>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ <xs:complexType name="ReferencePropertiesType">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ServiceNameType">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:attribute name="PortName" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <!-- Message information header blocks -->
+ <xs:element name="MessageID" type="wsa:AttributedURI"/>
+ <xs:element name="RelatesTo" type="wsa:Relationship"/>
+ <xs:element name="To" type="wsa:AttributedURI"/>
+ <xs:element name="Action" type="wsa:AttributedURI"/>
+ <xs:element name="From" type="wsa:EndpointReferenceType"/>
+ <xs:element name="ReplyTo" type="wsa:EndpointReferenceType"/>
+ <xs:element name="FaultTo" type="wsa:EndpointReferenceType"/>
+ <xs:complexType name="Relationship">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="RelationshipType" type="xs:QName" use="optional"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="RelationshipTypeValues">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="wsa:Reply"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="ReplyAfter"/>
+ <xs:complexType name="ReplyAfterType">
+ <xs:simpleContent>
+ <xs:extension base="xs:nonNegativeInteger">
+ <xs:anyAttribute namespace="##other"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:simpleType name="FaultSubcodeValues">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="wsa:InvalidMessageInformationHeader"/>
+ <xs:enumeration value="wsa:MessageInformationHeaderRequired"/>
+ <xs:enumeration value="wsa:DestinationUnreachable"/>
+ <xs:enumeration value="wsa:ActionNotSupported"/>
+ <xs:enumeration value="wsa:EndpointUnavailable"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attribute name="Action" type="xs:anyURI"/>
+ <!-- Common declarations and definitions -->
+ <xs:complexType name="AttributedQName">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="AttributedURI">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/common/schemas/src/main/resources/schemas/wsdl/addressing200403.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java?rev=685947&r1=685946&r2=685947&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java Thu Aug 14 08:47:37 2008
@@ -84,7 +84,8 @@
*/
public boolean isSupported(String namespace) {
return NATIVE_VERSION.equals(namespace)
- || Names200408.WSA_NAMESPACE_NAME.equals(namespace);
+ || Names200408.WSA_NAMESPACE_NAME.equals(namespace)
+ || Names200403.WSA_NAMESPACE_NAME.equals(namespace);
}
/**
@@ -108,6 +109,23 @@
}
/**
+ * Convert from 2005/08 AttributedURI to 2004/03 AttributedURI.
+ *
+ * @param internal the 2005/08 AttributedURIType
+ * @return an equivalent 2004/08 or 2004/03 AttributedURI
+ */
+ public static org.apache.cxf.ws.addressing.v200403.AttributedURI
+ convertTo200403(AttributedURIType internal) {
+ org.apache.cxf.ws.addressing.v200403.AttributedURI exposed = Names200403.WSA_OBJECT_FACTORY
+ .createAttributedURI();
+ String exposedValue = Names.WSA_ANONYMOUS_ADDRESS.equals(internal.getValue())
+ ? Names200403.WSA_ANONYMOUS_ADDRESS : Names.WSA_NONE_ADDRESS.equals(internal.getValue())
+ ? Names200403.WSA_NONE_ADDRESS : internal.getValue();
+ exposed.setValue(exposedValue);
+ putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
+ return exposed;
+ }
+ /**
* Convert from 2004/08 AttributedURI to 2005/08 AttributedURI.
*
* @param exposed the 2004/08 AttributedURI
@@ -128,6 +146,22 @@
}
/**
+ * Convert from 2004/03 AttributedURI to 2005/08 AttributedURI.
+ *
+ * @param exposed the 2004/03 AttributedURI
+ * @return an equivalent 2005/08 AttributedURIType
+ */
+ public static AttributedURIType convert(org.apache.cxf.ws.addressing.v200403.AttributedURI exposed) {
+ AttributedURIType internal = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType();
+ String internalValue = Names200403.WSA_ANONYMOUS_ADDRESS.equals(exposed.getValue())
+ ? Names.WSA_ANONYMOUS_ADDRESS : Names200403.WSA_NONE_ADDRESS.equals(exposed.getValue())
+ ? Names.WSA_NONE_ADDRESS : exposed.getValue();
+ internal.setValue(internalValue);
+ putAll(internal.getOtherAttributes(), exposed.getOtherAttributes());
+ return internal;
+ }
+
+ /**
* Convert from 2005/08 EndpointReferenceType to 2004/08
* EndpointReferenceType.
*
@@ -167,6 +201,40 @@
}
/**
+ * Convert from 2005/08 EndpointReferenceType to 2004/03 EndpointReferenceType.
+ *
+ * @param internal the 2005/08 EndpointReferenceType
+ * @return an equivalent 2004/03 EndpointReferenceType
+ */
+ public static org.apache.cxf.ws.addressing.v200403.EndpointReferenceType
+ convertTo200403(EndpointReferenceType internal) {
+ org.apache.cxf.ws.addressing.v200403.EndpointReferenceType exposed = Names200403.WSA_OBJECT_FACTORY
+ .createEndpointReferenceType();
+ exposed.setAddress(convertTo200403(internal.getAddress()));
+
+ QName serviceQName = EndpointReferenceUtils.getServiceName(internal, null);
+ if (serviceQName != null) {
+ org.apache.cxf.ws.addressing.v200403.ServiceNameType serviceName = Names200403.WSA_OBJECT_FACTORY
+ .createServiceNameType();
+ serviceName.setValue(serviceQName);
+ exposed.setServiceName(serviceName);
+ }
+ String portLocalName = EndpointReferenceUtils.getPortName(internal);
+ if (portLocalName != null) {
+ String namespace = serviceQName.getNamespaceURI() != null
+ ? serviceQName.getNamespaceURI() : Names.WSDL_INSTANCE_NAMESPACE_NAME;
+ QName portQName = new QName(namespace, portLocalName);
+ org.apache.cxf.ws.addressing.v200403.AttributedQName portType = Names200403.WSA_OBJECT_FACTORY
+ .createAttributedQName();
+ portType.setValue(portQName);
+ exposed.setPortType(portType);
+ }
+ // no direct analogue for Metadata
+ addAll(exposed.getAny(), internal.getAny());
+ putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
+ return exposed;
+ }
+ /**
* Convert from 2004/08 EndpointReferenceType to 2005/08
* EndpointReferenceType.
*
@@ -195,6 +263,31 @@
}
/**
+ * Convert from 2004/03 EndpointReferenceType to 2005/08 EndpointReferenceType.
+ *
+ * @param exposed the 2004/03 EndpointReferenceType
+ * @return an equivalent 2005/08 EndpointReferenceType
+ */
+ public static EndpointReferenceType
+ convert(org.apache.cxf.ws.addressing.v200403.EndpointReferenceType exposed) {
+ EndpointReferenceType internal = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ internal.setAddress(convert(exposed.getAddress()));
+ // TODO ref parameters not present in 2004/03
+ // internal.setReferenceParameters(convert(exposed
+ // .getReferenceParameters()));
+ org.apache.cxf.ws.addressing.v200403.ServiceNameType serviceName = exposed.getServiceName();
+ org.apache.cxf.ws.addressing.v200403.AttributedQName portName = exposed.getPortType();
+ if (serviceName != null && portName != null) {
+ EndpointReferenceUtils.setServiceAndPortName(internal, serviceName.getValue(), portName
+ .getValue().getLocalPart());
+ }
+
+ // no direct analogue for ReferenceProperties
+ addAll(internal.getAny(), exposed.getAny());
+ putAll(internal.getOtherAttributes(), exposed.getOtherAttributes());
+ return internal;
+ }
+/**
* Convert from EndpointReference to CXF internal 2005/08 EndpointReferenceType
*
* @param external the javax.xml.ws.EndpointReference
@@ -269,6 +362,7 @@
}
return internal;
}
+ // THERE IS NO ReferenceParametersType for 2004/03
/**
* Convert from 2005/08 RelatesToType to 2004/08 Relationship.
@@ -295,7 +389,30 @@
}
/**
- * Convert from 2004/08 Relationship to 2005/08 RelatesToType.
+ * Convert from 2005/08 RelatesToType to 2004/03 Relationship.
+ *
+ * @param internal the 2005/08 RelatesToType
+ * @return an equivalent 2004/03 Relationship
+ */
+ public static org.apache.cxf.ws.addressing.v200403.Relationship convertTo200403(RelatesToType internal) {
+ org.apache.cxf.ws.addressing.v200403.Relationship exposed = null;
+ if (internal != null) {
+ exposed = Names200403.WSA_OBJECT_FACTORY.createRelationship();
+ exposed.setValue(internal.getValue());
+ String internalRelationshipType = internal.getRelationshipType();
+ if (internalRelationshipType != null) {
+ QName exposedRelationshipType = null;
+ if (!Names.WSA_RELATIONSHIP_REPLY.equals(internalRelationshipType)) {
+ exposedRelationshipType = new QName(internalRelationshipType);
+ }
+ exposed.setRelationshipType(exposedRelationshipType);
+ }
+ putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
+ }
+ return exposed;
+ }
+
+ /** Convert from 2004/08 Relationship to 2005/08 RelatesToType.
*
* @param exposed the 2004/08 Relationship
* @return an equivalent 2005/08 RelatesToType
@@ -319,15 +436,38 @@
return internal;
}
- /**
+ /**
+ * Convert from 2004/03 Relationship to 2005/08 RelatesToType.
+ *
+ * @param exposed the 2004/03 Relationship
+ * @return an equivalent 2005/08 RelatesToType
+ */
+ public static RelatesToType convert(org.apache.cxf.ws.addressing.v200403.Relationship exposed) {
+ RelatesToType internal = null;
+ if (exposed != null) {
+ internal = ContextUtils.WSA_OBJECT_FACTORY.createRelatesToType();
+ internal.setValue(exposed.getValue());
+ QName exposedRelationshipType = exposed.getRelationshipType();
+ if (exposedRelationshipType != null) {
+ String internalRelationshipType = Names.WSA_REPLY_NAME.equals(exposedRelationshipType
+ .getLocalPart()) ? Names.WSA_RELATIONSHIP_REPLY : exposedRelationshipType.toString();
+ internal.setRelationshipType(internalRelationshipType);
+ }
+ internal.getOtherAttributes().putAll(exposed.getOtherAttributes());
+ }
+ return internal;
+ }
+
+ /**
* @param exposedURI specifies the version WS-Addressing
* @return JABXContext for the exposed namespace URI
*/
- public static JAXBContext getExposedJAXBContext(String exposedURI)
- throws JAXBException {
+ public static JAXBContext getExposedJAXBContext(String exposedURI) throws JAXBException {
+
return NATIVE_VERSION.equals(exposedURI)
- ? ContextUtils.getJAXBContext()
- : Names200408.getJAXBContext();
+ ? ContextUtils.getJAXBContext() : Names200408.WSA_NAMESPACE_NAME.equals(exposedURI) ? Names200408
+ .getJAXBContext() : Names200403.WSA_NAMESPACE_NAME.equals(exposedURI) ? Names200403
+ .getJAXBContext() : null;
}
/**
@@ -404,4 +544,49 @@
}
}
}
+ /**
+ * Holder for 2004/03 Names
+ */
+ public static class Names200403 {
+ public static final String WSA_NAMESPACE_NAME = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
+ public static final String WSA_ANONYMOUS_ADDRESS = WSA_NAMESPACE_NAME + "/role/anonymous";
+ public static final String WSA_NONE_ADDRESS = WSA_NAMESPACE_NAME + "/role/none";
+ public static final org.apache.cxf.ws.addressing.v200403.ObjectFactory WSA_OBJECT_FACTORY =
+ new org.apache.cxf.ws.addressing.v200403.ObjectFactory();
+ public static final Class<org.apache.cxf.ws.addressing.v200403.EndpointReferenceType> EPR_TYPE =
+ org.apache.cxf.ws.addressing.v200403.EndpointReferenceType.class;
+
+ private static JAXBContext jaxbContext;
+
+ protected Names200403() {
+ }
+
+ /**
+ * Retrieve a JAXBContext for marshalling and unmarshalling JAXB generated types for the 2004/08
+ * version.
+ *
+ * @return a JAXBContext
+ */
+ public static JAXBContext getJAXBContext() throws JAXBException {
+ synchronized (Names200403.class) {
+ if (jaxbContext == null) {
+ Class clz = org.apache.cxf.ws.addressing.v200403.ObjectFactory.class;
+ jaxbContext = JAXBContext.newInstance(clz.getPackage().getName(), clz.getClassLoader());
+ }
+ }
+ return jaxbContext;
+ }
+
+ /**
+ * Set the encapsulated JAXBContext (used by unit tests).
+ *
+ * @param ctx JAXBContext
+ */
+ public static void setJAXBContext(JAXBContext ctx) throws JAXBException {
+ synchronized (Names200403.class) {
+ jaxbContext = ctx;
+ }
+ }
+ }
+
}
Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/VersionTransformer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/VersionTransformer.java?rev=685947&r1=685946&r2=685947&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/VersionTransformer.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/VersionTransformer.java Thu Aug 14 08:47:37 2008
@@ -19,7 +19,6 @@
package org.apache.cxf.ws.addressing.soap;
-
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -31,12 +30,7 @@
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
-
import org.apache.cxf.common.logging.LogUtils;
-
-// importation convention: if the same class name is used for
-// 2005/08 and 2004/08, then the former version is imported
-// and the latter is fully qualified when used
import org.apache.cxf.ws.addressing.AttributedURIType;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.apache.cxf.ws.addressing.Names;
@@ -44,36 +38,27 @@
import org.apache.cxf.ws.addressing.v200408.AttributedURI;
import org.apache.cxf.ws.addressing.v200408.Relationship;
-
/**
- * This class is responsible for transforming between the native
- * WS-Addressing schema version (i.e. 2005/08) and exposed
- * version (currently may be 2005/08 or 2004/08).
+ * This class is responsible for transforming between the native WS-Addressing schema version (i.e. 2005/08)
+ * and exposed version (currently may be 2005/08 or 2004/08).
* <p>
- * The native version is that used throughout the stack, were the
- * WS-A types are represented via the JAXB generated types for the
- * 2005/08 schema.
+ * The native version is that used throughout the stack, were the WS-A types are represented via the JAXB
+ * generated types for the 2005/08 schema.
* <p>
- * The exposed version is that used when the WS-A types are
- * externalized, i.e. are encoded in the headers of outgoing
- * messages. For outgoing requests, the exposed version is
- * determined from configuration. For outgoing responses, the
- * exposed version is determined by the exposed version of
- * the corresponding request.
+ * The exposed version is that used when the WS-A types are externalized, i.e. are encoded in the headers of
+ * outgoing messages. For outgoing requests, the exposed version is determined from configuration. For
+ * outgoing responses, the exposed version is determined by the exposed version of the corresponding request.
* <p>
- * The motivation for using different native and exposed types
- * is usually to facilitate a WS-* standard based on an earlier
- * version of WS-Adressing (for example WS-RM depends on the
- * 2004/08 version).
+ * The motivation for using different native and exposed types is usually to facilitate a WS-* standard based
+ * on an earlier version of WS-Adressing (for example WS-RM depends on the 2004/08 version).
*/
-public class VersionTransformer
- extends org.apache.cxf.ws.addressing.VersionTransformer {
+public class VersionTransformer extends org.apache.cxf.ws.addressing.VersionTransformer {
public static final Set<QName> HEADERS;
private static final Logger LOG = LogUtils.getL7dLogger(VersionTransformer.class);
-
+
protected MAPCodec codec;
-
+
/**
* Constructor.
*
@@ -82,69 +67,63 @@
public VersionTransformer(MAPCodec mapCodec) {
codec = mapCodec;
}
-
+
/**
* Encode message in exposed version.
*
* @param exposeAs specifies the WS-Addressing version to expose
* @param value the value to encode
- * @param localName the localName for the header
+ * @param localName the localName for the header
* @param clz the class
* @param header the SOAP header element
* @param marshaller the JAXB marshaller to use
*/
- public <T> void encodeAsExposed(String exposeAs,
- T value,
- String localName,
- Class<T> clz,
- Element header,
- Marshaller marshaller)
- throws JAXBException {
+ public <T> void encodeAsExposed(String exposeAs, T value, String localName, Class<T> clz, Element header,
+ Marshaller marshaller) throws JAXBException {
if (value != null) {
if (NATIVE_VERSION.equals(exposeAs)) {
- codec.encodeMAP(value,
- new QName(exposeAs, localName),
- clz,
- header,
- marshaller);
+ codec.encodeMAP(value, new QName(exposeAs, localName), clz, header, marshaller);
} else if (Names200408.WSA_NAMESPACE_NAME.equals(exposeAs)) {
if (AttributedURIType.class.equals(clz)) {
- codec.encodeMAP(convert((AttributedURIType)value),
- new QName(exposeAs, localName),
- AttributedURI.class,
- header,
- marshaller);
+ codec.encodeMAP(convert((AttributedURIType)value), new QName(exposeAs, localName),
+ AttributedURI.class, header, marshaller);
} else if (EndpointReferenceType.class.equals(clz)) {
- codec.encodeMAP(convert((EndpointReferenceType)value),
+ codec.encodeMAP(convert((EndpointReferenceType)value), new QName(exposeAs, localName),
+ Names200408.EPR_TYPE, header, marshaller);
+ } else if (RelatesToType.class.equals(clz)) {
+ codec.encodeMAP(convert((RelatesToType)value), new QName(exposeAs, localName),
+ Relationship.class, header, marshaller);
+ }
+ } else if (Names200403.WSA_NAMESPACE_NAME.equals(exposeAs)) {
+ if (AttributedURIType.class.equals(clz)) {
+ codec.encodeMAP(convertTo200403((AttributedURIType)value),
new QName(exposeAs, localName),
- Names200408.EPR_TYPE,
- header,
+ org.apache.cxf.ws.addressing.v200403.AttributedURI.class, header,
marshaller);
+ } else if (EndpointReferenceType.class.equals(clz)) {
+ codec.encodeMAP(convertTo200403((EndpointReferenceType)value), new QName(exposeAs,
+ localName),
+ Names200403.EPR_TYPE, header, marshaller);
} else if (RelatesToType.class.equals(clz)) {
- codec.encodeMAP(convert((RelatesToType)value),
- new QName(exposeAs, localName),
- Relationship.class,
- header,
+ codec.encodeMAP(convertTo200403((RelatesToType)value), new QName(exposeAs, localName),
+ org.apache.cxf.ws.addressing.v200403.Relationship.class, header,
marshaller);
}
- }
+ }
}
}
-
+
/**
* Decodes a MAP from a exposed version.
- *
+ *
* @param encodedAs specifies the encoded version
* @param clz the class
* @param headerElement the SOAP header element
* @param marshaller the JAXB marshaller to use
* @return the decoded value
*/
- public <T> T decodeAsNative(String encodedAs,
- Class<T> clz,
- Element headerElement,
- Unmarshaller unmarshaller)
- throws JAXBException {
+ public <T> T decodeAsNative(String encodedAs, Class<T> clz, Element headerElement,
+ Unmarshaller unmarshaller) throws JAXBException {
T ret = null;
LOG.fine("decodeAsNative: encodedAs: " + encodedAs);
LOG.fine(" class: " + clz.getName());
@@ -153,60 +132,87 @@
ret = codec.decodeMAP(clz, headerElement, unmarshaller);
} else if (Names200408.WSA_NAMESPACE_NAME.equals(encodedAs)) {
if (AttributedURIType.class.equals(clz)) {
- return clz.cast(convert(codec.decodeMAP(AttributedURI.class,
- headerElement,
- unmarshaller)));
+ ret = clz.cast(convert(codec.decodeMAP(AttributedURI.class, headerElement, unmarshaller)));
+ } else if (EndpointReferenceType.class.equals(clz)) {
+ ret = clz.cast(convert(codec.decodeMAP(Names200408.EPR_TYPE, headerElement, unmarshaller)));
+ } else if (RelatesToType.class.equals(clz)) {
+ ret = clz.cast(convert(codec.decodeMAP(Relationship.class, headerElement, unmarshaller)));
+ }
+ } else if (Names200403.WSA_NAMESPACE_NAME.equals(encodedAs)) {
+ if (AttributedURIType.class.equals(clz)) {
+ ret = clz.cast(convert(codec
+ .decodeMAP(org.apache.cxf.ws.addressing.v200403.AttributedURI.class, headerElement,
+ unmarshaller)));
} else if (EndpointReferenceType.class.equals(clz)) {
- return clz.cast(convert(codec.decodeMAP(Names200408.EPR_TYPE,
- headerElement,
- unmarshaller)));
- } else if (RelatesToType.class.equals(clz)) {
- return clz.cast(convert(codec.decodeMAP(Relationship.class,
- headerElement,
- unmarshaller)));
- }
+ ret = clz.cast(convert(codec.decodeMAP(Names200403.EPR_TYPE, headerElement, unmarshaller)));
+ } else if (RelatesToType.class.equals(clz)) {
+ ret = clz.cast(convert(codec
+ .decodeMAP(org.apache.cxf.ws.addressing.v200403.Relationship.class, headerElement,
+ unmarshaller)));
+ }
}
return ret;
}
-
+
/**
- * Augment the set of headers understood by the protocol binding
- * with the 2004/08 header QNames.
+ * Augment the set of headers understood by the protocol binding with the 2004/08 header QNames.
*/
static {
Set<QName> headers = new HashSet<QName>();
headers.addAll(Names.HEADERS);
Names200408.addHeaders(headers);
+ Names200403.addHeaders(headers);
HEADERS = Collections.unmodifiableSet(headers);
}
-
+
/**
* Holder for 2004/08 Names
*/
public static final class Names200408
extends org.apache.cxf.ws.addressing.VersionTransformer.Names200408 {
-
+
protected Names200408() {
}
-
+
/**
* Adds 2004/08 headers to set.
*
* @param headers set of headers
*/
private static void addHeaders(Set<QName> headers) {
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_FROM_NAME));
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_TO_NAME));
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_REPLYTO_NAME));
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_FAULTTO_NAME));
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_ACTION_NAME));
- headers.add(new QName(WSA_NAMESPACE_NAME,
- Names.WSA_MESSAGEID_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_FROM_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_TO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_REPLYTO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_FAULTTO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_ACTION_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_MESSAGEID_NAME));
}
}
+
+ /**
+ * Adds 2004/03 headers to set.
+ *
+ * @param headers set of headers
+ */
+ public static final class Names200403
+ extends org.apache.cxf.ws.addressing.VersionTransformer.Names200403 {
+
+ protected Names200403() {
+ }
+
+ /**
+ * Adds 2004/08 headers to set.
+ *
+ * @param headers set of headers
+ */
+ private static void addHeaders(Set<QName> headers) {
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_FROM_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_TO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_REPLYTO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_FAULTTO_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_ACTION_NAME));
+ headers.add(new QName(WSA_NAMESPACE_NAME, Names.WSA_MESSAGEID_NAME));
+ }
+ }
+
}
Modified: cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?rev=685947&r1=685946&r2=685947&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java (original)
+++ cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java Thu Aug 14 08:47:37 2008
@@ -19,7 +19,6 @@
package org.apache.cxf.ws.addressing.soap;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -35,7 +34,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-
import org.apache.cxf.binding.soap.SoapBindingConstants;
import org.apache.cxf.binding.soap.SoapFault;
import org.apache.cxf.binding.soap.SoapMessage;
@@ -69,7 +67,6 @@
import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND;
-
public class MAPCodecTest extends Assert {
private MAPCodec codec;
@@ -104,28 +101,57 @@
@Test
public void testGetHeaders() throws Exception {
Set<QName> headers = codec.getUnderstoodHeaders();
- assertTrue("expected From header",
- headers.contains(Names.WSA_FROM_QNAME));
- assertTrue("expected To header",
- headers.contains(Names.WSA_TO_QNAME));
- assertTrue("expected ReplyTo header",
- headers.contains(Names.WSA_REPLYTO_QNAME));
- assertTrue("expected FaultTo header",
- headers.contains(Names.WSA_FAULTTO_QNAME));
- assertTrue("expected Action header",
- headers.contains(Names.WSA_ACTION_QNAME));
- assertTrue("expected MessageID header",
- headers.contains(Names.WSA_MESSAGEID_QNAME));
+ assertTrue("expected From header", headers.contains(Names.WSA_FROM_QNAME));
+ assertTrue("expected To header", headers.contains(Names.WSA_TO_QNAME));
+ assertTrue("expected ReplyTo header", headers.contains(Names.WSA_REPLYTO_QNAME));
+ assertTrue("expected FaultTo header", headers.contains(Names.WSA_FAULTTO_QNAME));
+ assertTrue("expected Action header", headers.contains(Names.WSA_ACTION_QNAME));
+ assertTrue("expected MessageID header", headers.contains(Names.WSA_MESSAGEID_QNAME));
+ }
+
+ @Test
+ public void testRequestorInboundNonNative200403() throws Exception {
+ String uri = VersionTransformer.Names200403.WSA_NAMESPACE_NAME;
+ SoapMessage message = setUpMessage(true, false, false, false, uri);
+ codec.handleMessage(message);
+ control.verify();
+ verifyMessage(message, true, false, false);
+ }
+
+ @Test
+ public void testResponderInboundNonNative200403() throws Exception {
+ String uri = VersionTransformer.Names200403.WSA_NAMESPACE_NAME;
+ SoapMessage message = setUpMessage(false, false, false, false, uri);
+ codec.handleMessage(message);
+ control.verify();
+ verifyMessage(message, false, false, false);
}
@Test
+ public void testRequestorOutboundNonNative200403() throws Exception {
+ String uri = VersionTransformer.Names200403.WSA_NAMESPACE_NAME;
+ SoapMessage message = setUpMessage(true, true, false, false, uri);
+ codec.handleMessage(message);
+ control.verify();
+ verifyMessage(message, true, true, false);
+ }
+
+ @Test
+ public void testResponderOutboundNonNative200403() throws Exception {
+ String uri = VersionTransformer.Names200403.WSA_NAMESPACE_NAME;
+ SoapMessage message = setUpMessage(false, true, false, false, uri);
+ codec.handleMessage(message);
+ control.verify();
+ verifyMessage(message, false, true, false);
+ }
+
public void testRequestorOutbound() throws Exception {
SoapMessage message = setUpMessage(true, true);
codec.handleMessage(message);
control.verify();
verifyMessage(message, true, true, true);
}
-
+
@Test
public void testRequestorOutboundPreExistingSOAPAction() throws Exception {
SoapMessage message = setUpMessage(true, true, false, true);
@@ -134,17 +160,16 @@
control.verify();
verifyMessage(message, true, true, true);
}
-
+
@Test
public void testRequestorOutboundNonNative() throws Exception {
String uri = VersionTransformer.Names200408.WSA_NAMESPACE_NAME;
- SoapMessage message =
- setUpMessage(true, true, false, false, uri);
+ SoapMessage message = setUpMessage(true, true, false, false, uri);
codec.handleMessage(message);
control.verify();
verifyMessage(message, true, true, false);
}
-
+
@Test
public void testResponderInbound() throws Exception {
SoapMessage message = setUpMessage(false, false);
@@ -160,17 +185,16 @@
control.verify();
verifyMessage(message, false, true, true);
}
-
+
@Test
public void testResponderInboundNonNative() throws Exception {
String uri = VersionTransformer.Names200408.WSA_NAMESPACE_NAME;
- SoapMessage message =
- setUpMessage(false, false, false, false, uri);
+ SoapMessage message = setUpMessage(false, false, false, false, uri);
codec.handleMessage(message);
control.verify();
verifyMessage(message, false, false, false);
}
-
+
@Test
public void testResponderOutboundInvalidMAP() throws Exception {
SoapMessage message = setUpMessage(false, true, true);
@@ -178,14 +202,12 @@
codec.handleMessage(message);
fail("expected SOAPFaultException on invalid MAP");
} catch (SoapFault sfe) {
- assertEquals("unexpected fault string",
- "Duplicate Message ID urn:uuid:12345",
- sfe.getMessage());
+ assertEquals("unexpected fault string", "Duplicate Message ID urn:uuid:12345", sfe.getMessage());
}
control.verify();
verifyMessage(message, false, true, true);
}
-
+
@Test
public void testResponderOutboundPreExistingSOAPAction() throws Exception {
SoapMessage message = setUpMessage(false, true, false, true);
@@ -198,13 +220,12 @@
@Test
public void testResponderOutboundNonNative() throws Exception {
String uri = VersionTransformer.Names200408.WSA_NAMESPACE_NAME;
- SoapMessage message =
- setUpMessage(false, true, false, false, uri);
+ SoapMessage message = setUpMessage(false, true, false, false, uri);
codec.handleMessage(message);
control.verify();
verifyMessage(message, false, true, false);
}
-
+
@Test
public void testRequestorInbound() throws Exception {
SoapMessage message = setUpMessage(true, false);
@@ -212,51 +233,32 @@
control.verify();
verifyMessage(message, true, false, true);
}
-
+
@Test
public void testRequestorInboundNonNative() throws Exception {
String uri = VersionTransformer.Names200408.WSA_NAMESPACE_NAME;
- SoapMessage message =
- setUpMessage(true, false, false, false, uri);
+ SoapMessage message = setUpMessage(true, false, false, false, uri);
codec.handleMessage(message);
control.verify();
verifyMessage(message, true, false, false);
}
- private SoapMessage setUpMessage(boolean requestor,
- boolean outbound)
- throws Exception {
- return setUpMessage(requestor, outbound, false);
+ private SoapMessage setUpMessage(boolean requestor, boolean outbound) throws Exception {
+ return setUpMessage(requestor, outbound, false);
}
- private SoapMessage setUpMessage(boolean requestor,
- boolean outbound,
- boolean invalidMAP)
+ private SoapMessage setUpMessage(boolean requestor, boolean outbound, boolean invalidMAP)
throws Exception {
- return setUpMessage(requestor,
- outbound,
- invalidMAP,
- false);
+ return setUpMessage(requestor, outbound, invalidMAP, false);
}
- private SoapMessage setUpMessage(boolean requestor,
- boolean outbound,
- boolean invalidMAP,
- boolean preExistingSOAPAction)
- throws Exception {
- return setUpMessage(requestor,
- outbound,
- invalidMAP,
- preExistingSOAPAction,
- Names.WSA_NAMESPACE_NAME);
+ private SoapMessage setUpMessage(boolean requestor, boolean outbound, boolean invalidMAP,
+ boolean preExistingSOAPAction) throws Exception {
+ return setUpMessage(requestor, outbound, invalidMAP, preExistingSOAPAction, Names.WSA_NAMESPACE_NAME);
}
- private SoapMessage setUpMessage(boolean requestor,
- boolean outbound,
- boolean invalidMAP,
- boolean preExistingSOAPAction,
- String exposeAs)
- throws Exception {
+ private SoapMessage setUpMessage(boolean requestor, boolean outbound, boolean invalidMAP,
+ boolean preExistingSOAPAction, String exposeAs) throws Exception {
SoapMessage message = new SoapMessage(new MessageImpl());
setUpOutbound(message, outbound);
expectRelatesTo = (requestor && !outbound) || (!requestor && outbound);
@@ -273,14 +275,9 @@
JAXBContext jaxbContext = control.createMock(JAXBContext.class);
ContextUtils.setJAXBContext(jaxbContext);
VersionTransformer.Names200408.setJAXBContext(jaxbContext);
+ VersionTransformer.Names200403.setJAXBContext(jaxbContext);
if (outbound) {
- setUpEncode(requestor,
- message,
- header,
- maps,
- mapProperty,
- invalidMAP,
- preExistingSOAPAction);
+ setUpEncode(requestor, message, header, maps, mapProperty, invalidMAP, preExistingSOAPAction);
} else {
setUpDecode(message, headers, maps, mapProperty, requestor);
}
@@ -288,13 +285,9 @@
return message;
}
- private void setUpEncode(boolean requestor,
- SoapMessage message,
- Element header,
- AddressingPropertiesImpl maps,
- String mapProperty,
- boolean invalidMAP,
- boolean preExistingSOAPAction) throws Exception {
+ private void setUpEncode(boolean requestor, SoapMessage message, Element header,
+ AddressingPropertiesImpl maps, String mapProperty, boolean invalidMAP,
+ boolean preExistingSOAPAction) throws Exception {
message.put(mapProperty, maps);
Marshaller marshaller = control.createMock(Marshaller.class);
ContextUtils.getJAXBContext().createMarshaller();
@@ -302,16 +295,14 @@
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
EasyMock.expectLastCall();
IArgumentMatcher matcher = new JAXBEltMatcher();
- int expectedMarshals = requestor
- ? expectedValues.length - 1
- : expectedValues.length;
+ int expectedMarshals = requestor ? expectedValues.length - 1 : expectedValues.length;
for (int i = 0; i < expectedMarshals; i++) {
EasyMock.reportMatcher(matcher);
EasyMock.eq(header);
marshaller.marshal(null, header);
EasyMock.expectLastCall();
}
-
+
NodeList children = control.createMock(NodeList.class);
header.getChildNodes();
EasyMock.expectLastCall().andReturn(children);
@@ -322,17 +313,15 @@
children.item(i);
EasyMock.expectLastCall().andReturn(child);
/*
- child.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
- EasyMock.eq("xmlns:wsa"),
- EasyMock.eq(maps.getNamespaceURI()));
- EasyMock.expectLastCall();
- */
+ * child.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"), EasyMock.eq("xmlns:wsa"),
+ * EasyMock.eq(maps.getNamespaceURI())); EasyMock.expectLastCall();
+ */
child.getNamespaceURI();
EasyMock.expectLastCall().andReturn(expectedNames[i].getNamespaceURI());
child.getLocalName();
EasyMock.expectLastCall().andReturn(expectedNames[i].getLocalPart());
}
-
+
mimeHeaders = new HashMap<String, List<String>>();
message.put(MIME_HEADERS, mimeHeaders);
if (preExistingSOAPAction) {
@@ -341,84 +330,46 @@
mimeHeaders.put(SoapBindingConstants.SOAP_ACTION, soapAction);
}
if (invalidMAP) {
- message.put("org.apache.cxf.ws.addressing.map.fault.name",
- Names.DUPLICATE_MESSAGE_ID_NAME);
+ message.put("org.apache.cxf.ws.addressing.map.fault.name", Names.DUPLICATE_MESSAGE_ID_NAME);
message.put("org.apache.cxf.ws.addressing.map.fault.reason",
"Duplicate Message ID urn:uuid:12345");
}
}
-
- private void setUpDecode(SoapMessage message,
- List<Header> headers,
- AddressingPropertiesImpl maps,
- String mapProperty,
- boolean requestor) throws Exception {
+
+ private void setUpDecode(SoapMessage message, List<Header> headers, AddressingPropertiesImpl maps,
+ String mapProperty, boolean requestor) throws Exception {
Unmarshaller unmarshaller = control.createMock(Unmarshaller.class);
ContextUtils.getJAXBContext().createUnmarshaller();
EasyMock.expectLastCall().andReturn(unmarshaller);
String uri = maps.getNamespaceURI();
boolean exposedAsNative = Names.WSA_NAMESPACE_NAME.equals(uri);
- boolean exposedAs200408 =
- VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
- assertTrue("unexpected namescape URI: " + uri,
- exposedAsNative || exposedAs200408);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_MESSAGEID_NAME,
- exposedAsNative
- ? AttributedURIType.class
- : AttributedURI.class,
- 0,
- unmarshaller);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_TO_NAME,
- exposedAsNative
- ? AttributedURIType.class
- : AttributedURI.class,
- 1,
- unmarshaller);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_REPLYTO_NAME,
- exposedAsNative
- ? EndpointReferenceType.class
- : VersionTransformer.Names200408.EPR_TYPE,
- 2,
- unmarshaller);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_FAULTTO_NAME,
- exposedAsNative
- ? EndpointReferenceType.class
- : VersionTransformer.Names200408.EPR_TYPE,
- 3,
- unmarshaller);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_RELATESTO_NAME,
- exposedAsNative
- ? RelatesToType.class
- : Relationship.class,
- 4,
- unmarshaller);
- setUpHeaderDecode(headers,
- uri,
- Names.WSA_ACTION_NAME,
- exposedAsNative
- ? AttributedURIType.class
- : AttributedURI.class,
- 5,
- unmarshaller);
- }
-
- private <T> void setUpHeaderDecode(List<Header> headers,
- String uri,
- String name,
- Class<T> clz,
- int index,
- Unmarshaller unmarshaller)
- throws Exception {
+ boolean exposedAs200408 = VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
+ boolean exposedAs200403 = VersionTransformer.Names200403.WSA_NAMESPACE_NAME.equals(uri);
+ assertTrue("unexpected namescape URI: " + uri, exposedAsNative || exposedAs200408 || exposedAs200403);
+ setUpHeaderDecode(headers, uri, Names.WSA_MESSAGEID_NAME, exposedAsNative
+ ? AttributedURIType.class : exposedAs200408 ? AttributedURI.class : exposedAs200403
+ ? org.apache.cxf.ws.addressing.v200403.AttributedURI.class : null, 0, unmarshaller);
+ setUpHeaderDecode(headers, uri, Names.WSA_TO_NAME, exposedAsNative
+ ? AttributedURIType.class : exposedAs200408 ? AttributedURI.class : exposedAs200403
+ ? org.apache.cxf.ws.addressing.v200403.AttributedURI.class : null, 1, unmarshaller);
+ setUpHeaderDecode(headers, uri, Names.WSA_REPLYTO_NAME, exposedAsNative
+ ? EndpointReferenceType.class : exposedAs200408
+ ? VersionTransformer.Names200408.EPR_TYPE : exposedAs200403
+ ? VersionTransformer.Names200403.EPR_TYPE : null, 2, unmarshaller);
+ setUpHeaderDecode(headers, uri, Names.WSA_FAULTTO_NAME, exposedAsNative
+ ? EndpointReferenceType.class : exposedAs200408
+ ? VersionTransformer.Names200408.EPR_TYPE : exposedAs200403
+ ? VersionTransformer.Names200403.EPR_TYPE : null, 3, unmarshaller);
+ setUpHeaderDecode(headers, uri, Names.WSA_RELATESTO_NAME, exposedAsNative
+ ? RelatesToType.class : exposedAs200408 ? Relationship.class : exposedAs200403
+ ? org.apache.cxf.ws.addressing.v200403.Relationship.class : null, 4, unmarshaller);
+ setUpHeaderDecode(headers, uri, Names.WSA_ACTION_NAME, exposedAsNative
+ ? AttributedURIType.class : exposedAs200408 ? AttributedURI.class : exposedAs200403
+ ? org.apache.cxf.ws.addressing.v200403.AttributedURI.class : null, 5, unmarshaller);
+ }
+
+ private <T> void setUpHeaderDecode(List<Header> headers, String uri, String name, Class<T> clz,
+ int index, Unmarshaller unmarshaller) throws Exception {
Element headerElement = control.createMock(Element.class);
headers.add(new Header(new QName(uri, name), headerElement));
headerElement.getNamespaceURI();
@@ -426,117 +377,118 @@
headerElement.getLocalName();
EasyMock.expectLastCall().andReturn(name);
Object v = expectedValues[index];
- JAXBElement<?> jaxbElement =
- new JAXBElement<T>(new QName(uri, name), clz, clz.cast(v));
+ JAXBElement<?> jaxbElement = new JAXBElement<T>(new QName(uri, name), clz, clz.cast(v));
unmarshaller.unmarshal(headerElement, clz);
EasyMock.expectLastCall().andReturn(jaxbElement);
}
-
+
private void setUpOutbound(Message message, boolean outbound) {
Exchange exchange = new ExchangeImpl();
exchange.setOutMessage(outbound ? message : new MessageImpl());
message.setExchange(exchange);
}
- private String getMAPProperty(boolean requestor, boolean outbound) {
- return requestor
- ? outbound
- ? CLIENT_ADDRESSING_PROPERTIES_OUTBOUND
- : CLIENT_ADDRESSING_PROPERTIES_INBOUND
- : outbound
- ? SERVER_ADDRESSING_PROPERTIES_OUTBOUND
- : SERVER_ADDRESSING_PROPERTIES_INBOUND;
+ private String getMAPProperty(boolean requestor, boolean outbound) {
+ return requestor ? outbound
+ ? CLIENT_ADDRESSING_PROPERTIES_OUTBOUND : CLIENT_ADDRESSING_PROPERTIES_INBOUND : outbound
+ ? SERVER_ADDRESSING_PROPERTIES_OUTBOUND : SERVER_ADDRESSING_PROPERTIES_INBOUND;
}
- private AddressingPropertiesImpl getMAPs(boolean requestor,
- boolean outbound,
- String uri) {
+ private AddressingPropertiesImpl getMAPs(boolean requestor, boolean outbound, String uri) {
AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
boolean exposeAsNative = Names.WSA_NAMESPACE_NAME.equals(uri);
- boolean exposeAs200408 =
- VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
- AttributedURIType id =
- ContextUtils.getAttributedURI("urn:uuid:12345");
+ boolean exposeAs200408 = VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
+ boolean exposeAs200403 = VersionTransformer.Names200403.WSA_NAMESPACE_NAME.equals(uri);
+
+ AttributedURIType id = ContextUtils.getAttributedURI("urn:uuid:12345");
maps.setMessageID(id);
- AttributedURIType to =
- ContextUtils.getAttributedURI("foobar");
+ AttributedURIType to = ContextUtils.getAttributedURI("foobar");
EndpointReferenceType toEpr = EndpointReferenceUtils.getEndpointReference(to);
maps.setTo(toEpr);
EndpointReferenceType replyTo = new EndpointReferenceType();
- String anonymous =
- exposeAsNative
- ? Names.WSA_ANONYMOUS_ADDRESS
- : VersionTransformer.Names200408.WSA_ANONYMOUS_ADDRESS;
- replyTo.setAddress(
- ContextUtils.getAttributedURI(anonymous));
+ String anonymous = exposeAsNative ? Names.WSA_ANONYMOUS_ADDRESS : exposeAs200408
+ ? VersionTransformer.Names200408.WSA_ANONYMOUS_ADDRESS
+ : VersionTransformer.Names200403.WSA_ANONYMOUS_ADDRESS;
+ replyTo.setAddress(ContextUtils.getAttributedURI(anonymous));
maps.setReplyTo(replyTo);
EndpointReferenceType faultTo = new EndpointReferenceType();
- anonymous =
- exposeAsNative
- ? Names.WSA_ANONYMOUS_ADDRESS
- : VersionTransformer.Names200408.WSA_ANONYMOUS_ADDRESS;
- faultTo.setAddress(
- ContextUtils.getAttributedURI(anonymous));
+ anonymous = exposeAsNative ? Names.WSA_ANONYMOUS_ADDRESS : exposeAs200408
+ ? VersionTransformer.Names200408.WSA_ANONYMOUS_ADDRESS
+ : VersionTransformer.Names200403.WSA_ANONYMOUS_ADDRESS;
+ faultTo.setAddress(ContextUtils.getAttributedURI(anonymous));
maps.setFaultTo(faultTo);
RelatesToType relatesTo = null;
if (expectRelatesTo) {
String correlationID = "urn:uuid:67890";
- relatesTo = new RelatesToType();
+ relatesTo = new RelatesToType();
relatesTo.setValue(correlationID);
maps.setRelatesTo(relatesTo);
correlatedExchange = new ExchangeImpl();
codec.uncorrelatedExchanges.put(correlationID, correlatedExchange);
}
- AttributedURIType action =
- ContextUtils.getAttributedURI("http://foo/bar/SEI/opRequest");
+ AttributedURIType action = ContextUtils.getAttributedURI("http://foo/bar/SEI/opRequest");
maps.setAction(action);
maps.exposeAs(uri);
expectedNamespaceURI = uri;
- expectedNames =
- new QName[] {new QName(uri, Names.WSA_MESSAGEID_NAME),
- new QName(uri, Names.WSA_TO_NAME),
- new QName(uri, Names.WSA_REPLYTO_NAME),
- new QName(uri, Names.WSA_FAULTTO_NAME),
- new QName(uri, Names.WSA_RELATESTO_NAME),
- new QName(uri, Names.WSA_ACTION_NAME)};
+ expectedNames = new QName[] {
+ new QName(uri, Names.WSA_MESSAGEID_NAME), new QName(uri, Names.WSA_TO_NAME),
+ new QName(uri, Names.WSA_REPLYTO_NAME), new QName(uri, Names.WSA_FAULTTO_NAME),
+ new QName(uri, Names.WSA_RELATESTO_NAME), new QName(uri, Names.WSA_ACTION_NAME)
+ };
if (exposeAsNative) {
- expectedValues = new Object[] {id, to, replyTo, faultTo, relatesTo, action};
- expectedDeclaredTypes =
- new Class<?>[] {AttributedURIType.class,
- AttributedURIType.class,
- EndpointReferenceType.class,
- EndpointReferenceType.class,
- RelatesToType.class,
- AttributedURIType.class};
+ expectedValues = new Object[] {
+ id, to, replyTo, faultTo, relatesTo, action
+ };
+ expectedDeclaredTypes = new Class<?>[] {
+ AttributedURIType.class, AttributedURIType.class, EndpointReferenceType.class,
+ EndpointReferenceType.class, RelatesToType.class, AttributedURIType.class
+ };
} else if (exposeAs200408) {
- expectedValues = new Object[] {VersionTransformer.convert(id),
- VersionTransformer.convert(to),
- VersionTransformer.convert(replyTo),
- VersionTransformer.convert(faultTo),
- VersionTransformer.convert(relatesTo),
- VersionTransformer.convert(action)};
+ expectedValues = new Object[] {
+ VersionTransformer.convert(id), VersionTransformer.convert(to),
+ VersionTransformer.convert(replyTo), VersionTransformer.convert(faultTo),
+ VersionTransformer.convert(relatesTo), VersionTransformer.convert(action)
+ };
if (!outbound) {
// conversion from 2004/08 to 2005/08 anonymous address
// occurs transparently in VersionTransformer
- VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[2]).
- getAddress().setValue(Names.WSA_ANONYMOUS_ADDRESS);
- VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[3]).
- getAddress().setValue(Names.WSA_ANONYMOUS_ADDRESS);
+ VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[2]).getAddress()
+ .setValue(Names.WSA_ANONYMOUS_ADDRESS);
+ VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[3]).getAddress()
+ .setValue(Names.WSA_ANONYMOUS_ADDRESS);
}
- expectedDeclaredTypes =
- new Class<?>[] {AttributedURI.class,
- AttributedURI.class,
- VersionTransformer.Names200408.EPR_TYPE,
- VersionTransformer.Names200408.EPR_TYPE,
- Relationship.class,
- AttributedURI.class};
+ expectedDeclaredTypes = new Class<?>[] {
+ AttributedURI.class, AttributedURI.class, VersionTransformer.Names200408.EPR_TYPE,
+ VersionTransformer.Names200408.EPR_TYPE, Relationship.class, AttributedURI.class
+ };
+ } else if (exposeAs200403) {
+ expectedValues = new Object[] {
+ VersionTransformer.convertTo200403(id), VersionTransformer.convertTo200403(to),
+ VersionTransformer.convertTo200403(replyTo), VersionTransformer.convertTo200403(faultTo),
+ VersionTransformer.convertTo200403(relatesTo), VersionTransformer.convertTo200403(action)
+ };
+ if (!outbound) {
+ // conversion from 2004/03 to 2005/08 anonymous address
+ // occurs transparently in VersionTransformer
+ VersionTransformer.Names200403.EPR_TYPE.cast(expectedValues[2]).getAddress()
+ .setValue(Names.WSA_ANONYMOUS_ADDRESS);
+ VersionTransformer.Names200403.EPR_TYPE.cast(expectedValues[3]).getAddress()
+ .setValue(Names.WSA_ANONYMOUS_ADDRESS);
+ }
+ expectedDeclaredTypes = new Class<?>[] {
+ org.apache.cxf.ws.addressing.v200403.AttributedURI.class,
+ org.apache.cxf.ws.addressing.v200403.AttributedURI.class,
+ VersionTransformer.Names200403.EPR_TYPE, VersionTransformer.Names200403.EPR_TYPE,
+ org.apache.cxf.ws.addressing.v200403.Relationship.class,
+ org.apache.cxf.ws.addressing.v200403.AttributedURI.class
+ };
} else {
fail("unexpected namespace URI: " + uri);
}
return maps;
}
-
+
private final class JAXBEltMatcher implements IArgumentMatcher {
public boolean matches(Object obj) {
QName name = expectedNames[expectedIndex];
@@ -549,8 +501,7 @@
}
if (obj instanceof JAXBElement) {
JAXBElement other = (JAXBElement)obj;
- ret = name.equals(other.getName())
- && declaredType.isAssignableFrom(other.getDeclaredType())
+ ret = name.equals(other.getName()) && declaredType.isAssignableFrom(other.getDeclaredType())
&& compare(value, other.getValue());
}
return ret;
@@ -559,30 +510,43 @@
public void appendTo(StringBuffer buffer) {
buffer.append("JAXBElements did not match[" + expectedIndex + "]");
}
-
+
private boolean compare(Object a, Object b) {
boolean ret = false;
if (a instanceof AttributedURI && b instanceof AttributedURI) {
ret = ((AttributedURI)a).getValue().equals(((AttributedURI)b).getValue());
+ } else if (a instanceof org.apache.cxf.ws.addressing.v200403.AttributedURI
+ && b instanceof org.apache.cxf.ws.addressing.v200403.AttributedURI) {
+ ret = ((org.apache.cxf.ws.addressing.v200403.AttributedURI)a).getValue()
+ .equals(((org.apache.cxf.ws.addressing.v200403.AttributedURI)b).getValue());
} else if (a instanceof AttributedURIType && b instanceof AttributedURIType) {
ret = ((AttributedURIType)a).getValue().equals(((AttributedURIType)b).getValue());
} else if (a instanceof EndpointReferenceType && b instanceof EndpointReferenceType) {
EndpointReferenceType aEPR = (EndpointReferenceType)a;
EndpointReferenceType bEPR = (EndpointReferenceType)b;
- ret = aEPR.getAddress() != null
- && bEPR.getAddress() != null
+ ret = aEPR.getAddress() != null && bEPR.getAddress() != null
&& aEPR.getAddress().getValue().equals(bEPR.getAddress().getValue());
} else if (VersionTransformer.Names200408.EPR_TYPE.isInstance(a)
&& VersionTransformer.Names200408.EPR_TYPE.isInstance(b)) {
ret = VersionTransformer.Names200408.EPR_TYPE.cast(a).getAddress() != null
&& VersionTransformer.Names200408.EPR_TYPE.cast(b).getAddress() != null
- && VersionTransformer.Names200408.EPR_TYPE.cast(a).getAddress().getValue().equals(
- VersionTransformer.Names200408.EPR_TYPE.cast(b).getAddress().getValue());
+ && VersionTransformer.Names200408.EPR_TYPE.cast(a).getAddress().getValue()
+ .equals(VersionTransformer.Names200408.EPR_TYPE.cast(b).getAddress().getValue());
+ } else if (VersionTransformer.Names200403.EPR_TYPE.isInstance(a)
+ && VersionTransformer.Names200403.EPR_TYPE.isInstance(b)) {
+ ret = VersionTransformer.Names200403.EPR_TYPE.cast(a).getAddress() != null
+ && VersionTransformer.Names200403.EPR_TYPE.cast(b).getAddress() != null
+ && VersionTransformer.Names200403.EPR_TYPE.cast(a).getAddress().getValue()
+ .equals(VersionTransformer.Names200403.EPR_TYPE.cast(b).getAddress().getValue());
} else if (a instanceof Relationship && b instanceof Relationship) {
ret = ((Relationship)a).getValue().equals(((Relationship)b).getValue());
+ } else if (a instanceof org.apache.cxf.ws.addressing.v200403.Relationship
+ && b instanceof org.apache.cxf.ws.addressing.v200403.Relationship) {
+ ret = ((org.apache.cxf.ws.addressing.v200403.Relationship)a).getValue()
+ .equals(((org.apache.cxf.ws.addressing.v200403.Relationship)b).getValue());
} else if (a instanceof RelatesToType && b instanceof RelatesToType) {
ret = ((RelatesToType)a).getValue().equals(((RelatesToType)b).getValue());
- }
+ }
return ret;
}
}
@@ -591,100 +555,89 @@
if (obj instanceof AddressingPropertiesImpl) {
AddressingPropertiesImpl other = (AddressingPropertiesImpl)obj;
return compareExpected(other);
- }
+ }
return false;
- }
+ }
private boolean compareExpected(AddressingPropertiesImpl other) {
boolean ret = false;
String uri = other.getNamespaceURI();
boolean exposedAsNative = Names.WSA_NAMESPACE_NAME.equals(uri);
- boolean exposedAs200408 =
- VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
- if (exposedAsNative || exposedAs200408) {
- String expectedMessageID =
- exposedAsNative
- ? ((AttributedURIType)expectedValues[0]).getValue()
- : ((AttributedURI)expectedValues[0]).getValue();
- String expectedTo =
- exposedAsNative
- ? ((AttributedURIType)expectedValues[1]).getValue()
- : ((AttributedURI)expectedValues[1]).getValue();
- String expectedReplyTo =
- exposedAsNative
- ? ((EndpointReferenceType)expectedValues[2]).getAddress().getValue()
- : (VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[2])).
- getAddress().getValue();
- String expectedAction =
- exposedAsNative
- ? ((AttributedURIType)expectedValues[5]).getValue()
- : ((AttributedURI)expectedValues[5]).getValue();
+ boolean exposedAs200408 = VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(uri);
+ boolean exposedAs200403 = VersionTransformer.Names200403.WSA_NAMESPACE_NAME.equals(uri);
+
+ if (exposedAsNative || exposedAs200408 || exposedAs200403) {
+ String expectedMessageID = exposedAsNative
+ ? ((AttributedURIType)expectedValues[0]).getValue() : exposedAs200408
+ ? ((AttributedURI)expectedValues[0]).getValue()
+ : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[0]).getValue();
+
+ String expectedTo = exposedAsNative
+ ? ((AttributedURIType)expectedValues[1]).getValue() : exposedAs200408
+ ? ((AttributedURI)expectedValues[1]).getValue()
+ : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[1]).getValue();
+
+ String expectedReplyTo = exposedAsNative ? ((EndpointReferenceType)expectedValues[2])
+ .getAddress().getValue() : exposedAs200408 ? (VersionTransformer.Names200408.EPR_TYPE
+ .cast(expectedValues[2])).getAddress().getValue() : (VersionTransformer.Names200403.EPR_TYPE
+ .cast(expectedValues[2])).getAddress().getValue();
+ String expectedAction = exposedAsNative
+ ? ((AttributedURIType)expectedValues[5]).getValue() : exposedAs200408
+ ? ((AttributedURI)expectedValues[5]).getValue()
+ : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[5]).getValue();
ret = expectedMessageID.equals(other.getMessageID().getValue())
&& expectedTo.equals(other.getTo().getValue())
- && expectedReplyTo.equals(
- other.getReplyTo().getAddress().getValue())
+ && expectedReplyTo.equals(other.getReplyTo().getAddress().getValue())
&& expectedAction.equals(other.getAction().getValue())
&& expectedNamespaceURI.equals(other.getNamespaceURI());
if (expectRelatesTo) {
- String expectedRelatesTo =
- exposedAsNative
- ? ((RelatesToType)expectedValues[4]).getValue()
- : ((Relationship)expectedValues[4]).getValue();
- ret = ret
- && expectedRelatesTo.equals(other.getRelatesTo().getValue());
+ String expectedRelatesTo = exposedAsNative
+ ? ((RelatesToType)expectedValues[4]).getValue() : exposedAs200408
+ ? ((Relationship)expectedValues[4]).getValue()
+ : ((org.apache.cxf.ws.addressing.v200403.Relationship)expectedValues[4]).getValue();
+ ret = ret && expectedRelatesTo.equals(other.getRelatesTo().getValue());
}
- }
+ }
return ret;
}
-
+
private void verifyAction() {
List<?> soapAction = (List<?>)mimeHeaders.get("SOAPAction");
assertNotNull("expected propogated action", soapAction);
assertEquals("expected single action", 1, soapAction.size());
- String expectedAction =
- "\"" + ((AttributedURIType)expectedValues[5]).getValue() + "\"";
- assertEquals("expected propogated action",
- expectedAction,
- soapAction.get(0));
+ String expectedAction = "\"" + ((AttributedURIType)expectedValues[5]).getValue() + "\"";
+ assertEquals("expected propogated action", expectedAction, soapAction.get(0));
}
- private void verifyMessage(SoapMessage message,
- boolean requestor,
- boolean outbound,
+ private void verifyMessage(SoapMessage message, boolean requestor, boolean outbound,
boolean exposedAsNative) {
if (requestor) {
if (outbound) {
String id = expectedValues[0] instanceof AttributedURIType
- ? ((AttributedURIType)expectedValues[0]).getValue()
- : ((AttributedURI)expectedValues[0]).getValue();
- //assertTrue("expected correlationID : " + id + " in map: " + codec.uncorrelatedExchanges,
- // codec.uncorrelatedExchanges.containsKey(id));
- assertSame("unexpected correlated exchange",
- codec.uncorrelatedExchanges.get(id),
- message.getExchange());
+ ? ((AttributedURIType)expectedValues[0]).getValue()
+ : expectedValues[0] instanceof AttributedURI ? ((AttributedURI)expectedValues[0])
+ .getValue() : ((org.apache.cxf.ws.addressing.v200403.AttributedURI)expectedValues[0])
+ .getValue();
+ // assertTrue("expected correlationID : " + id + " in map: " +
+ // codec.uncorrelatedExchanges,
+ // codec.uncorrelatedExchanges.containsKey(id));
+ assertSame("unexpected correlated exchange", codec.uncorrelatedExchanges.get(id), message
+ .getExchange());
} else {
- assertSame("unexpected correlated exchange",
- correlatedExchange,
- message.getExchange());
+ assertSame("unexpected correlated exchange", correlatedExchange, message.getExchange());
}
}
if (outbound) {
- int expectedMarshals = requestor
- ? expectedValues.length - 1
- : expectedValues.length;
+ int expectedMarshals = requestor ? expectedValues.length - 1 : expectedValues.length;
List<Header> headers = message.getHeaders();
- assertTrue("expected holders added to header list",
- headers.size() >= expectedMarshals);
+ assertTrue("expected holders added to header list", headers.size() >= expectedMarshals);
for (int i = 0; i < expectedMarshals; i++) {
- assertTrue("expected " + expectedNames[i] + " added to headers",
- message.hasHeader(expectedNames[i]));
+ assertTrue("expected " + expectedNames[i] + " added to headers", message
+ .hasHeader(expectedNames[i]));
}
}
- assertTrue("unexpected MAPs",
- verifyMAPs(message.get(getMAPProperty(requestor, outbound))));
-
+ assertTrue("unexpected MAPs", verifyMAPs(message.get(getMAPProperty(requestor, outbound))));
+
}
}
-
-