Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f322457d
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看板
未验证
提交
f322457d
编写于
11月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6357 【Distributeddatamgr】【monthly_20221018】API覆盖率补齐
Merge pull request !6357 from 梁梁/monthly_20221018
上级
1e8d6341
c66781ce
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
942 addition
and
12 deletion
+942
-12
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/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
浏览文件 @
f322457d
文件已添加
distributeddatamgr/dataObjectjstest/hap/signature/openharmony_sx.p7b
浏览文件 @
f322457d
无法预览此类型文件
distributeddatamgr/dataObjectjstest/hap/src/main/config.json
浏览文件 @
f322457d
...
...
@@ -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
浏览文件 @
f322457d
...
...
@@ -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
浏览文件 @
f322457d
此差异已折叠。
点击以展开。
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js
浏览文件 @
f322457d
...
...
@@ -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
浏览文件 @
f322457d
...
...
@@ -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
浏览文件 @
f322457d
/*
* 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.getRdbStore(context, config, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null)
console.info(TAG + 'beforeEach')
})
afterEach(async function () {
await dataRdb.deleteRdbStore(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
浏览文件 @
f322457d
...
...
@@ -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
浏览文件 @
f322457d
/*
* 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录