Author: veithen
Date: Mon Sep 19 20:13:22 2011
New Revision: 1172791

URL: http://svn.apache.org/viewvc?rev=1172791&view=rev
Log:
AXIS2-5111: Merged r1154615 to the 1.6 branch.

Added:
    
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java
      - copied unchanged from r1154615, 
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java
Modified:
    axis/axis2/java/core/branches/1_6/   (props changed)
    
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java
    
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/Echo.java
    
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
    
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/integration/UtilServer.java
    
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java

Propchange: axis/axis2/java/core/branches/1_6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 20:13:22 2011
@@ -1 +1 @@
-/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1156305,1156382,1157211,1157265,1157373,1157415,1157424,1157501,1157517,1157522,1157535,1163389,1166038,1166040,1167045
+/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1154615,1156305,1156382,1157211,1157265,1157373,1157415,1157424,1157501,1157517,1157522,1157535,1163389,1166038,1166040,1167045

Modified: 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java?rev=1172791&r1=1172790&r2=1172791&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java
 (original)
+++ 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/deployment/TargetResolverServiceTest.java
 Mon Sep 19 20:13:22 2011
@@ -39,7 +39,7 @@ public class TargetResolverServiceTest e
                        public void receive(MessageContext msgContext) throws 
AxisFault {
                                // Set the reply to on the server side to test 
server side
                                // target resolvers
-                               msgContext.setReplyTo(new EndpointReference(
+                               msgContext.setTo(new EndpointReference(
                    "http://ws.apache.org/new/anonymous/address";));
                            new 
RawXMLINOutMessageReceiver().receive(msgContext);
                        }

Modified: 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/Echo.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/Echo.java?rev=1172791&r1=1172790&r2=1172791&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/Echo.java
 (original)
+++ 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/Echo.java
 Mon Sep 19 20:13:22 2011
@@ -29,7 +29,7 @@ public class Echo {
     private static final Log log = LogFactory.getLog(Echo.class);
     public static final String SERVICE_NAME = "EchoXMLService";
     public static final String ECHO_OM_ELEMENT_OP_NAME = "echoOMElement";
-    
+
     public Echo() {
     }
 
@@ -42,7 +42,7 @@ public class Echo {
         log.info("echoOMElementNoResponse service called.");
     }
 
-     public void echoWithExeption(OMElement omEle) throws Exception {
+    public void echoWithExeption(OMElement omEle) throws Exception {
         throw new Exception("Invoked the service");
     }
 
@@ -55,6 +55,21 @@ public class Echo {
         return omEle;
     }
 
+    public OMElement longRunning(OMElement omEle) {
+        omEle.buildWithAttachments();
+        omEle.setLocalName(omEle.getLocalName() + "Response");
+        if (omEle.getFirstElement().getText().trim().startsWith("fault")) {
+            throw new RuntimeException("fault string found in echoOMElement");
+        }
+        try {
+            Thread.sleep(60000);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return omEle;
+    }
+
+
     public OMElement echoOM(OMElement omEle) {
         return omEle;
     }
@@ -68,7 +83,7 @@ public class Echo {
     }
 
     public OMElement echoMTOMtoBase64(OMElement omEle) {
-        OMText omText = (OMText)(omEle.getFirstElement()).getFirstOMChild();
+        OMText omText = (OMText) (omEle.getFirstElement()).getFirstOMChild();
         omText.setOptimize(false);
         return omEle;
     }

Modified: 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java?rev=1172791&r1=1172790&r2=1172791&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
 (original)
+++ 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
 Mon Sep 19 20:13:22 2011
@@ -161,7 +161,6 @@ public class PausingHandlerExecutionTest
     private void executeClient() throws Exception {
         OMElement payload = TestingUtils.createDummyOMElement();
         OMElement result = createClient().sendReceive(payload);
-
         TestingUtils.compareWithCreatedOMElement(result);
     }
 
@@ -192,8 +191,8 @@ public class PausingHandlerExecutionTest
 
         // expected results when pausing
         List expectedExecutionState = Arrays.asList(new String[] { "In1", 
"In2", "In2", "In3",
-                "In4", "In5", "In6", "Out1", "Out2", "Out3", "FCOut3", 
"FCOut2", "FCOut1", "FCIn6",
-                "FCIn5", "FCIn4", "FCIn3", "FCIn2", "FCIn1" });
+                "In4", "In5", "In6", "FCIn6", "FCIn5", "FCIn4", "FCIn3", 
"FCIn2", "FCIn1", "Out1",
+                "Out2", "Out3", "FCOut3", "FCOut2", "FCOut1" });
         
//-----------------------------------------------------------------------
         assertEquals(expectedExecutionState, testResults);
 

Modified: 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/integration/UtilServer.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/integration/UtilServer.java?rev=1172791&r1=1172790&r2=1172791&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/integration/UtilServer.java
 (original)
+++ 
axis/axis2/java/core/branches/1_6/modules/integration/test/org/apache/axis2/integration/UtilServer.java
 Mon Sep 19 20:13:22 2011
@@ -137,8 +137,8 @@ public class UtilServer {
         }
         return ConfigurationContextFactory
                 
.createConfigurationContextFromFileSystem(file.getAbsolutePath(),
-                                                          
file.getAbsolutePath() +
-                                                                  
"/conf/axis2.xml");
+                        file.getAbsolutePath() +
+                                "/conf/axis2.xml");
     }
 
     public static ConfigurationContext getNewConfigurationContext(
@@ -150,7 +150,7 @@ public class UtilServer {
         }
         return ConfigurationContextFactory
                 
.createConfigurationContextFromFileSystem(file.getAbsolutePath(),
-                                                          axis2xml);
+                        axis2xml);
     }
 
     public static synchronized void stop() throws AxisFault {
@@ -184,7 +184,7 @@ public class UtilServer {
                 .createConfigurationContextFromFileSystem(
                         
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), 
null);
         AxisModule axisModule = DeploymentEngine.buildModule(file,
-                                                             
configContext.getAxisConfiguration());
+                configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
 
         configContext.getAxisConfiguration().addService(service);
@@ -215,18 +215,26 @@ public class UtilServer {
         TestCase.assertTrue(file.exists());
 
         ConfigurationContext configContext =
-                ConfigurationContextFactory 
.createConfigurationContextFromFileSystem(
-                        
TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH +"/integrationRepo"),
+                
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
+                        
TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + "/integrationRepo"),
                         
TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + 
"/integrationRepo/conf/axis2.xml"));
         AxisModule axisModule = DeploymentEngine.buildModule(file,
-                                                             
configContext.getAxisConfiguration());
+                configContext.getAxisConfiguration());
         configContext.getAxisConfiguration().addModule(axisModule);
         return configContext;
     }
 
