Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c037b01
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c037b01
编写于
1月 20, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2794]<fix>: fix authentication failed with changed password
上级
d2e9f8f1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
68 addition
and
4 deletion
+68
-4
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
...rc/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
+59
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
...src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
+6
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
...c/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
+2
-2
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
.../java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
+1
-0
未找到文件。
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java
0 → 100644
浏览文件 @
9c037b01
package
com.taosdata.jdbc.rs
;
import
com.taosdata.jdbc.TSDBDriver
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.sql.*
;
import
java.util.Properties
;
public
class
AuthenticationTest
{
private
static
final
String
host
=
"master"
;
private
static
final
String
user
=
"root"
;
private
static
final
String
password
=
"123456"
;
private
Connection
conn
;
@Test
public
void
test
()
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
stmt
.
execute
(
"show databases"
);
ResultSet
rs
=
stmt
.
getResultSet
();
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
();
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Before
public
void
before
()
{
try
{
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
Properties
props
=
new
Properties
();
props
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
user
);
props
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
password
);
conn
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/restful_test"
,
props
);
}
catch
(
SQLException
|
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
@After
public
void
after
()
{
try
{
if
(
conn
!=
null
)
{
conn
.
close
();
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
浏览文件 @
9c037b01
...
...
@@ -6,6 +6,7 @@ import org.junit.Test;
import
java.sql.*
;
public
class
RestfulDriverTest
{
private
static
final
String
host
=
"master"
;
@Test
public
void
connect
()
{
...
...
@@ -15,9 +16,9 @@ public class RestfulDriverTest {
@Test
public
void
acceptsURL
()
throws
SQLException
{
Driver
driver
=
new
RestfulDriver
();
boolean
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS-RS://
master
:6041"
);
boolean
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS-RS://
"
+
host
+
"
:6041"
);
Assert
.
assertTrue
(
isAccept
);
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS://
master
:6041"
);
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS://
"
+
host
+
"
:6041"
);
Assert
.
assertFalse
(
isAccept
);
}
...
...
@@ -26,6 +27,9 @@ public class RestfulDriverTest {
Driver
driver
=
new
RestfulDriver
();
final
String
url
=
""
;
DriverPropertyInfo
[]
propertyInfo
=
driver
.
getPropertyInfo
(
url
,
null
);
for
(
DriverPropertyInfo
prop
:
propertyInfo
)
{
System
.
out
.
println
(
prop
);
}
}
@Test
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java
浏览文件 @
9c037b01
package
com.taosdata.jdbc.rs
;
import
org.junit.*
;
import
org.junit.runners.MethodSorters
;
...
...
@@ -10,12 +9,13 @@ import java.util.Random;
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
RestfulJDBCTest
{
private
static
final
String
host
=
"master"
;
private
Connection
connection
;
@Before
public
void
before
()
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://
master
:6041/restful_test?user=root&password=taosdata"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://
"
+
host
+
"
:6041/restful_test?user=root&password=taosdata"
);
}
@After
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
浏览文件 @
9c037b01
...
...
@@ -21,4 +21,5 @@ public class SqlSyntaxValidatorTest {
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database test"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"drop database if exist test"
));
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录