cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r564144 - in /incubator/cxf/trunk: distribution/src/main/release/samples/ws_rm/ distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/
Date Thu, 09 Aug 2007 08:46:31 GMT
Author: andreasmyth
Date: Thu Aug  9 01:46:30 2007
New Revision: 564144

URL: http://svn.apache.org/viewvc?view=rev&rev=564144
Log:
Fixed RM demo broken since refactoring of the low level IO layer and modified it to use the
new feature.

Added:
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml   (with props)
Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/README.txt
    incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/MessageLossSimulator.java
    incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/ws_rm.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/README.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/README.txt?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/README.txt (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/README.txt Thu Aug  9
01:46:30 2007
@@ -3,13 +3,14 @@
 
 This demo shows how WS-ReliableMessaging support in Apache CXF may be enabled.  
 
-The client and server both use interceptor configuration to install the
-WS-RM interceptors, comprising logical interceptors (RMInInterceptor/RMOutInterceptor)
+The client and server both apply the reliableMessaging feature to the bus.
+This ensures installation of the WS-RM interceptors,
+comprising logical interceptors (RMInInterceptor/RMOutInterceptor)
 responsible for managing the reliability properties of the current message, and a
 protocol interceptor (RMSoapInterceptor) responsible for encoding/decoding
 these properties as SOAP Headers.
 
-As WS-RM is dependent on WS-Addressing, the configuration uses 
+As WS-RM is dependent on WS-Addressing, the demo uses 
 the same approach as the ws_addressing sample to enable this
 functionality. However, you may notice that the WS-Addressing
 namespace URI is different in this case (i.e.
@@ -17,21 +18,16 @@
 http://www.w3.org/2005/08/addressing). This is because the WS-RM
 specification is still based on an older version of WS-Addressing.
 
-Three additional interceptors are configured: 
-
-- LoggingInInterceptor used on both the client- and server-side to log the 
-inbound SOAP messages and display these to the console. Notice the usage of 
+The logging feature is used to log the inbound and outbound
+SOAP messages and display these to the console. Notice the usage of 
 out-of-band RM protocol messages (CreateSequence and CreateSequenceResponse)
 and the WS-RM headers in application-level messages (Sequence,
 SequenceAcknowledgement, AckRequested etc.)  
 
-- LoggingOutInterceptor used on both the client- and server-side to log the 
-outbound SOAP messages and display these to the console.
-
-- MessageLossSimulator used only on the client-side to simulate message 
-loss by discarding every second application level message. This simulated 
-unreliability allows the retransmission of unacknowledged messages to be 
-observed.
+Finally, the MessageLossSimulator interceptor is installed
+on the client-side to simulate message loss by discarding every second
+application level message. This simulated unreliability allows the retransmission
+of unacknowledged messages to be observed.
 
 This demo also illustrates usage of the decoupled HTTP transport, whereby
 a separate server->client HTTP connection is used to deliver responses

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/MessageLossSimulator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/MessageLossSimulator.java?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/MessageLossSimulator.java
(original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/src/demo/ws_rm/common/MessageLossSimulator.java
Thu Aug  9 01:46:30 2007
@@ -50,10 +50,7 @@
         addBefore(MessageSenderInterceptor.class.getName());
     }
 
-    /**
-      * Simulate loss of every second application message by replacing the stream normally

-      * provided by the transport (in the MessageSenderInterceptor)/ 
-     */ 
+    
     public void handleMessage(Message message) throws Fault {
         AddressingProperties maps =
             RMContextUtils.retrieveMAPs(message, false, true);
@@ -81,7 +78,19 @@
             }
         }
         
-        message.setContent(OutputStream.class, new WrappedOutputStream(message));     
+        message.setContent(OutputStream.class, new WrappedOutputStream(message));  
+
+        message.getInterceptorChain().add(new AbstractPhaseInterceptor<Message>(Phase.PREPARE_SEND_ENDING)
{
+
+            public void handleMessage(Message message) throws Fault {
+                try {
+                    message.getContent(OutputStream.class).close();
+                } catch (IOException e) {
+                    throw new Fault(e);
+                }
+            }
+            
+        });   
     }
     
     private class WrappedOutputStream extends AbstractWrappedOutputStream {

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/ws_rm.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/ws_rm.xml?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/ws_rm.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/ws_rm/ws_rm.xml Thu Aug  9 01:46:30
2007
@@ -19,79 +19,36 @@
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cxf="http://cxf.apache.org/core"
+       xmlns:wsa="http://cxf.apache.org/ws/addressing"
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
        xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
        xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
-       xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       xsi:schemaLocation="
+       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
        http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
-  
-    <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/>
-    <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
-    <bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor">
-        <property name="bus" ref="cxf"/>
-    </bean>
-    <bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor">
-        <property name="bus" ref="cxf"/>
-    </bean>
-    <bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
-    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
-    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
-
-    <!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus.
-->
-
-    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
-        <property name="inInterceptors">
-            <list>
-                <ref bean="mapAggregator"/>
-                <ref bean="mapCodec"/>
-                <ref bean="rmLogicalIn"/>
-                <ref bean="rmCodec"/>
-                <ref bean="logInbound"/>
-            </list>
-        </property>
-        <property name="inFaultInterceptors">
-            <list>
-                <ref bean="mapAggregator"/>
-                <ref bean="mapCodec"/>
-                <ref bean="rmLogicalIn"/>
-                <ref bean="rmCodec"/>
-                <ref bean="logInbound"/>
-            </list>
-        </property>
-        <property name="outInterceptors">
-            <list>
-                <ref bean="mapAggregator"/>
-                <ref bean="mapCodec"/>
-                <ref bean="rmLogicalOut"/>
-                <ref bean="rmCodec"/>
-                <ref bean="logOutbound"/>
-            </list>
-        </property>
-        <property name="outFaultInterceptors">
-            <list>
-                <ref bean="mapAggregator"/>
-                <ref bean="mapCodec"/>
-                <ref bean="rmLogicalOut"/>
-                <ref bean="rmCodec"/>
-                <ref bean="logOutbound"/>
-            </list>
-        </property>
-    </bean>
-
-    <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort9001.http-conduit">
+ 
+    <cxf:bus>
+        <cxf:features>
+            <cxf:logging/>
+            <wsa:addressing/>
+            <wsrm-mgr:reliableMessaging>
+                <wsrm-policy:RMAssertion>
+                    <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/> 
         
+                    <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>    
     
+                </wsrm-policy:RMAssertion>
+                <wsrm-mgr:destinationPolicy>
+                    <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
+                </wsrm-mgr:destinationPolicy>
+            </wsrm-mgr:reliableMessaging>
+        </cxf:features>
+    </cxf:bus>
+    
+    <http:conduit name="{http://cxf.apache.org/hello_world_soap_http}GreeterPort.http-conduit">
       <http:client DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
     </http:conduit>
 
-	<wsrm-mgr:rmManager id="org.apache.cxf.ws.rm.RMManager">
-		<wsrm-policy:RMAssertion>
-			<wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>           
-      <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>          
-		</wsrm-policy:RMAssertion>
-		<wsrm-mgr:destinationPolicy>
-			<wsrm-mgr:acksPolicy intraMessageThreshold="0" />
-		</wsrm-mgr:destinationPolicy>
-	</wsrm-mgr:rmManager>
-	
 </beans>

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java
Thu Aug  9 01:46:30 2007
@@ -30,16 +30,17 @@
 
 public class RMFeatureBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
-    private static final String RM_CFG_NS = "http://cxf.apache.org/wsrm-config";
+    private static final String RM_NS =
+        "http://cxf.apache.org/ws/rm/manager";
 
     @Override
     protected void parseChildElements(Element element, ParserContext ctx, BeanDefinitionBuilder
bean) {
         mapElementToJaxbProperty(element, bean, 
-                new QName(RM_CFG_NS, "deliveryAssurance"), "deliveryAssurance");
+                new QName(RM_NS, "deliveryAssurance"), "deliveryAssurance");
         mapElementToJaxbProperty(element, bean, 
-                new QName(RM_CFG_NS, "sourcePolicy"), "sourcePolicy");
+                new QName(RM_NS, "sourcePolicy"), "sourcePolicy");
         mapElementToJaxbProperty(element, bean, 
-                new QName(RM_CFG_NS, "destinationPolicy"), "destinationPolicy");
+                new QName(RM_NS, "destinationPolicy"), "destinationPolicy");
         mapElementToJaxbProperty(element, bean, 
                 new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion"),

                 "RMAssertion",
@@ -64,6 +65,11 @@
     @Override
     protected boolean shouldGenerateIdAsFallback() {
         return true;
+    }
+    
+    @Override
+    protected String getJaxbPackage() {
+        return "org.apache.cxf.ws.rm.manager";
     }
     
     

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
Thu Aug  9 01:46:30 2007
@@ -23,9 +23,11 @@
 import java.util.Collection;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.ws.rm.persistence.RMMessage;
 import org.apache.cxf.ws.rm.persistence.RMStore;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -34,19 +36,43 @@
  */
 public class RMManagerConfigurationTest extends Assert {
 
+    private Bus bus;
+    
+    @After
+    public void tearDown() {
+        bus.shutdown(true);
+        BusFactory.setDefaultBus(null);
+    }
+    
     @Test
     public void testManagerBean() {
         SpringBusFactory factory = new SpringBusFactory();
-        Bus bus = factory.createBus("org/apache/cxf/ws/rm/manager-bean.xml");
+        bus = factory.createBus("org/apache/cxf/ws/rm/manager-bean.xml", false);
         RMManager manager = bus.getExtension(RMManager.class);
+        verifyManager(manager);
+    }
+    
+    @Test
+    public void testFeature() {
+        SpringBusFactory factory = new SpringBusFactory();
+        bus = factory.createBus("org/apache/cxf/ws/rm/feature.xml");
+        RMManager manager = bus.getExtension(RMManager.class);
+        verifyManager(manager);
+    }
+    
+    private void verifyManager(RMManager manager) {
         assertNotNull(manager);
         assertTrue(manager.getSourcePolicy().getSequenceTerminationPolicy().isTerminateOnShutdown());
+        assertEquals(0L, manager.getDestinationPolicy().getAcksPolicy().getIntraMessageThreshold());
         assertEquals(10000L, manager.getRMAssertion().getBaseRetransmissionInterval()
                      .getMilliseconds().longValue());
         assertEquals(10000L, manager.getRMAssertion().getAcknowledgementInterval()
                      .getMilliseconds().longValue());        
         TestStore store = (TestStore)manager.getStore();
-        assertEquals("here", store.getLocation());        
+        assertEquals("here", store.getLocation());     
+        assertNull(manager.getDeliveryAssurance().getAtLeastOnce());
+        assertNull(manager.getDeliveryAssurance().getAtMostOnce());
+        assertNotNull(manager.getDeliveryAssurance().getInOrder());
     }
     
     static class TestStore implements RMStore {

Added: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml?view=auto&rev=564144
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml Thu Aug  9
01:46:30 2007
@@ -0,0 +1,57 @@
+<?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:cxf="http://cxf.apache.org/core"       
+       xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"       
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd       
+http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+   
+    <cxf:bus>
+        <cxf:features>
+            <wsrm-mgr:reliableMessaging>
+                <wsrm-policy:RMAssertion>         
+                    <wsrm-policy:BaseRetransmissionInterval Milliseconds="10000"/>
          
+                    <wsrm-policy:AcknowledgementInterval Milliseconds="10000"/>   
                                                    
+                </wsrm-policy:RMAssertion>
+                <wsrm-mgr:deliveryAssurance>
+                    <wsrm-mgr:InOrder/>
+                </wsrm-mgr:deliveryAssurance>
+                <wsrm-mgr:sourcePolicy>
+                    <wsrm-mgr:sequenceTerminationPolicy terminateOnShutdown="true"/>
                   
+                </wsrm-mgr:sourcePolicy>
+                <wsrm-mgr:destinationPolicy>
+                    <wsrm-mgr:acksPolicy intraMessageThreshold="0"/>              
     
+                </wsrm-mgr:destinationPolicy>
+                <wsrm-mgr:store>
+                    <bean class="org.apache.cxf.ws.rm.RMManagerConfigurationTest$TestStore">
+                        <property name="location" value="here"/>
+                    </bean>
+                </wsrm-mgr:store>                
+            </wsrm-mgr:reliableMessaging>
+        </cxf:features>
+    </cxf:bus>
+    
+</beans>

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

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

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

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml?view=diff&rev=564144&r1=564143&r2=564144
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml Thu Aug
 9 01:46:30 2007
@@ -35,6 +35,9 @@
           <wsrm-policy:BaseRetransmissionInterval Milliseconds="10000"/>          

           <wsrm-policy:AcknowledgementInterval Milliseconds="10000"/>             
                                          
       </wsrm-policy:RMAssertion>
+      <wsrm-mgr:deliveryAssurance>
+          <wsrm-mgr:InOrder/>
+      </wsrm-mgr:deliveryAssurance>
       <wsrm-mgr:sourcePolicy>
           <wsrm-mgr:sequenceTerminationPolicy terminateOnShutdown="true"/>        
           
       </wsrm-mgr:sourcePolicy>



Mime
View raw message