change
This commit is contained in:
parent
cb017ca0bd
commit
f52b5fe423
|
@ -24,11 +24,10 @@ public class TSDBDriverTest {
|
||||||
"jdbc:TAOS://:/test",
|
"jdbc:TAOS://:/test",
|
||||||
"jdbc:TAOS://localhost:0/?user=root&password=taosdata"
|
"jdbc:TAOS://localhost:0/?user=root&password=taosdata"
|
||||||
};
|
};
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnectWithJdbcURL() {
|
public void connectWithJdbcURL() {
|
||||||
final String url = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
final String url = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
||||||
try {
|
try {
|
||||||
conn = DriverManager.getConnection(url);
|
conn = DriverManager.getConnection(url);
|
||||||
|
@ -40,7 +39,7 @@ public class TSDBDriverTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnectWithProperties() {
|
public void connectWithProperties() {
|
||||||
final String jdbcUrl = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
final String jdbcUrl = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
||||||
Properties connProps = new Properties();
|
Properties connProps = new Properties();
|
||||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||||
|
@ -56,7 +55,7 @@ public class TSDBDriverTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConnectWithConfigFile() {
|
public void connectWithConfigFile() {
|
||||||
String jdbcUrl = "jdbc:TAOS://:/log?user=root&password=taosdata";
|
String jdbcUrl = "jdbc:TAOS://:/log?user=root&password=taosdata";
|
||||||
Properties connProps = new Properties();
|
Properties connProps = new Properties();
|
||||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||||
|
@ -71,16 +70,6 @@ public class TSDBDriverTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SQLException.class)
|
|
||||||
public void testAcceptsURL() throws SQLException {
|
|
||||||
Driver driver = new TSDBDriver();
|
|
||||||
for (String url : validURLs) {
|
|
||||||
assertTrue("failure - acceptsURL(\" " + url + " \") should be true", driver.acceptsURL(url));
|
|
||||||
}
|
|
||||||
driver.acceptsURL(null);
|
|
||||||
fail("acceptsURL throws exception when parameter is null");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseURL() {
|
public void testParseURL() {
|
||||||
TSDBDriver driver = new TSDBDriver();
|
TSDBDriver driver = new TSDBDriver();
|
||||||
|
@ -121,8 +110,19 @@ public class TSDBDriverTest {
|
||||||
assertNull("failure - dbname should be null", actual.getProperty("dbname"));
|
assertNull("failure - dbname should be null", actual.getProperty("dbname"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test(expected = SQLException.class)
|
||||||
|
public void acceptsURL() throws SQLException {
|
||||||
|
Driver driver = new TSDBDriver();
|
||||||
|
for (String url : validURLs) {
|
||||||
|
assertTrue("failure - acceptsURL(\" " + url + " \") should be true", driver.acceptsURL(url));
|
||||||
|
}
|
||||||
|
driver.acceptsURL(null);
|
||||||
|
fail("acceptsURL throws exception when parameter is null");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPropertyInfo() throws SQLException {
|
public void getPropertyInfo() throws SQLException {
|
||||||
Driver driver = new TSDBDriver();
|
Driver driver = new TSDBDriver();
|
||||||
final String url = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
final String url = "jdbc:TAOS://localhost:6030/log?user=root&password=taosdata";
|
||||||
Properties connProps = new Properties();
|
Properties connProps = new Properties();
|
||||||
|
@ -142,23 +142,23 @@ public class TSDBDriverTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetMajorVersion() {
|
public void getMajorVersion() {
|
||||||
assertEquals("failure - getMajorVersion should be 2", 2, new TSDBDriver().getMajorVersion());
|
assertEquals(2, new TSDBDriver().getMajorVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetMinorVersion() {
|
public void getMinorVersion() {
|
||||||
assertEquals("failure - getMinorVersion should be 0", 0, new TSDBDriver().getMinorVersion());
|
assertEquals(0, new TSDBDriver().getMinorVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testJdbcCompliant() {
|
public void jdbcCompliant() {
|
||||||
assertFalse("failure - jdbcCompliant should be false", new TSDBDriver().jdbcCompliant());
|
assertFalse(new TSDBDriver().jdbcCompliant());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetParentLogger() throws SQLFeatureNotSupportedException {
|
public void getParentLogger() throws SQLFeatureNotSupportedException {
|
||||||
assertNull("failure - getParentLogger should be be null", new TSDBDriver().getParentLogger());
|
assertNull(new TSDBDriver().getParentLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -169,6 +169,4 @@ public class TSDBDriverTest {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue