1
2
3
4
5
6
7 package org.mule.transport.jdbc.functional;
8
9 import static org.junit.Assert.assertEquals;
10 import static org.junit.Assert.fail;
11
12 import org.mule.api.client.MuleClient;
13
14 import java.sql.Connection;
15 import java.util.List;
16
17 import org.apache.commons.dbutils.QueryRunner;
18 import org.apache.commons.dbutils.handlers.ArrayListHandler;
19 import org.junit.Test;
20
21
22
23
24 public class JdbcEndpointWithNestedQueriesTestCase extends AbstractJdbcFunctionalTestCase
25 {
26 public JdbcEndpointWithNestedQueriesTestCase()
27 {
28 super();
29 setPopulateTestData(false);
30 }
31
32 @Override
33 protected String getConfigResources()
34 {
35 return "jdbc-endpoint-with-nested-queries-test.xml";
36 }
37
38 @Test
39 public void testDisposeAfterQueryExecution() throws Exception
40 {
41 QueryRunner queryRunner = jdbcConnector.getQueryRunner();
42 Connection connection = jdbcConnector.getConnection();
43
44
45 MuleClient client = muleContext.getClient();
46 client.send("vm://in", "some test data", null);
47
48
49 List<?> results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST", new ArrayListHandler());
50 assertEquals(1, results.size());
51
52
53 try
54 {
55 muleContext.dispose();
56 }
57 catch (Exception ex)
58 {
59 fail("Server disposal failed");
60 }
61 }
62 }