MockDriver: Add compatability to recent java version.
parent
54f83919e4
commit
01b1eea67d
|
|
@ -5,53 +5,59 @@ import java.sql.Driver;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.DriverPropertyInfo;
|
import java.sql.DriverPropertyInfo;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.SQLFeatureNotSupportedException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
public class MockDriver implements Driver {
|
public class MockDriver implements Driver {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MockDriver driver = new MockDriver();
|
MockDriver driver = new MockDriver();
|
||||||
try {
|
try {
|
||||||
DriverManager.registerDriver(driver);
|
DriverManager.registerDriver(driver);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection connect(String url, Properties info) throws SQLException {
|
public Connection connect(String url, Properties info) throws SQLException {
|
||||||
if (!url.startsWith("jdbc:jaydebeapi://")) {
|
if (!url.startsWith("jdbc:jaydebeapi://")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Mockito.mock(Connection.class);
|
return Mockito.mock(Connection.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsURL(String url) throws SQLException {
|
public boolean acceptsURL(String url) throws SQLException {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMajorVersion() {
|
public int getMajorVersion() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinorVersion() {
|
public int getMinorVersion() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean jdbcCompliant() {
|
public boolean jdbcCompliant() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||||
|
throw new SQLFeatureNotSupportedException("Not supported by this driver.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue