axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From barre...@apache.org
Subject svn commit: r899243 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/context/OperationContext.java test/org/apache/axis2/context/OperationContextTest.java
Date Thu, 14 Jan 2010 15:37:46 GMT
Author: barrettj
Date: Thu Jan 14 15:37:46 2010
New Revision: 899243

URL: http://svn.apache.org/viewvc?rev=899243&view=rev
Log:
Fix bug in OperationContext.removeMessageContexts(String) that was causing it to never remove
anything.  Added TDD unit test for same.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/context/OperationContextTest.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java?rev=899243&r1=899242&r2=899243&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/OperationContext.java
Thu Jan 14 15:37:46 2010
@@ -296,7 +296,7 @@
 
         MessageContext mc = getMessageContext(label);
         if (mc != null) {
-            messageContexts.remove(mc);
+            messageContexts.remove(label);
             setComplete(false); 
             touch();
         }

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/context/OperationContextTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/context/OperationContextTest.java?rev=899243&r1=899242&r2=899243&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/context/OperationContextTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/context/OperationContextTest.java
Thu Jan 14 15:37:46 2010
@@ -32,6 +32,8 @@
 
 import javax.xml.namespace.QName;
 
+import java.util.HashMap;
+
 public class OperationContextTest extends AbstractTestCase {
 
     private ConfigurationContext configContext = new ConfigurationContext(
@@ -74,5 +76,20 @@
         return messageContext;
 
     }
-
+        
+    public void testRemoveMessageContext() {
+        OperationContext opCtx = new OperationContext();
+        HashMap<String, MessageContext> msgCtxMap = opCtx.getMessageContexts();
+        assertTrue("Initial map not empty", msgCtxMap.isEmpty());
+        msgCtxMap.put("Key-1", new MessageContext());
+        msgCtxMap.put("Key-2", new MessageContext());
+        assertEquals("Map not created correctly", 2, msgCtxMap.size());
+        try {
+            opCtx.removeMessageContext("Key-1");
+            assertEquals("Label not removed correctly", 1, msgCtxMap.size());
+        }
+        catch (Exception e) {
+            fail("Unexpected exception: " + e);
+        }
+    }
 }



Mime
View raw message