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 2012/08/16 20:11:53 UTC

svn commit: r1373966 - in /cxf/trunk: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/ rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/ systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/

Author: dkulp
Date: Thu Aug 16 18:11:52 2012
New Revision: 1373966

URL: http://svn.apache.org/viewvc?rev=1373966&view=rev
Log:
Update WS-Addressing encoding to not bounce the headers through a DOM
The ws-a headers can be written directly out to the output stream and thus take advantage of anything already set on the XMLStreamWriter (like namespaces)

Modified:
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.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
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=1373966&r1=1373965&r2=1373966&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Thu Aug 16 18:11:52 2012
@@ -32,7 +32,6 @@ import java.util.logging.Logger;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 
@@ -42,6 +41,7 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
@@ -52,6 +52,7 @@ import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
@@ -202,60 +203,51 @@ public class MAPCodec extends AbstractSo
                 List<Header> header = message.getHeaders();
                 discardMAPs(header, maps);
 
-                Element hdr = getHeaderFactory().getHeader(message.getVersion());                
                 JAXBContext jaxbContext = 
                     VersionTransformer.getExposedJAXBContext(
                                                      maps.getNamespaceURI());
-                Marshaller marshaller = jaxbContext.createMarshaller();
                 QName duplicate = maps.getDuplicate();
-                marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
                 encodeAsExposed(maps,
                                 message,
                                 maps.getAction(), 
                                 Names.WSA_ACTION_QNAME,
                                 AttributedURIType.class, 
-                                hdr, 
-                                marshaller);
+                                jaxbContext);
                 if (Names.WSA_ACTION_QNAME.equals(duplicate)) {
                     encodeAsExposed(maps,
                                     message,
                                     maps.getAction(), 
                                     Names.WSA_ACTION_QNAME,
                                     AttributedURIType.class, 
-                                    hdr, 
-                                    marshaller);
+                                    jaxbContext);
                 }
                 encodeAsExposed(maps,
                                 message,
                                 maps.getMessageID(), 
                                 Names.WSA_MESSAGEID_QNAME,
                                 AttributedURIType.class, 
-                                hdr, 
-                                marshaller);
+                                jaxbContext);
                 if (Names.WSA_MESSAGEID_QNAME.equals(duplicate)) {
                     encodeAsExposed(maps,
                                     message,
                                     maps.getMessageID(), 
                                     Names.WSA_MESSAGEID_QNAME,
                                     AttributedURIType.class, 
-                                    hdr, 
-                                    marshaller);
+                                    jaxbContext);
                 }
                 encodeAsExposed(maps,
                                 message,
                                 maps.getTo(), 
                                 Names.WSA_TO_QNAME,
                                 AttributedURIType.class,  
-                                hdr, 
-                                marshaller);
+                                jaxbContext);
                 if (Names.WSA_TO_QNAME.equals(duplicate)) {
                     encodeAsExposed(maps,
                                     message,
                                     maps.getTo(), 
                                     Names.WSA_TO_QNAME,
                                     AttributedURIType.class,  
-                                    hdr, 
-                                    marshaller);
+                                    jaxbContext);
                 }
                 if (needsReplyTo(maps)) {
                     encodeAsExposed(maps,
@@ -263,16 +255,14 @@ public class MAPCodec extends AbstractSo
                             maps.getReplyTo(), 
                             Names.WSA_REPLYTO_QNAME, 
                             EndpointReferenceType.class,
-                            hdr,
-                            marshaller);
+                            jaxbContext);
                     if (Names.WSA_REPLYTO_QNAME.equals(duplicate)) {
                         encodeAsExposed(maps,
                                         message,
                                         maps.getReplyTo(), 
                                         Names.WSA_REPLYTO_QNAME, 
                                         EndpointReferenceType.class,
-                                        hdr,
-                                        marshaller);
+                                        jaxbContext);
                     }
                 }
 
@@ -281,32 +271,28 @@ public class MAPCodec extends AbstractSo
                                 maps.getRelatesTo(),
                                 Names.WSA_RELATESTO_QNAME,
                                 RelatesToType.class,
