Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
108d1f7a
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看板
提交
108d1f7a
编写于
12月 28, 2022
作者:
Y
yanglifeng1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<modified>
Signed-off-by:
N
yanglifeng1217
<
yanglifeng5@huawei.com
>
上级
e5d934a8
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
128 addition
and
112 deletion
+128
-112
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js
...est/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js
+4
-4
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js
...test/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js
+5
-5
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
...est/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
+16
-27
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
...test/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
+96
-69
distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js
...test/hap/src/main/js/test/KvManagerCallbackJsunit.test.js
+1
-1
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js
...st/hap/src/main/js/test/PreferencesCallBackJsunit.test.js
+1
-1
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js
...test/hap/src/main/js/test/PreferencesHelperJsunit.test.js
+1
-1
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
...est/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
+1
-1
distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
...esjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
+1
-1
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js
...main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js
+1
-1
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js
.../test/RelationalStorePredicatesComplexFiledJsunit.test.js
+1
-1
未找到文件。
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js
浏览文件 @
108d1f7a
...
...
@@ -2105,7 +2105,7 @@ describe('deviceKvStoreCallbackTest', function () {
* @tc.type: FUNC
* @tc.name Test Js Api DeviceKvStore.GetResultSet() testcase 007
*/
it
(
'
SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700
'
);
try
{
let
resultSet
;
...
...
@@ -2124,9 +2124,9 @@ describe('deviceKvStoreCallbackTest', function () {
await
kvStore
.
putBatch
(
entries
,
async
function
(
err
,
data
)
{
console
.
info
(
'
SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
inKeys
(
"
batch_test
"
);
await
kvStore
.
getResultSet
(
localDeviceId
,
predicates
,
async
function
(
err
,
result
)
{
let
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
batch_test
"
);
await
kvStore
.
getResultSet
(
localDeviceId
,
query
,
async
function
(
err
,
result
)
{
console
.
info
(
'
SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700 getResultSet success
'
);
resultSet
=
result
;
expect
(
resultSet
.
getCount
()
==
10
).
assertTrue
();
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js
浏览文件 @
108d1f7a
...
...
@@ -2330,7 +2330,7 @@ describe('deviceKvStorePromiseTest', function () {
* @tc.type: FUNC
* @tc.name Test Js Api DeviceKvStore.getResultSet() testcase 007
*/
it
(
'
SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700
'
);
try
{
let
resultSet
;
...
...
@@ -2349,9 +2349,9 @@ describe('deviceKvStorePromiseTest', function () {
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
let
predicates
=
new
dataSharePredicates
.
DataSharePredicates
();
predicates
.
inKeys
(
"
batch_test
"
);
await
kvStore
.
getResultSet
(
localDeviceId
,
predicates
).
then
(
async
(
result
)
=>
{
let
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
batch_test
"
);
await
kvStore
.
getResultSet
(
localDeviceId
,
query
).
then
(
async
(
result
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700 getResultSet success
'
);
resultSet
=
result
;
expect
(
resultSet
.
getCount
()
==
10
).
assertTrue
();
...
...
@@ -2367,7 +2367,7 @@ describe('deviceKvStorePromiseTest', function () {
expect
(
null
).
assertFail
();
done
();
}
})
})
/**
* @tc.number SUB_DDM_DKV_DEVICEKVSTORE_CLOSERESULTSET_PROMISE_0100
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
浏览文件 @
108d1f7a
...
...
@@ -775,19 +775,14 @@ describe('SingleKvStoreCallbackTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest001
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
await
kvStore
.
delete
(
predicates
,
function
(
err
,
data
)
{
if
(
err
==
undefined
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest001 delete success
'
);
expect
(
null
).
assertFail
();
}
else
{
console
.
error
(
'
SingleKvStoreDeletePredicatesCallbackTest001 delete fail
'
+
err
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
err
!=
undefined
).
assertTrue
();
}
await
kvStore
.
delete
(
KEY_TEST_STRING_ELEMENT
,
function
(
err
,
data
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700 delete err:
'
+
err
);
expect
(
err
==
undefined
).
assertTrue
();
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700 expect fin
'
);
done
();
});
}
catch
(
e
)
{
console
.
error
(
'
S
ingleKvStoreDeletePredicatesCallbackTest001
e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
console
.
error
(
'
S
UB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700
e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
e
.
code
==
401
).
assertTrue
();
done
();
}
...
...
@@ -802,13 +797,10 @@ describe('SingleKvStoreCallbackTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2800
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest002
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
let
arr
=
[
"
name
"
];
predicates
.
inKeys
(
arr
);
await
kvStore
.
put
(
"
name
"
,
"
Bob
"
,
async
function
(
err
,
data
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest002 put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
await
kvStore
.
delete
(
predicates
,
function
(
err
,
data
)
{
await
kvStore
.
delete
(
"
name
"
,
function
(
err
,
data
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest002 delete success
'
);
expect
(
err
==
undefined
).
assertTrue
();
done
();
...
...
@@ -828,23 +820,20 @@ describe('SingleKvStoreCallbackTest', function () {
* @tc.name Test Js Api SingleKvStore.Delete() testcase 003
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
S
ingleKvStoreDeletePredicatesCallbackTest003
'
);
console
.
log
(
'
S
UB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
let
arr
=
[
null
];
predicates
.
inKeys
(
arr
);
await
kvStore
.
put
(
"
name
"
,
"
Bob
"
,
async
function
(
err
,
data
)
{
console
.
log
(
'
S
ingleKvStoreDeletePredicatesCallbackTest003
put success
'
);
console
.
log
(
'
S
UB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900
put success
'
);
expect
(
err
==
undefined
).
assertTrue
();
await
kvStore
.
delete
(
predicates
,
function
(
err
,
data
)
{
console
.
log
(
'
SingleKvStoreDeletePredicatesCallbackTest003 delete success:
'
+
err
);
expect
(
err
==
undefined
).
assertTrue
();
done
();
});
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 expect finash
'
);
})
await
kvStore
.
delete
(
arr
,
function
(
err
,
data
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 delete success:
'
+
err
);
});
}
catch
(
e
)
{
console
.
error
(
'
S
ingleKvStoreDeletePredicatesCallbackTest003
e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
null
).
assertFail
();
console
.
error
(
'
S
UB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900
e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
e
.
code
==
401
).
assertTrue
();
done
();
}
})
...
...
@@ -2228,8 +2217,8 @@ describe('SingleKvStoreCallbackTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULT_CALLBACK_7800
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SingleKvStoreGetResultSetPredicatesCallbackTest001
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
await
kvStore
.
getResultSet
(
predicates
).
then
((
result
)
=>
{
let
query
=
new
factory
.
Query
();
await
kvStore
.
getResultSet
(
query
).
then
((
result
)
=>
{
console
.
log
(
'
SingleKvStoreGetResultSetPredicatesCallbackTest001 getResultSet success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
SingleKvStoreGetResultSetPredicatesCallbackTest001 getResultSet fail
'
+
err
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
浏览文件 @
108d1f7a
...
...
@@ -771,13 +771,12 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
await
kvStore
.
delete
(
predicates
).
then
((
data
)
=>
{
await
kvStore
.
delete
(
"
KEY_TEST_STRING_ELEMENTS
"
).
then
((
data
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete success
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
err
!=
undefined
).
assertTrue
();
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete fail err
'
+
err
);
expect
(
err
==
undefined
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
...
...
@@ -795,13 +794,10 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
let
arr
=
[
"
name
"
];
predicates
.
inKeys
(
arr
);
await
kvStore
.
put
(
"
name
"
,
"
Bob
"
).
then
(
async
(
data
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200 put success
'
);
expect
(
data
==
undefined
).
assertTrue
();
await
kvStore
.
delete
(
predicates
).
then
((
data
)
=>
{
await
kvStore
.
delete
(
"
name
"
).
then
((
data
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200 delete success
'
);
expect
(
data
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
...
...
@@ -828,16 +824,14 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
let
arr
=
[
null
];
predicates
.
inKeys
(
arr
);
await
kvStore
.
put
(
"
name
"
,
"
Bob
"
).
then
(
async
(
data
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 put success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 put fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
await
kvStore
.
delete
(
predicates
,
function
(
err
,
data
)
{
await
kvStore
.
delete
(
"
name
"
,
function
(
err
,
data
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 delete success
'
);
expect
(
err
!=
undefined
).
assertTrue
();
done
();
...
...
@@ -1553,24 +1547,29 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100
'
);
try
{
let
values
=
[];
let
arr1
=
new
Uint8Array
([
4
,
5
,
6
,
7
]);
let
arr2
=
new
Uint8Array
([
4
,
5
,
6
,
7
,
8
]);
let
vb1
=
{
key
:
"
name_1
"
,
value
:
arr1
};
let
vb2
=
{
key
:
"
name_2
"
,
value
:
arr2
};
values
.
push
(
vb1
);
values
.
push
(
vb2
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 values:
'
+
JSON
.
stringify
(
values
));
await
kvStore
.
putBatch
(
values
).
then
(
async
(
err
)
=>
{
let
entries
=
[];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
key
=
'
batch_test_number_key
'
;
var
entry
=
{
key
:
key
+
i
,
value
:
{
type
:
factory
.
ValueType
.
DOUBLE
,
value
:
2.00
}
}
entries
.
push
(
entry
);
}
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entries:
'
+
JSON
.
stringify
(
entries
));
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
var
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name
_
"
);
query
.
prefixKey
(
"
batch_test
_
"
);
await
kvStore
.
getEntries
(
query
).
then
((
entrys
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 getEntries success
'
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entrys.length:
'
+
entrys
.
length
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
1
]));
expect
(
entrys
.
length
==
2
).
assertTrue
();
expect
(
entrys
.
length
==
10
).
assertTrue
();
done
();
});
});
...
...
@@ -1590,22 +1589,29 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200
'
);
try
{
let
values
=
[];
let
vb1
=
{
key
:
"
name_1
"
,
value
:
"
arr1
"
};
let
vb2
=
{
key
:
"
name_2
"
,
value
:
"
arr2
"
};
values
.
push
(
vb1
);
values
.
push
(
vb2
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 values:
'
+
JSON
.
stringify
(
values
));
await
kvStore
.
putBatch
(
values
).
then
(
async
(
err
)
=>
{
let
entries
=
[];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
key
=
'
key_test_int
'
;
var
entry
=
{
key
:
key
+
i
,
value
:
{
type
:
factory
.
ValueType
.
INTEGER
,
value
:
'
123
'
}
}
entries
.
push
(
entry
);
}
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entries:
'
+
JSON
.
stringify
(
entries
));
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
var
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name
_
"
);
query
.
prefixKey
(
"
key_test
_
"
);
await
kvStore
.
getEntries
(
query
).
then
((
entrys
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 getEntries success
'
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entrys.length:
'
+
entrys
.
length
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
1
]));
expect
(
entrys
.
length
==
2
).
assertTrue
();
expect
(
entrys
.
length
==
10
).
assertTrue
();
done
();
}).
catch
((
err
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 delete fail
'
+
err
);
...
...
@@ -1631,24 +1637,29 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300
'
);
try
{
let
values
=
[];
let
vb1
=
{
key
:
"
name_1
"
,
value
:
123
};
let
vb2
=
{
key
:
"
name_2
"
,
value
:
321.0
};
let
vb3
=
{
key
:
"
name_3
"
,
value
:
321.00
};
values
.
push
(
vb1
);
values
.
push
(
vb2
);
values
.
push
(
vb3
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 values:
'
+
JSON
.
stringify
(
values
));
await
kvStore
.
putBatch
(
values
).
then
(
async
(
err
)
=>
{
let
entries
=
[];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
key
=
'
key_test_boolean
'
;
var
entry
=
{
key
:
key
+
i
,
value
:
{
type
:
factory
.
ValueType
.
BOOLEAN
,
value
:
'
true
'
}
}
entries
.
push
(
entry
);
}
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entries:
'
+
JSON
.
stringify
(
entries
));
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
var
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name
_
"
);
query
.
prefixKey
(
"
key_test
_
"
);
await
kvStore
.
getEntries
(
query
).
then
((
entrys
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 getEntries success
'
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entrys.length:
'
+
entrys
.
length
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
2
]));
expect
(
entrys
.
length
==
3
).
assertTrue
();
expect
(
entrys
.
length
==
10
).
assertTrue
();
done
();
});
});
...
...
@@ -1668,22 +1679,29 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400
'
);
try
{
let
values
=
[];
let
vb1
=
{
key
:
"
name_1
"
,
value
:
true
};
let
vb2
=
{
key
:
"
name_2
"
,
value
:
false
};
values
.
push
(
vb1
);
values
.
push
(
vb2
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 values:
'
+
JSON
.
stringify
(
values
));
await
kvStore
.
putBatch
(
values
).
then
(
async
(
err
)
=>
{
let
entries
=
[];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
key
=
'
key_test_float
'
;
var
entry
=
{
key
:
key
+
i
,
value
:
{
type
:
factory
.
ValueType
.
FLOAT
,
value
:
'
321.12
'
}
}
entries
.
push
(
entry
);
}
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entries:
'
+
JSON
.
stringify
(
entries
));
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
var
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name
_
"
);
query
.
prefixKey
(
"
key_test
_
"
);
await
kvStore
.
getEntries
(
query
).
then
((
entrys
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 getEntries success
'
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entrys.length:
'
+
entrys
.
length
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
1
]));
expect
(
entrys
.
length
==
2
).
assertTrue
();
expect
(
entrys
.
length
==
10
).
assertTrue
();
done
();
});
});
...
...
@@ -1703,23 +1721,32 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500
'
);
try
{
let
values
=
[];
let
vb1
=
{
key
:
"
name_1
"
,
value
:
null
};
let
vb2
=
{
key
:
"
name_2
"
,
value
:
null
};
values
.
push
(
vb1
);
values
.
push
(
vb2
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 values:
'
+
JSON
.
stringify
(
values
));
await
kvStore
.
putBatch
(
values
).
then
(
async
(
err
)
=>
{
let
entries
=
[];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
key
=
'
key_test_string
'
;
var
entry
=
{
key
:
key
+
i
,
value
:
{
type
:
factory
.
ValueType
.
STRING
,
value
:
'
value-string-001
'
}
}
entries
.
push
(
entry
);
}
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entries:
'
+
JSON
.
stringify
(
entries
));
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
var
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name
_
"
);
query
.
prefixKey
(
"
key_test
_
"
);
await
kvStore
.
getEntries
(
query
).
then
((
entrys
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 getEntries success
'
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys.length:
'
+
entrys
.
length
);
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
1
]));
expect
(
entrys
.
length
==
2
).
assertTrue
();
expect
(
entrys
[
0
].
value
==
null
).
assertTrue
();
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[1]:
'
+
JSON
.
stringify
(
entrys
[
1
]));
expect
(
entrys
.
length
==
10
).
assertTrue
();
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
0
]));
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]:
'
+
JSON
.
stringify
(
entrys
[
0
].
value
));
expect
(
entrys
[
0
].
value
.
value
==
'
value-string-001
'
).
assertTrue
();
done
();
});
});
...
...
@@ -2762,9 +2789,9 @@ describe('SingleKvStorePromiseTest', function () {
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0700 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
let
predicates
=
new
dataShare
.
DataSharePredicates
();
predicates
.
prefixKey
(
"
name_
"
);
await
kvStore
.
getResultSet
(
predicates
).
then
((
result
)
=>
{
let
query
=
new
factory
.
Query
();
query
.
prefixKey
(
"
name_
"
);
await
kvStore
.
getResultSet
(
query
).
then
((
result
)
=>
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0700 getResultSet success
'
);
resultSet
=
result
;
expect
(
resultSet
.
getCount
()
==
10
).
assertTrue
();
...
...
@@ -2795,8 +2822,8 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800
'
);
try
{
let
predicates
=
new
dataShare
.
DataSharePredicates
();
await
kvStore
.
getResultSet
(
predicates
,
async
function
(
err
,
result
)
{
let
query
=
new
factory
.
Query
();
await
kvStore
.
getResultSet
(
query
,
async
function
(
err
,
result
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800 GetResultSet success:
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
kvStore
.
closeResultSet
(
result
);
expect
(
err
==
undefined
).
assertTrue
();
...
...
distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
factory
from
'
@ohos.data.distributedData
'
;
const
TEST_BUNDLE_NAME
=
'
ohos.acts.kvStore
'
;
...
...
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataPreferences
from
'
@ohos.data.preferences
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
...
...
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataPreferences
from
'
@ohos.data.preferences
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
...
...
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataPreferences
from
'
@ohos.data.preferences
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
...
...
distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
storage
from
'
@system.storage
'
;
const
TAG
=
'
[SYSTEM_STORAGE_JSKITS_TEST]
'
...
...
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataRdb
from
'
@ohos.data.rdb
'
;
const
TAG
=
"
[RDB_JSKITS_TEST]
"
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js
浏览文件 @
108d1f7a
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
data_Rdb
from
'
@ohos.data.relationalStore
'
;
import
ability_featureAbility
from
'
@ohos.ability.featureAbility
'
var
context
=
ability_featureAbility
.
getContext
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录