use of util.StubDriver in project jdk8u_jdk by JetBrains.
the class DriverManagerTests method test13.
/**
* Validate that SQLException is thrown when the URL is not valid for any of
* the registered drivers
*/
@Test(expectedExceptions = SQLException.class)
public void test13() throws Exception {
DriverManager.registerDriver(new StubDriver());
DriverManager.getDriver(InvalidURL);
}
use of util.StubDriver in project jdk8u_jdk by JetBrains.
the class DriverManagerTests method test14.
/**
* Validate that a Connection object is returned when a valid URL is
* specified to getConnection
*
*/
@Test
public void test14() throws Exception {
DriverManager.registerDriver(new StubDriver());
assertTrue(DriverManager.getConnection(StubDriverURL) != null);
assertTrue(DriverManager.getConnection(StubDriverURL, "LuckyDog", "tennisanyone") != null);
Properties props = new Properties();
props.put("user", "LuckyDog");
props.put("password", "tennisanyone");
assertTrue(DriverManager.getConnection(StubDriverURL, props) != null);
}
use of util.StubDriver in project jdk8u_jdk by JetBrains.
the class DriverManagerTests method test15.
/**
* Register a driver and make sure you find it via its URL. Deregister the
* driver and validate it is not longer registered
*
* @throws Exception
*/
@Test()
public void test15() throws Exception {
DriverManager.registerDriver(new StubDriver());
Driver d = DriverManager.getDriver(StubDriverURL);
assertTrue(d != null);
assertTrue(isDriverRegistered(d));
DriverManager.deregisterDriver(d);
assertFalse(isDriverRegistered(d));
}
use of util.StubDriver in project jdk8u_jdk by JetBrains.
the class DriverManagerPermissionsTests method test8.
/*
* Validate that deregisterDriver succeeds if
* SQLPermission("deregisterDriver") has been granted
*/
@Test
public void test8() throws SQLException {
setPolicy(new TestPolicy("deregisterDriver"));
DriverManager.deregisterDriver(new StubDriver());
}
use of util.StubDriver in project jdk8u_jdk by JetBrains.
the class DriverManagerPermissionsTests method test9.
/*
* Validate that deregisterDriver succeeds if AllPermissions has been
* granted
*/
@Test
public void test9() throws SQLException {
setPolicy(new TestPolicy("all"));
DriverManager.deregisterDriver(new StubDriver());
}
Aggregations