1 package uba.db.jdbc;
2
3 import java.sql.Connection;
4 import java.sql.DriverPropertyInfo;
5 import java.util.Properties;
6
7 /***
8 * @version $Revision: 1.1.1.1 $
9 */
10 public class MockConnectionFactory implements ConnectionFactory {
11 private String validConnectionURL;
12 private DriverPropertyInfo[] connectionPropertiesInformation;
13 private Connection createConnectionResult;
14
15 public boolean canCreateConnectionTo(String connectionURL) {
16 return connectionURL.equals(validConnectionURL);
17 }
18
19 public void acceptsConnectionTo(String validConnectionURL) {
20 this.validConnectionURL = validConnectionURL;
21 }
22
23 public void setConnectionPropertiesInformation(DriverPropertyInfo[] driverPropertyInfos) {
24 this.connectionPropertiesInformation = driverPropertyInfos;
25 }
26
27 public DriverPropertyInfo[] getConnectionPropertiesInformation() {
28 return connectionPropertiesInformation;
29 }
30
31 public void setCreateConnectionResult(Connection conn) {
32 createConnectionResult = conn;
33 }
34
35 public Connection createConnection(String url, Properties info) {
36 return createConnectionResult;
37 }
38 }