You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2008/03/03 19:05:38 UTC

svn commit: r633215 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/engine/DispatchPhase.java test/org/apache/axis2/engine/DispatchPhaseTest.java

Author: damrhei
Date: Mon Mar  3 10:05:36 2008
New Revision: 633215

URL: http://svn.apache.org/viewvc?rev=633215&view=rev
Log:
Updates to the DispatchPhase such that is considers MEPs defined in WSDL2Constants.

Added:
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/DispatchPhaseTest.java
Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java?rev=633215&r1=633214&r2=633215&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/DispatchPhase.java Mon Mar  3 10:05:36 2008
@@ -31,6 +31,7 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.RequestResponseTransport;
 import org.apache.axis2.transport.TransportListener;
@@ -116,15 +117,15 @@
         Boolean disableAck = (Boolean) msgContext.getProperty(Constants.Configuration.DISABLE_RESPONSE_ACK);
         if(disableAck == null || disableAck.booleanValue() == false) {
         	String mepString = msgContext.getAxisOperation().getMessageExchangePattern();
-        	if (mepString.equals(WSDL20_2006Constants.MEP_URI_IN_ONLY)
-	                || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY)) {
+        	if (isOneway(mepString)) {
 	            Object requestResponseTransport =
 	                    msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
 	            if (requestResponseTransport != null) {
 	                ((RequestResponseTransport) requestResponseTransport).acknowledgeMessage(msgContext);
 	            }
 	        } else if (mepString.equals(WSDL20_2006Constants.MEP_URI_IN_OUT)
-	                || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_OUT)) { // OR, if 2 way operation but the response is intended to not use the response channel of a 2-way transport
+	                || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_OUT)
+	                || mepString.equals(WSDL2Constants.MEP_URI_IN_OUT)) { // OR, if 2 way operation but the response is intended to not use the response channel of a 2-way transport
 	            // then we don't need to keep the transport waiting.
 	            Object requestResponseTransport =
 	                    msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
@@ -279,6 +280,16 @@
                 msgContext.setServiceGroupContextId(serviceGroupId.getText());
             }
         }
+    }
+    
+    /**
+     * This method will determine if the MEP indicated by 'mepString' specifies
+     * a oneway MEP.
+     */
+    boolean isOneway(String mepString) {
+        return (mepString.equals(WSDL20_2006Constants.MEP_URI_IN_ONLY)
+                || mepString.equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY)
+                || mepString.equals(WSDL2Constants.MEP_URI_IN_ONLY));
     }
 
 }

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/DispatchPhaseTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/DispatchPhaseTest.java?rev=633215&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/DispatchPhaseTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/DispatchPhaseTest.java Mon Mar  3 10:05:36 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.axis2.engine;
+
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004_Constants;
+import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2006Constants;
+
+import junit.framework.TestCase;
+
+public class DispatchPhaseTest extends TestCase {
+    
+    /**
+     * Verify capability of isOneway method in DispatchPhase.
+     */
+    public void testIsOneway() {
+        String mep = WSDL2Constants.MEP_URI_IN_ONLY;
+        DispatchPhase phase = new DispatchPhase();
+        boolean oneway = phase.isOneway(mep);
+        assertTrue(oneway);
+        mep = WSDL20_2004_Constants.MEP_URI_IN_ONLY;
+        oneway = phase.isOneway(mep);
+        assertTrue(oneway);
+        mep = WSDL20_2006Constants.MEP_URI_IN_ONLY;
+        oneway = phase.isOneway(mep);
+        assertTrue(oneway);
+        mep = WSDL2Constants.MEP_URI_IN_OUT;
+        oneway = phase.isOneway(mep);
+        assertFalse(oneway);
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org