Re: [mule-scm] [mule][24684] branches/mule-3.2.x/transports/jdbc/src: MULE-6366: JDBC Outbound endpoint, loss of session properties when outbound endpoint is request response

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [mule-scm] [mule][24684] branches/mule-3.2.x/transports/jdbc/src: MULE-6366: JDBC Outbound endpoint, loss of session properties when outbound endpoint is request response

Pablo Kraan
This change breaks JdbcMessagePropertiesCopyingTestCase.

Pablo

On Fri, Jul 27, 2012 at 2:01 PM, <[hidden email]> wrote:
Revision
24684
Author
svacas
Date
2012-07-27 12:01:50 -0500 (Fri, 27 Jul 2012)

Log Message

MULE-6366: JDBC Outbound endpoint, loss of session properties when outbound endpoint is request response

Modified Paths

Added Paths

Diff

Modified: branches/mule-3.2.x/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageDispatcher.java (24683 => 24684)


--- branches/mule-3.2.x/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageDispatcher.java	2012-07-27 16:03:45 UTC (rev 24683)
+++ branches/mule-3.2.x/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageDispatcher.java	2012-07-27 17:01:50 UTC (rev 24684)
@@ -63,7 +63,7 @@
         
         SqlStatementStrategy strategy = 
             jdbcConnector.getSqlStatementStrategyFactory().create(statement, payload);
-        return strategy.executeStatement(jdbcConnector, endpoint, event, event.getTimeout());
+        return strategy.executeStatement(jdbcConnector, endpoint, event, event.getTimeout()).createInboundMessage();
     }
 
     @Override

Added: branches/mule-3.2.x/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSessionVarablesCopyingTestCase.java (0 => 24684)


--- branches/mule-3.2.x/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSessionVarablesCopyingTestCase.java	                        (rev 0)
+++ branches/mule-3.2.x/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSessionVarablesCopyingTestCase.java	2012-07-27 17:01:50 UTC (rev 24684)
@@ -0,0 +1,61 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.jdbc.functional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.mule.DefaultMuleMessage;
+import org.mule.api.MuleMessage;
+import org.mule.module.client.MuleClient;
+import org.mule.transport.NullPayload;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+
+public class JdbcSessionVarablesCopyingTestCase extends AbstractJdbcFunctionalTestCase
+{
+
+    public JdbcSessionVarablesCopyingTestCase(ConfigVariant variant, String configResources)
+    {
+        super(variant, configResources);
+    }
+
+    @Parameters
+    public static Collection<Object[]> parameters()
+    {
+        return Arrays.asList(new Object[][]{
+            {ConfigVariant.FLOW, "jdbc-session-variables-copying-flow.xml"}
+        });
+    }
+
+    @Test
+    public void testMessagePropertiesCopying() throws Exception
+    {
+        MuleClient client = new MuleClient(muleContext);
+        
+        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
+        // provide a valid type header so the JDBC query actually returns something
+        message.setOutboundProperty("type", 1);
+
+        MuleMessage result = client.send("vm://in", message);
+        assertNotNull(result);
+        assertNull(result.getExceptionPayload());
+        assertFalse(result.getPayload() instanceof NullPayload);
+        assertEquals("test", result.getSessionProperty("test"));
+    }
+
+}
Property changes on: branches/mule-3.2.x/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSessionVarablesCopyingTestCase.java
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: branches/mule-3.2.x/transports/jdbc/src/test/resources/jdbc-session-variables-copying-flow.xml (0 => 24684)


--- branches/mule-3.2.x/transports/jdbc/src/test/resources/jdbc-session-variables-copying-flow.xml	                        (rev 0)
+++ branches/mule-3.2.x/transports/jdbc/src/test/resources/jdbc-session-variables-copying-flow.xml	2012-07-27 17:01:50 UTC (rev 24684)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:spring="http://www.springframework.org/schema/beans" 
+    xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
+    xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+    xsi:schemaLocation="
+       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
+       http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc.xsd
+       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+    <jdbc:derby-data-source name="jdbcDataSource" url="jdbc:derby:muleEmbeddedDB;create=true"/>
+
+    <jdbc:connector name="jdbcConnector" pollingFrequency="1000" dataSource-ref="jdbcDataSource" queryTimeout="3000">
+        <service-overrides sessionHandler="org.mule.session.SerializeAndEncodeSessionHandler"/>
+        <jdbc:query key="getTest" value="SELECT ID, TYPE, DATA, ACK, RESULT FROM TEST WHERE TYPE = #[type] AND ACK IS NULL"/>
+    </jdbc:connector>
+
+    <flow name="testService">
+        <vm:inbound-endpoint path="in" exchange-pattern="request-response"/>
+        <message-properties-transformer scope="session">
+            <add-message-property key="test" value="test" />
+        </message-properties-transformer>
+        <jdbc:outbound-endpoint queryKey="getTest" exchange-pattern="request-response"/>
+    </flow>
+
+</mule>
Property changes on: branches/mule-3.2.x/transports/jdbc/src/test/resources/jdbc-session-variables-copying-flow.xml
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email