Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cdd0d55b
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cdd0d55b
编写于
8月 25, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
liangzhenyu6@huawei.com
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
19a58f14
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
21 deletion
+26
-21
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
...test/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
+5
-4
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
...ejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
+21
-17
未找到文件。
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
浏览文件 @
cdd0d55b
...
...
@@ -214,20 +214,21 @@ describe('rdbResultSetTest', function () {
* @tc.desc resultSet isStarted normal test
*/
it
(
'
testIsStarted0003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testIsStarted0003 start *************
'
);
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
console
.
info
(
TAG
+
"
************* testIsStarted0003 start *************
"
);
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
test
"
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
try
{
expect
(
false
).
assertEqual
(
resultSet
.
isStarted
)
expect
(
true
).
assertEqual
(
resultSet
.
goToNextRow
())
expect
(
true
).
assertEqual
(
resultSet
.
isStarted
)
expect
(
false
).
assertEqual
(
resultSet
.
goToPreviousRow
())
expect
(
fals
e
).
assertEqual
(
resultSet
.
isStarted
)
expect
(
tru
e
).
assertEqual
(
resultSet
.
isStarted
)
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
resultSet
=
null
done
();
console
.
info
(
TAG
+
'
************* testIsStarted0003 end *************
'
);
console
.
info
(
TAG
+
"
************* testIsStarted0003 end *************
"
);
})
/**
...
...
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
浏览文件 @
cdd0d55b
...
...
@@ -25,6 +25,7 @@ const STORE_CONFIG = {
}
var
rdbStore
=
undefined
;
var
resultSet
=
undefined
;
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -320,7 +321,7 @@ describe('rdbstoreInsertTest', function () {
})
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test2
"
);
predicates
.
equalTo
(
"
name
"
,
"
lisi
"
)
resultSet
=
await
rdbStore
.
query
(
predicates
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
try
{
console
.
info
(
TAG
+
"
resultSet query done
"
);
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
...
...
@@ -334,11 +335,11 @@ describe('rdbstoreInsertTest', function () {
expect
(
"
lisi
"
).
assertEqual
(
name
)
expect
(
23
).
assertEqual
(
age
)
expect
(
200
).
assertEqual
(
salary
)
await
rdb
s
tore
.
delete
(
predicates
).
then
((
number
)
=>
{
await
rdb
S
tore
.
delete
(
predicates
).
then
((
number
)
=>
{
expect
(
1
).
assertEqual
(
number
)
}).
then
(
async
()
=>
{
resultSet
=
await
rdbStore
.
query
(
predicates
).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
})
})
}
catch
(
e
)
{
...
...
@@ -393,6 +394,7 @@ describe('rdbstoreInsertTest', function () {
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
age
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
age
"
))
const
salary
=
resultSet
.
getDouble
(
resultSet
.
getColumnIndex
(
"
salary
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
console
.
info
(
TAG
+
"
id=
"
+
id
+
"
, name=
"
+
name
+
"
, age=
"
+
age
+
"
, salary=
"
+
salary
+
"
, blobType=
"
+
blobType
);
expect
(
1
).
assertEqual
(
id
);
expect
(
"
zhangsan
"
).
assertEqual
(
name
)
...
...
@@ -414,6 +416,7 @@ describe('rdbstoreInsertTest', function () {
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
age
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
age
"
))
const
salary
=
resultSet
.
getDouble
(
resultSet
.
getColumnIndex
(
"
salary
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
console
.
info
(
TAG
+
"
id=
"
+
id
+
"
, name=
"
+
name
+
"
, age=
"
+
age
+
"
, salary=
"
+
salary
+
"
, blobType=
"
+
blobType
);
expect
(
2
).
assertEqual
(
id
);
expect
(
"
lisi
"
).
assertEqual
(
name
)
...
...
@@ -425,7 +428,7 @@ describe('rdbstoreInsertTest', function () {
"
salary
"
:
500
,
"
blobType
"
:
u8
,
}
await
rdb
s
tore
.
insert
(
"
test3
"
,
valueBucket4
)
await
rdb
S
tore
.
insert
(
"
test3
"
,
valueBucket4
)
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test3
"
);
predicates
.
equalTo
(
"
name
"
,
"
zhangmaowen
"
)
resultSet
=
await
rdbStore
.
query
(
predicates
)
...
...
@@ -488,6 +491,7 @@ describe('rdbstoreInsertTest', function () {
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
age
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
age
"
))
const
salary
=
resultSet
.
getDouble
(
resultSet
.
getColumnIndex
(
"
salary
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
console
.
info
(
TAG
+
"
id=
"
+
id
+
"
, name=
"
+
name
+
"
, age=
"
+
age
+
"
, salary=
"
+
salary
+
"
, blobType=
"
+
blobType
);
expect
(
56
).
assertEqual
(
id
);
expect
(
"
zhangsan55
"
).
assertEqual
(
name
)
...
...
@@ -594,11 +598,11 @@ describe('rdbstoreInsertTest', function () {
const
valueBuckets
=
[
valueBucket1
,
valueBucket2
,
valueBucket3
]
try
{
await
rdbStore
.
batchInsert
(
"
test6
"
,
"
valueBuckets
"
).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
})
}
catch
(
err
){
console
.
info
(
TAG
+
"
Batch insert data error:
"
+
err
)
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStorebatchInsertPromise0006 end *************
"
);
...
...
@@ -614,11 +618,11 @@ describe('rdbstoreInsertTest', function () {
await
rdbStore
.
executeSql
(
CREATE_TABLE_NAME
+
"
7
"
+
CREATE_TABLE
)
try
{
await
rdbStore
.
batchInsert
(
"
test7
"
).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
})
}
catch
(
err
){
console
.
info
(
TAG
+
"
Batch insert data error:
"
+
err
)
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStorebatchInsertPromise0007 end *************
"
);
...
...
@@ -748,7 +752,7 @@ describe('rdbstoreInsertTest', function () {
expect
(
3
).
assertEqual
(
data
)
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
testCallback2
"
);
predicates
.
equalTo
(
"
name
"
,
"
lisi
"
)
resultSet
=
await
rdbStore
.
query
(
predicates
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
try
{
console
.
info
(
TAG
+
"
resultSet query done
"
);
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
...
...
@@ -762,11 +766,11 @@ describe('rdbstoreInsertTest', function () {
expect
(
"
lisi
"
).
assertEqual
(
name
)
expect
(
23
).
assertEqual
(
age
)
expect
(
200
).
assertEqual
(
salary
)
await
rdb
s
tore
.
delete
(
predicates
).
then
((
number
)
=>
{
await
rdb
S
tore
.
delete
(
predicates
).
then
((
number
)
=>
{
expect
(
1
).
assertEqual
(
number
)
}).
then
(
async
()
=>
{
resultSet
=
await
rdbStore
.
query
(
predicates
).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
})
})
}
catch
(
e
)
{
...
...
@@ -856,7 +860,7 @@ describe('rdbstoreInsertTest', function () {
"
salary
"
:
500
,
"
blobType
"
:
u8
,
}
await
rdb
s
tore
.
insert
(
"
testCallback3
"
,
valueBucket4
)
await
rdb
S
tore
.
insert
(
"
testCallback3
"
,
valueBucket4
)
predicates
=
new
dataRdb
.
RdbPredicates
(
"
testCallback3
"
);
predicates
.
equalTo
(
"
name
"
,
"
zhangmaowen
"
)
resultSet
=
await
rdbStore
.
query
(
predicates
)
...
...
@@ -1034,14 +1038,14 @@ describe('rdbstoreInsertTest', function () {
try
{
await
rdbStore
.
batchInsert
(
"
testCallback6
"
,
"
valueBuckets
"
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
expect
(
true
).
assertTrue
()
expect
(
err
!=
null
).
assertTrue
()
}
else
{
expect
(
false
).
assertTrue
()
}
})
}
catch
(
err
){
console
.
info
(
TAG
+
"
Batch insert data error:
"
+
err
)
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
}
})
...
...
@@ -1059,15 +1063,15 @@ describe('rdbstoreInsertTest', function () {
console
.
info
(
TAG
+
"
************* testRdbStorebatchInsertCallback0007 start *************
"
);
try
{
await
rdbStore
.
executeSql
(
CREATE_TABLE_NAME
+
"
Callback7
"
+
CREATE_TABLE
).
then
(
async
()
=>
{
await
rdb
s
tore
.
batchInsert
(
"
testCallback7
"
,
(
err
,
data
)
=>
{
await
rdb
S
tore
.
batchInsert
(
"
testCallback7
"
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
}
})
})
}
catch
(
err
){
console
.
info
(
TAG
+
"
Batch insert data error:
"
+
err
)
expect
(
true
).
assertTrue
();
expect
(
err
!=
null
).
assertTrue
();
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStorebatchInsertCallback0007 end *************
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录