-                                hdr,
-                                marshaller);
+                                jaxbContext);
                 if (Names.WSA_RELATESTO_QNAME.equals(duplicate)) {
                     encodeAsExposed(maps,
                                     message,
                                     maps.getRelatesTo(),
                                     Names.WSA_RELATESTO_QNAME,
                                     RelatesToType.class,
-                                    hdr,
-                                    marshaller);
+                                    jaxbContext);
                 }
                 encodeAsExposed(maps,
                                 message,
                                 maps.getFrom(), 
                                 Names.WSA_FROM_QNAME,
                                 EndpointReferenceType.class,  
-                                hdr, 
-                                marshaller);
+                                jaxbContext);
                 if (Names.WSA_FROM_QNAME.equals(duplicate)) {
                     encodeAsExposed(maps,
                                     message,
                                     maps.getFrom(), 
                                     Names.WSA_FROM_QNAME,
                                     EndpointReferenceType.class,  
-                                    hdr, 
-                                    marshaller);
+                                    jaxbContext);
                 }
                 if (needsFaultTo(maps)) {
                     encodeAsExposed(maps,
@@ -314,30 +300,18 @@ public class MAPCodec extends AbstractSo
                                     maps.getFaultTo(), 
                                     Names.WSA_FAULTTO_QNAME, 
                                     EndpointReferenceType.class,
-                                    hdr,
-                                    marshaller);
+                                    jaxbContext);
                     if (Names.WSA_FAULTTO_QNAME.equals(duplicate)) {
                         encodeAsExposed(maps,
                                         message,
                                         maps.getFaultTo(), 
                                         Names.WSA_FAULTTO_QNAME, 
                                         EndpointReferenceType.class,
-                                        hdr,
-                                        marshaller);
+                                        jaxbContext);
                     }
                 }
-                encodeReferenceParameters(maps, hdr, marshaller);
+                encodeReferenceParameters(maps, message, jaxbContext);
                 
-                Node childNode = hdr.getFirstChild();
-                
-                while (childNode != null) {
-                    Header holder = new Header(
-                                               new QName(childNode.getNamespaceURI(), 
-                                                         childNode.getLocalName()), 
-                                                         childNode);
-                    header.add(holder);
-                    childNode = childNode.getNextSibling();
-                }
                 maps.setDuplicate(null);
                 
                 propogateAction(maps.getAction(), message);
@@ -365,14 +339,20 @@ public class MAPCodec extends AbstractSo
                 .equals(maps.getReplyTo().getAddress().getValue());
     }
 
