cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r538108 - /incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
Date Tue, 15 May 2007 09:48:11 GMT
Author: eglynn
Date: Tue May 15 02:48:10 2007
New Revision: 538108

URL: http://svn.apache.org/viewvc?view=rev&rev=538108
Log:
Minor cleanup in MAPCodecTest.


Modified:
    incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java

Modified: incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?view=diff&rev=538108&r1=538107&r2=538108
==============================================================================
--- incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
(original)
+++ incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
Tue May 15 02:48:10 2007
@@ -249,8 +249,7 @@
                 return header;
             }
         });
-        List<Header> headers = new ArrayList<Header>(); 
-        message.put(Header.HEADER_LIST, headers);
+        List<Header> headers = message.getHeaders();
         JAXBContext jaxbContext = control.createMock(JAXBContext.class);
         ContextUtils.setJAXBContext(jaxbContext);
         VersionTransformer.Names200408.setJAXBContext(jaxbContext);
@@ -297,18 +296,20 @@
         header.getChildNodes();
         EasyMock.expectLastCall().andReturn(children);
         children.getLength();
-        EasyMock.expectLastCall().andReturn(1);
-        Element child = control.createMock(Element.class);
-        children.item(0);
-        EasyMock.expectLastCall().andReturn(child);
-        child.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
-                             EasyMock.eq("xmlns:" + Names.WSA_NAMESPACE_PREFIX),
-                             EasyMock.eq(maps.getNamespaceURI()));
-        EasyMock.expectLastCall();
-        child.getNamespaceURI();
-        EasyMock.expectLastCall().andReturn("bar");
-        child.getLocalName();
-        EasyMock.expectLastCall().andReturn("foo");
+        EasyMock.expectLastCall().andReturn(expectedMarshals).anyTimes();
+        for (int i = 0; i < expectedMarshals; i++) {
+            Element child = control.createMock(Element.class);
+            children.item(i);
+            EasyMock.expectLastCall().andReturn(child);
+            child.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
+                                 EasyMock.eq("xmlns:" + Names.WSA_NAMESPACE_PREFIX),
+                                 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);
@@ -644,6 +645,18 @@
                 assertSame("unexpected correlated exchange",
                            correlatedExchange,
                            message.getExchange());
+            }
+        }
+        if (outbound) {
+            int expectedMarshals = requestor 
+                                   ? expectedValues.length - 1
+                                   : expectedValues.length;
+            List<Header> headers = message.getHeaders();
+            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("unexpected MAPs",



Mime
View raw message