[jboss-svn-commits] JBL Code SVN: r24681 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/message and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jan 13 13:58:30 EST 2009


Author: tfennelly
Date: 2009-01-13 13:58:30 -0500 (Tue, 13 Jan 2009)
New Revision: 24681

Added:
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java
Removed:
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java
Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2227: ServiceInvoker not properly handling acync delivery of fault messages.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-01-13 18:24:58 UTC (rev 24680)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-01-13 18:58:30 UTC (rev 24681)
@@ -351,16 +351,22 @@
 
 	                replyMessage = eprInvoker.attemptDelivery(message, epr);
 	                if (replyMessage != null) {
-                        // remove the security context so that it is not exposed to the action pipeline.
-                        replyMessage.getContext().removeContext(SecurityService.CONTEXT);
+                        if(eprInvoker.synchronous) {
+                            // remove the security context so that it is not exposed to the action pipeline.
+                            replyMessage.getContext().removeContext(SecurityService.CONTEXT);
 
-                        if (Type.isFaultMessage(replyMessage)) {
-                            Factory.createExceptionFromFault(replyMessage) ;
+                            if (Type.isFaultMessage(replyMessage)) {
+                                Factory.createExceptionFromFault(replyMessage) ;
+                            }
+
+                            // We've delivered it, we're done!
+                            return replyMessage;
+                        } else {
+                            // It was an async delivery.  The replyMessage was just an indicator that
+                            // the delivery succeeded.  Return null...
+                            return null;
                         }
-
-                        // We've delivered it, we're done!
-	                    return replyMessage;
-	                } else {
+                    } else {
 	                    logger.info("Unresponsive EPR: " + epr+" for message: "+message.getHeader());
 
 	                    serviceClusterInfo.removeDeadEPR(epr);

Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault (from rev 24678, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault)

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java	2009-01-13 17:31:57 UTC (rev 24678)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java	2009-01-13 18:58:30 UTC (rev 24681)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.soa.esb.message.fault;
-
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.helpers.ConfigTree;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class FaultProcessorAction extends AbstractActionPipelineProcessor {
-
-    public static List<Message> faultMessages = new ArrayList<Message>();
-
-    public FaultProcessorAction(ConfigTree config) {
-    }
-
-    public Message process(Message message) throws ActionProcessingException {
-        faultMessages.add(message);
-        return message;
-    }
-}

Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java (from rev 24678, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/FaultProcessorAction.java	2009-01-13 18:58:30 UTC (rev 24681)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.message.fault;
+
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class FaultProcessorAction extends AbstractActionPipelineProcessor {
+
+    public static List<Message> faultMessages = new ArrayList<Message>();
+
+    public FaultProcessorAction(ConfigTree config) {
+    }
+
+    public Message process(Message message) throws ActionProcessingException {
+        faultMessages.add(message);
+        return message;
+    }
+}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml	2009-01-13 17:31:57 UTC (rev 24678)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml	2009-01-13 18:58:30 UTC (rev 24681)
@@ -1,18 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
-
-    <services>
-        <service category="ServiceCat" name="CallService" description="The Service">
-            <actions mep="OneWay">
-                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
-            </actions>			
-        </service>
-
-        <service category="ServiceCat" name="FaultService" description="The Fault Service">
-            <actions mep="OneWay">
-                <action name="action" class="org.jboss.soa.esb.message.fault.FaultProcessorAction" />
-            </actions>
-        </service>
-    </services>
-
-</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml (from rev 24678, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB-2227-config-01.xml	2009-01-13 18:58:30 UTC (rev 24681)
@@ -0,0 +1,18 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+    <services>
+        <service category="ServiceCat" name="CallService" description="The Service">
+            <actions mep="OneWay">
+                <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+            </actions>			
+        </service>
+
+        <service category="ServiceCat" name="FaultService" description="The Fault Service">
+            <actions mep="OneWay">
+                <action name="action" class="org.jboss.soa.esb.message.fault.FaultProcessorAction" />
+            </actions>
+        </service>
+    </services>
+
+</jbossesb>
\ No newline at end of file

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java	2009-01-13 17:31:57 UTC (rev 24678)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java	2009-01-13 18:58:30 UTC (rev 24681)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.soa.esb.message.fault;
-
-import junit.framework.TestCase;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.mock.MockAction;
-import org.jboss.soa.esb.testutils.AbstractTestRunner;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.util.Type;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBESB_2227_UnitTest extends TestCase {
-
-
-    protected void setUp() throws Exception {
-        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "GLOBAL");
-        MockAction.exception = null;
-    }
-
-    protected void tearDown() throws Exception {
-        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "NONE");
-        MockAction.exception = null;
-    }
-
-    public void test_async() throws Exception {
-        AbstractTestRunner testRunner = new AbstractTestRunner() {
-            public void test() throws Exception {
-                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "CallService");
-                Message message = MessageFactory.getInstance().getMessage();
-
-                FaultProcessorAction.faultMessages.clear();
-                MockAction.exception = new ActionProcessingException("Exception in Service Action!!!");
-
-                message.getBody().add("Hi there!");
-                message.getHeader().getCall().setFaultTo(new LogicalEPR("ServiceCat", "FaultService"));
-                invoker.deliverAsync(message);
-
-                waitForFault(message);
-
-                Message faultMessage = FaultProcessorAction.faultMessages.get(0);
-                assertTrue(Type.isFaultMessage(faultMessage));
-                assertEquals("org.jboss.soa.esb.actions.ActionProcessingException: Exception in Service Action!!!", faultMessage.getFault().getReason());
-            }
-        }.setServiceConfig("JBESB-2227-config-01.xml");
-
-        testRunner.run();
-    }
-
-    private void waitForFault(Message message) {
-        long start = System.currentTimeMillis();
-
-        while(System.currentTimeMillis() - start < 5000) {
-            if(!FaultProcessorAction.faultMessages.isEmpty()) {
-                return;
-            }
-            sleep(50);
-        }
-
-        fail("Timed out waiting on fault message!!");
-    }
-
-    private static void sleep(long millis) {
-        try {
-            Thread.sleep(millis);
-        } catch (InterruptedException e) {
-            fail("Unexpected InterruptedException exception.");
-        }
-    }
-}

Copied: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java (from rev 24678, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/fault/JBESB_2227_UnitTest.java	2009-01-13 18:58:30 UTC (rev 24681)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.message.fault;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.mock.MockAction;
+import org.jboss.soa.esb.testutils.AbstractTestRunner;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.util.Type;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_2227_UnitTest extends TestCase {
+
+
+    protected void setUp() throws Exception {
+        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "GLOBAL");
+        MockAction.exception = null;
+    }
+
+    protected void tearDown() throws Exception {
+        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "NONE");
+        MockAction.exception = null;
+    }
+
+    public void test_async() throws Exception {
+        AbstractTestRunner testRunner = new AbstractTestRunner() {
+            public void test() throws Exception {
+                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "CallService");
+                Message message = MessageFactory.getInstance().getMessage();
+
+                FaultProcessorAction.faultMessages.clear();
+                MockAction.exception = new ActionProcessingException("Exception in Service Action!!!");
+
+                message.getBody().add("Hi there!");
+                message.getHeader().getCall().setFaultTo(new LogicalEPR("ServiceCat", "FaultService"));
+                invoker.deliverAsync(message);
+
+                waitForFault(message);
+
+                Message faultMessage = FaultProcessorAction.faultMessages.get(0);
+                assertTrue(Type.isFaultMessage(faultMessage));
+                assertEquals("org.jboss.soa.esb.actions.ActionProcessingException: Exception in Service Action!!!", faultMessage.getFault().getReason());
+            }
+        }.setServiceConfig("JBESB-2227-config-01.xml");
+
+        testRunner.run();
+    }
+
+    private void waitForFault(Message message) {
+        long start = System.currentTimeMillis();
+
+        while(System.currentTimeMillis() - start < 5000) {
+            if(!FaultProcessorAction.faultMessages.isEmpty()) {
+                return;
+            }
+            sleep(50);
+        }
+
+        fail("Timed out waiting on fault message!!");
+    }
+
+    private static void sleep(long millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (InterruptedException e) {
+            fail("Unexpected InterruptedException exception.");
+        }
+    }
+}




More information about the jboss-svn-commits mailing list