change
This commit is contained in:
parent
d0b002ea73
commit
3ce4dd3dbb
|
@ -98,7 +98,7 @@ public class ResultSetTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SQLFeatureNotSupportedException.class)
|
@Test(expected = SQLException.class)
|
||||||
public void testUnsupport() throws SQLException, UnsupportedEncodingException {
|
public void testUnsupport() throws SQLException, UnsupportedEncodingException {
|
||||||
statement.execute("show databases");
|
statement.execute("show databases");
|
||||||
resSet = statement.getResultSet();
|
resSet = statement.getResultSet();
|
||||||
|
|
|
@ -9,13 +9,14 @@ import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class SubscribeTest {
|
public class SubscribeTest {
|
||||||
Connection connection;
|
Connection connection;
|
||||||
Statement statement;
|
Statement statement;
|
||||||
String dbName = "test";
|
String dbName = "test";
|
||||||
String tName = "t0";
|
String tName = "t0";
|
||||||
String host = "localhost";
|
String host = "127.0.0.1";
|
||||||
String topic = "test";
|
String topic = "test";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -23,7 +24,6 @@ public class SubscribeTest {
|
||||||
try {
|
try {
|
||||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_HOST, host);
|
|
||||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
||||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
||||||
|
@ -55,9 +55,8 @@ public class SubscribeTest {
|
||||||
|
|
||||||
int a = 0;
|
int a = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
Thread.sleep(900);
|
TimeUnit.MILLISECONDS.sleep(1000);
|
||||||
TSDBResultSet resSet = subscribe.consume();
|
TSDBResultSet resSet = subscribe.consume();
|
||||||
|
|
||||||
while (resSet.next()) {
|
while (resSet.next()) {
|
||||||
for (int i = 1; i <= resSet.getMetaData().getColumnCount(); i++) {
|
for (int i = 1; i <= resSet.getMetaData().getColumnCount(); i++) {
|
||||||
System.out.printf(i + ": " + resSet.getString(i) + "\t");
|
System.out.printf(i + ": " + resSet.getString(i) + "\t");
|
||||||
|
@ -82,7 +81,7 @@ public class SubscribeTest {
|
||||||
@After
|
@After
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
statement.executeQuery("drop database " + dbName);
|
statement.execute("drop database " + dbName);
|
||||||
if (statement != null)
|
if (statement != null)
|
||||||
statement.close();
|
statement.close();
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
|
|
Loading…
Reference in New Issue