You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2010/11/19 23:08:26 UTC

svn commit: r1037050 - in /axis/axis2/java/core/trunk/modules/kernel: src/org/apache/axis2/description/OutOnlyAxisOperation.java test/org/apache/axis2/description/OutOnlyAxisOperationTest.java

Author: veithen
Date: Fri Nov 19 22:08:25 2010
New Revision: 1037050

URL: http://svn.apache.org/viewvc?rev=1037050&view=rev
Log:
AXIS2-4057 (OutOnlyAxisOperation: AxisMessage passed to the addMessage method is not saved as a child of the AxisOperation): Applied the patch provided by Antonio Andrade.

Added:
    axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java   (with props)
Modified:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=1037050&r1=1037049&r2=1037050&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java Fri Nov 19 22:08:25 2010
@@ -41,6 +41,9 @@ import java.util.HashMap;
 
 public class OutOnlyAxisOperation extends AxisOperation {
 
+    protected static final String OUT_MESSAGE_KEY = 
+      WSDLConstants.WSDL_MESSAGE_OUT_MESSAGE;
+    
     private AxisMessage inFaultMessage;
 
     // just to keep the inflow , there won't be any usage
@@ -48,8 +51,6 @@ public class OutOnlyAxisOperation extend
 
     private AxisMessage outFaultMessage;
 
-    private AxisMessage outMessage;
-
     public OutOnlyAxisOperation() {
         super();
         //setup a temporary name
@@ -67,7 +68,7 @@ public class OutOnlyAxisOperation extend
 
     public void addMessage(AxisMessage message, String label) {
         if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
-            outMessage = message;
+            addChild(OUT_MESSAGE_KEY, message);
         } else {
             throw new UnsupportedOperationException("Not yet implemented");
         }
@@ -99,7 +100,7 @@ public class OutOnlyAxisOperation extend
     }
 
     private void createMessage() {
-        outMessage = new AxisMessage();
+        AxisMessage outMessage = new AxisMessage();
         outMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
         outMessage.setParent(this);
         inFaultMessage = new AxisMessage();
@@ -107,11 +108,16 @@ public class OutOnlyAxisOperation extend
         outFaultMessage = new AxisMessage();
         outFaultMessage.setParent(this);
         inPhases = new ArrayList();
+        addChild(OUT_MESSAGE_KEY, outMessage);
+    }
+    
+    private AxisMessage getOutMessage() {
+        return (AxisMessage)getChild(OUT_MESSAGE_KEY);
     }
 
     public AxisMessage getMessage(String label) {
         if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE.equals(label)) {
-            return outMessage;
+          return getOutMessage();
         } else {
             throw new UnsupportedOperationException("Not yet implemented");
         }
@@ -126,7 +132,7 @@ public class OutOnlyAxisOperation extend
     }
 
     public ArrayList getPhasesOutFlow() {
-        return outMessage.getMessageFlow();
+        return getOutMessage().getMessageFlow();
     }
 
     public ArrayList getRemainingPhasesInFlow() {
@@ -142,7 +148,7 @@ public class OutOnlyAxisOperation extend
     }
 
     public void setPhasesOutFlow(ArrayList list) {
-        outMessage.setMessageFlow(list);
+        getOutMessage().setMessageFlow(list);
     }
 
     public void setRemainingPhasesInFlow(ArrayList list) {

Added: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java?rev=1037050&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java (added)
+++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java Fri Nov 19 22:08:25 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.description;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.wsdl.WSDLConstants;
+
+public class OutOnlyAxisOperationTest extends TestCase {
+
+    public void testGetChildren() {
+        OutOnlyAxisOperation operation = new OutOnlyAxisOperation();
+        AxisMessage message = new AxisMessage();
+        operation.addMessage(message, WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+        for (Iterator it = operation.getChildren(); it.hasNext();) {
+            AxisDescription o = (AxisDescription)it.next();
+            if (message == o) { // Reference check is OK here
+                return;
+            }
+        }
+        fail(operation.getClass().getName() + ".getChildren() method did not " +
+          "return the message that was added");
+    }
+
+}

Propchange: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/OutOnlyAxisOperationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native