-    private void encodeReferenceParameters(AddressingProperties maps, Element header, 
-                                           Marshaller marshaller) throws JAXBException {
+    private void encodeReferenceParameters(AddressingProperties maps,
+                                           SoapMessage msg, 
+                                           JAXBContext ctx) throws JAXBException {
+        Element header =  null;
+
         EndpointReferenceType toEpr = maps.getToEndpointReference();
         if (null != toEpr) {
             ReferenceParametersType params = toEpr.getReferenceParameters();
             if (null != params) {
                 for (Object o : params.getAny()) {
                     if (o instanceof Element || o instanceof JAXBElement) {
+                        if (header == null) {
+                            header = getHeaderFactory().getHeader(msg.getVersion());                
+                        }
                         JAXBElement<?> jaxbEl = null;
                         if (o instanceof Element) {
                             Element e = (Element)o;
@@ -380,11 +360,18 @@ public class MAPCodec extends AbstractSo
                             header.appendChild(importedNode);                            
                         } else {
                             jaxbEl = (JAXBElement<?>) o;
-                            marshaller.marshal(jaxbEl, header);
+                            ctx.createMarshaller().marshal(jaxbEl, header);
                         }
                                                
                         Element lastAdded = (Element)header.getLastChild();
+                        header.removeChild(lastAdded);
                         addIsReferenceParameterMarkerAttribute(lastAdded, maps.getNamespaceURI());
+                        
+                        
+                        Header holder = new Header(new QName(lastAdded.getNamespaceURI(), 
+                                                             lastAdded.getLocalName()),
+                                                             lastAdded);
+                        msg.getHeaders().add(holder);
                     } else {
                         LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
                     }
@@ -423,35 +410,6 @@ public class MAPCodec extends AbstractSo
         isRefParamAttr.setTextContent("1");
         lastAdded.setAttributeNodeNS(isRefParamAttr);
     }
-
-    private void addMustUnderstandAttribute(Element header,
-                                            QName name,
-                                            SoapMessage msg,
-                                            AddressingProperties maps) {
-        if (maps.getMustUnderstand().contains(name)) {
-            Element lastAdded = (Element)header.getLastChild();
-            String pfx = lastAdded.lookupPrefix(msg.getVersion().getNamespace());
-            if (StringUtils.isEmpty(pfx)) {
-                pfx = "soap";
-            }
-            if (msg.hasAdditionalEnvNs()) {
-                String ns = msg.getVersion().getNamespace();
-                Map<String, String> nsMap = msg.getEnvelopeNs();
-                for (Map.Entry<String, String> entry : nsMap.entrySet()) {
-                    if (ns.equals(entry.getValue())) {
-                        pfx = entry.getKey();
-                    }
-                }
-            }
-            
-            Attr mustUnderstandAttr = 
-                lastAdded.getOwnerDocument().createAttributeNS(
-                    msg.getVersion().getNamespace(),
-                    pfx + ":mustUnderstand");
-            mustUnderstandAttr.setTextContent("1");
-            lastAdded.setAttributeNodeNS(mustUnderstandAttr);
-        }
-    }
     
     /**
      * Encode message in exposed version.
@@ -462,30 +420,29 @@ public class MAPCodec extends AbstractSo
      * @param name the QName for the header 
      * @param clz the class
      * @param header the SOAP header element
-     * @param marshaller the JAXB marshaller to use
+     * @param JAXBContext the JAXB context to use
      */
     private <T> void encodeAsExposed(AddressingProperties maps,
                                      SoapMessage message,
                                      T value,
                                      QName name,
                                      Class<T> clz,
-                                     Element header,
-                                     Marshaller marshaller) throws JAXBException {
+                                     JAXBContext context) throws JAXBException {
         if (value != null) {
             LOG.log(Level.FINE,
                     "{0} : {1}",
                     new Object[] {name.getLocalPart(), getLogText(value)});
-            transformer.encodeAsExposed(maps.getNamespaceURI(),
+            
+            boolean mu = maps.getMustUnderstand().contains(name);
+                
+            transformer.encodeAsExposed(message,
+                                        maps.getNamespaceURI(),
                                         value,
                                         name.getLocalPart(),
                                         clz,
-                                        header,
-                                        marshaller);
+                                        context,
+                                        mu);
         }
-        addMustUnderstandAttribute(header,
-                                   name,
-                                   message,
-                                   maps);
     }
     
     /**
@@ -698,20 +655,23 @@ public class MAPCodec extends AbstractSo
     /**
      * Encodes an MAP as a SOAP header.
      *
+     * @param message the message to store the headers on
      * @param value the value to encode
      * @param qname the QName for the header 
      * @param clz the class
      * @param header the SOAP header element
-     * @param marshaller the JAXB marshaller to use
+     * @param marshaller the JAXB context to use
      */
-    protected <T> void encodeMAP(T value,
+    protected <T> void encodeMAP(SoapMessage message,
+                                 T value,
                                  QName qname,
                                  Class<T> clz,
-                                 Element header,
-                                 Marshaller marshaller) throws JAXBException {
-        if (value != null) {
-            marshaller.marshal(new JAXBElement<T>(qname, clz, value), header);
-        }
+                                 JAXBContext ctx,
+                                 boolean mustUnderstand) throws JAXBException {
+        SoapHeader h = new SoapHeader(qname, new JAXBElement<T>(qname, clz, value),
+                                      new JAXBDataBinding(ctx));
+        h.setMustUnderstand(mustUnderstand);
+        message.getHeaders().add(h);
     }
 
     /**

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=1373966&r1=1373965&r2=1373966&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 16 18:11:52 2012
@@ -24,12 +24,14 @@ import java.util.HashSet;
 import java.util.Set;
 import java.util.logging.Logger;
 
+import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
+
+import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -76,38 +78,48 @@ public class VersionTransformer extends 
      * @param localName the localName for the header
      * @param clz the class
      * @param header the SOAP header element
-     * @param marshaller the JAXB marshaller to use
+     * @param marshaller the JAXB context 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(SoapMessage message,
+                                    String exposeAs, T value,
+                                    String localName, Class<T> clz,
+                                    JAXBContext marshaller,
+                                    boolean mustUnderstand) throws JAXBException {
         if (value != null) {
             if (NATIVE_VERSION.equals(exposeAs)) {
-                codec.encodeMAP(value, new QName(exposeAs, localName), clz, header, marshaller);
+                codec.encodeMAP(message, value, new QName(exposeAs, localName), clz,
+                                marshaller, mustUnderstand);
             } 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(message,
+                                    convert((AttributedURIType)value), new QName(exposeAs, localName),
+                                    AttributedURI.class, marshaller, mustUnderstand);
                 } else if (EndpointReferenceType.class.equals(clz)) {
-                    codec.encodeMAP(convert((EndpointReferenceType)value), new QName(exposeAs, localName),
-                                    Names200408.EPR_TYPE, header, marshaller);
+                    codec.encodeMAP(message,
+                                    convert((EndpointReferenceType)value), new QName(exposeAs, localName),
+                                    Names200408.EPR_TYPE, marshaller, mustUnderstand);
                 } else if (RelatesToType.class.equals(clz)) {
-                    codec.encodeMAP(convert((RelatesToType)value), new QName(exposeAs, localName),
-                                    Relationship.class, header, marshaller);
+                    codec.encodeMAP(message,
+                                    convert((RelatesToType)value), new QName(exposeAs, localName),
+                                    Relationship.class, marshaller, mustUnderstand);
                 }
             } else if (Names200403.WSA_NAMESPACE_NAME.equals(exposeAs)) {
                 if (AttributedURIType.class.equals(clz)) {
-                    codec.encodeMAP(convertTo200403((AttributedURIType)value),
+                    codec.encodeMAP(message,
+                                    convertTo200403((AttributedURIType)value),
                                     new QName(exposeAs, localName),
-                                    org.apache.cxf.ws.addressing.v200403.AttributedURI.class, header,
-                                    marshaller);
+                                    org.apache.cxf.ws.addressing.v200403.AttributedURI.class, 
+                                    marshaller, mustUnderstand);
                 } else if (EndpointReferenceType.class.equals(clz)) {
-                    codec.encodeMAP(convertTo200403((EndpointReferenceType)value), new QName(exposeAs,
+                    codec.encodeMAP(message,
+                                    convertTo200403((EndpointReferenceType)value), new QName(exposeAs,
                                                                                              localName),
-                                    Names200403.EPR_TYPE, header, marshaller);
+                                    Names200403.EPR_TYPE, marshaller, mustUnderstand);
                 } else if (RelatesToType.class.equals(clz)) {
-                    codec.encodeMAP(convertTo200403((RelatesToType)value), new QName(exposeAs, localName),
-                                    org.apache.cxf.ws.addressing.v200403.Relationship.class, header,
-                                    marshaller);
+                    codec.encodeMAP(message,
+                                    convertTo200403((RelatesToType)value), new QName(exposeAs, localName),
+                                    org.apache.cxf.ws.addressing.v200403.Relationship.class,
+                                    marshaller, mustUnderstand);
                 }
             }
         }

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=1373966&r1=1373965&r2=1373966&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 16 18:11:52 2012
@@ -27,12 +27,10 @@ import java.util.Set;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapFault;
@@ -53,7 +51,6 @@ import org.apache.cxf.ws.addressing.v200
 import org.apache.cxf.ws.addressing.v200408.Relationship;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.EasyMock;
-import org.easymock.IArgumentMatcher;
 import org.easymock.IMocksControl;
 import org.junit.After;
 import org.junit.Assert;
@@ -72,9 +69,7 @@ public class MAPCodecTest extends Assert
     private MAPCodec codec;
     private IMocksControl control;
     private QName[] expectedNames;
-    private Class<?>[] expectedDeclaredTypes;
     private Object[] expectedValues;
-    private int expectedIndex;
     private String expectedNamespaceURI;
     private Map<String, List<String>> mimeHeaders;
     private Exchange correlatedExchange;
@@ -91,9 +86,7 @@ public class MAPCodecTest extends Assert
     @After
     public void tearDown() throws Exception {
         expectedNames = null;
-        expectedDeclaredTypes = null;
         expectedValues = null;
-        expectedIndex = 0;
         expectedNamespaceURI = null;
         mimeHeaders = null;
         correlatedExchange = null;
@@ -331,43 +324,7 @@ public class MAPCodecTest extends Assert
                              AddressingPropertiesImpl maps, String mapProperty, boolean invalidMAP,
                              boolean preExistingSOAPAction) throws Exception {
         message.put(mapProperty, maps);
-        Marshaller marshaller = control.createMock(Marshaller.class);
-        ContextUtils.getJAXBContext().createMarshaller();
-        EasyMock.expectLastCall().andReturn(marshaller);
-        marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
-        EasyMock.expectLastCall();
-        IArgumentMatcher matcher = new JAXBEltMatcher();
-        int len = expectFaultTo ? expectedValues.length : expectedValues.length - 1;
-        for (int i = 0; i < len; i++) {
-            if (!requestor || i != 4) {
-                EasyMock.reportMatcher(matcher);
-                EasyMock.eq(header);
-                marshaller.marshal(null, header);
-                EasyMock.expectLastCall();
-            }
-        }
-        
-        Node child = control.createMock(Node.class);
-        header.getFirstChild();
-        EasyMock.expectLastCall().andReturn(child);
-        
-        int i = 0;
-        while (child != null) {
-            if (requestor && i == 4) {
-                i++;
-            }
-            child.getNamespaceURI();
-            EasyMock.expectLastCall().andReturn(expectedNames[i].getNamespaceURI());
-            child.getLocalName();
-            EasyMock.expectLastCall().andReturn(expectedNames[i].getLocalPart());
-
-            Node nextChild = ++i < len
-                             ? control.createMock(Node.class)
-                             : null;
-            child.getNextSibling();
-            EasyMock.expectLastCall().andReturn(nextChild);
-            child = nextChild;
-        }
+
 
         mimeHeaders = new HashMap<String, List<String>>();
         message.put(MIME_HEADERS, mimeHeaders);
@@ -501,12 +458,6 @@ public class MAPCodecTest extends Assert
             expectedValues = new Object[] {
                 action, id, to, replyTo, relatesTo, from, faultTo
             };
-            expectedDeclaredTypes = new Class<?>[] {
-                AttributedURIType.class, 
-                AttributedURIType.class, AttributedURIType.class, 
-                EndpointReferenceType.class, RelatesToType.class,
-                EndpointReferenceType.class, EndpointReferenceType.class 
-            };
         } else if (exposeAs200408) {
             expectedValues = new Object[] {
                 VersionTransformer.convert(action),
@@ -525,12 +476,6 @@ public class MAPCodecTest extends Assert
                 VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[5]).getAddress()
                     .setValue(Names.WSA_ANONYMOUS_ADDRESS);
             }
-            expectedDeclaredTypes = new Class<?>[] {
-                AttributedURI.class, AttributedURI.class, AttributedURI.class,
-                VersionTransformer.Names200408.EPR_TYPE, Relationship.class,
-                VersionTransformer.Names200408.EPR_TYPE, 
-                VersionTransformer.Names200408.EPR_TYPE
-            };
         } else if (exposeAs200403) {
             expectedValues = new Object[] {
                 VersionTransformer.convertTo200403(action),
@@ -549,83 +494,12 @@ public class MAPCodecTest extends Assert
                 VersionTransformer.Names200403.EPR_TYPE.cast(expectedValues[5]).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,
-                org.apache.cxf.ws.addressing.v200403.AttributedURI.class,
-                VersionTransformer.Names200403.EPR_TYPE,
-                org.apache.cxf.ws.addressing.v200403.Relationship.class,
-                VersionTransformer.Names200403.EPR_TYPE,
-                VersionTransformer.Names200403.EPR_TYPE
-            };
         } else {
             fail("unexpected namespace URI: " + uri);
         }
         return maps;
     }
 
-    private final class JAXBEltMatcher implements IArgumentMatcher {
-        public boolean matches(Object obj) {
-            if (expectedIndex == 4 && !expectRelatesTo) {
-                expectedIndex++;
-            }
-            QName name = expectedNames[expectedIndex];
-            Class<?> declaredType = expectedDeclaredTypes[expectedIndex];
-            Object value = expectedValues[expectedIndex];
-            boolean ret = false;
-            expectedIndex++;
-            if (obj instanceof JAXBElement) {
-                JAXBElement<?> other = (JAXBElement<?>)obj;
-                ret = name.equals(other.getName()) && declaredType.isAssignableFrom(other.getDeclaredType())
-                      && compare(value, other.getValue());
-            }
-            return ret;
-        }
-
-        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
-                      && 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());
-            } 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;
-        }
-    }
-
     private boolean verifyMAPs(Object obj) {
         if (obj instanceof AddressingPropertiesImpl) {
             AddressingPropertiesImpl other = (AddressingPropertiesImpl)obj;

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java?rev=1373966&r1=1373965&r2=1373966&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java Thu Aug 16 18:11:52 2012
@@ -156,6 +156,19 @@ public class HeaderVerifier extends Abst
                         }
                     }
                 }
+            } else if (obj instanceof JAXBElement) {
+                JAXBElement<?> el = (JAXBElement<?>)obj;
+                if (namespaceURI.equals(el.getName().getNamespaceURI())) {
+                    if (namespaceURI.endsWith("addressing")) {
+                        currentNamespaceURI = namespaceURI;
+                        wsaHeaders.add(el.getName().getLocalPart());
+                    } else if (MAPTestBase.CUSTOMER_NAME.getNamespaceURI().equals(namespaceURI)) {
+                        String headerText = (String)el.getValue();
+                        if (MAPTestBase.CUSTOMER_KEY.equals(headerText)) {
+                            wsaHeaders.add(el.getName().getLocalPart());
+                        }
+                    }
+                }
             }
             
         }