1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.jdbc.test;
12
13 import com.mockobjects.dynamic.Mock;
14
15 import java.io.PrintWriter;
16 import java.sql.Connection;
17 import java.sql.SQLException;
18
19 import javax.sql.DataSource;
20
21 public class TestDataSource implements DataSource
22 {
23
24 public Connection getConnection() throws SQLException
25 {
26 Mock mockConnection = new Mock(Connection.class);
27 mockConnection.expectAndReturn("getAutoCommit", false);
28 mockConnection.expect("commit");
29 mockConnection.expect("close");
30
31 return (Connection) mockConnection.proxy();
32 }
33
34 public Connection getConnection(String username, String password) throws SQLException
35 {
36 return getConnection();
37 }
38
39 public int getLoginTimeout() throws SQLException
40 {
41 return 0;
42 }
43
44 public PrintWriter getLogWriter() throws SQLException
45 {
46 return null;
47 }
48
49 public void setLoginTimeout(int seconds) throws SQLException
50 {
51
52 }
53
54 public void setLogWriter(PrintWriter out) throws SQLException
55 {
56
57 }
58 }
59
60