Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5d24a707
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5d24a707
编写于
3月 11, 2021
作者:
sangshuduo
提交者:
GitHub
3月 11, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5410 from taosdata/hotfix/TD-3222
Hotfix/td 3222
上级
8f5820fd
129f98e1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
142 addition
and
8 deletion
+142
-8
src/connector/jdbc/pom.xml
src/connector/jdbc/pom.xml
+1
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
...src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
+130
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/FailOverTest.java
...c/src/test/java/com/taosdata/jdbc/cases/FailOverTest.java
+11
-8
未找到文件。
src/connector/jdbc/pom.xml
浏览文件 @
5d24a707
...
...
@@ -102,6 +102,7 @@
<include>
**/*Test.java
</include>
</includes>
<excludes>
<exclude>
**/DatetimeBefore1970Test.java
</exclude>
<exclude>
**/AppMemoryLeakTest.java
</exclude>
<exclude>
**/AuthenticationTest.java
</exclude>
<exclude>
**/TaosInfoMonitorTest.java
</exclude>
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
0 → 100644
浏览文件 @
5d24a707
package
com.taosdata.jdbc
;
import
org.junit.Test
;
import
java.sql.SQLException
;
import
java.sql.SQLWarning
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.*;
public
class
TSDBJNIConnectorTest
{
public
static
void
main
(
String
[]
args
)
{
try
{
TSDBJNIConnector
.
init
(
"/etc/taos/taos.cfg"
,
"en_US.UTF-8"
,
""
,
""
);
TSDBJNIConnector
connector
=
new
TSDBJNIConnector
();
connector
.
connect
(
"127.0.0.1"
,
6030
,
"test"
,
"root"
,
"taosdata"
);
long
pSql
=
connector
.
executeQuery
(
"show dnodes"
);
// if pSql is create/insert/update/delete/alter SQL
if
(
connector
.
isUpdateQuery
(
pSql
))
{
connector
.
freeResultSet
(
pSql
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_WITH_EXECUTEQUERY
);
}
List
<
ColumnMetaData
>
columnMetaDataList
=
new
ArrayList
<>();
int
code
=
connector
.
getSchemaMetaData
(
pSql
,
columnMetaDataList
);
if
(
code
==
TSDBConstants
.
JNI_CONNECTION_NULL
)
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
if
(
code
==
TSDBConstants
.
JNI_RESULT_SET_NULL
)
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_RESULT_SET_NULL
));
}
if
(
code
==
TSDBConstants
.
JNI_NUM_OF_FIELDS_0
)
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_NUM_OF_FIELDS_0
));
}
}
catch
(
SQLWarning
throwables
)
{
throwables
.
printStackTrace
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
isClosed
()
{
}
@Test
public
void
isResultsetClosed
()
{
}
@Test
public
void
init
()
{
}
@Test
public
void
initImp
()
{
}
@Test
public
void
setOptions
()
{
}
@Test
public
void
getTsCharset
()
{
}
@Test
public
void
connect
()
{
}
@Test
public
void
executeQuery
()
{
}
@Test
public
void
getErrCode
()
{
}
@Test
public
void
getErrMsg
()
{
}
@Test
public
void
isUpdateQuery
()
{
}
@Test
public
void
freeResultSet
()
{
}
@Test
public
void
getAffectedRows
()
{
}
@Test
public
void
getSchemaMetaData
()
{
}
@Test
public
void
fetchRow
()
{
}
@Test
public
void
fetchBlock
()
{
}
@Test
public
void
closeConnection
()
{
}
@Test
public
void
subscribe
()
{
}
@Test
public
void
consume
()
{
}
@Test
public
void
unsubscribe
()
{
}
@Test
public
void
validateCreateTableSql
()
{
}
}
\ No newline at end of file
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/FailOverTest.java
浏览文件 @
5d24a707
...
...
@@ -4,7 +4,6 @@ import org.junit.Test;
import
java.sql.*
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
public
class
FailOverTest
{
...
...
@@ -18,13 +17,17 @@ public class FailOverTest {
long
end
=
System
.
currentTimeMillis
()
+
1000
*
60
*
5
;
while
(
System
.
currentTimeMillis
()
<
end
)
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
))
{
Statement
stmt
=
conn
.
createStatement
();
ResultSet
resultSet
=
stmt
.
executeQuery
(
"select server_status()"
);
resultSet
.
next
();
int
status
=
resultSet
.
getInt
(
"server_status()"
);
System
.
out
.
println
(
">>>>>>>>>"
+
sdf
.
format
(
new
Date
())
+
" status : "
+
status
);
stmt
.
close
();
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
);
Statement
stmt
=
conn
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
"show dnodes"
);
ResultSetMetaData
meta
=
rs
.
getMetaData
();
while
(
rs
.
next
())
{
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
System
.
out
.
print
(
meta
.
getColumnLabel
(
i
)
+
": "
+
rs
.
getString
(
i
)
+
"\t"
);
}
System
.
out
.
println
();
}
System
.
out
.
println
(
"======================="
);
rs
.
close
();
TimeUnit
.
SECONDS
.
sleep
(
5
);
}
catch
(
SQLException
|
InterruptedException
e
)
{
e
.
printStackTrace
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录