cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r475711 - in /incubator/cxf/trunk: rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ systests/src/test/java/org/apache/cxf/systest/ws/rm/
Date Thu, 16 Nov 2006 12:30:25 GMT
Author: andreasmyth
Date: Thu Nov 16 04:30:24 2006
New Revision: 475711

URL: http://svn.apache.org/viewvc?view=rev&rev=475711
Log:
[JIRA CXF-138, CXF-140] Support and system test for twoway messages in RM interceptors (acknowledgement
for responses).

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway.xml   (with
props)
Modified:
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.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/RMManager.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/JaxwsInterceptorRemover.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Thu Nov 16
04:30:24 2006
@@ -55,7 +55,8 @@
     private static final Logger LOG = LogUtils.getL7dLogger(Proxy.class);
 
     private RMEndpoint reliableEndpoint;
-    
+    // REVISIT assumption there is only a single outstanding offer
+    private Identifier offeredIdentifier;
     
 
     public Proxy(RMEndpoint rme) {
@@ -140,6 +141,7 @@
             }
             offer.setIdentifier(reliableEndpoint.getSource().generateSequenceIdentifier());
             create.setOffer(offer);
+            setOfferedIdentifier(offer);
         }
         
         OperationInfo oi = reliableEndpoint.getService().getServiceInfo().getInterface()
@@ -149,6 +151,16 @@
     
     void lastMessage(SourceSequence s) throws IOException {
         // TODO
+    }
+    
+    Identifier getOfferedIdentifier() {
+        return offeredIdentifier;    
+    }
+    
+    void setOfferedIdentifier(OfferType offer) { 
+        if (offer != null) {
+            offeredIdentifier = offer.getIdentifier();
+        }
     }
        
     Object invoke(OperationInfo oi, Object[] params, Map<String, Object> context) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java Thu
