cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r449679 [2/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache/cxf/transport/ rt/core/src/main/java/org/a...
Date Mon, 25 Sep 2006 13:26:05 GMT
Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?view=diff&rev=449679&r1=449678&r2=449679
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java Mon Sep 25 06:26:03 2006
@@ -29,13 +29,14 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
-import static javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -43,15 +44,14 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
-import org.easymock.IArgumentMatcher;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 
 
 import static org.apache.cxf.binding.soap.Soap11.SOAP_NAMESPACE;
-import static org.apache.cxf.message.Message.ONEWAY_MESSAGE;
 import static org.apache.cxf.message.Message.REQUESTOR_ROLE;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
 import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND;
@@ -84,6 +84,7 @@
         Message message = setUpMessage(true, true, false, true, true);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
     
     public void testRequestorOutboundUsingAddressingMAPsInContextZeroLengthAction() 
@@ -91,6 +92,7 @@
         Message message = setUpMessage(true, true, false, true, true, true);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundUsingAddressingMAPsInContextFault() 
@@ -98,6 +100,7 @@
         Message message = setUpMessage(true, true, false, true, true);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundUsingAddressingNoMAPsInContext() 
@@ -105,6 +108,7 @@
         Message message = setUpMessage(true, true, false, true, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
     
     public void testRequestorOutboundUsingAddressingNoMAPsInContextFault() 
@@ -112,12 +116,14 @@
         Message message = setUpMessage(true, true, false, true, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundNotUsingAddressing() throws Exception {
         Message message = setUpMessage(true, true, false, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, false);
     }
 
     public void testRequestorOutboundNotUsingAddressingFault() 
@@ -125,6 +131,7 @@
         Message message = setUpMessage(true, true, false, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, false);
     }
 
     public void testRequestorOutboundOnewayUsingAddressingMAPsInContext() 
@@ -132,6 +139,7 @@
         Message message = setUpMessage(true, true, true, true, true);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundOnewayUsingAddressingMAPsInContextFault() 
@@ -139,6 +147,7 @@
         Message message = setUpMessage(true, true, true, true, true);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundOnewayUsingAddressingNoMAPsInContext() 
@@ -146,6 +155,7 @@
         Message message = setUpMessage(true, true, true, true, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundOnewayUsingAddressingNoMAPsInContextFault() 
@@ -153,25 +163,30 @@
         Message message = setUpMessage(true, true, true, true, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, true);
     }
 
     public void testRequestorOutboundOnewayNotUsingAddressing() throws Exception {
         Message message = setUpMessage(true, true, true, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, true, false);
     }
+    
 
     public void testRequestorOutboundOnewayNotUsingAddressingFault() 
         throws Exception {
         Message message = setUpMessage(true, true, true, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, true, false);
     }
 
     public void testResponderInboundValidMAPs() throws Exception {
         Message message = setUpMessage(false, false, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, false, false);
     }
     
     public void testResponderInboundDecoupled() throws Exception {
@@ -179,6 +194,7 @@
             setUpMessage(false, false, false, true, false, true);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, false, true);
     }
     
     public void testResponderInboundOneway() throws Exception {
@@ -186,12 +202,14 @@
             setUpMessage(false, false, true, true, false, true);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, false, true);
     }
 
     public void testResponderInboundValidMAPsFault() throws Exception {
         Message message = setUpMessage(false, false, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, false, false, true);
     }
 
     public void testResponderInboundInvalidMAPs() throws Exception {
@@ -199,6 +217,7 @@
         Message message = setUpMessage(false, false, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, false, false /*check*/);
     }
 
     public void testResponderInboundInvalidMAPsFault() throws Exception {
@@ -206,12 +225,14 @@
         Message message = setUpMessage(false, false, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, false, false, false /*check*/);
     }
 
     public void testResponderOutbound() throws Exception {
         Message message = setUpMessage(false, true, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, true, true);
     }
     
     public void testResponderOutboundZeroLengthAction() throws Exception {
@@ -219,6 +240,7 @@
             setUpMessage(false, true, false, false, false, false, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, false, true, true);
     }
 
     public void testResponderOutboundFault() throws Exception {
@@ -232,18 +254,21 @@
                                                       true});
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, false, true, true);
     }
 
     public void testRequestorInbound() throws Exception {
-        Message message = setUpMessage(true, true, false);
+        Message message = setUpMessage(true, false, false);
         aggregator.handleMessage(message);
         control.verify();
+        verifyMessage(message, true, false, false /*check*/);
     }
 
     public void testRequestorInboundFault() throws Exception {
-        Message message = setUpMessage(true, true, false);
+        Message message = setUpMessage(true, false, false);
         aggregator.handleFault(message);
         control.verify();
+        verifyMessage(message, true, false, false /*check*/);
     }
 
     private Message setUpMessage(boolean requestor, 
@@ -330,13 +355,17 @@
         boolean decoupled = params[5];
         boolean zeroLengthAction = params[6];
         boolean fault = params[7];
-        Message message = control.createMock(Message.class);
-        message.get(MESSAGE_OUTBOUND_PROPERTY);
-        EasyMock.expectLastCall().andReturn(Boolean.valueOf(outbound));
-        message.get(REQUESTOR_ROLE);
-        EasyMock.expectLastCall().andReturn(Boolean.valueOf(requestor));
-        Exchange exchange = control.createMock(Exchange.class);
+        
+        Message message = getMessage();        
+        Exchange exchange = getExchange();
+        setUpOutbound(message, exchange, outbound);
+        setUpMessageProperty(message,
+                             REQUESTOR_ROLE,
+                             Boolean.valueOf(requestor));
         if (outbound && requestor) {
+            if (usingAddressing) {
+                setUpConduit(message, exchange);
+            }
             setUpUsingAddressing(message, exchange, usingAddressing);
             if (usingAddressing) {
                 setUpRequestor(message,
@@ -362,11 +391,9 @@
     private void setUpUsingAddressing(Message message,
                                       Exchange exchange,
                                       boolean usingAddressing) {
-        message.getExchange();
-        EasyMock.expectLastCall().andReturn(exchange);
+        setUpMessageExchange(message, exchange);
         Endpoint endpoint = control.createMock(Endpoint.class);
-        exchange.get(Endpoint.class);
-        EasyMock.expectLastCall().andReturn(endpoint);
+        setUpExchangeGet(exchange, Endpoint.class, endpoint);
         EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
         endpoint.getEndpointInfo();
         EasyMock.expectLastCall().andReturn(endpointInfo);
@@ -402,39 +429,43 @@
                                 boolean mapsInContext,
                                 boolean decoupled,
                                 boolean zeroLengthAction) throws Exception {
-        message.get(REQUESTOR_ROLE);
-        EasyMock.expectLastCall().andReturn(Boolean.TRUE);
+        setUpMessageProperty(message,
+                             REQUESTOR_ROLE,
+                             Boolean.valueOf(Boolean.TRUE));
         AddressingPropertiesImpl maps = mapsInContext 
                                         ? new AddressingPropertiesImpl()
                                         : null;
         if (zeroLengthAction) {
             maps.setAction(ContextUtils.getAttributedURI(""));
         }
-        message.get(CLIENT_ADDRESSING_PROPERTIES);
-        EasyMock.expectLastCall().andReturn(maps);
+        setUpMessageProperty(message,
+                                CLIENT_ADDRESSING_PROPERTIES,
+                                maps);
         Method method = SEI.class.getMethod("op", new Class[0]);
         if (!zeroLengthAction) {
             setUpMethod(message, exchange, method);
-            message.get(REQUESTOR_ROLE);
-            EasyMock.expectLastCall().andReturn(Boolean.TRUE);
+            setUpMessageProperty(message,
+                                    REQUESTOR_ROLE,
+                                    Boolean.TRUE);
             expectedAction = "http://foo/bar/SEI/opRequest";
         }
-        message.get(REQUESTOR_ROLE);
-        EasyMock.expectLastCall().andReturn(Boolean.TRUE);
-        message.get(ONEWAY_MESSAGE);
-        EasyMock.expectLastCall().andReturn(Boolean.valueOf(oneway));
-        EasyMock.eq(CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+        setUpMessageProperty(message,
+                                REQUESTOR_ROLE,
+                                Boolean.TRUE);
+        setUpOneway(message, exchange, oneway);
         expectedMAPs = maps;
         expectedTo = Names.WSA_NONE_ADDRESS;
         expectedReplyTo = oneway 
                           ? Names.WSA_NONE_ADDRESS
                           : Names.WSA_ANONYMOUS_ADDRESS;
-        EasyMock.reportMatcher(new MAPMatcher());
-        message.put(CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
-                    mapsInContext
-                    ? maps
-                    : new AddressingPropertiesImpl());
-        EasyMock.expectLastCall().andReturn(null);
+        // Now verified via verifyMessage()
+        //EasyMock.eq(CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+        //EasyMock.reportMatcher(new MAPMatcher());
+        //message.put(CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
+        //            mapsInContext
+        //            ? maps
+        //            : new AddressingPropertiesImpl());
+        //EasyMock.expectLastCall().andReturn(null);
     }
 
     private void setUpResponder(Message message,
@@ -444,8 +475,9 @@
                                 boolean decoupled,
                                 boolean zeroLengthAction,
                                 boolean fault) throws Exception {
-        message.get(REQUESTOR_ROLE);
-        EasyMock.expectLastCall().andReturn(Boolean.FALSE);
+        setUpMessageProperty(message,
+                             REQUESTOR_ROLE,
+                             Boolean.FALSE);
         AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
         EndpointReferenceType replyTo = new EndpointReferenceType();
         replyTo.setAddress(
@@ -465,48 +497,64 @@
         if (zeroLengthAction) {
             maps.setAction(ContextUtils.getAttributedURI(""));
         }
-        message.get(SERVER_ADDRESSING_PROPERTIES_INBOUND);
-        EasyMock.expectLastCall().andReturn(maps);
-        
-        if (!outbound && (oneway || decoupled)) {
-            message.get(ONEWAY_MESSAGE);
-            EasyMock.expectLastCall().andReturn(Boolean.valueOf(oneway));
-            setUpRebase(message);
+        setUpMessageProperty(message,
+                             SERVER_ADDRESSING_PROPERTIES_INBOUND,
+                             maps);
+        if (!outbound) {
+            setUpOneway(message, exchange, oneway);
+            if (oneway || decoupled) {
+                setUpRebase(message, exchange);
+            }
         }
         if (outbound || aggregator.messageIDs.size() > 0) {
             if (!zeroLengthAction) {
                 Method method = SEI.class.getMethod("op", new Class[0]);
                 setUpMethod(message, exchange, method);
-                message.get(REQUESTOR_ROLE);
-                EasyMock.expectLastCall().andReturn(Boolean.FALSE);
+                setUpMessageProperty(message,
+                                     REQUESTOR_ROLE,
+                                     Boolean.FALSE);
                 expectedAction = "http://foo/bar/SEI/opResponse";
             }
-            message.get(REQUESTOR_ROLE);
-            EasyMock.expectLastCall().andReturn(Boolean.FALSE);
-            message.get(SERVER_ADDRESSING_PROPERTIES_INBOUND);
-            EasyMock.expectLastCall().andReturn(maps);
+            setUpMessageProperty(message,
+                                 REQUESTOR_ROLE,
+                                 Boolean.FALSE);
+            setUpMessageProperty(message,
+                                 SERVER_ADDRESSING_PROPERTIES_INBOUND,
+                                 maps);            
             if (fault) {
                 // REVISIT test double rebase does not occur
-                setUpRebase(message);
+                setUpRebase(message, exchange);
             }
-            EasyMock.eq(SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
             expectedTo = decoupled
                          ? "http://localhost:9999/decoupled"
                          : Names.WSA_ANONYMOUS_ADDRESS;
             expectedRelatesTo = maps.getMessageID().getValue();
-            EasyMock.reportMatcher(new MAPMatcher());
-            message.put(SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
-                        new AddressingPropertiesImpl());
-            EasyMock.expectLastCall().andReturn(null);
+            // Now verified via verifyMessage()
+            //EasyMock.eq(SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+            //EasyMock.reportMatcher(new MAPMatcher());
+            //message.put(SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
+            //            new AddressingPropertiesImpl());
+            //EasyMock.expectLastCall().andReturn(null);
         }
     }
     
-    private void setUpRebase(Message message) throws Exception {
-        message.get("org.apache.cxf.ws.addressing.partial.response.sent");
-        EasyMock.expectLastCall().andReturn(Boolean.FALSE);
+    private void setUpRebase(Message message, Exchange exchange)
+        throws Exception {
+        setUpMessageProperty(message,
+                             "org.apache.cxf.ws.addressing.partial.response.sent",
+                             Boolean.FALSE);
+        Endpoint endpoint = control.createMock(Endpoint.class);
+        exchange.get(Endpoint.class);
+        EasyMock.expectLastCall().andReturn(endpoint);
+        Binding binding = control.createMock(Binding.class);
+        endpoint.getBinding();        
+        EasyMock.expectLastCall().andReturn(binding);
+        Message partialResponse = getMessage();
+        binding.createMessage();
+        EasyMock.expectLastCall().andReturn(partialResponse);
+
         Destination target = control.createMock(Destination.class);
-        message.getDestination();
-        EasyMock.expectLastCall().andReturn(target);
+        setUpMessageDestination(message, target);
         Conduit backChannel = control.createMock(Conduit.class);
         target.getBackChannel(EasyMock.eq(message),
                               EasyMock.isA(Message.class),
@@ -515,14 +563,33 @@
         // REVISIT test interceptor chain setup & send
     }
 
+    private void setUpOneway(Message message, Exchange exchange, boolean oneway) {
+        setUpMessageExchange(message, exchange);
+        setUpExchangeOneway(exchange, oneway);
+    }
+
+    private void setUpOutbound(Message message, Exchange exchange, boolean outbound) {
+        setUpMessageExchange(message, exchange);
+        setUpExchangeOutbound(exchange, message, outbound);
+    }
+
+    private void setUpConduit(Message message, Exchange exchange) {
+        setUpMessageExchange(message, exchange);        
+        Conduit conduit = EasyMock.createMock(Conduit.class);
+        setUpExchangeConduit(exchange, conduit);
+        EndpointReferenceType to =
+            ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
+        to.setAddress(ContextUtils.getAttributedURI(expectedTo));
+        conduit.getTarget();
+        EasyMock.expectLastCall().andReturn(to);
+    }
+    
     private void setUpMethod(Message message, Exchange exchange, Method method) {
-        message.getExchange();
-        EasyMock.expectLastCall().andReturn(exchange);
+        setUpMessageExchange(message, exchange);        
         OperationInfo opInfo = new OperationInfo(); 
         opInfo.setProperty(Method.class.getName(), method);
         BindingOperationInfo bindingOpInfo = new TestBindingOperationInfo(opInfo);
-        exchange.get(BindingOperationInfo.class);
-        EasyMock.expectLastCall().andReturn(bindingOpInfo);
+        setUpExchangeGet(exchange, BindingOperationInfo.class, bindingOpInfo);
         // Usual fun with EasyMock not always working as expected
         //BindingOperationInfo bindingOpInfo =
         //    EasyMock.createMock(BindingOperationInfo.class); 
@@ -532,48 +599,117 @@
         //opInfo.getProperty(EasyMock.eq(Method.class.getName()));
         //EasyMock.expectLastCall().andReturn(method);
     }
+    
+    private Message getMessage() {
+        //return control.createMock(Message.class);
+        return new MessageImpl();
+    }
 
-    private final class MAPMatcher implements IArgumentMatcher {
-        public boolean matches(Object obj) {
-            if (obj instanceof AddressingPropertiesImpl) {
-                AddressingPropertiesImpl other = (AddressingPropertiesImpl)obj;
-                return compareExpected(other);
-            }
-            return false;
-        }    
+    private Exchange getExchange() {
+        Exchange exchange = control.createMock(Exchange.class);
+        //Exchange exchange = new ExchangeImpl();
+        return exchange;
+    }
+    
+    private void setUpMessageProperty(Message message, String key, Object value) {
+        //message.get(key);
+        //EasyMock.expectLastCall().andReturn(value);
+        message.put(key, value);
+    }
+
+    private void setUpMessageExchange(Message message, Exchange exchange) {
+        //message.getExchange();
+        //EasyMock.expectLastCall().andReturn(exchange);
+        message.setExchange(exchange);
+    }
+    
+    private void setUpMessageDestination(Message message, Destination target) {
+        //message.getDestination();
+        //EasyMock.expectLastCall().andReturn(target);
+        ((MessageImpl)message).setDestination(target);    
+    }
 
-        public void appendTo(StringBuffer buffer) {
-            buffer.append("MAPs did not match");
+    private <T> void setUpExchangeGet(Exchange exchange, Class<T> clz, T value) {
+        exchange.get(clz);
+        EasyMock.expectLastCall().andReturn(value);
+        //exchange.put(Endpoint.class, value);
+    }
+
+    private void setUpExchangeOneway(Exchange exchange, boolean oneway) {
+        exchange.isOneWay();
+        EasyMock.expectLastCall().andReturn(oneway);
+        //exchange.setOneWay(oneway);
+    }
+
+    private void setUpExchangeOutbound(Exchange exchange,
+                                       Message message,
+                                       boolean outbound) {
+        exchange.getOutMessage();
+        EasyMock.expectLastCall().andReturn(outbound ? message : null);
+        //exchange.setOutMessage(outbound ? message : new MessageImpl());
+    }
+
+    private void setUpExchangeConduit(Exchange exchange, Conduit conduit) {
+        exchange.getConduit();
+        EasyMock.expectLastCall().andReturn(conduit);
+        //exchange.setConduit(conduit);
+    }
+
+    private boolean verifyMAPs(Object obj) {
+        if (obj instanceof AddressingPropertiesImpl) {
+            AddressingPropertiesImpl other = (AddressingPropertiesImpl)obj;
+            return compareExpected(other);
         }
+        return false;
+    }    
 
-        private boolean compareExpected(AddressingPropertiesImpl other) {
-            boolean ret = false;
-            if (expectedMAPs == null || expectedMAPs == other) {
-                boolean toOK = 
-                    expectedTo == null 
-                    || expectedTo.equals(other.getTo().getValue());
-                boolean replyToOK = 
-                    expectedReplyTo == null 
-                    || expectedReplyTo.equals(
-                           other.getReplyTo().getAddress().getValue());
-                boolean relatesToOK =
-                    expectedRelatesTo == null 
-                    || expectedRelatesTo.equals(
-                           other.getRelatesTo().getValue());
-                boolean actionOK =
-                    expectedAction == null
-                    || expectedAction.equals(other.getAction().getValue());
-                boolean messageIdOK = other.getMessageID() != null;
-                ret = toOK 
-                      && replyToOK 
-                      && relatesToOK 
-                      && actionOK
-                      && messageIdOK;
-            }
-            return ret;
+    private boolean compareExpected(AddressingPropertiesImpl other) {
+        boolean ret = false;
+        if (expectedMAPs == null || expectedMAPs == other) {
+            boolean toOK = 
+                expectedTo == null 
+                || expectedTo.equals(other.getTo().getValue());
+            boolean replyToOK = 
+                expectedReplyTo == null 
+                || expectedReplyTo.equals(
+                       other.getReplyTo().getAddress().getValue());
+            boolean relatesToOK =
+                expectedRelatesTo == null 
+                || expectedRelatesTo.equals(
+                       other.getRelatesTo().getValue());
+            boolean actionOK =
+                expectedAction == null
+                || expectedAction.equals(other.getAction().getValue());
+            boolean messageIdOK = other.getMessageID() != null;
+            ret = toOK 
+                  && replyToOK 
+                  && relatesToOK 
+                  && actionOK
+                  && messageIdOK;
         }
-    } 
+        return ret;
+    }
     
+    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 void verifyMessage(Message message,
+                               boolean requestor,
+                               boolean outbound,
+                               boolean expectMapsInContext) {
+        if (expectMapsInContext) {
+            assertTrue("unexpected MAPs",
+                       verifyMAPs(message.get(getMAPProperty(requestor, outbound))));
+        } 
+    }
+
     private static interface SEI {
         @RequestWrapper(targetNamespace = "http://foo/bar", className = "SEI", localName = "opRequest")
         @ResponseWrapper(targetNamespace = "http://foo/bar", className = "SEI", localName = "opResponse")

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?view=diff&rev=449679&r1=449678&r2=449679
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java Mon Sep 25 06:26:03 2006
@@ -33,14 +33,15 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.soap.SOAPFaultException;
 
-import static javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY;
-
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 import junit.framework.TestCase;
 
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
 import org.apache.cxf.ws.addressing.AttributedURIType;
@@ -73,6 +74,8 @@
     private int expectedIndex;
     private String expectedNamespaceURI;
     private Map<String, List<String>> mimeHeaders;
+    private Exchange correlatedExchange;
+    private boolean expectRelatesTo;
 
     public void setUp() {
         codec = new MAPCodec();
@@ -86,6 +89,7 @@
         expectedIndex = 0;
         expectedNamespaceURI = null;
         mimeHeaders = null;
+        correlatedExchange = null;
     }
 
     public void testGetHeaders() throws Exception {
@@ -275,17 +279,19 @@
                                      String exposeAs) 
         throws Exception {
         SoapMessage message = new SoapMessage(new MessageImpl());
-        message.put(MESSAGE_OUTBOUND_PROPERTY, Boolean.valueOf(outbound));
+        setUpOutbound(message, outbound);
+        expectRelatesTo = (requestor && !outbound) || (!requestor && outbound);
         message.put(REQUESTOR_ROLE, Boolean.valueOf(requestor));
         String mapProperty = getMAPProperty(requestor, outbound);
-        AddressingPropertiesImpl maps = getMAPs(exposeAs, outbound);
+        AddressingPropertiesImpl maps = getMAPs(requestor, outbound, exposeAs);
         Element header = control.createMock(Element.class);
         message.setHeaders(Element.class, header);
         JAXBContext jaxbContext = control.createMock(JAXBContext.class);
         ContextUtils.setJAXBContext(jaxbContext);
         VersionTransformer.Names200408.setJAXBContext(jaxbContext);
         if (outbound) {
-            setUpEncode(message,
+            setUpEncode(requestor,
+                        message,
                         header,
                         maps,
                         mapProperty,
@@ -298,7 +304,8 @@
         return message;
     }
 
-    private void setUpEncode(SoapMessage message,
+    private void setUpEncode(boolean requestor,
+                             SoapMessage message,
                              Element header,
                              AddressingPropertiesImpl maps,
                              String mapProperty,
@@ -321,7 +328,10 @@
         marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
         EasyMock.expectLastCall();
         IArgumentMatcher matcher = new JAXBEltMatcher();
-        for (int i = 0; i < expectedValues.length; i++) {
+        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);
@@ -431,6 +441,12 @@
         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
@@ -442,7 +458,9 @@
                  : SERVER_ADDRESSING_PROPERTIES_INBOUND;
     }
 
-    private AddressingPropertiesImpl getMAPs(String uri, boolean outbound) {
+    private AddressingPropertiesImpl getMAPs(boolean requestor,
+                                             boolean outbound,
+                                             String uri) {
         AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
         boolean exposeAsNative = Names.WSA_NAMESPACE_NAME.equals(uri);
         boolean exposeAs200408 = 
@@ -469,9 +487,15 @@
         faultTo.setAddress(
             ContextUtils.getAttributedURI(anonymous));
         maps.setFaultTo(faultTo);
-        RelatesToType relatesTo = new RelatesToType(); 
-        relatesTo.setValue("urn:uuid:67890");
-        maps.setRelatesTo(relatesTo);
+        RelatesToType relatesTo = null;
+        if (expectRelatesTo) {
+            String correlationID = "urn:uuid:67890";
+            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");
         maps.setAction(action);
@@ -529,6 +553,9 @@
             Object value = expectedValues[expectedIndex];
             boolean ret = false;
             expectedIndex++;
+            if (expectedIndex == 5 && !expectRelatesTo) {
+                return true;
+            }
             if (obj instanceof JAXBElement) {
                 JAXBElement other = (JAXBElement)obj;
                 ret = name.equals(other.getName()) 
@@ -597,10 +624,6 @@
                 ? ((EndpointReferenceType)expectedValues[2]).getAddress().getValue()
                 : (VersionTransformer.Names200408.EPR_TYPE.cast(expectedValues[2])).
                     getAddress().getValue();
-            String expectedRelatesTo = 
-                exposedAsNative
-                ? ((RelatesToType)expectedValues[4]).getValue()
-                : ((Relationship)expectedValues[4]).getValue();
             String expectedAction =                    
                 exposedAsNative
                 ? ((AttributedURIType)expectedValues[5]).getValue()
@@ -609,10 +632,17 @@
             ret = expectedMessageID.equals(other.getMessageID().getValue())
                   && expectedTo.equals(other.getTo().getValue())
                   && expectedReplyTo.equals(
-                         other.getReplyTo().getAddress().getValue())
-                  && expectedRelatesTo.equals(other.getRelatesTo().getValue())
+                        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());
+            }
         } 
         return ret;
     }
@@ -632,13 +662,21 @@
                                boolean requestor,
                                boolean outbound,
                                boolean exposedAsNative) {
-        if (requestor && !outbound) {
-            String relatesTo = (String)message.get("org.apache.cxf.correlation.in");
-            assertEquals("unexpected relates to",
-                         exposedAsNative
-                         ? ((RelatesToType)expectedValues[4]).getValue()
-                         : ((Relationship)expectedValues[4]).getValue(),
-                         relatesTo);
+        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());
+            } else {
+                assertSame("unexpected correlated exchange",
+                           correlatedExchange,
+                           message.getExchange());
+            }
         }
         assertTrue("unexpected MAPs",
                    verifyMAPs(message.get(getMAPProperty(requestor, outbound))));

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java?view=diff&rev=449679&r1=449678&r2=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/ClientServerSetupBase.java Mon Sep 25 06:26:03 2006
@@ -52,4 +52,7 @@
         }
     } 
     
+    protected Bus getBus() {
+        return bus;
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/TestServerBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/TestServerBase.java?view=diff&rev=449679&r1=449678&r2=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/TestServerBase.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/common/TestServerBase.java Mon Sep 25 06:26:03 2006
@@ -38,4 +38,9 @@
         return bus; 
     }
     
+    public void setBus(Bus b) {
+        bus = b; 
+    }
+
+    
 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/GreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/GreeterImpl.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/GreeterImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/GreeterImpl.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+import java.util.concurrent.Future;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.hello_world_soap_http.types.BareDocumentResponse;
+import org.apache.hello_world_soap_http.types.ErrorCode;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
+import org.apache.hello_world_soap_http.types.GreetMeSometimeResponse;
+import org.apache.hello_world_soap_http.types.NoSuchCodeLit;
+import org.apache.hello_world_soap_http.types.SayHiResponse;
+import org.apache.hello_world_soap_http.types.TestDocLitFaultResponse;
+
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
+
+
+@WebService(serviceName = "SOAPServiceAddressing", 
+            portName = "SoapPort", 
+            endpointInterface = "org.apache.hello_world_soap_http.Greeter", 
+            targetNamespace = "http://apache.org/hello_world_soap_http")
+public class GreeterImpl implements Greeter {
+    VerificationCache verificationCache;
+
+    /**
+     * Injectable context.
+     */
+    @Resource
+    private WebServiceContext context;
+
+
+    public String greetMe(String me) {
+        System.out.println("\n\n*** GreetMe called with: " + me + "***\n\n");
+        verifyMAPs();
+        return "Hello " + me;
+    }
+
+    public void greetMeOneWay(String requestType) {   
+        System.out.println("\n\n*** GreetMeOneWay called with: " + requestType + "***\n\n");
+        verifyMAPs();
+    }
+
+    public String sayHi() {
+        verifyMAPs();
+        return "Bonjour";
+    }
+    
+    public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
+        verifyMAPs();
+        if (faultType.equals(BadRecordLitFault.class.getSimpleName())) {
+            throw new BadRecordLitFault("TestBadRecordLit", "BadRecordLitFault");
+        }
+        if (faultType.equals(NoSuchCodeLitFault.class.getSimpleName())) {
+            ErrorCode ec = new ErrorCode();
+            ec.setMajor((short)1);
+            ec.setMinor((short)1);
+            NoSuchCodeLit nscl = new NoSuchCodeLit();
+            nscl.setCode(ec);
+            throw new NoSuchCodeLitFault("TestNoSuchCodeLit", nscl);
+        }
+    }
+
+    public BareDocumentResponse testDocLitBare(String in) {
+        BareDocumentResponse res = new BareDocumentResponse();
+        res.setCompany("Celtix");
+        res.setId(1);
+        return res;
+    }
+
+    private void verifyMAPs() {
+        if (context.getMessageContext() != null) {
+            String property = SERVER_ADDRESSING_PROPERTIES_INBOUND;
+            AddressingProperties maps = (AddressingProperties)
+                context.getMessageContext().get(property);
+            verificationCache.put(MAPTest.verifyMAPs(maps, this));
+        }
+    }
+
+    public String greetMeSometime(String me) {
+        return "How are you " + me;
+    }
+    
+    public Future<?>  greetMeSometimeAsync(String requestType, 
+                                           AsyncHandler<GreetMeSometimeResponse> asyncHandler) { 
+        return null; 
+        /*not called */
+    }
+    
+    public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType) { 
+        return null; 
+        /*not called */
+    }
+    
+    public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType) {  
+        return null; 
+        /*not called */
+    }
+    
+    public Future<?> testDocLitFaultAsync(String faultType, AsyncHandler ah) {  
+        return null; 
+        /*not called */
+    }
+    
+    public Future<?> testDocLitBareAsync(String bare, AsyncHandler ah) {
+        return null;
+        /* not called */
+    }
+    
+    public Response<BareDocumentResponse> testDocLitBareAsync(String bare) {
+        return null;
+        /* not called */
+    }
+    
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) { 
+        return null; 
+        /*not called */
+    }
+    
+    public Response<GreetMeResponse> greetMeAsync(String requestType) { 
+        return null; 
+        /*not called */
+    }
+    
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) { 
+        return null; 
+        /*not called */
+    }
+    
+    public Response<SayHiResponse> sayHiAsync() { 
+        return null; 
+        /*not called */
+    }
+    
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/GreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,180 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.addressing.soap.VersionTransformer;
+import org.apache.cxf.ws.addressing.v200408.AttributedURI;
+
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND;
+
+
+/**
+ * Verifies presence of expected SOAP headers.
+ */
+public class HeaderVerifier extends AbstractSoapInterceptor {
+    VerificationCache verificationCache;
+    String currentNamespaceURI;
+    
+    public HeaderVerifier() {
+        super();
+        setPhase(Phase.POST_PROTOCOL);
+    }
+    
+    public Set<QName> getUnderstoodHeaders() {
+        return Names.HEADERS;
+    }
+
+    public void handleMessage(SoapMessage message) {
+        addPartialResponseHeader(message);
+        verify(message);
+    }
+
+    public void handleFault(SoapMessage message) {
+        verify(message);
+    }
+
+    private void addPartialResponseHeader(SoapMessage message) {
+        try {
+            // add piggybacked wsa:From header to partial response
+            if (isOutgoingPartialResponse(message)) {
+                Element header = message.getHeaders(Element.class);
+                marshallFrom("urn:piggyback_responder", header, getMarshaller());
+            }
+        } catch (Exception e) {
+            verificationCache.put("SOAP header addition failed: " + e);
+            e.printStackTrace();
+        }
+    }
+
+    private void verify(SoapMessage message) {
+        try {
+            List<String> wsaHeaders = new ArrayList<String>();
+            Element headers = message.getHeaders(Element.class);
+            if (headers != null) {
+                recordWSAHeaders(headers,
+                                 wsaHeaders,
+                                 Names.WSA_NAMESPACE_NAME);
+                recordWSAHeaders(headers,
+                                 wsaHeaders,
+                                 VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
+            }
+            boolean partialResponse = isIncomingPartialResponse(message)
+                                      || isOutgoingPartialResponse(message);
+            verificationCache.put(MAPTest.verifyHeaders(wsaHeaders, 
+                                                        partialResponse));
+        } catch (SOAPException se) {
+            verificationCache.put("SOAP header verification failed: " + se);
+        }
+    }
+
+    private void recordWSAHeaders(Element headers,
+                                  List<String> wsaHeaders,
+                                  String namespaceURI) {
+        NodeList headerElements =
+            headers.getElementsByTagNameNS(namespaceURI, "*");
+        for (int i = 0; i < headerElements.getLength(); i++) {
+            Node headerElement = headerElements.item(i);
+            if (namespaceURI.equals(headerElement.getNamespaceURI())) {
+                currentNamespaceURI = namespaceURI;
+                wsaHeaders.add(headerElement.getLocalName());
+            }
+        }
+    }
+
+    private boolean isOutgoingPartialResponse(SoapMessage message) {
+        AddressingProperties maps = 
+            (AddressingProperties)message.get(SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+        return ContextUtils.isOutbound(message)
+               && ContextUtils.isRequestor(message)
+               && maps != null
+               && Names.WSA_ANONYMOUS_ADDRESS.equals(maps.getTo().getValue());
+    }
+    
+    private boolean isIncomingPartialResponse(SoapMessage message) 
+        throws SOAPException {
+        AddressingProperties maps = 
+            (AddressingProperties)message.get(CLIENT_ADDRESSING_PROPERTIES_INBOUND);
+        return !ContextUtils.isOutbound(message)
+               && ContextUtils.isRequestor(message)
+               && Names.WSA_ANONYMOUS_ADDRESS.equals(maps.getTo().getValue());
+    }
+    
+    private Marshaller getMarshaller() throws JAXBException {
+        JAXBContext jaxbContext =
+            VersionTransformer.getExposedJAXBContext(currentNamespaceURI);
+        Marshaller marshaller = jaxbContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
+        return marshaller;
+    }
+
+    private void marshallFrom(String from, Element header, Marshaller marshaller) 
+        throws JAXBException {
+        if (Names.WSA_NAMESPACE_NAME.equals(currentNamespaceURI)) {
+            String u = "urn:piggyback_responder";
+            AttributedURIType value =
+                org.apache.cxf.ws.addressing.ContextUtils.getAttributedURI(u);
+            marshaller.marshal(
+                new JAXBElement<AttributedURIType>(Names.WSA_FROM_QNAME,
+                                                   AttributedURIType.class,
+                                                   value),
+                header);
+        } else if (VersionTransformer.Names200408.WSA_NAMESPACE_NAME.equals(
+                                                      currentNamespaceURI)) {
+            AttributedURI value =
+                VersionTransformer.Names200408.WSA_OBJECT_FACTORY.createAttributedURI();
+            value.setValue(from);
+            QName qname = new QName(VersionTransformer.Names200408.WSA_NAMESPACE_NAME, 
+                                    Names.WSA_FROM_NAME);
+            marshaller.marshal(
+                new JAXBElement<AttributedURI>(qname,
+                                               AttributedURI.class,
+                                               value),
+                header);
+        }                                                                    
+    }
+    
+    public void setVerificationCache(VerificationCache cache) {
+        verificationCache = cache;
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,368 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.ProtocolException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.ClientServerTestBase;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+import org.apache.cxf.ws.addressing.soap.VersionTransformer;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.hello_world_soap_http.SOAPService;
+
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES;
+
+
+/**
+ * Tests the addition of WS-Addressing Message Addressing Properties.
+ */
+public class MAPTest extends ClientServerTestBase implements VerificationCache {
+
+    static final String INBOUND_KEY = "inbound";
+    static final String OUTBOUND_KEY = "outbound";
+
+    private static MAPVerifier mapVerifier;
+    private static HeaderVerifier headerVerifier;
+
+    private static final QName SERVICE_NAME = 
+        new QName("http://apache.org/hello_world_soap_http", "SOAPServiceAddressing");
+    private static final QName PORT_NAME =
+        new QName("http://apache.org/hello_world_soap_http", "SoapPort");
+    private static final String NOWHERE = "http://nowhere.nada.nothing.nought:5555";
+    private static final String DECOUPLED = "http://localhost:9999/decoupled_endpoint";
+    private static Map<Object, Map<String, String>> messageIDs =
+        new HashMap<Object, Map<String, String>>();
+    private Greeter greeter;
+    private String verified;
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(MAPTest.class);
+    }
+    
+    public static Test suite() throws Exception {
+        TestSuite suite = new TestSuite(MAPTest.class);
+        return new ClientServerSetupBase(suite) {
+            public void startServers() throws Exception {
+                // special case handling for WS-Addressing system test to avoid
+                // UUID related issue when server is run as separate process
+                // via maven on Win2k
+                boolean inProcess = "Windows 2000".equals(System.getProperty("os.name"));
+                assertTrue("server did not launch correctly", 
+                           launchServer(Server.class, inProcess));
+            }
+            
+            public void setUp() throws Exception {
+                // temporary mechanism to override configuration for 
+                // decoupled response endpoint
+                System.setProperty(HTTPConduit.HTTP_DECOUPLED_ENDPOINT,
+                                   "http://localhost:9999/decoupled_endpoint");
+                super.setUp();
+                MAPAggregator aggregator = new MAPAggregator();
+                mapVerifier = new MAPVerifier();
+                MAPCodec codec = new MAPCodec();
+                headerVerifier = new HeaderVerifier();
+                Interceptor[] interceptors =
+                {aggregator, mapVerifier, codec, headerVerifier};
+                addInterceptors(getBus().getInInterceptors(), interceptors);
+                addInterceptors(getBus().getOutInterceptors(), interceptors);
+                addInterceptors(getBus().getInFaultInterceptors(), interceptors);
+            }
+            
+            private void addInterceptors(List<Interceptor> chain,
+                                         Interceptor[] interceptors) {
+                for (int i = 0; i < interceptors.length; i++) {
+                    chain.add(interceptors[i]);
+                }
+            }
+        };
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
+        SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
+        greeter = (Greeter)service.getPort(PORT_NAME, Greeter.class);
+        mapVerifier.verificationCache = this;
+        headerVerifier.verificationCache = this;
+    }
+    
+    public void tearDown() {
+        verified = null;
+    }
+
+    //--Tests
+    
+    public void testImplicitMAPs() throws Exception {
+        try {
+            String greeting = greeter.greetMe("implicit1");
+            assertEquals("unexpected response received from service", 
+                         "Hello implicit1",
+                         greeting);
+            checkVerification();
+            greeting = greeter.greetMe("implicit2");
+            assertEquals("unexpected response received from service", 
+                         "Hello implicit2",
+                         greeting);
+            checkVerification();
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+
+    public void xtestExplicitMAPs() throws Exception {
+        try {
+            Map<String, Object> requestContext = 
+                ((BindingProvider)greeter).getRequestContext();
+            AddressingProperties maps = new AddressingPropertiesImpl();
+            AttributedURIType id = 
+                ContextUtils.getAttributedURI("urn:uuid:12345");
+            maps.setMessageID(id);
+            requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps);
+            String greeting = greeter.greetMe("explicit1");
+            assertEquals("unexpected response received from service", 
+                         "Hello explicit1",
+                         greeting);
+            checkVerification();
+
+            // the previous addition to the request context impacts
+            // on all subsequent invocations on this proxy => a duplicate
+            // message ID fault is expected
+            try {
+                greeter.greetMe("explicit2");
+                fail("expected ProtocolException on duplicate message ID");
+            } catch (ProtocolException pe) {
+                assertTrue("expected duplicate message ID failure",
+                           "Duplicate Message ID urn:uuid:12345".equals(pe.getMessage()));
+                checkVerification();
+            }
+
+            // clearing the message ID ensure a duplicate is not sent
+            maps.setMessageID(null);
+            maps.setRelatesTo(ContextUtils.getRelatesTo(id.getValue()));
+            greeting = greeter.greetMe("explicit3");
+            assertEquals("unexpected response received from service", 
+                         "Hello explicit3",
+                         greeting);
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void xtestFaultTo() throws Exception {
+        try {
+            String greeting = greeter.greetMe("warmup");
+            assertEquals("unexpected response received from service", 
+                         "Hello warmup",
+                         greeting);
+            checkVerification();
+
+            Map<String, Object> requestContext = 
+                ((BindingProvider)greeter).getRequestContext();
+            AddressingProperties maps = new AddressingPropertiesImpl();
+            maps.setReplyTo(EndpointReferenceUtils.getEndpointReference(NOWHERE));
+            maps.setFaultTo(EndpointReferenceUtils.getEndpointReference(DECOUPLED));
+            requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps);
+            try {
+                greeter.testDocLitFault("BadRecordLitFault");
+                fail("expected fault from service");
+            } catch (BadRecordLitFault brlf) {
+                checkVerification();
+            } catch (UndeclaredThrowableException ex) {
+                throw (Exception)ex.getCause();
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void testOneway() throws Exception {
+        try {
+            greeter.greetMeOneWay("implicit_oneway1");
+            checkVerification();
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void xtestApplicationFault() throws Exception {
+        try {
+            greeter.testDocLitFault("BadRecordLitFault");
+            fail("expected fault from service");
+        } catch (BadRecordLitFault brlf) {
+            checkVerification();
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+        String greeting = greeter.greetMe("intra-fault");
+        assertEquals("unexpected response received from service", 
+                     "Hello intra-fault",
+                     greeting);
+        try {
+            greeter.testDocLitFault("NoSuchCodeLitFault");
+            fail("expected NoSuchCodeLitFault");
+        } catch (NoSuchCodeLitFault nsclf) {
+            checkVerification();
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+
+    public void testVersioning() throws Exception {
+        try {
+            // expect two MAPs instances versioned with 200408, i.e. for both 
+            // the partial and full responses
+            mapVerifier.expectedExposedAs.add(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
+            mapVerifier.expectedExposedAs.add(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
+            String greeting = greeter.greetMe("versioning1");
+            assertEquals("unexpected response received from service", 
+                         "Hello versioning1",
+                         greeting);
+            checkVerification();
+            greeting = greeter.greetMe("versioning2");
+            assertEquals("unexpected response received from service", 
+                         "Hello versioning2",
+                         greeting);
+            checkVerification();
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+
+    //--VerificationCache implementation
+
+    public void put(String verification) {
+        if (verification != null) {
+            verified = verified == null
+                       ? verification
+                : verified + "; " + verification;
+        }
+    }
+
+    //--Verification methods called by handlers
+
+    /**
+     * Verify presence of expected MAPs.
+     *
+     * @param maps the MAPs to verify
+     * @param checkPoint the check point
+     * @return null if all expected MAPs present, otherwise an error string.
+     */
+    protected static String verifyMAPs(AddressingProperties maps, 
+                                       Object checkPoint) {
+        if (maps == null) {
+            return "expected MAPs";
+        }
+        //String rt = maps.getReplyTo() != null ? maps.getReplyTo().getAddress().getValue() : "null"; 
+        //System.out.println("verifying MAPs: " + maps
+        //                   + " id: " + maps.getMessageID().getValue() 
+        //                   + " to: " + maps.getTo().getValue()
+        //                   + " reply to: " + rt);
+        // MessageID
+        String id = maps.getMessageID().getValue();
+        if (id == null) {
+            return "expected MessageID MAP";
+        }
+        if (!id.startsWith("urn:uuid")) {
+            return "bad URN format in MessageID MAP: " + id;
+        }
+        // ensure MessageID is unique for this check point
+        Map<String, String> checkPointMessageIDs = messageIDs.get(checkPoint);
+        if (checkPointMessageIDs != null) { 
+            if (checkPointMessageIDs.containsKey(id)) {
+                //return "MessageID MAP duplicate: " + id;
+                return null;
+            }
+        } else {
+            checkPointMessageIDs = new HashMap<String, String>();
+            messageIDs.put(checkPoint, checkPointMessageIDs);    
+        }
+        checkPointMessageIDs.put(id, id);
+        // To
+        if (maps.getTo() == null) {
+            return "expected To MAP";
+        }
+        return null;
+    }
+
+    /**
+     * Verify presence of expected MAP headers.
+     *
+     * @param wsaHeaders a list of the wsa:* headers present in the SOAP
+     * message
+     * @param parial true if partial response
+     * @return null if all expected headers present, otherwise an error string.
+     */
+    protected static String verifyHeaders(List<String> wsaHeaders, boolean partial) {
+        //System.out.println("verifying headers: " + wsaHeaders);
+        String ret = null;
+        if (!wsaHeaders.contains(Names.WSA_MESSAGEID_NAME)) {
+            ret = "expected MessageID header"; 
+        }
+        if (!wsaHeaders.contains(Names.WSA_TO_NAME)) {
+            ret = "expected To header";
+        }
+       
+        if (!(wsaHeaders.contains(Names.WSA_REPLYTO_NAME)
+              || wsaHeaders.contains(Names.WSA_RELATESTO_NAME))) {
+            ret = "expected ReplyTo or RelatesTo header";
+        }
+        if (partial) { 
+            if (!wsaHeaders.contains(Names.WSA_FROM_NAME)) {
+                ret = "expected From header";
+            }
+        } else {
+            // REVISIT Action missing from full response
+            //if (!wsaHeaders.contains(Names.WSA_ACTION_NAME)) {
+            //    ret = "expected Action header";
+            //}            
+        }
+        return ret;
+    }
+
+    private void checkVerification() {
+        assertNull("MAP/Header verification failed: " + verified, verified);
+    }
+}
+

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.Names;
+
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND;
+
+
+/**
+ * Verifies presence of MAPs in the context.
+ */
+public class MAPVerifier extends AbstractPhaseInterceptor<Message> {
+    VerificationCache verificationCache;
+    List<String> expectedExposedAs = new ArrayList<String>();
+    private Map<String, Object> mapProperties;
+
+    public MAPVerifier() {
+        super();
+        setPhase(Phase.POST_LOGICAL);
+        mapProperties = new HashMap<String, Object>();
+        mapProperties.put(MAPTest.INBOUND_KEY, CLIENT_ADDRESSING_PROPERTIES_INBOUND);
+        mapProperties.put(MAPTest.OUTBOUND_KEY, CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+    }
+    
+    public void handleMessage(Message message) {
+        //verify(message);
+    }
+
+    public void handleFault(Message message) {
+        verify(message);
+    }
+
+    private void verify(Message message) {
+        boolean isOutbound = ContextUtils.isOutbound(message);
+        String mapProperty = 
+            (String)mapProperties.get(isOutbound 
+                                      ? MAPTest.OUTBOUND_KEY
+                                      : MAPTest.INBOUND_KEY);
+        AddressingPropertiesImpl maps = 
+            (AddressingPropertiesImpl)message.get(mapProperty);
+        if (ContextUtils.isRequestor(message)) {
+            if (isOutbound) {
+                String exposeAs = getExpectedExposeAs(false);
+                if (exposeAs != null) {
+                    maps.exposeAs(exposeAs);
+                }
+            } else {
+                String exposeAs = getExpectedExposeAs(true);
+                String expected = exposeAs != null
+                                  ? exposeAs
+                                  : Names.WSA_NAMESPACE_NAME;
+                if (maps.getNamespaceURI() != expected) {
+                    verificationCache.put("Incoming version mismatch"
+                                          + " expected: " + expected
+                                          + " got: " + maps.getNamespaceURI());
+                }
+                exposeAs = null;
+            }
+        }
+        verificationCache.put(MAPTest.verifyMAPs(maps, this));
+    }
+    
+    private String getExpectedExposeAs(boolean remove) {
+        int size = expectedExposedAs.size();
+        return  size == 0 
+                ? null
+                : remove
+                  ? expectedExposedAs.remove(size - 1)
+                  : expectedExposedAs.get(size - 1);
+    }
+    
+    public void setVerificationCache(VerificationCache cache) {
+        verificationCache = cache;
+    }
+    
+    public void addToExpectedExposedAs(String str) {
+        expectedExposedAs.add(str);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.bus.cxf.CXFBusFactory;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.systest.common.TestServerBase;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+
+public class Server extends TestServerBase implements VerificationCache {
+    
+    private String verified;
+ 
+    protected void run()  {
+        addInterceptors();
+        GreeterImpl implementor = new GreeterImpl();
+        implementor.verificationCache = this;         
+        String address = "http://localhost:9008/SoapContext/SoapPort";
+        Endpoint.publish(address, implementor);
+    }
+    
+    protected void addInterceptors() {
+        CXFBusFactory bf = new CXFBusFactory();
+        setBus(bf.createBus());
+        bf.setDefaultBus(getBus());
+        MAPAggregator aggregator = new MAPAggregator();
+        MAPVerifier mapVerifier = new MAPVerifier();
+        mapVerifier.verificationCache = this;
+        MAPCodec codec = new MAPCodec();
+        HeaderVerifier headerVerifier = new HeaderVerifier();
+        headerVerifier.verificationCache = this;
+        Interceptor[] interceptors =
+        {aggregator, mapVerifier, codec, headerVerifier};
+        addInterceptors(getBus().getInInterceptors(), interceptors);
+        addInterceptors(getBus().getOutInterceptors(), interceptors);
+        addInterceptors(getBus().getOutFaultInterceptors(), interceptors);
+    }
+    
+    private void addInterceptors(List<Interceptor> chain,
+                                 Interceptor[] interceptors) {
+        for (int i = 0; i < interceptors.length; i++) {
+            chain.add(interceptors[i]);
+        }
+    }
+        
+    public static void main(String[] args) {
+        try { 
+            Server s = new Server(); 
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally { 
+            System.out.println("done!");
+        }
+    }
+
+    public void put(String verification) {
+        if (verification != null) {
+            verified = verified == null
+                       ? verification
+                : verified + "; " + verification;
+        }
+    }
+
+    /**
+     * Used to facilitate assertions on server-side behaviour.
+     *
+     * @param log logger to use for diagnostics if assertions fail
+     * @return true if assertions hold
+     */
+    protected boolean verify(Logger log) {
+        if (verified != null) {
+            log.log(Level.WARNING, 
+                    "MAP/Header verification failed: {0}",
+                    verified);
+        }
+        return verified == null;
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/Server.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/VerificationCache.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/VerificationCache.java?view=auto&rev=449679
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/VerificationCache.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/VerificationCache.java Mon Sep 25 06:26:03 2006
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.addressing;
+
+public interface VerificationCache {
+    void put(String verification);
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/VerificationCache.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message