cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r598904 - in /incubator/cxf/trunk: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/ systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/ systests/src/test/java/...
Date Wed, 28 Nov 2007 08:25:03 GMT
Author: mmao
Date: Wed Nov 28 00:25:02 2007
New Revision: 598904

URL: http://svn.apache.org/viewvc?rev=598904&view=rev
Log:
CXF-1191 
 * Fix the build
 * Support explicit action name for both input/output


Modified:
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/AddNumberImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
    incubator/cxf/trunk/systests/src/test/resources/wsdl/add_numbers.wsdl

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Wed Nov 28 00:25:02 2007
@@ -39,6 +39,7 @@
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
@@ -56,6 +57,9 @@
     private static final Logger LOG = 
         LogUtils.getL7dLogger(MAPAggregator.class);
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    private static final QName WSAW_ACTION_QNAME = new QName("http://www.w3.org/2006/05/addressing/wsdl",

+                                                             "Action");
     
 
     /**
@@ -388,6 +392,29 @@
         return maps;
     }
 
+    private String getActionFromInputMessage(final OperationInfo operation) {
+        MessageInfo inputMessage = operation.getInput();
+
+        if (inputMessage.getExtensionAttributes() != null) {
+            QName inputAction = (QName)inputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
+            if (inputAction != null) {
+                return inputAction.getLocalPart();
+            }
+        }
+        return null;
+    }
+    
+    private String getActionFromOutputMessage(final OperationInfo operation) {
+        MessageInfo outputMessage = operation.getOutput();
+        if (outputMessage != null && outputMessage.getExtensionAttributes() != null)
{
+            QName outputAction = (QName)outputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
+            if (outputAction != null) {
+                return outputAction.getLocalPart();
+            }
+        }
+        return null;
+    }
+
     protected String getActionUri(Message message) {
         OperationInfo op = message.getExchange().get(OperationInfo.class);
         String interfaceName = op.getInterface().getName().getLocalPart();
@@ -396,13 +423,19 @@
         String opNamespace = addPath(op.getName().getNamespaceURI(), interfaceName);
         
         if (ContextUtils.isRequestor(message)) {
-            if (null == op.getInputName()) {
+            String explicitAction = getActionFromInputMessage(op);
+            if (explicitAction != null) {
+                actionUri = explicitAction;
+            } else if (null == op.getInputName()) {
                 actionUri = addPath(opNamespace, op.getName().getLocalPart() + "Request");
             } else {
                 actionUri = addPath(opNamespace, op.getInputName());
             }
         } else {
-            if (null == op.getOutputName()) {
+            String explicitAction = getActionFromOutputMessage(op);
+            if (explicitAction != null) {
+                actionUri = explicitAction;
+            } else if (null == op.getOutputName()) {
                 actionUri = addPath(opNamespace, op.getOutput().getName().getLocalPart());
             } else {
                 actionUri = addPath(opNamespace, op.getOutputName());

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/AddNumberImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/AddNumberImpl.java?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/AddNumberImpl.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_feature/AddNumberImpl.java
Wed Nov 28 00:25:02 2007
@@ -34,4 +34,8 @@
     public int addNumbers2(int number1, int number2) {
         return number1 + number2;
     }
+
+    public int addNumbers3(int number1, int number2) {
+        return number1 + number2;
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/AddNumberImpl.java
Wed Nov 28 00:25:02 2007
@@ -36,4 +36,8 @@
     public int addNumbers2(int number1, int number2) {
         return number1 + number2;
     }
+
+    public int addNumbers3(int number1, int number2) {
+        return number1 + number2;
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addr_fromwsdl/WSAFromWSDLTest.java
Wed Nov 28 00:25:02 2007
@@ -102,6 +102,23 @@
         assertTrue(input.toString().indexOf(expectedIn) != -1);
     }
 
+
+    @Test
+    public void testAddNumbers3() throws Exception {
+        ByteArrayOutputStream input = setupInLogging();
+        ByteArrayOutputStream output = setupOutLogging();
+
+        AddNumbersPortType port = getPort();
+
+        assertEquals(3, port.addNumbers3(1, 2));
+
+        String expectedOut = "3in";
+        String expectedIn = "3out";
+
+        assertTrue(output.toString().indexOf(expectedOut) != -1);
+        assertTrue(input.toString().indexOf(expectedIn) != -1);
+    }
+
     private AddNumbersPortType getPort() {
         URL wsdl = getClass().getResource("/wsdl/add_numbers.wsdl");
         assertNotNull("WSDL is null", wsdl);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java
Wed Nov 28 00:25:02 2007
@@ -59,6 +59,9 @@
         = "http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest";
     public static final String GREETME_ACTION
         = "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest";
+    private static final String GREETME_RESPONSE_ACTION
+        = "http://cxf.apache.org/greeter_control/Greeter/greetMeResponse";
+
     private static final Logger LOG = LogUtils.getLogger(ServerPersistenceTest.class);
     private static final String CFG = "/org/apache/cxf/systest/ws/rm/persistent.xml";
     private static final String SERVER_LOSS_CFG 
@@ -179,8 +182,8 @@
         mf.verifyPartialResponses(4);
         mf.purgePartialResponses();
         expectedActions = new String[] {RMConstants.getCreateSequenceResponseAction(),
-                                        GREETME_ACTION,
-                                        GREETME_ACTION};
+                                        GREETME_RESPONSE_ACTION,
+                                        GREETME_RESPONSE_ACTION};
         mf.verifyActions(expectedActions, false);
         // mf.verifyMessageNumbers(new String[] {null, "1", "3"}, false);
         // mf.verifyAcknowledgements(new boolean[] {false, true, true}, false);    
@@ -216,7 +219,7 @@
             assertTrue(nIn >= 1);
             String[] expectedActions = new String[nIn];
             for (int i = 0; i < nIn; i++) {
-                expectedActions[i] = GREETME_ACTION;
+                expectedActions[i] = GREETME_RESPONSE_ACTION;
             }
             mf.verifyActions(expectedActions, false);
         }

Modified: incubator/cxf/trunk/systests/src/test/resources/wsdl/add_numbers.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/wsdl/add_numbers.wsdl?rev=598904&r1=598903&r2=598904&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/wsdl/add_numbers.wsdl (original)
+++ incubator/cxf/trunk/systests/src/test/resources/wsdl/add_numbers.wsdl Wed Nov 28 00:25:02
2007
@@ -89,11 +89,11 @@
 	    <output message="tns:addNumbers2Response" name="add2Out"/>
 <!-- 	    <fault name="addNumbersFault" message="tns:addNumbersFault"/> -->
 	</operation>
-<!-- 	<operation name="addNumbers3"> -->
-<!-- 	    <input message="tns:addNumbers3" wsaw:Action="3in"/> -->
-<!-- 	    <output message="tns:addNumbers3Response" wsaw:Action="3out"/> -->
+	<operation name="addNumbers3">
+	    <input message="tns:addNumbers3" wsaw:Action="3in"/>
+	    <output message="tns:addNumbers3Response" wsaw:Action="3out"/>
 <!-- 	    <fault name="addNumbersFault" message="tns:addNumbersFault" wsaw:Action="3fault"/>
-->
-<!-- 	</operation> -->
+	</operation>
     </portType>
     <binding name="AddNumbersBinding" type="tns:AddNumbersPortType">
 	<wsaw:UsingAddressing wsdl:required="false" />
@@ -124,18 +124,18 @@
 <!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
 <!-- 	    </fault> -->
 	</operation>
-<!-- 	<operation name="addNumbers3"> -->
-<!-- 	    <soap:operation soapAction="" /> -->
-<!-- 	    <input> -->
-<!-- 		<soap:body use="literal" /> -->
-<!-- 	    </input> -->
-<!-- 	    <output> -->
-<!-- 		<soap:body use="literal" /> -->
-<!-- 	    </output> -->
+	<operation name="addNumbers3">
+	    <soap:operation soapAction="" />
+	    <input>
+		<soap:body use="literal" />
+	    </input>
+	    <output>
+		<soap:body use="literal" />
+	    </output>
 <!-- 	    <fault name="addNumbersFault"> -->
 <!-- 		<soap:fault name="addNumbersFault" use="literal" /> -->
 <!-- 	    </fault> -->
-<!-- 	</operation> -->
+	</operation>
     </binding>
     <service name="AddNumbersService">
 	<port name="AddNumbersPort" binding="tns:AddNumbersBinding">



Mime
View raw message