package com.rubiconproject.oss.kv.distributed.test;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.sql.DataSource;
public class DummyDataSource implements DataSource {
private PrintWriter logWriter;
private int loginTimeout;
public Connection getConnection() throws SQLException {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql:///test",
"test", "test");
return conn;
} catch (Exception e) {
throw new SQLException(e);
}
}
public Connection getConnection(String username, String password)
throws SQLException {
return getConnection();
}
public PrintWriter getLogWriter() throws SQLException {
return logWriter;
}
public int getLoginTimeout() throws SQLException {
return loginTimeout;
}
public void setLogWriter(PrintWriter out) throws SQLException {
this.logWriter = out;
}
public void setLoginTimeout(int seconds) throws SQLException {
this.loginTimeout = seconds;
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
public <T> T unwrap(Class<T> iface) throws SQLException {
return null;
}
}