cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r520348 - in /incubator/cxf/trunk: rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/ rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/ rt/ws/rm/ rt/ws/rm/src/main/...
Date Tue, 20 Mar 2007 10:40:58 GMT
Author: andreasmyth
Date: Tue Mar 20 03:40:54 2007
New Revision: 520348

URL: http://svn.apache.org/viewvc?view=rev&rev=520348
Log:
[JIRA CXF-384] 
* RM interceptors to assert the RMAssertions.
* Added system tests demonstrating how the policy framework uses attachments of RMAssertions and an Addressing assertions to automatically engage addressing and RM interceptors.
* Renamed the PolicyClientServerTest to AddressingPolicyClientServerTest and changed it to use non-anonymous ReplyTo. 
* ServerPolicyOutFaultInterceptor to obtain BindingFaultInfo from the wrapped operation if it cannot be obtained from the operation itself.

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyClientServerTest.java
      - copied, changed from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/PolicyClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-external.xml
      - copied unchanged from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only-external.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml
      - copied, changed from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java
      - copied, changed from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/InMessageRecorder.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java
      - copied, changed from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java
      - copied, changed from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/OutMessageRecorder.java
Removed:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/PolicyClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only-external.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/InMessageRecorder.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/OutMessageRecorder.java
Modified:
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
    incubator/cxf/trunk/rt/ws/rm/pom.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/OutPolicyInfo.java Tue Mar 20 03:40:54 2007
@@ -43,13 +43,19 @@
 /**
  * 
  */
