Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2079a5a6
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看板
提交
2079a5a6
编写于
11月 25, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用例运行时序优化
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
d7bcd4d0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
185 addition
and
192 deletion
+185
-192
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreBackupRestoreCallbackJsunit.test.js
.../main/js/test/RdbstoreBackupRestoreCallbackJsunit.test.js
+56
-54
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreBackupRestoreWithFAContextJsunit.test.js
.../js/test/RdbstoreBackupRestoreWithFAContextJsunit.test.js
+66
-67
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreDeleteJsunit.test.js
...eJstest/hap/src/main/js/test/RdbstoreDeleteJsunit.test.js
+32
-41
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
...stest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
+14
-10
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
...etest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
+17
-20
未找到文件。
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreBackupRestoreCallbackJsunit.test.js
浏览文件 @
2079a5a6
...
@@ -134,7 +134,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
...
@@ -134,7 +134,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0100 start *************
"
)
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0100 start *************
"
)
// RDB backup function test
// RDB backup function test
await
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
await
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
async
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
else
{
}
else
{
...
@@ -145,52 +145,52 @@ export default function rdbStoreBackupRestoreCallbackTest() {
...
@@ -145,52 +145,52 @@ export default function rdbStoreBackupRestoreCallbackTest() {
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
}
}
}
})
// RDB before restored, delete data
let
deleteData
=
new
dataRdb
.
RdbPredicates
(
"
backupTest
"
)
// RDB before restored, delete data
deleteData
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
let
deleteData
=
new
dataRdb
.
RdbPredicates
(
"
backupTest
"
)
await
RdbStore
.
delete
(
deleteData
)
deleteData
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
RdbStore
.
delete
(
deleteData
).
then
(()
=>
{
// RDB restore function test
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
,
async
(
err
,
data
)
=>
{
await
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
,
async
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
else
{
}
else
{
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
true
).
assertTrue
()
expect
(
true
).
assertTrue
()
}
}
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
}
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
backupTest
"
)
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
backupTest
"
)
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
let
resultSet
=
await
RdbStore
.
query
(
predicates
)
let
resultSet
=
await
RdbStore
.
query
(
predicates
)
try
{
try
{
console
.
info
(
TAG
+
"
After restore resultSet query done
"
)
console
.
info
(
TAG
+
"
After restore resultSet query done
"
)
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
const
id
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
id
"
))
const
id
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
id
"
))
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
expect
(
1
).
assertEqual
(
id
)
expect
(
1
).
assertEqual
(
id
)
expect
(
"
zhangsan
"
).
assertEqual
(
name
)
expect
(
"
zhangsan
"
).
assertEqual
(
name
)
expect
(
1
).
assertEqual
(
blobType
[
0
])
expect
(
1
).
assertEqual
(
blobType
[
0
])
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
TAG
+
'
RdbBackupRestoreTest_0010 accessSync err4:
'
+
err
)
console
.
info
(
TAG
+
'
RdbBackupRestoreTest_0010 accessSync err4:
'
+
err
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
}
resultSet
=
null
resultSet
=
null
RdbStore
=
null
RdbStore
=
null
}
}
done
()
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0100 end *************
"
)
})
})
})
})
done
()
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0100 end *************
"
)
})
})
/**
/**
...
@@ -262,7 +262,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
...
@@ -262,7 +262,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
// RDB restore function test, backup file
// RDB restore function test, backup file
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
false
).
assertTrue
(
0
)
expect
(
false
).
assertTrue
()
}
else
{
}
else
{
try
{
try
{
console
.
info
(
TAG
+
'
Backup database success
'
)
console
.
info
(
TAG
+
'
Backup database success
'
)
...
@@ -279,17 +279,18 @@ export default function rdbStoreBackupRestoreCallbackTest() {
...
@@ -279,17 +279,18 @@ export default function rdbStoreBackupRestoreCallbackTest() {
}
}
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
false
).
assertTrue
(
0
)
console
.
info
(
`
${
TAG
}
Backup database second failed, error: message:
${
err
.
message
}
`
)
expect
(
true
).
assertTrue
()
done
();
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0500 end *************
"
)
}
else
{
}
else
{
try
{
try
{
console
.
info
(
TAG
+
'
Backup database success
'
)
console
.
info
(
TAG
+
'
Backup database s
econd s
uccess
'
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
}
catch
(
err
){
}
catch
(
err
){
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
}
}
}
done
()
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0500 end *************
"
)
})
})
})
})
}
}
...
@@ -333,22 +334,23 @@ export default function rdbStoreBackupRestoreCallbackTest() {
...
@@ -333,22 +334,23 @@ export default function rdbStoreBackupRestoreCallbackTest() {
*/
*/
it
(
'
RdbBackupRestoreCallbackTest_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
RdbBackupRestoreCallbackTest_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0700 start *************
"
)
console
.
info
(
TAG
+
"
************* RdbBackupRestoreCallbackTest_0700 start *************
"
)
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
let
DATABASE_BACKUP_TEST_NAME
=
"
BackupTest.db
"
RdbStore
.
backup
(
DATABASE_BACKUP_TEST_NAME
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
else
{
}
else
{
expect
(
true
).
assertTrue
()
expect
(
true
).
assertTrue
()
}
}
})
})
await
dataRdb
.
deleteRdbStore
(
context
,
DATABASE_BACKUP_NAME
).
then
(()
=>
{
await
dataRdb
.
deleteRdbStore
(
context
,
DATABASE_BACKUP_
TEST_
NAME
).
then
(()
=>
{
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_
TEST_
NAME
)
}
catch
(
err
){
}
catch
(
err
){
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
}
}
})
})
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
,
(
err
,
data
)
=>
{
RdbStore
.
restore
(
DATABASE_BACKUP_
TEST_
NAME
,
(
err
,
data
)
=>
{
if
(
err
!=
null
){
if
(
err
!=
null
){
expect
(
true
).
assertTrue
()
expect
(
true
).
assertTrue
()
}
}
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreBackupRestoreWithFAContextJsunit.test.js
浏览文件 @
2079a5a6
...
@@ -132,65 +132,73 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
...
@@ -132,65 +132,73 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0010 start *************
"
)
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0010 start *************
"
)
// RDB backup function test
// RDB backup function test
let
promiseBackup
=
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
)
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
).
then
(
async
()
=>
{
promiseBackup
.
then
(()
=>
{
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
"
RdbBackupRestoreTest_0010 backup success
"
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
}
}).
catch
((
err
)
=>
{
// RDB before restored, delete data
expect
(
false
).
assertTrue
()
let
deleteData
=
new
dataRdb
.
RdbPredicates
(
"
test
"
)
})
deleteData
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
await
promiseBackup
await
RdbStore
.
delete
(
deleteData
)
// RDB before restored, delete data
let
deleteData
=
new
dataRdb
.
RdbPredicates
(
"
test
"
)
deleteData
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
await
RdbStore
.
delete
(
deleteData
)
// RDB restore function test
// RDB restore function test
let
promiseRestore
=
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
)
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
).
then
(
async
()
=>
{
promiseRestore
.
then
(()
=>
{
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
expect
(
false
).
assertTrue
(
)
expect
(
false
).
assertTrue
()
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
"
RdbBackupRestoreTest_0010 restore success
"
)
expect
(
true
).
assertTrue
()
expect
(
true
).
assertTrue
()
}
}
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
fileio
.
accessSync
(
DATABASE_DIR
+
STORE_CONFIG
.
name
)
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
"
RdbBackupRestoreTest_0010 restore success2
"
)
expect
(
false
).
assertTrue
()
}
// RDB after restored, data query test
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
)
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
RdbStore
.
query
(
predicates
).
then
((
resultSet
)
=>
{
try
{
console
.
info
(
TAG
+
"
After restore resultSet query done
"
)
resultSet
.
goToFirstRow
();
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
console
.
info
(
"
RdbBackupRestoreTest_0010 goto first row success
"
)
const
id
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
id
"
))
console
.
info
(
"
RdbBackupRestoreTest_0010 get dolumnindex id success
"
)
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
console
.
info
(
"
RdbBackupRestoreTest_0010 get dolumnindex name success
"
)
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
console
.
info
(
`RdbBackupRestoreTest_0010 id is
${
id
}
,name id
${
name
}
,blobType is
${
blobType
[
0
]}
`
)
expect
(
1
).
assertEqual
(
id
)
expect
(
"
zhangsan
"
).
assertEqual
(
name
)
expect
(
1
).
assertEqual
(
blobType
[
0
])
}
catch
(
err
)
{
console
.
info
(
TAG
+
'
RdbBackupRestoreTest_0010 accessSync err4:
'
+
err
)
expect
(
false
).
assertTrue
()
}
resultSet
=
null
RdbStore
=
null
done
()
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0010 end *************
"
)
})
}).
catch
((
err
)
=>
{
console
.
info
(
"
RdbBackupRestoreTest_0010 restore error:
"
+
err
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
}
}
)
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
})
})
await
promiseRestore
// RDB after restored, data query test
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
)
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
let
resultSet
=
await
RdbStore
.
query
(
predicates
)
try
{
console
.
info
(
TAG
+
"
After restore resultSet query done
"
)
expect
(
true
).
assertEqual
(
resultSet
.
goToFirstRow
())
const
id
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
id
"
))
const
name
=
resultSet
.
getString
(
resultSet
.
getColumnIndex
(
"
name
"
))
const
blobType
=
resultSet
.
getBlob
(
resultSet
.
getColumnIndex
(
"
blobType
"
))
expect
(
1
).
assertEqual
(
id
)
expect
(
"
zhangsan
"
).
assertEqual
(
name
)
expect
(
1
).
assertEqual
(
blobType
[
0
])
}
catch
(
err
)
{
console
.
info
(
TAG
+
'
RdbBackupRestoreTest_0010 accessSync err4:
'
+
err
)
expect
(
false
).
assertTrue
()
}
resultSet
=
null
RdbStore
=
null
done
()
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0010 end *************
"
)
})
})
/**
/**
...
@@ -298,24 +306,16 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
...
@@ -298,24 +306,16 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
*/
*/
it
(
'
RdbBackupRestoreTest_0060
'
,
0
,
async
function
(
done
)
{
it
(
'
RdbBackupRestoreTest_0060
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0060 start *************
"
)
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0060 start *************
"
)
// Backup file is specified to database name
// Backup file is specified to database name
await
RdbStore
.
backup
(
STORE_CONFIG
.
name
).
then
(()
=>
{
RdbStore
.
backup
(
STORE_CONFIG
.
name
).
then
(()
=>
{
console
.
info
(
TAG
+
'
Backup database finish
'
)
console
.
info
(
TAG
+
'
Backup database finish
'
);
expect
(
false
).
assertTrue
()
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
()
console
.
info
(
TAG
+
"
Backup database error
"
);
})
expect
(
true
).
assertTrue
()
;
done
();
// Backup file is specified to database name again
await
RdbStore
.
backup
(
STORE_CONFIG
.
name
).
then
(()
=>
{
console
.
info
(
TAG
+
'
Backup database finish
'
)
}).
catch
((
err
)
=>
{
expect
(
true
).
assertTrue
();
})
})
done
();
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0060 end *************
"
)
})
})
/**
/**
* @tc.name RDB BackupRestore test
* @tc.name RDB BackupRestore test
* @tc.number SUB_DDM_RDB_JS_RdbBackupRestoreTest_0070
* @tc.number SUB_DDM_RDB_JS_RdbBackupRestoreTest_0070
...
@@ -324,13 +324,12 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
...
@@ -324,13 +324,12 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
it
(
'
RdbBackupRestoreTest_0070
'
,
0
,
async
function
(
done
)
{
it
(
'
RdbBackupRestoreTest_0070
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0070 start *************
"
)
console
.
info
(
TAG
+
"
************* RdbBackupRestoreTest_0070 start *************
"
)
await
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
)
await
RdbStore
.
backup
(
DATABASE_BACKUP_NAME
)
await
dataRdb
.
deleteRdbStore
(
context
,
DATABASE_BACKUP_NAME
).
then
(()
=>
{
await
dataRdb
.
deleteRdbStore
(
context
,
DATABASE_BACKUP_NAME
)
try
{
try
{
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
fileio
.
accessSync
(
DATABASE_DIR
+
DATABASE_BACKUP_NAME
)
}
catch
(
err
){
}
catch
(
err
){
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
}
}
})
await
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
).
catch
((
err
)
=>
{
await
RdbStore
.
restore
(
DATABASE_BACKUP_NAME
).
catch
((
err
)
=>
{
console
.
info
(
TAG
+
'
Restore fail:
'
+
err
)
console
.
info
(
TAG
+
'
Restore fail:
'
+
err
)
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreDeleteJsunit.test.js
浏览文件 @
2079a5a6
...
@@ -85,18 +85,16 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -85,18 +85,16 @@ describe('rdbStoreDeleteTest', function () {
}
}
//删除
//删除
{
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
3
).
assertEqual
(
ret
)
expect
(
3
).
assertEqual
(
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0001 end *************
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
})
})
await
deletePromise
}
}
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0001 end *************
'
);
})
})
/**
/**
...
@@ -138,17 +136,15 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -138,17 +136,15 @@ describe('rdbStoreDeleteTest', function () {
{
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
predicates
.
equalTo
(
'
name
'
,
'
zhangsan
'
)
predicates
.
equalTo
(
'
name
'
,
'
zhangsan
'
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
1
).
assertEqual
(
ret
)
await
expect
(
1
).
assertEqual
(
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
await
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0002 end *************
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
})
})
await
deletePromise
}
}
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0002 end *************
'
);
})
})
/**
/**
...
@@ -185,27 +181,24 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -185,27 +181,24 @@ describe('rdbStoreDeleteTest', function () {
expect
(
1
).
assertEqual
(
resultSet
.
rowCount
)
expect
(
1
).
assertEqual
(
resultSet
.
rowCount
)
}
}
//删除
//删除
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
predicates
.
equalTo
(
'
age
'
,
28
)
predicates
.
equalTo
(
'
age
'
,
28
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
1
).
assertEqual
(
ret
)
expect
(
1
).
assertEqual
(
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
//删除后查询
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
})
await
deletePromise
}
//删除后查询
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
predicates
.
equalTo
(
'
age
'
,
28
)
predicates
.
equalTo
(
'
age
'
,
28
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
}
done
()
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0003 end *************
'
);
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0003 end *************
'
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
})
})
})
/**
/**
...
@@ -247,16 +240,16 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -247,16 +240,16 @@ describe('rdbStoreDeleteTest', function () {
{
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
predicates
.
equalTo
(
'
aaa id
'
,
1
)
predicates
.
equalTo
(
'
aaa id
'
,
1
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
'
delete done:
'
+
ret
)
console
.
info
(
TAG
+
'
delete done:
'
+
ret
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
TAG
+
'
delete with wrong conditions
'
)
console
.
info
(
TAG
+
'
delete with wrong conditions
'
)
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0004 end *************
'
);
})
})
}
}
done
()
done
();
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0004 end *************
'
);
})
})
/**
/**
...
@@ -298,17 +291,16 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -298,17 +291,16 @@ describe('rdbStoreDeleteTest', function () {
{
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
predicates
.
equalTo
(
'
name
'
,
'
lisi
'
)
predicates
.
equalTo
(
'
name
'
,
'
lisi
'
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
2
).
assertEqual
(
ret
)
expect
(
2
).
assertEqual
(
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
console
.
info
(
TAG
+
'
Delete done:
'
+
ret
)
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0005 end *************
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
})
})
await
deletePromise
}
}
done
()
console
.
info
(
TAG
+
'
************* testRdbStoreDelete0005 end *************
'
);
})
})
/**
/**
...
@@ -350,8 +342,7 @@ describe('rdbStoreDeleteTest', function () {
...
@@ -350,8 +342,7 @@ describe('rdbStoreDeleteTest', function () {
//删除
//删除
try
{
try
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
''
)
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
''
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
deletePromise
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
'
delete done:
'
+
ret
)
console
.
info
(
TAG
+
'
delete done:
'
+
ret
)
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
()
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbstoreRdbstoreJsunit.test.js
浏览文件 @
2079a5a6
...
@@ -105,16 +105,20 @@ describe('rdbStoreTest', function () {
...
@@ -105,16 +105,20 @@ describe('rdbStoreTest', function () {
let
storeConfig
=
{
let
storeConfig
=
{
name
:
"
/wrong/rdbstore.db
"
,
name
:
"
/wrong/rdbstore.db
"
,
}
}
let
storePromise
=
dataRdb
.
getRdbStore
(
storeConfig
,
4
);
try
{
storePromise
.
then
(
async
(
ret
)
=>
{
dataRdb
.
getRdbStore
(
storeConfig
,
4
).
then
(
async
(
ret
)
=>
{
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
"
);
})
})
storePromise
=
null
expect
(
false
).
assertTrue
();
done
();
}
catch
(
error
){
console
.
info
(
TAG
+
"
************* testRdbStore0003 end *************
"
);
console
.
info
(
TAG
+
`catch err: failed: err: code=
${
error
.
code
}
, message =
${
error
.
message
}
`
)
expect
(
error
.
code
).
assertEqual
(
"
401
"
)
done
();
console
.
info
(
TAG
+
"
************* testRdbStore0003 end *************
"
);
}
})
})
/**
/**
...
...
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
浏览文件 @
2079a5a6
...
@@ -178,12 +178,12 @@ describe('rdbStoreV9Test', function () {
...
@@ -178,12 +178,12 @@ describe('rdbStoreV9Test', function () {
}else{
}else{
console.info(TAG + "create table success")
console.info(TAG + "create table success")
}
}
done();
dataRdb.deleteRdbStore(context,"secure.db").then(()=>{
console.info(TAG + "Delete rdbstore success")
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 end *************");
})
});
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 end *************");
})
})
/**
/**
...
@@ -205,12 +205,11 @@ describe('rdbStoreV9Test', function () {
...
@@ -205,12 +205,11 @@ describe('rdbStoreV9Test', function () {
}else{
}else{
console.info(TAG + "create table success")
console.info(TAG + "create table success")
}
}
done();
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 end *************");
})
});
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 end *************");
})
})
/**
/**
...
@@ -232,12 +231,11 @@ describe('rdbStoreV9Test', function () {
...
@@ -232,12 +231,11 @@ describe('rdbStoreV9Test', function () {
}else{
}else{
console.info(TAG + "create table success")
console.info(TAG + "create table success")
}
}
done();
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 end *************");
})
});
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 end *************");
})
})
/**
/**
...
@@ -259,12 +257,11 @@ describe('rdbStoreV9Test', function () {
...
@@ -259,12 +257,11 @@ describe('rdbStoreV9Test', function () {
}else{
}else{
console.info(TAG + "get rdb store success")
console.info(TAG + "get rdb store success")
}
}
done();
dataRdb.deleteRdbStore(context,"secure.db").then(() => {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************");
})
});
});
await dataRdb.deleteRdbStore(context,"secure.db");
await sleep(1000)
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************");
})
})
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录