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 2015/11/25 08:49:23 UTC

svn commit: r1716316 - /axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java

Author: veithen
Date: Wed Nov 25 07:49:23 2015
New Revision: 1716316

URL: http://svn.apache.org/viewvc?rev=1716316&view=rev
Log:
Test cases should not have side effects visible to other test cases.

Modified:
    axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java

Modified: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java?rev=1716316&r1=1716315&r2=1716316&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerPrePostInvokerTests.java Wed Nov 25 07:49:23 2015
@@ -124,25 +124,27 @@ public class HandlerPrePostInvokerTests
     }
 
     public void testPostInvokerMessageAccessed() {
-        
-        FactoryRegistry.setFactory(HandlerPostInvokerFactory.class, new HandlerPostInvokerFactoryImpl());
-        
-        ArrayList<Handler> handlers = new ArrayList<Handler>();
-        handlers.add(new SOAPHandlerGetsMessage());
-        HandlerChainProcessor processor =
-                new HandlerChainProcessor(handlers, Protocol.soap11);
-        boolean success = true;
-        // server-side incoming request
-        success = processor.processChain(mc.getMEPContext(),
-                                HandlerChainProcessor.Direction.IN,
-                                HandlerChainProcessor.MEP.REQUEST,
-                                true);
-        
-        assertTrue("processChain should have succeeded", success);
-        assertTrue("postInvoker should have been called", postInvokerCalled);
-        assertTrue("Handler did access message but messageAccessed property is false.", messageAccessed);
-
-
+        HandlerPostInvokerFactory orgHandlerPostInvokerFactory = (HandlerPostInvokerFactory)FactoryRegistry.getFactory(HandlerPostInvokerFactory.class);
+        try {
+            FactoryRegistry.setFactory(HandlerPostInvokerFactory.class, new HandlerPostInvokerFactoryImpl());
+            
+            ArrayList<Handler> handlers = new ArrayList<Handler>();
+            handlers.add(new SOAPHandlerGetsMessage());
+            HandlerChainProcessor processor =
+                    new HandlerChainProcessor(handlers, Protocol.soap11);
+            boolean success = true;
+            // server-side incoming request
+            success = processor.processChain(mc.getMEPContext(),
+                                    HandlerChainProcessor.Direction.IN,
+                                    HandlerChainProcessor.MEP.REQUEST,
+                                    true);
+            
+            assertTrue("processChain should have succeeded", success);
+            assertTrue("postInvoker should have been called", postInvokerCalled);
+            assertTrue("Handler did access message but messageAccessed property is false.", messageAccessed);
+        } finally {
+            FactoryRegistry.setFactory(HandlerPostInvokerFactory.class, orgHandlerPostInvokerFactory);
+        }
     }
 
     /*****************************************