Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
28830aa8
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,发现更多精彩内容 >>
提交
28830aa8
编写于
11月 07, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用例整改
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
02e1bd1f
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
1094 addition
and
114 deletion
+1094
-114
distributeddatamgr/dataObjectjstest/hap/signature/openharmony_sx - 副本.p7b
...gr/dataObjectjstest/hap/signature/openharmony_sx - 副本.p7b
+0
-0
distributeddatamgr/dataObjectjstest/hap/signature/openharmony_sx.p7b
...datamgr/dataObjectjstest/hap/signature/openharmony_sx.p7b
+0
-0
distributeddatamgr/dataObjectjstest/hap/src/main/config.json
distributeddatamgr/dataObjectjstest/hap/src/main/config.json
+18
-2
distributeddatamgr/dataObjectjstest/hap/src/main/js/test/List.test.js
...atamgr/dataObjectjstest/hap/src/main/js/test/List.test.js
+2
-0
distributeddatamgr/dataObjectjstest/hap/src/main/js/test/ObjectStoreJsunitV9.test.js
...ctjstest/hap/src/main/js/test/ObjectStoreJsunitV9.test.js
+649
-0
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/config.json
...oretest/distributedKVStorejstest/hap/src/main/config.json
+0
-1
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/List.test.js
...istributedKVStorejstest/hap/src/main/js/test/List.test.js
+20
-20
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js
...ibutedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js
+4
-4
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
...est/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
+16
-6
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
...test/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
+54
-44
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/config.json
...lStoretest/relationalStoreJstest/hap/src/main/config.json
+1
-0
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/List.test.js
...t/relationalStoreJstest/hap/src/main/js/test/List.test.js
+26
-26
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbStoreDistributedJsunit.test.js
...st/hap/src/main/js/test/RdbStoreDistributedJsunit.test.js
+31
-1
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
...test/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
+2
-8
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/List.test.ets
...ionalStoreStagetest/entry/src/main/ets/test/List.test.ets
+5
-1
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreDistributedEtsunit.test.ets
...try/src/main/ets/test/RdbstoreDistributedEtsunit.test.ets
+95
-0
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
...etest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
+55
-1
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreResultsetV9Etsunit.test.ets
...try/src/main/ets/test/RdbstoreResultsetV9Etsunit.test.ets
+116
-0
未找到文件。
distributeddatamgr/dataObjectjstest/hap/signature/openharmony_sx - 副本.p7b
0 → 100644
浏览文件 @
28830aa8
文件已添加
distributeddatamgr/dataObjectjstest/hap/signature/openharmony_sx.p7b
浏览文件 @
28830aa8
无法预览此类型文件
distributeddatamgr/dataObjectjstest/hap/src/main/config.json
浏览文件 @
28830aa8
...
...
@@ -17,8 +17,7 @@
"name"
:
".entry"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"tablet"
,
"default"
,
"default"
,
"phone"
],
"distro"
:
{
...
...
@@ -27,6 +26,23 @@
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"user_grant"
,
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"ceshi"
},
{
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
,
"reason"
:
"ceshi"
}
],
"abilities"
:
[
{
"skills"
:
[
...
...
distributeddatamgr/dataObjectjstest/hap/src/main/js/test/List.test.js
浏览文件 @
28830aa8
...
...
@@ -13,6 +13,8 @@
* limitations under the License.
*/
import
objectStoreTest
from
'
./ObjectStoreJsunit.test.js
'
import
objectStoreTestV9
from
'
./ObjectStoreJsunitV9.test.js
'
export
default
function
testsuite
()
{
objectStoreTest
()
objectStoreTestV9
()
}
distributeddatamgr/dataObjectjstest/hap/src/main/js/test/ObjectStoreJsunitV9.test.js
0 → 100644
浏览文件 @
28830aa8
此差异已折叠。
点击以展开。
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/config.json
浏览文件 @
28830aa8
...
...
@@ -18,7 +18,6 @@
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
,
"deviceType"
:
[
"tablet"
,
"default"
,
"phone"
],
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/List.test.js
浏览文件 @
28830aa8
...
...
@@ -13,30 +13,30 @@
* limitations under the License.
*/
import
SingleKvStorePromiseTest
from
'
./SingleKvStoreKVPromiseJsTest.js
'
import
deviceKvStoreCallbackTest
from
'
./DeviceKvStoreKVCallbackJsTest.js
'
import
deviceKvStorePromiseTest
from
'
./DeviceKvStoreKVPromiseJsTest.js
'
import
kvManagerCallbackTest
from
'
./KvManagerKVCallbackJsTest.js
'
import
KVManagerPromiseTest
from
'
./KvManagerKVPromiseJsTest.js
'
import
KvStoreResultSetTest
from
'
./KvStoreResultSetKVJsTest.js
'
//
import deviceKvStoreCallbackTest from './DeviceKvStoreKVCallbackJsTest.js'
//
import deviceKvStorePromiseTest from './DeviceKvStoreKVPromiseJsTest.js'
//
import kvManagerCallbackTest from './KvManagerKVCallbackJsTest.js'
//
import KVManagerPromiseTest from './KvManagerKVPromiseJsTest.js'
//
import KvStoreResultSetTest from './KvStoreResultSetKVJsTest.js'
import
queryTest
from
'
./QueryKVJsTest.js
'
import
SingleKvStoreCallbackTest
from
'
./SingleKvStoreKVCallbackJsTest.js
'
import
FieldNodeTest
from
'
./FieldNodeJsTest.js
'
import
kvStoreBackupCallbackJsunittest
from
'
./KvStoreBackupCallbackJsTest.js
'
import
kvStoreBackupPromiseJsunittest
from
'
./KvStoreBackupPromiseJsTest.js
'
import
schemaTest
from
'
./SchemaJsTest.js
'
import
singleKvStoreEnumTest
from
'
./SingleKvStoreEnumJsTest.js
'
//
import FieldNodeTest from './FieldNodeJsTest.js'
//
import kvStoreBackupCallbackJsunittest from './KvStoreBackupCallbackJsTest.js'
//
import kvStoreBackupPromiseJsunittest from './KvStoreBackupPromiseJsTest.js'
//
import schemaTest from './SchemaJsTest.js'
//
import singleKvStoreEnumTest from './SingleKvStoreEnumJsTest.js'
export
default
function
testsuite
()
{
SingleKvStorePromiseTest
()
deviceKvStoreCallbackTest
()
deviceKvStorePromiseTest
()
kvManagerCallbackTest
()
KVManagerPromiseTest
()
KvStoreResultSetTest
()
//
deviceKvStoreCallbackTest()
//
deviceKvStorePromiseTest()
//
kvManagerCallbackTest()
//
KVManagerPromiseTest()
//
KvStoreResultSetTest()
queryTest
()
SingleKvStoreCallbackTest
()
FieldNodeTest
()
kvStoreBackupCallbackJsunittest
()
kvStoreBackupPromiseJsunittest
()
schemaTest
()
singleKvStoreEnumTest
()
//
FieldNodeTest()
//
kvStoreBackupCallbackJsunittest()
//
kvStoreBackupPromiseJsunittest()
//
schemaTest()
//
singleKvStoreEnumTest()
}
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/QueryKVJsTest.js
浏览文件 @
28830aa8
...
...
@@ -1932,12 +1932,12 @@ describe('queryTest', function() {
})
/**
* @tc.number: SUB_DDM_DKV_QUERY_
PREFIXKEY
_PROMISE_0200
* @tc.number: SUB_DDM_DKV_QUERY_
SETSUGGESTINDEX
_PROMISE_0200
* @tc.desc: Test Js Api Query.SetSuggestIndex() testcase 002
* @tc.type: FUNC
* @tc.name Test Js Api Query.SetSuggestIndex() testcase 002
*/
it
(
'
SUB_DDM_DKV_QUERY_
PREFIXKEY
_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_DDM_DKV_QUERY_
SETSUGGESTINDEX
_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
var
query
=
null
;
try
{
query
=
new
ddm
.
Query
();
...
...
@@ -1953,12 +1953,12 @@ describe('queryTest', function() {
})
/**
* @tc.number: SUB_DDM_DKV_QUERY_
PREFIXKEY
_PROMISE_0300
* @tc.number: SUB_DDM_DKV_QUERY_
SETSUGGESTINDEX
_PROMISE_0300
* @tc.desc: Test Js Api Query.SetSuggestIndex() testcase 003
* @tc.type: FUNC
* @tc.name Test Js Api Query.SetSuggestIndex() testcase 003
*/
it
(
'
SUB_DDM_DKV_QUERY_
PREFIXKEY
_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_DDM_DKV_QUERY_
SETSUGGESTINDEX
_PROMISE_0300
'
,
0
,
async
function
(
done
)
{
var
query
=
null
;
try
{
query
=
new
ddm
.
Query
();
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js
浏览文件 @
28830aa8
...
...
@@ -2337,14 +2337,24 @@ describe('SingleKvStoreCallbackTest', function () {
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULT_CALLBACK_8200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SingleKvStoreCloseResultSetCallbackTest004
'
);
try
{
console
.
info
(
'
SingleKvStoreCloseResultSetCallbackTest004 success
'
);
}
catch
(
e
)
{
console
.
error
(
'
SingleKvStoreCloseResultSetCallbackTest004 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
null
).
assertFail
();
let
resultSet
=
null
;
await
kvStore
.
getResultSet
(
'
batch_test_string_key
'
).
then
((
result
)
=>
{
console
.
info
(
'
SingleKvStoreCloseResultSetCallbackTest004 getResultSet success
'
);
resultSet
=
result
;
})
try
{
kvStore
.
closeResultSet
(
""
,(
err
,
data
)
=>
{
console
.
info
(
'
SingleKvStoreCloseResultSetCallbackTest004 close result finish
'
)
expect
(
null
).
assertFail
();
})
}
catch
(
err
){
expect
(
err
.
code
).
assertEqual
(
"
401
"
)
}
done
();
})
});
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETENTRIES_CALLBACK_8300
...
...
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js
浏览文件 @
28830aa8
...
...
@@ -2420,47 +2420,47 @@ describe('SingleKvStorePromiseTest', function () {
})
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
* @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 001
* @tc.type: FUNC
* @tc.name Test Js Api SingleKvStoreGetSecurityLevel testcase 001
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
'
);
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
'
);
try
{
await
kvStore
.
getSecurityLevel
().
then
((
data
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getSecurityLevel success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getSecurityLevel success:
'
+
data
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getSecurityLevel success:
'
+
factory
.
SecurityLevel
.
S2
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getSecurityLevel success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getSecurityLevel success:
'
+
data
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getSecurityLevel success:
'
+
factory
.
SecurityLevel
.
S2
);
expect
(
data
==
factory
.
SecurityLevel
.
S2
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getSecurityLevel fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getSecurityLevel fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
null
).
assertFail
();
}
done
();
})
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
* @tc.desc Test Js Api SingleKvStoreGetSecurityLevel testcase 002
* @tc.type: FUNC
* @tc.name Test Js Api SingleKvStoreGetSecurityLevel testcase 002
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
'
);
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
'
);
try
{
await
kvStore
.
getSecurityLevel
(
1
).
then
((
data
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 getSecurityLevel success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 getSecurityLevel success
'
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 getSecurityLevel fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 getSecurityLevel fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
}
done
();
})
...
...
@@ -2508,13 +2508,13 @@ describe('SingleKvStorePromiseTest', function () {
})
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
* @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 00
1
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
* @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 00
7
* @tc.type: FUNC
* @tc.name Test Js Api SingleKvStoreGetResultSet testcase 00
1
* @tc.name Test Js Api SingleKvStoreGetResultSet testcase 00
7
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00
'
);
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00
'
);
try
{
let
resultSet
;
let
entries
=
[];
...
...
@@ -2530,61 +2530,61 @@ describe('SingleKvStorePromiseTest', function () {
entries
.
push
(
entry
);
}
await
kvStore
.
putBatch
(
entries
).
then
(
async
(
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 putBatch success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
await
kvStore
.
getResultSet
(
'
batch_test_string_key
'
).
then
((
result
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getResultSet success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getResultSet success
'
);
resultSet
=
result
;
expect
(
resultSet
.
getCount
()
==
10
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 getResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 getResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
await
kvStore
.
closeResultSet
(
resultSet
).
then
((
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 closeResultSet success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 closeResultSet success
'
);
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 closeResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 closeResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
1
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
7
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
null
).
assertFail
();
}
done
();
})
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
* @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 00
2
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
* @tc.desc Test Js Api SingleKvStoreGetResultSet testcase 00
8
* @tc.type: FUNC
* @tc.name Test Js Api SingleKvStoreGetResultSet testcase 00
2
* @tc.name Test Js Api SingleKvStoreGetResultSet testcase 00
8
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00
'
);
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00
'
);
try
{
let
resultSet
;
await
kvStore
.
getResultSet
(
'
batch_test_string_key
'
).
then
((
result
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 getResultSet success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 getResultSet success
'
);
resultSet
=
result
;
expect
(
resultSet
.
getCount
()
==
0
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 getResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 getResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
await
kvStore
.
closeResultSet
(
resultSet
).
then
((
err
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 closeResultSet success
'
);
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 closeResultSet success
'
);
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 closeResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 closeResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
2
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0
8
00 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
expect
(
null
).
assertFail
();
}
done
();
...
...
@@ -2661,7 +2661,7 @@ describe('SingleKvStorePromiseTest', function () {
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0500 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_
SETSYNCRANGE_PROMISE_01
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_
GETSECURITYLEVEL_PROMISE_05
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
var
query
=
new
factory
.
Query
();
...
...
@@ -2714,7 +2714,7 @@ describe('SingleKvStorePromiseTest', function () {
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0600 putBatch success
'
);
expect
(
err
==
undefined
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_
SETSYNCRANGE_PROMISE_01
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_
GETSECURITYLEVEL_PROMISE_06
00 putBatch fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
var
query
=
new
factory
.
Query
();
...
...
@@ -2850,8 +2850,7 @@ describe('SingleKvStorePromiseTest', function () {
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200
'
);
try
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200 success
'
);
let
resultSet
=
null
;
let
resultSet
=
undefined
;
await
kvStore
.
getResultSet
(
'
batch_test_string_key
'
).
then
((
result
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200 getResultSet success
'
);
resultSet
=
result
;
...
...
@@ -2904,13 +2903,24 @@ describe('SingleKvStorePromiseTest', function () {
* @tc.name Test Js Api SingleKvStoreCloseResultSet testcase 004
*/
it
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400
'
);
let
resultSet
=
undefined
;
let
errorInfo
=
undefined
;
await
kvStore
.
getResultSet
(
'
batch_test_string_key
'
).
then
((
result
)
=>
{
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 getResultSet success
'
);
resultSet
=
result
;
}).
catch
((
err
)
=>
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 getResultSet fail
'
+
`, error code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
expect
(
null
).
assertFail
();
});
try
{
kvStore
.
closeResultSet
(
""
)
console
.
info
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 success
'
);
}
catch
(
e
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 e
'
+
`, error code is
${
e
.
code
}
, message is
${
e
.
message
}
`
);
e
xpect
(
null
).
assertFail
();
}
catch
(
e
rr
)
{
console
.
error
(
'
SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 e
'
+
`, error code is
${
e
rr
.
code
}
, message is
${
err
.
message
}
`
);
e
rrorInfo
=
err
}
expect
(
errorInfo
.
code
).
assertEqual
(
"
401
"
);
done
();
})
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/config.json
浏览文件 @
28830aa8
...
...
@@ -16,6 +16,7 @@
"package"
:
"ohos.acts.relationalStorejstest"
,
"name"
:
".entry"
,
"deviceType"
:
[
"tablet"
,
"default"
,
"phone"
],
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/List.test.js
浏览文件 @
28830aa8
...
...
@@ -12,35 +12,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
rdbStoreBackupRestoreCallbackTest
from
'
./RdbstoreBackupRestoreCallbackJsunit.test.js
'
import
rdbStoreBackupRestoreWithFAContextTest
from
'
./RdbstoreBackupRestoreWithFAContextJsunit.test.js
'
import
rdbStoreDeleteTest
from
'
./RdbstoreDeleteJsunit.test.js
'
//
import rdbStoreBackupRestoreCallbackTest from './RdbstoreBackupRestoreCallbackJsunit.test.js'
//
import rdbStoreBackupRestoreWithFAContextTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
//
import rdbStoreDeleteTest from './RdbstoreDeleteJsunit.test.js'
import
rdbStoreDistributedTest
from
'
./RdbStoreDistributedJsunit.test.js
'
import
rdbstoreInsertTest
from
'
./RdbstoreInsertJsunit.test.js
'
import
rdbStorePredicatesJoinTest
from
'
./RdbstorePredicatesJoinJsunit.test.js
'
import
rdbPredicatesTest
from
'
./RdbstorePredicatesJsunit.test.js
'
import
rdbStoreTest
from
'
./RdbstoreRdbstoreJsunit.test.js
'
//
import rdbstoreInsertTest from './RdbstoreInsertJsunit.test.js'
//
import rdbStorePredicatesJoinTest from './RdbstorePredicatesJoinJsunit.test.js'
//
import rdbPredicatesTest from './RdbstorePredicatesJsunit.test.js'
//
import rdbStoreTest from './RdbstoreRdbstoreJsunit.test.js'
import
rdbResultSetTest
from
'
./RdbStoreResultSetJsunit.test.js
'
import
rdbstoreStoreExcuteSqlTest
from
'
./RdbstoreStoreExcuteSqlJsunit.test.js
'
import
rdbstoreTransactionTest
from
'
./RdbstoreTransactionJsunit.test.js
'
import
rdbStoreUpdateTest
from
'
./RdbstoreUpdateJsunit.test.js
'
import
rdbstoreQueryTest
from
'
./RdbstoreQuery.test.js
'
import
rdbStoreEncryptionTest
from
'
./RdbstoreEncryptionJsunit.test.js
'
import
rdbStorePredicatesComplexFiledTest
from
'
./RdbstorePredicatesComplexFiledJsunit.test.js
'
//
import rdbstoreStoreExcuteSqlTest from './RdbstoreStoreExcuteSqlJsunit.test.js'
//
import rdbstoreTransactionTest from './RdbstoreTransactionJsunit.test.js'
//
import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js'
//
import rdbstoreQueryTest from './RdbstoreQuery.test.js'
//
import rdbStoreEncryptionTest from './RdbstoreEncryptionJsunit.test.js'
//
import rdbStorePredicatesComplexFiledTest from './RdbstorePredicatesComplexFiledJsunit.test.js'
export
default
function
testsuite
()
{
rdbStoreBackupRestoreCallbackTest
()
rdbStoreBackupRestoreWithFAContextTest
()
rdbStoreDeleteTest
()
//
rdbStoreBackupRestoreCallbackTest()
//
rdbStoreBackupRestoreWithFAContextTest()
//
rdbStoreDeleteTest()
rdbStoreDistributedTest
()
rdbstoreInsertTest
()
rdbStorePredicatesJoinTest
()
rdbPredicatesTest
()
rdbStoreTest
()
//
rdbstoreInsertTest()
//
rdbStorePredicatesJoinTest()
//
rdbPredicatesTest()
//
rdbStoreTest()
rdbResultSetTest
()
rdbstoreStoreExcuteSqlTest
()
rdbstoreTransactionTest
()
rdbStoreUpdateTest
()
rdbstoreQueryTest
()
rdbStoreEncryptionTest
()
rdbStorePredicatesComplexFiledTest
()
//
rdbstoreStoreExcuteSqlTest()
//
rdbstoreTransactionTest()
//
rdbStoreUpdateTest()
//
rdbstoreQueryTest()
//
rdbStoreEncryptionTest()
//
rdbStorePredicatesComplexFiledTest()
}
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbStoreDistributedJsunit.test.js
浏览文件 @
28830aa8
...
...
@@ -15,7 +15,9 @@
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataRdb
from
'
@ohos.data.rdb
'
;
import
abilityFeatureAbility
from
'
@ohos.ability.featureAbility
'
;
let
context
=
abilityFeatureAbility
.
getContext
();
const
TAG
=
"
[RDB_JSKITS_TEST_Distributed]
"
const
STORE_NAME
=
"
distributed_rdb.db
"
var
rdbStore
=
undefined
;
...
...
@@ -310,6 +312,34 @@ describe('rdbStoreDistributedTest', function () {
done
();
console
.
info
(
TAG
+
"
************* testRdbStoreDistributed0011 end *************
"
);
})
/**
* @tc.name sync test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100
* @tc.desc sync test
*/
it
(
'
SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 start *************
"
);
let
config
=
{
name
:
"
secure.db
"
,
securityLevel
:
dataRdb
.
SecurityLevel
.
S1
}
await
dataRdb
.
getRdbStoreV9
(
context
,
config
,
1
).
then
(
async
(
store
)
=>
{
let
predicates
=
new
dataRdb
.
RdbPredicatesV9
(
"
employee
"
)
predicates
=
predicates
.
inDevices
(
"
12345678abcd
"
);
try
{
store
.
sync
(
dataRdb
.
SyncMode
.
SYNC_MODE_PUSH
,
predicates
);
}
catch
(
err
)
{
expect
(
null
).
assertFail
();
}
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
})
await
dataRdb
.
deleteRdbStore
(
context
,
"
secure.db
"
);
done
();
console
.
info
(
TAG
+
"
************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 end *************
"
);
})
/**
* @tc.name sync Callback test
...
...
@@ -369,7 +399,7 @@ describe('rdbStoreDistributedTest', function () {
console
.
info
(
TAG
+
"
************* testRdbStoreDistributed0013 end *************
"
);
})
/**
/**
* @tc.name obtainDistributedTableName Callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_014
* @tc.desc obtainDistributedTableName test
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
浏览文件 @
28830aa8
...
...
@@ -1559,16 +1559,10 @@ describe('rdbResultSetTest', function () {
it
(
'
testIsColumnNull0003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
************* testIsColumnNull0003 start *************
'
);
{
let
errInfo
=
undefined
;
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
'
test
'
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
try
{
resultSet
.
goToRow
(
5
)
expect
(
false
).
assertEqual
(
resultSet
.
isColumnNull
(
2
))
}
catch
(
err
){
errInfo
=
err
}
expect
(
errInfo
.
code
).
assertEqual
(
"
14800012
"
)
resultSet
.
goToRow
(
5
)
expect
(
false
).
assertEqual
(
resultSet
.
isColumnNull
(
2
))
resultSet
=
null
;
done
();
console
.
info
(
TAG
+
'
************* testIsColumnNull0003 end *************
'
);
...
...
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/List.test.ets
浏览文件 @
28830aa8
...
...
@@ -13,6 +13,10 @@
* limitations under the License.
*/
import rdbStoreV9Test from './RdbstoreRdbstoreV9.test.ets'
import rdbStoreDistributedTest from './RdbstoreDistributedEtsunit.test.ets'
import rdbResultSetTest from './RdbstoreResultsetV9Etsunit.test.ets'
export default function testsuite() {
rdbStoreDistributedTest(globalThis.abilityContext)
rdbStoreV9Test(globalThis.abilityContext);
}
\ No newline at end of file
rdbResultSetTest(globalThis.abilityContext)
}
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreDistributedEtsunit.test.ets
0 → 100644
浏览文件 @
28830aa8
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST_Distributed]"
const STORE_NAME = "distributed_rdb.db"
var rdbStore = undefined;
const config = {
"name": STORE_NAME,
securityLevel: dataRdb.SecurityLevel.S1
}
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"
export default function rdbStoreDistributedTest(context) {
describe('rdbStoreDistributedTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
})
beforeEach(async function () {
rdbStore = await dataRdb.getRdbStoreV9(context, config, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null)
console.info(TAG + 'beforeEach')
})
afterEach(async function () {
await dataRdb.deleteRdbStoreV9(context, STORE_NAME);
console.info(TAG + 'afterEach')
})
afterAll(async function () {
console.info(TAG + 'afterAll')
})
console.info(TAG + "*************Unit Test Begin*************");
/**
* @tc.name obtainDistributedTableName Callback interface test
* @tc.number SUB_DDM_AppDataFWK_ETSRDB_Distributed_obtainDistributedTableName_0100
* @tc.desc obtainDistributedTableName test
*/
it('SUB_DDM_AppDataFWK_ETSRDB_Distributed_obtainDistributedTableName_0100', 0, async function (done){
let errInfo = undefined;
function obtainDistributedTableName(deviceId, tableName, Callback){
rdbStore.obtainDistributedTableName(deviceId, tableName, Callback)
}
try{
obtainDistributedTableName(["deviceId"], "EMPLOYEE", function (err, tableName) {
expect(err != null).assertTrue();
console.info('ObtainDistributedTableName failed, Unauthorized.' + err)
})
}catch(err){
errInfo = err
}
expect(errInfo.code).assertEqual("401")
done();
})
/**
* @tc.name obtainDistributedTableName Promise interface test
* @tc.number SUB_DDM_AppDataFWK_ETSRDB_Distributed_obtainDistributedTableName_0200
* @tc.desc obtainDistributedTableName test
*/
it('SUB_DDM_AppDataFWK_ETSRDB_Distributed_obtainDistributedTableName_0200',0,async function (done){
let errInfo = undefined
function obtainDistributedTableName(deviceId, tableName){
rdbStore.obtainDistributedTableName(deviceId, tableName)
}
try{
obtainDistributedTableName(["deviceId"], "EMPLOYEE")
}catch(err){
errInfo = err
}
expect(errInfo.code).assertEqual("401")
done();
})
console.info(TAG + "*************Unit Test End*************");
})
}
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreRdbstoreV9.test.ets
浏览文件 @
28830aa8
...
...
@@ -257,7 +257,7 @@ describe('rdbStoreV9Test', function () {
console.info(TAG + "get rdb store error")
expect(null).assertFail();
}else{
console.info(TAG + "
create tabl
e success")
console.info(TAG + "
get rdb stor
e success")
}
done();
});
...
...
@@ -266,6 +266,60 @@ describe('rdbStoreV9Test', function () {
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************");
})
/**
* @tc.name rdb store deleteRdbStoreV9
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100
* @tc.desc rdb store deleteRdbStoreV9
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4
}
let deleteResult = false
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => {
console.info(TAG + "create table success")
})
await dataRdb.deleteRdbStoreV9(context,"secure.db").then(() => {
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
});
expect(deleteResult).assertTrue();
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 end *************");
})
/**
* @tc.name rdb store deleteRdbStoreV9
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100
* @tc.desc rdb store deleteRdbStoreV9
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
let deleteResult = false
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => {
console.info(TAG + "create rdb store success")
})
dataRdb.deleteRdbStoreV9(context,"secure.db", (err, data) => {
if(err == undefined){
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
}
done();
})
await sleep(1000)
expect(deleteResult).assertTrue();
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 end *************");
})
console.log(TAG + "*************Unit Test End*************");
})
}
\ No newline at end of file
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/RdbstoreResultsetV9Etsunit.test.ets
0 → 100644
浏览文件 @
28830aa8
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
import
dataRdb
from
'@ohos.data.rdb'
const
TAG
=
'[RDB_JSKITS_TEST]'
const
CREATE_TABLE_TEST
=
'CREATE TABLE IF NOT EXISTS test ('
+
'id INTEGER PRIMARY KEY AUTOINCREMENT, '
+
'data1 text,'
+
'data2 long, '
+
'data3 double,'
+
'data4 blob)'
;
const
STORE_CONFIG
=
{
name
:
'Resultset.db'
,
securityLevel
:
dataRdb
.
SecurityLevel
.
S1
}
const
COLOUNM_NAMES
=
[
"id"
,
"data1"
,
"data2"
,
"data3"
,
"data4"
];
var
rdbStore
=
undefined
;
export
default
function
rdbResultSetTest
(
context
)
{
describe
(
'rdbResultSetTest'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
TAG
+
'beforeAll'
)
rdbStore
=
await
dataRdb
.
getRdbStoreV9
(
context
,
STORE_CONFIG
,
1
);
await
rdbStore
.
executeSql
(
CREATE_TABLE_TEST
,
null
);
await
createTest
();
})
beforeEach
(
async
function
()
{
console
.
info
(
TAG
+
'beforeEach'
)
})
afterEach
(
function
()
{
console
.
info
(
TAG
+
'afterEach'
)
})
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'afterAll'
)
rdbStore
=
null
await
dataRdb
.
deleteRdbStoreV9
(
context
,
'Resultset.db'
);
})
//插入数据
async
function
createTest
()
{
console
.
info
(
TAG
+
'createTest data start'
);
{
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
const
valueBucket
=
{
'data1'
:
'hello'
,
'data2'
:
10
,
'data3'
:
1.0
,
'data4'
:
u8
,
}
await
rdbStore
.
insert
(
'test'
,
valueBucket
)
}
{
var
u8
=
new
Uint8Array
([
3
,
4
,
5
])
const
valueBucket
=
{
'data1'
:
'2'
,
'data2'
:
-
5
,
'data3'
:
2.5
,
'data4'
:
u8
,
}
await
rdbStore
.
insert
(
'test'
,
valueBucket
)
}
{
var
u8
=
new
Uint8Array
(
0
)
const
valueBucket
=
{
'data1'
:
'hello world'
,
'data2'
:
3
,
'data3'
:
1.8
,
'data4'
:
u8
,
}
await
rdbStore
.
insert
(
'test'
,
valueBucket
)
}
console
.
info
(
TAG
+
'createTest data end'
);
}
/**
* @tc.name resultSet getBlob normal test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0010
* @tc.desc resultSet getBlob normal test
*/
it
(
'testGetBlob0001'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'************* testGetBlob0001 start *************'
);
let
predicates
=
await
new
dataRdb
.
RdbPredicatesV9
(
'test'
)
let
resultSetV9
=
await
rdbStore
.
query
(
predicates
)
try
{
{
expect
(
true
)
.
assertEqual
(
resultSetV9
.
goToFirstRow
())
const
id
=
resultSetV9
.
getLong
(
resultSetV9
.
getColumnIndex
(
'id'
))
const
data4
=
resultSetV9
.
getBlob
(
resultSetV9
.
getColumnIndex
(
'data4'
))
console
.
info
(
TAG
+
'id='
+
id
+
', data4='
+
data4
);
expect
(
1
)
.
assertEqual
(
data4
[
0
]);
expect
(
2
)
.
assertEqual
(
data4
[
1
]);
expect
(
3
)
.
assertEqual
(
data4
[
2
]);
}
resultSetV9
.
close
();
expect
(
true
)
.
assertEqual
(
resultSetV9
.
isClosed
)
}
catch
(
e
)
{
expect
(
null
)
.
assertFail
();
}
resultSetV9
=
null
done
();
console
.
info
(
TAG
+
'************* testGetBlob0001 end *************'
);
})
console
.
info
(
TAG
+
'*************Unit Test End*************'
);
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录