-public class OutPolicyInfo  {
+public class OutPolicyInfo {
     
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(OutPolicyInfo.class);
     
     protected Policy policy;     
     protected Collection<Assertion> chosenAlternative;
     protected List<Interceptor> interceptors;
+    
+    public void initialise(EndpointPolicyInfo epi, PolicyEngine engine) {
+        policy = epi.getPolicy();
+        chosenAlternative = epi.getChosenAlternative();
+        initialiseInterceptors(engine);  
+    }
     
     void initialise(Endpoint e, 
                     BindingOperationInfo boi, 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Tue Mar 20 03:40:54 2007
@@ -53,7 +53,7 @@
  * 
  */
 public class PolicyEngine implements BusExtension {
-    
+     
     private Bus bus;
     private PolicyRegistry registry;
     private Collection<PolicyProvider> policyProviders;
@@ -349,7 +349,7 @@
         return true;
     }
     
-    OutPolicyInfo getClientRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, Conduit c) {
+    public OutPolicyInfo getClientRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, Conduit c) {
         BindingOperation bo = new BindingOperation(e, boi);
         OutPolicyInfo opi = clientRequestInfo.get(bo);
         if (null == opi) {
@@ -364,7 +364,12 @@
         return opi;
     }
     
-    OutPolicyInfo getServerRequestPolicyInfo(Endpoint e, BindingOperationInfo boi) {
+    public void setClientRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
+        BindingOperation bo = new BindingOperation(e, boi);
+        clientRequestInfo.put(bo, opi);
+    }
+    
+    public OutPolicyInfo getServerRequestPolicyInfo(Endpoint e, BindingOperationInfo boi) {
         BindingOperation bo = new BindingOperation(e, boi);
         OutPolicyInfo opi = serverRequestInfo.get(bo);
         if (null == opi) {
@@ -375,7 +380,12 @@
         return opi;
     }
     
-    OutPolicyInfo getClientResponsePolicyInfo(Endpoint e, BindingOperationInfo boi) {
+    public void setServerRequestPolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
+        BindingOperation bo = new BindingOperation(e, boi);
+        serverRequestInfo.put(bo, opi);
+    }
+    
+    public OutPolicyInfo getClientResponsePolicyInfo(Endpoint e, BindingOperationInfo boi) {
         BindingOperation bo = new BindingOperation(e, boi);
         OutPolicyInfo opi = clientResponseInfo.get(bo);
         if (null == opi) {
@@ -386,7 +396,12 @@
         return opi;
     }
     
-    OutPolicyInfo getClientFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi) {
+    public void setClientResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
+        BindingOperation bo = new BindingOperation(e, boi);
+        clientResponseInfo.put(bo, opi);
+    }
+    
+    public OutPolicyInfo getClientFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi) {
         BindingFault bf = new BindingFault(e, bfi);
         OutPolicyInfo opi = clientFaultInfo.get(bf);
         if (null == opi) {
@@ -397,7 +412,12 @@
         return opi;
     }
     
-    EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Conduit conduit) {
+    public void setClientFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, OutPolicyInfo opi) {
+        BindingFault bf = new BindingFault(e, bfi);
+        clientFaultInfo.put(bf, opi);
+    }
+    
+    public EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Conduit conduit) {
         EndpointPolicyInfo epi = endpointInfo.get(e);
         if (null != epi) {
             return epi;
@@ -405,8 +425,8 @@
         Assertor assertor = conduit instanceof Assertor ? (Assertor)conduit : null;
         return createEndpointPolicyInfo(e, false, assertor);
     }
-    
-    EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Destination destination) {
+   
+    public EndpointPolicyInfo getEndpointPolicyInfo(Endpoint e, Destination destination) {
         EndpointPolicyInfo epi = endpointInfo.get(e);
         if (null != epi) {
             return epi;
@@ -423,7 +443,12 @@
         return epi;
     }
     
-    OutPolicyInfo getServerResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, 
+    public void setEndpointPolicyInfo(Endpoint e, EndpointPolicyInfo epi) {
+        endpointInfo.put(e, epi);
+    }
+    
+    
+    public OutPolicyInfo getServerResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, 
                                                          Destination d) {
         BindingOperation bo = new BindingOperation(e, boi);
         OutPolicyInfo opi = serverResponseInfo.get(bo);
@@ -439,7 +464,12 @@
         return opi;
     }
     
-    OutPolicyInfo getServerFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, 
+    public void setServerResponsePolicyInfo(Endpoint e, BindingOperationInfo boi, OutPolicyInfo opi) {
+        BindingOperation bo = new BindingOperation(e, boi);
+        serverResponseInfo.put(bo, opi);
+    }
+    
+    public OutPolicyInfo getServerFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, 
                                                          Destination d) {
         BindingFault bf = new BindingFault(e, bfi);
         OutPolicyInfo opi = serverFaultInfo.get(bf);
@@ -455,6 +485,11 @@
         return opi;
     }
     
+    public void setServerFaultPolicyInfo(Endpoint e, BindingFaultInfo bfi, OutPolicyInfo opi) {
+        BindingFault bf = new BindingFault(e, bfi);
+        serverFaultInfo.put(bf, opi);
+    }
+    
     
     /**
      * Class used as key in the client request policy and server response policy maps.
@@ -467,6 +502,20 @@
             endpoint = e;
             boi = b;
         }
+
+        @Override
+        public int hashCode() {
+            return boi.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            BindingOperation other = (BindingOperation)obj;
+            return boi.equals(other.boi) && endpoint.equals(other.endpoint);
+        }
+        
+        
+        
     }
     
     /**
@@ -474,11 +523,22 @@
      */
     class BindingFault {
         Endpoint endpoint;
-        BindingFaultInfo boi;
+        BindingFaultInfo bfi;
         
         BindingFault(Endpoint e, BindingFaultInfo b) {
             endpoint = e;
-            boi = b;
+            bfi = b;
+        }
+        
+        @Override
+        public int hashCode() {
+            return bfi.hashCode();
+        }
+        
+        @Override
+        public boolean equals(Object obj) {
+            BindingFault other = (BindingFault)obj;
+            return bfi.equals(other.bfi) && endpoint.equals(other.endpoint);
         }
     }
 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java Tue Mar 20 03:40:54 2007
@@ -21,6 +21,8 @@
 
 import java.util.Collection;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
@@ -99,13 +101,25 @@
         return true;
     }
     
+    public static void logPolicy(Logger log, Level level, String msg, PolicyComponent pc) {
+        if (null == pc) {
+            log.log(level, msg);
+            return;
+        }
+        StringBuffer buf = new StringBuffer();
+        buf.append(msg);
+        nl(buf);
+        printPolicyComponent(pc, buf, 0);
+        log.log(level, buf.toString());
+    }
+    
     public static void printPolicyComponent(PolicyComponent pc) {
         StringBuffer buf = new StringBuffer();
         printPolicyComponent(pc, buf, 0);
         System.out.println(buf.toString());
     }
     
-    private static void printPolicyComponent(PolicyComponent pc, StringBuffer buf, int level) {
+    public static void printPolicyComponent(PolicyComponent pc, StringBuffer buf, int level) {
         indent(buf, level);
         buf.append("type: ");
         buf.append(typeToString(pc.getType()));

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java Tue Mar 20 03:40:54 2007
@@ -101,16 +101,30 @@
     }
     
     BindingFaultInfo getBindingFaultInfo(Message msg, Exception ex, BindingOperationInfo boi) {
-        BindingFaultInfo bfi = msg.get(BindingFaultInfo.class);
+        BindingFaultInfo bfi = msg.get(BindingFaultInfo.class);        
         if (null == bfi) {
+            Throwable cause = ex.getCause();
+            if (null == cause) {
+                return null;
+            }
             for (BindingFaultInfo b : boi.getFaults()) {
                 Class<?> faultClass = b.getFaultInfo().getProperty(Class.class.getName(), Class.class);
-                if (faultClass.isAssignableFrom(ex.getClass())) {
+                if (faultClass.isAssignableFrom(cause.getClass())) {
                     bfi = b;
                     msg.put(BindingFaultInfo.class, bfi);
                     break;
                 }
-            }            
+            }  
+            if (null == bfi && null != boi.getWrappedOperation()) {
+                for (BindingFaultInfo b : boi.getWrappedOperation().getFaults()) {
+                    Class<?> faultClass = b.getFaultInfo().getProperty(Class.class.getName(), Class.class);
+                    if (faultClass.isAssignableFrom(cause.getClass())) {
+                        bfi = b;
+                        msg.put(BindingFaultInfo.class, bfi);
+                        break;
+                    }
+                }  
+            }
         }
         return bfi;
     }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Tue Mar 20 03:40:54 2007
@@ -120,7 +120,6 @@
     public Policy getEffectivePolicy(BindingMessageInfo bmi) {
         ServiceInfo si = bmi.getBindingOperation().getBinding().getService();
         DescriptionInfo di = si.getDescription();
-
         Policy p = getElementPolicy(bmi, false, di);
         MessageInfo mi = bmi.getMessageInfo();
         p = p.merge(getElementPolicy(mi, true, di));
@@ -157,7 +156,7 @@
         
         Policy elementPolicy = new Policy();
         
-        if (null == ex) {
+        if (null == ex || null == di) {
             return elementPolicy;
         }
         
@@ -237,6 +236,9 @@
     
      
     private Extensible getMessageTypeInfo(QName name, DescriptionInfo di) {
+        if (null == di) {
+            return null;
+        }
         Definition def = (Definition)di.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
         if (null == def) {
             return null;

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java Tue Mar 20 03:40:54 2007
@@ -571,13 +571,23 @@
     public void testKeys() {
         engine = new PolicyEngine();
         Endpoint endpoint = control.createMock(Endpoint.class);
-        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
-        PolicyEngine.BindingOperation bo = engine.new BindingOperation(endpoint, boi);
+        BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);      
+        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);  
+        OutPolicyInfo opi = control.createMock(OutPolicyInfo.class);
+        control.replay();
+        
+        PolicyEngine.BindingOperation bo = engine.new BindingOperation(endpoint, boi); 
         assertNotNull(bo);
+        PolicyEngine.BindingOperation bo2 = engine.new BindingOperation(endpoint, boi);
+        assertEquals(bo, bo2);
+        assertEquals(bo.hashCode(), bo2.hashCode());
         
-        BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
+        engine.setClientRequestPolicyInfo(endpoint, boi, opi);
+        assertSame(opi, engine.getClientRequestPolicyInfo(endpoint, boi, null));
+             
         PolicyEngine.BindingFault bf = engine.new BindingFault(endpoint, bfi);
-        assertNotNull(bf);      
+        assertNotNull(bf); 
+        control.verify();
     }
      
     private void doTestGetInterceptors(boolean isServer, boolean fault) throws NoSuchMethodException {

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java Tue Mar 20 03:40:54 2007
@@ -254,7 +254,7 @@
     public void testServerPolicyOutFaultInterceptorGetBindingFaultInfo() {
         ServerPolicyOutFaultInterceptor interceptor = new ServerPolicyOutFaultInterceptor();
         message = control.createMock(Message.class);
-        Exception ex = new UnsupportedOperationException();
+        Exception ex = new UnsupportedOperationException(new RuntimeException());
         boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(message.get(BindingFaultInfo.class)).andReturn(null);
         BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);

Modified: incubator/cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/pom.xml?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Tue Mar 20 03:40:54 2007
@@ -58,6 +58,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-policy</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-common-utilities</artifactId>
             <version>${project.version}</version>
         </dependency>

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java Tue Mar 20 03:40:54 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ws.rm;
 
+import java.util.Collection;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -28,6 +29,8 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.policy.AssertionInfo;
+import org.apache.cxf.ws.policy.AssertionInfoMap;
 
 /**
  * Interceptor responsible for implementing exchange of RM protocol messages,
@@ -90,6 +93,28 @@
     } 
     
     public void postHandleMessage(Message msg) throws Fault {
+    }
+    
+    /**
+     * Asserts all RMAssertion assertions for the current message, regardless their attributes
+     * (if there is more thsn one we have ensured that they are all supported by considering
+     * e.g. the minimum acknowledgment interval).
+     * @param message the current message
+     */
+    void assertReliability(Message message) {
+        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+        if (null == aim) {
+            return;
+            
+        }
+        Collection<AssertionInfo> ais = aim.get(RMConstants.getRMAssertionQName());
+        if (null == ais || ais.size() == 0) {
+            return;
+        }
+        
+        for (AssertionInfo ai : ais) {
+            ai.setAsserted(true);
+        }
     }
     
     // rm logic

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Tue Mar 20 03:40:54 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ws.rm;
 
+import java.util.Collection;
 import java.util.List;
 
 import javax.wsdl.extensions.ExtensibilityElement;
@@ -43,6 +44,9 @@
 import org.apache.cxf.service.model.UnwrappedOperationInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.policy.EndpointPolicyInfo;
+import org.apache.cxf.ws.policy.OutPolicyInfo;
+import org.apache.cxf.ws.policy.PolicyEngine;
 
 public class RMEndpoint {
     
@@ -187,6 +191,7 @@
         replyTo = r;
         createService();
         createEndpoint();
+        setPolicies();
     }
     
     void createService() {
@@ -231,6 +236,41 @@
         endpoint = new WrappedEndpoint(applicationEndpoint, ei, service);
         service.setEndpoint(endpoint);
     }
+    
+    void setPolicies() {
+        
+        // if addressing was enabled on the application endpoint by means 
+        // of the UsingAddressing element extensor, use this for the 
+        // RM endpoint also
+
+        Object ua = getUsingAddressing(applicationEndpoint.getEndpointInfo());
+        if (null != ua) {
+            endpoint.getEndpointInfo().addExtensor(ua);
+        } 
+        
+        // use same WS-policies as for application endpoint
+        
+        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
+        
+        EndpointPolicyInfo epi = engine.getEndpointPolicyInfo(applicationEndpoint, conduit);
+        OutPolicyInfo opi = new OutPolicyInfo();
+        opi.initialise(epi, engine);
+        
+        engine.setEndpointPolicyInfo(endpoint, epi);
+       
+        BindingInfo bi = endpoint.getEndpointInfo().getBinding();
+        Collection<BindingOperationInfo> bois = bi.getOperations();
+        
+        for (BindingOperationInfo boi : bois) {
+            engine.setServerRequestPolicyInfo(endpoint, boi, opi);
+            engine.setServerResponsePolicyInfo(endpoint, boi, opi);
+
+            engine.setClientRequestPolicyInfo(endpoint, boi, opi);
+            engine.setClientResponsePolicyInfo(endpoint, boi, opi);            
+        }
+        
+        // TODO: FaultPolicy (SequenceFault)
+    }
 
     void buildInterfaceInfo(ServiceInfo si) {
         InterfaceInfo ii = new InterfaceInfo(si, INTERFACE_NAME);
@@ -241,6 +281,8 @@
         buildCreateSequenceOperationInfo(ii);
         buildTerminateSequenceOperationInfo(ii);
         buildSequenceAckOperationInfo(ii);
+        
+        // TODO: FaultInfo (SequenceFault)
     }
 
     void buildCreateSequenceOperationInfo(InterfaceInfo ii) {
@@ -415,6 +457,8 @@
 
             si.addBinding(bi);
         }
+        
+        // TODO: BindingFaultInfo (SequenceFault)
     }
     
     Object getUsingAddressing(EndpointInfo endpointInfo) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Tue Mar 20 03:40:54 2007
@@ -83,7 +83,10 @@
         
         boolean isServer = RMContextUtils.isServerSide(message);
         LOG.fine("isServerSide: " + isServer);
+        boolean isApplicationMessage = RMContextUtils.isAplicationMessage(action);       
+        LOG.fine("isApplicationMessage: " + isApplicationMessage);
         
+        /*
         if (RMConstants.getCreateSequenceAction().equals(action) && !isServer) {
             LOG.fine("Processing inbound CreateSequence on client side.");
             RMEndpoint rme = getManager().getReliableEndpoint(message);
@@ -103,21 +106,31 @@
             processAcknowledgments(rmps);
             return;
         }
+        */
         
         // for application AND out of band messages
         
-        Destination destination = getManager().getDestination(message);
-
-        if (null != rmps) {            
-
+        if (isApplicationMessage) {
+            Destination destination = getManager().getDestination(message);
+            if (null != rmps) {
+                processAcknowledgments(rmps);
+                processAcknowledgmentRequests(rmps);
+                processSequence(destination, message);
+                processDeliveryAssurance(rmps);
+            }
+        } else if (RMConstants.getSequenceAckAction().equals(action)) {
             processAcknowledgments(rmps);
-            
-            processAcknowledgmentRequests(rmps);  
-            
-            processSequence(destination, message);
-            
-            processDeliveryAssurance(rmps);
+        } else if (RMConstants.getCreateSequenceAction().equals(action) && !isServer) {
+            LOG.fine("Processing inbound CreateSequence on client side.");
+            RMEndpoint rme = getManager().getReliableEndpoint(message);
+            Servant servant = rme.getServant();
+            CreateSequenceResponseType csr = servant.createSequence(message);
+            Proxy proxy = rme.getProxy();
+            proxy.createSequenceResponse(csr);
+            return;
         }
+        
+        assertReliability(message);
     }
     
     void processAcknowledgments(RMProperties rmps) throws SequenceFault {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java Tue Mar 20 03:40:54 2007
@@ -155,6 +155,8 @@
             || RMConstants.getTerminateSequenceAction().equals(action)) {
             maps.setReplyTo(RMUtils.createNoneReference());
         }
+        
+        assertReliability(message);
     }
     
     void addAcknowledgements(Destination destination, 

Copied: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyClientServerTest.java (from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/PolicyClientServerTest.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyClientServerTest.java?view=diff&rev=520348&p1=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/PolicyClientServerTest.java&r1=518568&p2=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyClientServerTest.java&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/PolicyClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/AddressingPolicyClientServerTest.java Tue Mar 20 03:40:54 2007
@@ -41,15 +41,15 @@
  * Tests the use of the WS-Policy Framework to automatically engage WS-Addressing and
  * WS-RM in response to Policies defined for the endpoint via an external policy attachment.
  */
-public class PolicyClientServerTest extends AbstractBusClientServerTestBase {
+public class AddressingPolicyClientServerTest extends AbstractBusClientServerTestBase {
 
-    private static final Logger LOG = Logger.getLogger(PolicyClientServerTest.class.getName());
+    private static final Logger LOG = Logger.getLogger(AddressingPolicyClientServerTest.class.getName());
 
     public static class Server extends AbstractBusTestServerBase {
     
         protected void run()  {            
             SpringBusFactory bf = new SpringBusFactory();
-            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-only.xml");
+            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr.xml");
             BusFactory.setDefaultBus(bus);
             LoggingInInterceptor in = new LoggingInInterceptor();
             bus.getInInterceptors().add(in);
@@ -61,7 +61,7 @@
             GreeterImpl implementor = new GreeterImpl();
             String address = "http://localhost:9020/SoapContext/GreeterPort";
             Endpoint.publish(address, implementor);
-            LOG.info("Published greeter endpoint.");
+            LOG.info("Published greeter endpoint.");            
         }
         
 
@@ -86,7 +86,7 @@
     @Test
     public void testUsingAddressing() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-only.xml");
+        bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr.xml");
         BusFactory.setDefaultBus(bus);
         LoggingInInterceptor in = new LoggingInInterceptor();
         bus.getInInterceptors().add(in);

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java Tue Mar 20 03:40:54 2007
@@ -0,0 +1,167 @@
+/**
+ * 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.policy;
+
+import java.util.logging.Logger;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.greeter_control.BasicGreeterService;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.PingMeFault;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.systest.ws.util.InMessageRecorder;
+import org.apache.cxf.systest.ws.util.MessageFlow;
+import org.apache.cxf.systest.ws.util.MessageRecorder;
+import org.apache.cxf.systest.ws.util.OutMessageRecorder;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.ws.rm.RMConstants;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests the use of the WS-Policy Framework to automatically engage WS-Addressing and
+ * WS-RM in response to Policies defined for the endpoint via an external policy attachment.
+ */
+public class RMPolicyClientServerTest extends AbstractBusClientServerTestBase {
+
+    private static final Logger LOG = Logger.getLogger(RMPolicyClientServerTest.class.getName());
+    private static final String GREETMEONEWAY_ACTION = null;
+    private static final String GREETME_ACTION = null;
+    private static final String GREETME_RESPONSE_ACTION = null;
+    private static final String PINGME_ACTION = null;
+    private static final String PINGME_RESPONSE_ACTION = null;
+
+    public static class Server extends AbstractBusTestServerBase {
+    
+        protected void run()  {            
+            SpringBusFactory bf = new SpringBusFactory();
+            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rm.xml");
+            BusFactory.setDefaultBus(bus);
+            LoggingInInterceptor in = new LoggingInInterceptor();
+            bus.getInInterceptors().add(in);
+            LoggingOutInterceptor out = new LoggingOutInterceptor();
+            bus.getOutInterceptors().add(out);
+            bus.getOutFaultInterceptors().add(out);
+            
+            GreeterImpl implementor = new GreeterImpl();
+            String address = "http://localhost:9020/SoapContext/GreeterPort";
+            Endpoint.publish(address, implementor);
+            LOG.info("Published greeter endpoint.");
+        }
+        
+
+        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!");
+            }
+        }
+    }    
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class));
+    }
+         
+    @Test
+    public void testUsingRM() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        bus = bf.createBus("org/apache/cxf/systest/ws/policy/rm.xml");
+        BusFactory.setDefaultBus(bus);
+        OutMessageRecorder outRecorder = new OutMessageRecorder();
+        bus.getOutInterceptors().add(outRecorder);
+        InMessageRecorder inRecorder = new InMessageRecorder();
+        bus.getInInterceptors().add(inRecorder);
+        
+        BasicGreeterService gs = new BasicGreeterService();
+        final Greeter greeter = gs.getGreeterPort();
+        LOG.fine("Created greeter client.");
+
+        // oneway
+
+        greeter.greetMeOneWay("CXF");
+
+        // two-way
+
+        assertEquals("CXF", greeter.greetMe("cxf")); 
+     
+        // exception
+
+        try {
+            greeter.pingMe();
+        } catch (PingMeFault ex) {
+            fail("First invocation should have succeeded.");
+        } 
+       
+        try {
+            greeter.pingMe();
+            fail("Expected PingMeFault not thrown.");
+        } catch (PingMeFault ex) {
+            assertEquals(2, (int)ex.getFaultInfo().getMajor());
+            assertEquals(1, (int)ex.getFaultInfo().getMinor());
+        } 
+
+        MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
+        mr.awaitMessages(5, 9, 5000);
+
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
+        
+        
+        mf.verifyMessages(5, true);
+        String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(), 
+                                                 GREETMEONEWAY_ACTION,
+                                                 GREETME_ACTION, 
+                                                 PINGME_ACTION,
+                                                 PINGME_ACTION};
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3", "4"}, true);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false, false}, true);
+        mf.verifyAcknowledgements(new boolean[] {false, false, false, true, true}, true);
+
+        mf.verifyMessages(9, false);
+        mf.verifyPartialResponses(5);        
+        mf.purgePartialResponses();
+
+        expectedActions = new String[] {
+            RMConstants.getCreateSequenceResponseAction(),
+            GREETME_RESPONSE_ACTION,
+            PINGME_RESPONSE_ACTION,
+            PINGME_RESPONSE_ACTION
+        };
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, false);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false}, false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, true}, false);
+         
+    }
+}

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyClientServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java Tue Mar 20 03:40:54 2007
@@ -0,0 +1,167 @@
+/**
+ * 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.policy;
+
+import java.util.logging.Logger;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.PingMeFault;
+import org.apache.cxf.greeter_control.ReliableGreeterService;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.systest.ws.util.InMessageRecorder;
+import org.apache.cxf.systest.ws.util.MessageFlow;
+import org.apache.cxf.systest.ws.util.MessageRecorder;
+import org.apache.cxf.systest.ws.util.OutMessageRecorder;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.ws.rm.RMConstants;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests the use of the WS-Policy Framework to automatically engage WS-Addressing and
+ * WS-RM in response to Policies defined for the endpoint via an external policy attachment.
+ */
+public class RMWsdlPolicyClientServerTest extends AbstractBusClientServerTestBase {
+
+    private static final Logger LOG = Logger.getLogger(RMWsdlPolicyClientServerTest.class.getName());
+    private static final String GREETMEONEWAY_ACTION = null;
+    private static final String GREETME_ACTION = null;
+    private static final String GREETME_RESPONSE_ACTION = null;
+    private static final String PINGME_ACTION = null;
+    private static final String PINGME_RESPONSE_ACTION = null;
+
+    public static class Server extends AbstractBusTestServerBase {
+    
+        protected void run()  {            
+            SpringBusFactory bf = new SpringBusFactory();
+            Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
+            BusFactory.setDefaultBus(bus);
+            LoggingInInterceptor in = new LoggingInInterceptor();
+            bus.getInInterceptors().add(in);
+            LoggingOutInterceptor out = new LoggingOutInterceptor();
+            bus.getOutInterceptors().add(out);
+            bus.getOutFaultInterceptors().add(out);
+            
+            ReliableGreeterImpl implementor = new ReliableGreeterImpl();
+            String address = "http://localhost:9020/SoapContext/GreeterPort";
+            Endpoint.publish(address, implementor);
+            LOG.info("Published greeter endpoint.");
+        }
+        
+
+        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!");
+            }
+        }
+    }    
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class));
+    }
+         
+    @Test
+    public void testUsingRM() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
+        BusFactory.setDefaultBus(bus);
+        OutMessageRecorder outRecorder = new OutMessageRecorder();
+        bus.getOutInterceptors().add(outRecorder);
+        InMessageRecorder inRecorder = new InMessageRecorder();
+        bus.getInInterceptors().add(inRecorder);
+        
+        ReliableGreeterService gs = new ReliableGreeterService();
+        final Greeter greeter = gs.getGreeterPort();
+        LOG.fine("Created greeter client.");
+
+        // oneway
+
+        greeter.greetMeOneWay("CXF");
+
+        // two-way
+
+        assertEquals("CXF", greeter.greetMe("cxf")); 
+     
+        // exception
+
+        try {
+            greeter.pingMe();
+        } catch (PingMeFault ex) {
+            fail("First invocation should have succeeded.");
+        } 
+       
+        try {
+            greeter.pingMe();
+            fail("Expected PingMeFault not thrown.");
+        } catch (PingMeFault ex) {
+            assertEquals(2, (int)ex.getFaultInfo().getMajor());
+            assertEquals(1, (int)ex.getFaultInfo().getMinor());
+        } 
+
+        MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
+        mr.awaitMessages(5, 9, 5000);
+
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
+        
+        
+        mf.verifyMessages(5, true);
+        String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(), 
+                                                 GREETMEONEWAY_ACTION,
+                                                 GREETME_ACTION, 
+                                                 PINGME_ACTION,
+                                                 PINGME_ACTION};
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3", "4"}, true);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false, false}, true);
+        mf.verifyAcknowledgements(new boolean[] {false, false, false, true, true}, true);
+
+        mf.verifyMessages(9, false);
+        mf.verifyPartialResponses(5);        
+        mf.purgePartialResponses();
+
+        expectedActions = new String[] {
+            RMConstants.getCreateSequenceResponseAction(),
+            GREETME_RESPONSE_ACTION,
+            PINGME_RESPONSE_ACTION,
+            PINGME_RESPONSE_ACTION
+        };
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, false);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false}, false);
+        mf.verifyAcknowledgements(new boolean[] {false, true, true, true}, false);
+         
+    }
+}

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMWsdlPolicyClientServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java Tue Mar 20 03:40:54 2007
@@ -0,0 +1,35 @@
+/**
+ * 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.policy;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.greeter_control.AbstractGreeterImpl;
+
+/**
+ * 
+ */
+
+@WebService(serviceName = "ReliableGreeterService",
+            portName = "GreeterPort",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+public class ReliableGreeterImpl extends AbstractGreeterImpl {
+}

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/ReliableGreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml (from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only.xml)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml?view=diff&rev=520348&p1=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only.xml&r1=518568&p2=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr-only.xml (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/addr.xml Tue Mar 20 03:40:54 2007
@@ -18,19 +18,15 @@
   under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:wsrm-mgmt="http://cxf.apache.org/ws/rm/manager"
-       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
 http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-    <!--  
     <http:conduit id="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit">
-      <http:client DecoupledEndpoint="http://localhost:9995/decoupled_endpoint"/>
+      <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
     </http:conduit>
-    -->
 
     <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
         <property name="bus" ref="cxf"/>
@@ -39,7 +35,34 @@
 
     <bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
         <constructor-arg ref="cxf"/>
-        <property name="location" value="org/apache/cxf/systest/ws/policy/addr-only-external.xml"/>
+        <property name="location" value="org/apache/cxf/systest/ws/policy/addr-external.xml"/>
+    </bean>
+
+    <!--
+    <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/>
+    <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+
+    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+            </list>
+        </property>
     </bean>
+    -->
+
 
 </beans>

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml Tue Mar 20 03:40:54 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<attachments xmlns:wsp="http://www.w3.org/2006/07/ws-policy" xmlns:wsa="http://www.w3.org/2005/08/addressing">
+    <wsp:PolicyAttachment>
+        <wsp:AppliesTo>
+            <wsa:EndpointReference>
+                <wsa:Address>http://localhost:9020/SoapContext/GreeterPort</wsa:Address>
+            </wsa:EndpointReference>
+        </wsp:AppliesTo>
+        <wsp:Policy>
+            <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/01/addressing/metadata">
+                <wsp:Policy/>
+            </wsam:Addressing>
+            <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
+                <wsrmp:BaseRetransmissionInterval Milliseconds="30000"/>
+            </wsrmp:RMAssertion>`
+        </wsp:Policy>
+    </wsp:PolicyAttachment>    
+</attachments>
+

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm-external.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml Tue Mar 20 03:40:54 2007
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <http:conduit id="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit">
+      <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
+    </http:conduit>
+
+    <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+        <property name="bus" ref="cxf"/>
+        <property name="registerInterceptors" value="true"/>
+    </bean>
+
+    <bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
+        <constructor-arg ref="cxf"/>
+        <property name="location" value="org/apache/cxf/systest/ws/policy/rm-external.xml"/>
+    </bean>
+
+</beans>
\ No newline at end of file

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rm.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml Tue Mar 20 03:40:54 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <http:conduit id="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit">
+      <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
+    </http:conduit>
+
+    <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+        <property name="bus" ref="cxf"/>
+        <property name="registerInterceptors" value="true"/>
+    </bean>
+
+</beans>
\ No newline at end of file

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java Tue Mar 20 03:40:54 2007
@@ -34,6 +34,8 @@
 import org.apache.cxf.greeter_control.Control;
 import org.apache.cxf.greeter_control.types.StartGreeterResponse;
 import org.apache.cxf.greeter_control.types.StopGreeterResponse;
+import org.apache.cxf.systest.ws.util.InMessageRecorder;
+import org.apache.cxf.systest.ws.util.OutMessageRecorder;
 import org.apache.cxf.ws.rm.RMManager;
 
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/DecoupledClientServerTest.java Tue Mar 20 03:40:54 2007
@@ -59,7 +59,7 @@
             bus.getOutFaultInterceptors().add(out);
             
             GreeterImpl implementor = new GreeterImpl();
-            implementor.setDelay(8000);
+            implementor.setDelay(5000);
             String address = "http://localhost:9020/SoapContext/GreeterPort";
             Endpoint.publish(address, implementor);
             LOG.info("Published greeter endpoint.");

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java Tue Mar 20 03:40:54 2007
@@ -36,6 +36,10 @@
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.GreeterService;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.systest.ws.util.InMessageRecorder;
+import org.apache.cxf.systest.ws.util.MessageFlow;
+import org.apache.cxf.systest.ws.util.MessageRecorder;
+import org.apache.cxf.systest.ws.util.OutMessageRecorder;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -879,28 +883,8 @@
     }
     
     private void awaitMessages(int nExpectedOut, int nExpectedIn, int timeout) {
-        int waited = 0;
-        int nOut = 0;
-        int nIn = 0;
-        while (waited <= timeout) {                
-            synchronized (outRecorder) {
-                nOut = outRecorder.getOutboundMessages().size();
-            }
-            synchronized (inRecorder) {
-                nIn = inRecorder.getInboundMessages().size();
-            }
-            if (nIn >= nExpectedIn && nOut >= nExpectedOut) {
-                return;
-            }
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException ex) {
-                // ignore
-            }
-            waited += 100;
-        }
-        assertEquals("Did not receive expected number of inbound messages", nExpectedIn, nIn);
-        assertEquals("Did not send expected number of outbound messages", nExpectedOut, nOut);        
+        MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
+        mr.awaitMessages(nExpectedOut, nExpectedIn, timeout);
     }
 
     private void removeRMInterceptors(List<Interceptor> interceptors) {

Copied: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java (from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/InMessageRecorder.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java?view=diff&rev=520348&p1=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/InMessageRecorder.java&r1=518568&p2=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/InMessageRecorder.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/InMessageRecorder.java Tue Mar 20 03:40:54 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.systest.ws.rm;
+package org.apache.cxf.systest.ws.util;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -65,7 +65,7 @@
         }
     }
 
-    protected List<byte[]> getInboundMessages() {
+    public List<byte[]> getInboundMessages() {
         return inbound;
     } 
 }

Copied: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java (from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java?view=diff&rev=520348&p1=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java&r1=518568&p2=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/MessageFlow.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java Tue Mar 20 03:40:54 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.systest.ws.rm;
+package org.apache.cxf.systest.ws.util;
 
 import java.io.ByteArrayInputStream;
 import java.util.ArrayList;

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java?view=auto&rev=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java Tue Mar 20 03:40:54 2007
@@ -0,0 +1,58 @@
+/**
+ * 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.util;
+
+import junit.framework.Assert;
+
+public class MessageRecorder extends Assert {
+   
+    private OutMessageRecorder outRecorder;
+    private InMessageRecorder inRecorder;
+
+    public MessageRecorder(OutMessageRecorder or, InMessageRecorder ir) {
+        inRecorder = ir;
+        outRecorder = or;
+    }
+ 
+    public void awaitMessages(int nExpectedOut, int nExpectedIn, int timeout) {
+        int waited = 0;
+        int nOut = 0;
+        int nIn = 0;
+        while (waited <= timeout) {                
+            synchronized (outRecorder) {
+                nOut = outRecorder.getOutboundMessages().size();
+            }
+            synchronized (inRecorder) {
+                nIn = inRecorder.getInboundMessages().size();
+            }
+            if (nIn >= nExpectedIn && nOut >= nExpectedOut) {
+                return;
+            }
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException ex) {
+                // ignore
+            }
+            waited += 100;
+        }
+        assertEquals("Did not receive expected number of inbound messages", nExpectedIn, nIn);
+        assertEquals("Did not send expected number of outbound messages", nExpectedOut, nOut);        
+    }    
+}

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

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java (from r518568, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/OutMessageRecorder.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java?view=diff&rev=520348&p1=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/OutMessageRecorder.java&r1=518568&p2=incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java&r2=520348
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/OutMessageRecorder.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/OutMessageRecorder.java Tue Mar 20 03:40:54 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.systest.ws.rm;
+package org.apache.cxf.systest.ws.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
@@ -67,7 +67,7 @@
     }
 
 
-    protected List<byte[]> getOutboundMessages() {
+    public List<byte[]> getOutboundMessages() {
         return outbound;
     } 
     

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl?view=diff&rev=520348&r1=520347&r2=520348
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/greeter_control.wsdl Tue Mar 20 03:40:54 2007
@@ -254,6 +254,20 @@
         </wsdl:port>
     </wsdl:service>
    
+    <wsdl:service name="ReliableGreeterService">
+        <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
+            <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
+            <wsp:Policy xmlns:wsp="http://www.w3.org/2006/07/ws-policy">
+                <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/01/addressing/metadata">
+                    <wsp:Policy/>
+                </wsam:Addressing>
+                <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
+                    <wsrmp:BaseRetransmissionInterval Milliseconds="30000"/>
+                </wsrmp:RMAssertion>
+            </wsp:Policy>
+        </wsdl:port>
+    </wsdl:service>
+   
     <wsdl:service name="BasicGreeterService">
         <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
             <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>



Mime
View raw message