+    public static void engageAddressingModule() throws AxisFault {
+        File file = getAddressingMARFile();
+        AxisModule axisModule = DeploymentEngine.buildModule(file,
+                receiver.getConfigurationContext().getAxisConfiguration());
+        
receiver.getConfigurationContext().getAxisConfiguration().engageModule(axisModule);
+    }
+
+
     public static ConfigurationContext createClientConfigurationContext(String 
repo)
             throws AxisFault {
-        return ConfigurationContextFactory 
.createConfigurationContextFromFileSystem(
+        return 
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                 repo,
                 repo + "/conf/axis2.xml");
     }
@@ -239,7 +247,7 @@ public class UtilServer {
         ConfigurationContext configContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem(clientHome, null);
         AxisModule axisModule = DeploymentEngine.buildModule(file,
-                                                             
configContext.getAxisConfiguration());
+                configContext.getAxisConfiguration());
 
         configContext.getAxisConfiguration().addModule(axisModule);
 // sysContext.getAxisConfiguration().engageModule(moduleDesc.getName());

Modified: 
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?rev=1172791&r1=1172790&r2=1172791&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
 (original)
+++ 
axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
 Mon Sep 19 20:13:22 2011
@@ -83,27 +83,31 @@ public abstract class AbstractMessageRec
      * @throws AxisFault if a problem occurred
      */
     public void receive(final MessageContext messageCtx) throws AxisFault {
-       if (messageCtx.isPropertyTrue(DO_ASYNC)
-                               || ((messageCtx.getParameter(DO_ASYNC) != null) 
&&
-                    
JavaUtils.isTrueExplicitly(messageCtx.getParameter(DO_ASYNC).getValue()))) {
-
+        // Checking whether the replyTo address, if it is non Anonymous then 
we need to send the ACK and
+        // send the reply to on replyTo address
+        EndpointReference replyTo = messageCtx.getReplyTo();
+        if (replyTo != null && !replyTo.hasAnonymousAddress()) {
+            // We have a valid reply to address, so processing the request 
through AsyncMessageReceiverWorker and send the ACK
+            processAsAsync(messageCtx);
+            return;
+        }
+        // Checking for long running services
+        if (messageCtx.isPropertyTrue(DO_ASYNC)
+                || ((messageCtx.getParameter(DO_ASYNC) != null) &&
+                
JavaUtils.isTrueExplicitly(messageCtx.getParameter(DO_ASYNC).getValue()))) {
             String mep = messageCtx.getAxisOperation()
-                                       .getMessageExchangePattern();
-                       EndpointReference replyTo = messageCtx.getReplyTo();
-                       // In order to invoke the service in the ASYNC mode, 
the request
+                    .getMessageExchangePattern();
+            // Checking whether the replyTo address is valid, so that we can 
send the Application response
+            // In order to invoke the service in the ASYNC mode, the request
                        // should contain ReplyTo header if the MEP of the 
service is not
                        // InOnly type
-                       if ((!WSDLUtil.isOutputPresentForMEP(mep))
-                                       || (replyTo != null && 
!replyTo.hasAnonymousAddress())) {
-                               AsyncMessageReceiverWorker worker = new 
AsyncMessageReceiverWorker(
-                                               messageCtx);
-                               messageCtx.getEnvelope().build();
-                               
messageCtx.getConfigurationContext().getThreadPool().execute(
-                                               worker);
-                               return;
-                       }
-               }
+            if ((!WSDLUtil.isOutputPresentForMEP(mep))
+                    || (replyTo != null && !replyTo.hasAnonymousAddress())) {
+                processAsAsync(messageCtx);
+                return;
+            }
 
+        }
 
         ThreadContextDescriptor tc = setThreadContext(messageCtx);
         try {
@@ -129,6 +133,28 @@ public abstract class AbstractMessageRec
     }
 
     /**
+     * This is to create a separate thread to process business logic 
invocation. We create a AsyncMessageReceiverWorker
+     * which internally calls the message receiver specified for the operation.
+     *
+     * We send the ACK through the incoming transport and reply through the 
address specified in replyTo address.
+     * @param messageCtx msgContext the current MessageContext
+     */
+    private void processAsAsync(MessageContext messageCtx) {
+        AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(
+                messageCtx);
+        if (messageCtx.isDoingMTOM() || messageCtx.isDoingSwA()) {
+            // If we are doing MTOM or SWA then we need to build with 
attachment, because we are going to close the incoming connection
+            messageCtx.getEnvelope().buildWithAttachments();
+        } else {
+            // We need to build the envelop since we are going to close the 
input stream
+            messageCtx.getEnvelope().build();
+        }
+
+        messageCtx.getConfigurationContext().getThreadPool().execute(
+                worker);
+    }
+
+    /**
      * Several pieces of information need to be available to the service
      * implementation class.  For one, the ThreadContextClassLoader needs
      * to be correct, and for another we need to give the service code


Reply via email to