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