Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f9b6d88c
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9b6d88c
编写于
11月 11, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用例执行时序优化
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
37337840
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
86 deletion
+44
-86
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
...stest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
+44
-86
未找到文件。
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
浏览文件 @
f9b6d88c
...
@@ -25,6 +25,9 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM
...
@@ -25,6 +25,9 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM
const
STORE_CONFIG
=
{
const
STORE_CONFIG
=
{
name
:
"
rdbstore.db
"
,
name
:
"
rdbstore.db
"
,
}
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
export
default
function
rdbStoreTest
()
{
export
default
function
rdbStoreTest
()
{
describe
(
'
rdbStoreTest
'
,
function
()
{
describe
(
'
rdbStoreTest
'
,
function
()
{
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
...
@@ -54,18 +57,15 @@ describe('rdbStoreTest', function () {
...
@@ -54,18 +57,15 @@ describe('rdbStoreTest', function () {
*/
*/
it
(
'
testRdbStore0001
'
,
0
,
async
function
(
done
)
{
it
(
'
testRdbStore0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStore0001 start *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0001 start *************
"
);
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
1
);
await
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
1
).
then
(
async
(
store
)
=>
{
storePromise
.
then
(
async
(
store
)
=>
{
try
{
try
{
await
console
.
info
(
TAG
+
"
getRdbStore done:
"
+
store
);
console
.
info
(
TAG
+
"
getRdbStore done:
"
+
store
);
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
})
})
await
storePromise
storePromise
=
null
done
();
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0001 end *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0001 end *************
"
);
})
})
...
@@ -80,7 +80,7 @@ describe('rdbStoreTest', function () {
...
@@ -80,7 +80,7 @@ describe('rdbStoreTest', function () {
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
2
);
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
2
);
storePromise
.
then
(
async
(
store
)
=>
{
storePromise
.
then
(
async
(
store
)
=>
{
try
{
try
{
await
console
.
info
(
TAG
+
"
getRdbStore done:
"
+
store
);
console
.
info
(
TAG
+
"
getRdbStore done:
"
+
store
);
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
...
@@ -107,7 +107,7 @@ describe('rdbStoreTest', function () {
...
@@ -107,7 +107,7 @@ describe('rdbStoreTest', function () {
}
}
let
storePromise
=
dataRdb
.
getRdbStore
(
storeConfig
,
4
);
let
storePromise
=
dataRdb
.
getRdbStore
(
storeConfig
,
4
);
storePromise
.
then
(
async
(
ret
)
=>
{
storePromise
.
then
(
async
(
ret
)
=>
{
await
console
.
info
(
TAG
+
"
getRdbStore done
"
+
ret
);
console
.
info
(
TAG
+
"
getRdbStore done
"
+
ret
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
TAG
+
"
getRdbStore with wrong path
"
);
console
.
info
(
TAG
+
"
getRdbStore with wrong path
"
);
...
@@ -124,22 +124,13 @@ describe('rdbStoreTest', function () {
...
@@ -124,22 +124,13 @@ describe('rdbStoreTest', function () {
*/
*/
it
(
'
testRdbStore0004
'
,
0
,
async
function
(
done
)
{
it
(
'
testRdbStore0004
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStore0004 start *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0004 start *************
"
);
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
1
);
try
{
storePromise
.
then
(
async
(
store
)
=>
{
let
store
=
await
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
1
)
try
{
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
await
dataRdb
.
deleteRdbStore
(
"
rdbstore.db
"
)
await
dataRdb
.
deleteRdbStore
(
"
rdbstore.db
"
).
then
(()
=>
{
}
catch
(
e
)
{
console
.
info
(
TAG
+
"
deleteRdbStore promise done
"
+
store
);
expect
(
true
).
assertTrue
();
})
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
})
}
await
storePromise
storePromise
=
null
done
();
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0004 end *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0004 end *************
"
);
})
})
...
@@ -151,24 +142,14 @@ describe('rdbStoreTest', function () {
...
@@ -151,24 +142,14 @@ describe('rdbStoreTest', function () {
*/
*/
it
(
'
testRdbStore0005
'
,
0
,
async
function
(
done
)
{
it
(
'
testRdbStore0005
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStore0005 start *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0005 start *************
"
);
try
{
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
2
);
let
store
=
await
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
2
);
storePromise
.
then
(
async
(
store
)
=>
{
console
.
info
(
TAG
+
"
Get rdbstore success
"
)
try
{
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
await
dataRdb
.
deleteRdbStore
(
"
rdbstore.db
"
)
let
deletePromise
=
dataRdb
.
deleteRdbStore
(
"
rdbstore.db
"
)
}
catch
(
e
)
{
deletePromise
.
then
(()
=>
{
console
.
info
(
TAG
+
"
deleteRdbStore promise done
"
+
store
);
expect
(
true
).
assertTrue
();
})
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
})
}
await
storePromise
storePromise
=
null
done
();
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0005 end *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0005 end *************
"
);
})
})
...
@@ -185,20 +166,14 @@ describe('rdbStoreTest', function () {
...
@@ -185,20 +166,14 @@ describe('rdbStoreTest', function () {
const
STORE_CONFIG
=
{
const
STORE_CONFIG
=
{
name
:
"
rdbstorecontext.db
"
,
name
:
"
rdbstorecontext.db
"
,
}
}
console
.
info
(
TAG
+
"
first
"
)
rdbstore
=
await
dataRdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
)
await
dataRdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
).
then
((
data
)
=>
{
console
.
info
(
TAG
+
"
Get rdbstore success
"
)
console
.
info
(
TAG
+
"
Get rdbstore success
"
)
expect
(
rdbstore
!=
null
).
assertTrue
();
rdbstore
=
data
;
await
dataRdb
.
deleteRdbStore
(
STORE_CONFIG
.
name
)
expect
(
rdbstore
!=
null
).
assertTrue
();
}).
catch
((
errInfo
)
=>
{
console
.
info
(
TAG
+
"
Get rdbstore fail
"
+
errInfo
)
expect
(
null
).
assertFail
();
})
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
TAG
+
"
Get rdbstore fail catch err:
"
+
err
)
console
.
info
(
TAG
+
"
Get rdbstore fail catch err:
"
+
err
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
}
await
dataRdb
.
deleteRdbStore
(
STORE_CONFIG
.
name
)
rdbstore
=
null
;
rdbstore
=
null
;
done
();
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0006 end *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0006 end *************
"
);
...
@@ -216,20 +191,14 @@ describe('rdbStoreTest', function () {
...
@@ -216,20 +191,14 @@ describe('rdbStoreTest', function () {
const
STORE_CONFIG
=
{
const
STORE_CONFIG
=
{
name
:
"
rdbstorecontext.db
"
,
name
:
"
rdbstorecontext.db
"
,
}
}
console
.
info
(
TAG
+
"
first
"
)
rdbstore
=
await
dataRdb
.
getRdbStore
(
contextApplication
,
STORE_CONFIG
,
1
)
await
dataRdb
.
getRdbStore
(
contextApplication
,
STORE_CONFIG
,
1
).
then
((
data
)
=>
{
console
.
info
(
TAG
+
"
Get rdbstore success
"
)
console
.
info
(
TAG
+
"
Get rdbstore success
"
)
expect
(
rdbstore
!=
null
).
assertTrue
();
rdbstore
=
data
;
await
dataRdb
.
deleteRdbStore
(
STORE_CONFIG
.
name
)
expect
(
rdbstore
!=
null
).
assertTrue
();
}).
catch
((
errInfo
)
=>
{
console
.
info
(
TAG
+
"
Get rdbstore fail
"
+
errInfo
)
expect
(
null
).
assertFail
();
})
}
catch
(
err
){
}
catch
(
err
){
console
.
info
(
TAG
+
"
Get rdbstore fail catch err:
"
+
err
)
console
.
info
(
TAG
+
"
Get rdbstore fail catch err:
"
+
err
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}
}
await
dataRdb
.
deleteRdbStore
(
STORE_CONFIG
.
name
)
rdbstore
=
null
;
rdbstore
=
null
;
done
();
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0007 end *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0007 end *************
"
);
...
@@ -242,20 +211,15 @@ describe('rdbStoreTest', function () {
...
@@ -242,20 +211,15 @@ describe('rdbStoreTest', function () {
*/
*/
it
(
'
testRdbStore0008
'
,
0
,
async
function
(
done
)
{
it
(
'
testRdbStore0008
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStore0008 start *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0008 start *************
"
);
let
rdbstore
=
null
;
dataRdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
async
(
err
,
data
)
=>
{
dataRdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
(
data
,
err
)
=>
{
console
.
info
(
TAG
+
"
getRdbStore finish
"
)
if
(
err
!=
undefined
){
console
.
info
(
TAG
+
"
getRdbStore success:
"
+
data
)
expect
(
null
).
assertFail
()
expect
(
data
!=
null
).
assertTrue
();
}
else
{
await
dataRdb
.
deleteRdbStore
(
contextApplication
,
STORE_CONFIG
.
name
)
rdbstore
=
data
;
done
();
console
.
info
(
TAG
+
"
getRdbStore success:
"
+
rdbstore
)
console
.
info
(
TAG
+
"
************* testRdbStore0008 end *************
"
);
expect
(
rdbstore
).
assertNotNull
();
}
});
});
await
dataRdb
.
deleteRdbStore
(
context
,
STORE_CONFIG
.
name
)
await
sleep
(
1000
)
rdbstore
=
null
;
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0008 end *************
"
);
})
})
/**
/**
...
@@ -265,21 +229,15 @@ describe('rdbStoreTest', function () {
...
@@ -265,21 +229,15 @@ describe('rdbStoreTest', function () {
*/
*/
it
(
'
testRdbStore0009
'
,
0
,
async
function
(
done
){
it
(
'
testRdbStore0009
'
,
0
,
async
function
(
done
){
console
.
info
(
TAG
+
"
************* testRdbStore0009 start *************
"
);
console
.
info
(
TAG
+
"
************* testRdbStore0009 start *************
"
);
let
rdbstore
=
null
;
dataRdb
.
getRdbStore
(
contextApplication
,
STORE_CONFIG
,
1
,
async
(
err
,
data
)
=>
{
dataRdb
.
getRdbStore
(
contextApplication
,
STORE_CONFIG
,
1
,
(
data
,
err
)
=>
{
console
.
info
(
TAG
+
"
getRdbStore finish
"
)
if
(
err
!=
undefined
){
console
.
info
(
TAG
+
"
getRdbStore success:
"
+
data
)
expect
(
null
).
assertFail
()
expect
(
data
!=
null
).
assertTrue
();
}
else
{
await
dataRdb
.
deleteRdbStore
(
contextApplication
,
STORE_CONFIG
.
name
)
rdbstore
=
data
;
done
();
console
.
info
(
TAG
+
"
getRdbStore success:
"
+
rdbstore
)
console
.
info
(
TAG
+
"
************* testRdbStore0009 end *************
"
);
expect
(
rdbstore
).
assertNotNull
();
}
});
});
await
dataRdb
.
deleteRdbStore
(
contextApplication
,
STORE_CONFIG
.
name
)
await
sleep
(
1000
)
rdbstore
=
null
;
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0009 end *************
"
);
})
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录