Nov 16 04:30:24 2006
@@ -88,7 +88,25 @@
      * @return the RM properties
      */
     public static RMProperties retrieveRMProperties(Message message, boolean outbound) {
-        return (RMProperties)message.get(getRMPropertiesKey(outbound));
+        if (outbound) {
+            return (RMProperties)message.get(getRMPropertiesKey(true));
+        } else {
+            Message m = null;
+            if (isOutbound(message)) {
+                // the in properties are only available on the in message
+                m = message.getExchange().getInMessage();
+                if (null == m) {
+                    m = message.getExchange().getInFaultMessage();
+                }
+            } else {
+                m = message;
+            }
+            if (null != m) {
+                return (RMProperties)m.get(getRMPropertiesKey(false));
+            }
+        }
+        return null;
+        
     }
     
     /**

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=475711&r1=475710&r2=475711
==============================================================================
--- 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 Thu Nov
16 04:30:24 2006
@@ -63,8 +63,6 @@
     private Destination destination;
     private Service service;
     private Endpoint endpoint;
-    // REVISIT assumption there is only a single outstanding offer
-    private Identifier offeredIdentifier;
     private Proxy proxy;
     private Servant servant;
     
@@ -326,16 +324,6 @@
             bi.addOperation(boi);
 
             si.addBinding(bi);
-        }
-    }
-    
-    Identifier getOfferedIdentifier() {
-        return offeredIdentifier;    
-    }
-    
-    void setOfferedIdentifier(OfferType offer) { 
-        if (offer != null) {
-            offeredIdentifier = offer.getIdentifier();
         }
     }
     

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Thu Nov
16 04:30:24 2006
@@ -188,7 +188,6 @@
             }
 
             seq = source.getCurrent(inSeqId);
-            addSourceSequence(seq);
             seq.setTarget(to);
         }
 

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java Thu Nov 16
04:30:24 2006
@@ -154,7 +154,7 @@
         // to the local destination sequence list, otherwise we have to wait for
         // and incoming CreateSequence request
         
-        Identifier offeredId = reliableEndpoint.getOfferedIdentifier();
+        Identifier offeredId = reliableEndpoint.getProxy().getOfferedIdentifier();
         if (null != offeredId) {
             AcceptType accept = createResponse.getAccept();
             assert null != accept;

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java Thu Nov 16
04:30:24 2006
@@ -59,6 +59,8 @@
     
     public void addSequence(SourceSequence seq) { 
         addSequence(seq, true);
+        getReliableEndpoint().getManager().addSourceSequence(seq);
+        
     }
     
     public void addSequence(SourceSequence seq, boolean persist) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Thu
Nov 16 04:30:24 2006
@@ -215,15 +215,11 @@
         EasyMock.expectLastCall();
         SourceSequence sseq = control.createMock(SourceSequence.class);
         EasyMock.expect(source.getCurrent(inSid)).andReturn(sseq);
-        Identifier sid = control.createMock(Identifier.class);
-        EasyMock.expect(sseq.getIdentifier()).andReturn(sid);
-        EasyMock.expect(sid.getValue()).andReturn("S1").times(2);
         sseq.setTarget(EasyMock.isA(EndpointReferenceType.class));
         EasyMock.expectLastCall();
         
         control.replay();
         assertSame(sseq, manager.getSequence(inSid, message, maps));
-        assertSame(manager.getSourceSequence(sid), sseq);
         control.verify();
     }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/JaxwsInterceptorRemover.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/JaxwsInterceptorRemover.java?view=diff&rev=475711&r1=475710&r2=475711
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/JaxwsInterceptorRemover.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/JaxwsInterceptorRemover.java
Thu Nov 16 04:30:24 2006
@@ -50,7 +50,7 @@
         while (it.hasNext()) {
             PhaseInterceptor pi = (PhaseInterceptor)it.next();
             if (LogicalHandlerInterceptor.class.getName().equals(pi.getId())) {
-                chain.remove(pi);
+                // chain.remove(pi);
                 break;
             }
         }
@@ -66,7 +66,7 @@
         while (it.hasNext()) {
             PhaseInterceptor pi = (PhaseInterceptor)it.next();
             if (StreamHandlerInterceptor.class.getName().equals(pi.getId())) {
-                chain.remove(pi);
+                //chain.remove(pi);
                 break;
             }
         }

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=475711&r1=475710&r2=475711
==============================================================================
--- 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
Thu Nov 16 04:30:24 2006
@@ -42,15 +42,16 @@
 public class SequenceTest extends ClientServerTestBase {
 
     private static final Logger LOG = Logger.getLogger(SequenceTest.class.getName());
-    // private static final String APP_NAMESPACE =
-    // "http://celtix.objectweb.org/greeter_control";
+    // private static final String APP_NAMESPACE ="http://celtix.objectweb.org/greeter_control";
     // private static final String GREETMEONEWAY_ACTION = APP_NAMESPACE +
-    // "/types/Greeter/greetMeOneWay";
+    //     "/types/Greeter/greetMeOneWay";
     // private static final String GREETME_ACTION = APP_NAMESPACE +
-    // "/types/Greeter/greetMe";
+    //     "/types/Greeter/greetMe";
     // private static final String GREETME_RESPONSE_ACTION = GREETME_ACTION +
-    // "Response";
+    //     "Response";
     private static final String GREETMEONEWAY_ACTION = null;
+    private static final String GREETME_ACTION = null;
+    private static final String GREETME_RESPONSE_ACTION = null;
 
     private Bus controlBus;
     private Control control;
@@ -63,6 +64,7 @@
     private boolean doTestOnewayDeferredAnonymousAcks = true;
     private boolean doTestOnewayDeferredNonAnonymousAcks = true;
     private boolean doTestOnewayAnonymousAcksSequenceLength1 = true;
+    private boolean doTestTwowayNonAnonymous = true;
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(SequenceTest.class);
@@ -86,25 +88,20 @@
         SpringBusFactory bf = new SpringBusFactory();
         controlBus = bf.createBus();
         bf.setDefaultBus(controlBus);
-        LOG.fine("Initialised control bus.");
         controlBus = new SpringBusFactory().getDefaultBus();
 
         ControlService service = new ControlService();
-        LOG.fine("Created ControlService.");
         control = service.getControlPort();
-        LOG.fine("Created Control.");
     }
     
     public void tearDown() {
         if (null != greeter) {
             assertTrue("Failed to stop greeter.", control.stopGreeter());            
             greeterBus.shutdown(true);
-            LOG.fine("Shutdown greeter bus.");
             greeterBus = null;
         }
         if (null != control) {               
             controlBus.shutdown(true);
-            LOG.fine("Shutdown control bus.");
         }
     }
 
@@ -268,6 +265,48 @@
         mf.verifyLastMessage(new boolean[] {false, false, false, false, false, false}, false);
         mf.verifyAcknowledgements(new boolean[] {false, true, false, false, true, false},
false);
     }
+    
+    public void testTwowayNonAnonymous() throws Exception {
+        if (!doTestTwowayNonAnonymous) {
+            return;
+        }
+        setupGreeter("org/apache/cxf/systest/ws/rm/twoway.xml");
+
+        greeter.greetMe("one");
+        greeter.greetMe("two");
+        greeter.greetMe("three");
+
+        // CreateSequence and three greetMe messages
+        // TODO there should be partial responses to the decoupled responses!
+
+        // awaitMessages(6, 6);
+        
+        MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
+        
+        
+        mf.verifyMessages(4, true);
+        String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(), 
+                                                 GREETME_ACTION,
+                                                 GREETME_ACTION, 
+                                                 GREETME_ACTION};
+        mf.verifyActions(expectedActions, true);
+        mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, true);
+        mf.verifyLastMessage(new boolean[] {false, false, false, false}, true);
+        mf.verifyAcknowledgements(new boolean[] {false, false, true, true}, true);
+
+        // createSequenceResponse plus 3 greetMeResponse messages plus
+        // one partial response for each of the four messages
+
+        mf.verifyMessages(8, false);
+        expectedActions = new String[] {null, RMConstants.getCreateSequenceResponseAction(),

+                                        null, GREETME_RESPONSE_ACTION, 
+                                        null, GREETME_RESPONSE_ACTION, 
+                                        null, GREETME_RESPONSE_ACTION};
+        mf.verifyActions(expectedActions, false);
+        mf.verifyMessageNumbers(new String[] {null, null, null, "1", null, "2", null, "3"},
false);
+        mf.verifyLastMessage(new boolean[8], false);
+        mf.verifyAcknowledgements(new boolean[] {false, false, false, true, false, true,
false, true}, false);
+    }
 
 
     // --- test utilities ---
@@ -277,7 +316,7 @@
         SpringBusFactory bf = new SpringBusFactory();
         greeterBus = bf.createBus(cfgResource);
         bf.setDefaultBus(greeterBus);
-        LOG.fine("Initialised greeter bus.");
+        LOG.fine("Initialised greeter bus with configuration: " + cfgResource);
 
         outRecorder = new OutMessageRecorder();
         greeterBus.getOutInterceptors().add(new JaxwsInterceptorRemover());

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway.xml?view=auto&rev=475711
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/twoway.xml Thu
Nov 16 04:30:24 2006
@@ -0,0 +1,38 @@
+<?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:wsrm-mgmt="http://cxf.apache.org/ws/rm/manager"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean name="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit" abstract="true">
+        <property name="client">
+            <value>
+                <http-conf:client DecoupledEndpoint="http://localhost:9998/decoupled_endpoint"/>
+            </value>
+        </property>
+    </bean>
+    
+    <import resource="rminterceptors.xml"/>  
+
+</beans>
\ No newline at end of file

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

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

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



Mime
View raw message