Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4783e082
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看板
提交
4783e082
编写于
7月 25, 2023
作者:
Y
yanglifeng1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<modified>
Signed-off-by:
N
yanglifeng1217
<
yanglifeng5@huawei.com
>
上级
dfe0d829
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
148 addition
and
27 deletion
+148
-27
distributeddatamgr/BUILD.gn
distributeddatamgr/BUILD.gn
+1
-1
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdCallback.test.ets
...src/main/ets/test/preferencesDataGroupIdCallback.test.ets
+9
-9
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdPromise.test.ets
.../src/main/ets/test/preferencesDataGroupIdPromise.test.ets
+6
-6
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesSyncJsunit.test.js
...jstest/hap/src/main/js/test/PreferencesSyncJsunit.test.js
+26
-0
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/List.test.ets
...ionalStoreStagetest/entry/src/main/ets/test/List.test.ets
+4
-1
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/relationalStoreEmit.test.ets
...test/entry/src/main/ets/test/relationalStoreEmit.test.ets
+92
-0
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdCallback.test.ets
...main/ets/test/relationalStoreDataGroupIdCallback.test.ets
+6
-6
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdPromise.test.ets
.../main/ets/test/relationalStoreDataGroupIdPromise.test.ets
+4
-4
未找到文件。
distributeddatamgr/BUILD.gn
浏览文件 @
4783e082
...
...
@@ -23,10 +23,10 @@ group("distributeddatamgr") {
"dataSharejstest/hap:dataShare_js_test",
"distributedKVStoretest:distributedKVStoretest",
"kvStoretest:kvStoretest",
"preferencesdatagroupidtest:ActsPreferencesDataGroupIdTest",
"preferencesjstest/hap:preferences_js_test",
"relationalStoretest:relationalStoretest",
"relationalstoredatagroupidtest:ActsRelationalstoreDataGroupIdTest",
"preferencesdatagroupidtest:ActsPreferencesDataGroupIdTest",
]
} else {
deps = [
...
...
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdCallback.test.ets
浏览文件 @
4783e082
...
...
@@ -26,8 +26,8 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0100
* @tc.name preferences dataGroupId null callback test
* @tc.desc preferences dataGroupId null callback test
* @tc.name preferences
getPreferences
dataGroupId null callback test
* @tc.desc preferences
getPreferences
dataGroupId null callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0100', 0, async function (done) {
const Options = {
...
...
@@ -55,7 +55,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0200
* @tc.name preferences dataGroupId undefined callback test
* @tc.desc preferences dataGroupId undefined callback test
* @tc.desc preferences
getPreferences
dataGroupId undefined callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0200', 0, async function (done) {
const Options = {
...
...
@@ -82,7 +82,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0300
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
* @tc.desc preferences
getPreferences
dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0300', 0, async function (done) {
const Options = {
...
...
@@ -110,7 +110,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0400
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
* @tc.desc preferences d
eletePreferences d
ataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0400', 0, async function (done) {
const Options = {
...
...
@@ -143,7 +143,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0500
* @tc.name preferences dataGroupId null callback test
* @tc.desc preferences dataGroupId null callback test
* @tc.desc preferences
getPreferences
dataGroupId null callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0500', 0, async function (done) {
const Options = {
...
...
@@ -171,7 +171,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0600
* @tc.name preferences dataGroupId undefined callback test
* @tc.desc preferences dataGroupId undefined callback test
* @tc.desc preferences
removePreferencesFromCache
dataGroupId undefined callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0600', 0, async function (done) {
const Options = {
...
...
@@ -198,7 +198,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0700
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
* @tc.desc preferences
removePreferencesFromCache
dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0700', 0, async function (done) {
const Options = {
...
...
@@ -226,7 +226,7 @@ export default function preferencesDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0800
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
* @tc.desc preferences
removePreferencesFromCache
dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0800', 0, async function (done) {
const Options = {
...
...
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdPromise.test.ets
浏览文件 @
4783e082
...
...
@@ -27,7 +27,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0100
* @tc.name preferences dataGroupId null promise test
* @tc.desc preferences dataGroupId null promise test
* @tc.desc preferences
getPreferences
dataGroupId null promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0100', 0, async function (done) {
const Options = {
...
...
@@ -63,7 +63,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0200
* @tc.name preferences dataGroupId undefined promise test
* @tc.desc preferences dataGroupId undefined promise test
* @tc.desc preferences
getPreferences
dataGroupId undefined promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0200', 0, async function (done) {
const Options = {
...
...
@@ -99,7 +99,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0300
* @tc.name preferences dataGroupId promise test
* @tc.desc preferences dataGroupId promise test
* @tc.desc preferences
getPreferences
dataGroupId promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0300', 0, async function (done) {
const Options = {
...
...
@@ -135,7 +135,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0400
* @tc.name preferences dataGroupId null promise test
* @tc.desc preferences dataGroupId null promise test
* @tc.desc preferences
getPreferences
dataGroupId null promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0400', 0, async function (done) {
const Options = {
...
...
@@ -171,7 +171,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0500
* @tc.name preferences dataGroupId undefined promise test
* @tc.desc preferences dataGroupId undefined promise test
* @tc.desc preferences
removePreferencesFromCache
dataGroupId undefined promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0500', 0, async function (done) {
const Options = {
...
...
@@ -207,7 +207,7 @@ export default function preferencesDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0600
* @tc.name preferences dataGroupId promise test
* @tc.desc preferences dataGroupId promise test
* @tc.desc preferences
removePreferencesFromCache
dataGroupId promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0600', 0, async function (done) {
const Options = {
...
...
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesSyncJsunit.test.js
浏览文件 @
4783e082
...
...
@@ -378,5 +378,31 @@ export default function PreferencesSyncTest() {
expect
(
"
default
"
).
assertEqual
(
mPreferences
.
getSync
(
KEY_TEST_STRING_ELEMENT
,
"
default
"
));
done
();
})
/**
* @tc.number SUB_DDM_Preferences_removePreferencesFromCacheSync_0100
* @tc.name removePreferencesFromCacheSync interface test
* @tc.desc removePreferencesFromCacheSync interface test
*/
it
(
'
testPreferencesCallback0172
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
testPreferencesCallback0172 begin.
"
);
mPreferences
=
await
dataPreferences
.
getPreferences
(
context
,
NAME
);
await
mPreferences
.
clearSync
();
await
mPreferences
.
putSync
(
KEY_TEST_STRING_ELEMENT
,
'
test
'
)
await
mPreferences
.
getSync
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
mPreferences
.
flush
(
async
function
(
err
,
val
)
{
if
(
err
)
{
console
.
log
(
TAG
+
"
flush err.
"
);
expect
().
assertFail
();
}
console
.
log
(
TAG
+
"
flush done.
"
);
await
dataPreferences
.
removePreferencesFromCacheSync
(
context
,
NAME
);
let
value
=
mPreferences
.
getSync
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
console
.
log
(
TAG
+
"
testPreferencesCallback0172 end.
"
+
value
);
expect
(
'
test
'
).
assertEqual
(
value
);
done
();
console
.
log
(
TAG
+
"
testPreferencesCallback0172 end.
"
);
});
})
})
}
\ No newline at end of file
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/List.test.ets
浏览文件 @
4783e082
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022
-2023
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
...
...
@@ -16,8 +16,11 @@
import relationalStoreDistributedTest from './relationalStoreDistributedEtsunit.test.ets'
import relationalStoreTest from './relationalStoreEtsunit.test.ets'
import relationalStoreResultSetTest from './relationalStoreTestResultsetEtsunit.test.ets'
import relationalStoreEmitTest from './relationalStoreEmit.test'
export default function testsuite() {
relationalStoreDistributedTest(globalThis.abilityContext)
relationalStoreTest(globalThis.abilityContext)
relationalStoreResultSetTest(globalThis.abilityContext)
relationalStoreEmitTest()
}
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/relationalStoreEmit.test.ets
0 → 100644
浏览文件 @
4783e082
/*
* Copyright (C) 2023 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
data_Rdb
from
'@ohos.data.relationalStore'
;
const
TAG
=
"[RelationalStore_Emit_TEST]"
;
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)"
;
let
rdbStore
;
const
STORE_CONFIG
=
{
name
:
"rdbstoreEmit.db"
,
securityLevel
:
data_Rdb
.
SecurityLevel
.
S1
};
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
export
default
function
relationalStoreEmitTest
()
{
describe
(
'relationalStoreEmitTest'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
TAG
+
'beforeAll'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
TAG
+
'beforeEach'
);
rdbStore
=
await
data_Rdb
.
getRdbStore
(
globalThis
.
abilityContext
,
STORE_CONFIG
)
await
rdbStore
.
executeSql
(
CREATE_TABLE_TEST
);
})
afterEach
(
async
function
()
{
console
.
info
(
TAG
+
'afterAll'
);
data_Rdb
.
deleteRdbStore
(
globalThis
.
abilityContext
,
"rdbstoreEmit.db"
);
})
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'afterAll'
);
})
console
.
info
(
TAG
+
"*************Unit Test Begin*************"
);
/**
* @tc.number SUB_DDM_RelationalStore_Emit_0100
* @tc.name relationalStore emit test
* @tc.desc relationalStore emit test
*/
it
(
'testRdbStoreDistributed0012'
,
0
,
async
function
(
done
)
{
async
function
subscribeInsert
()
{
console
.
info
(
TAG
+
"subscribeInsert start"
);
const
valueBucket
=
{
"name"
:
"zhangsan"
}
await
rdbStore
.
insert
(
"test"
,
valueBucket
)
console
.
info
(
TAG
+
"subscribeInsert end"
);
}
try
{
await
rdbStore
.
on
(
'storeObserverInsert'
,
false
,
subscribeInsert
);
await
rdbStore
.
emit
(
'storeObserverInsert'
);
await
sleep
(
2000
);
let
resultSet
=
await
rdbStore
.
querySql
(
"SELECT * FROM test"
);
console
.
info
(
TAG
+
"resultSet = "
+
resultSet
.
rowCount
);
expect
(
1
)
.
assertEqual
(
resultSet
.
rowCount
);
done
();
}
catch
(
err
)
{
console
.
error
(
`failed, code is ${err.code},message is ${err.message}`
);
expect
()
.
assertFail
()
done
();
}
})
})
}
\ No newline at end of file
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdCallback.test.ets
浏览文件 @
4783e082
...
...
@@ -54,7 +54,7 @@ export default function relationalStoreDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0100
* @tc.name relationalStore dataGroupId null callback test
* @tc.desc relationalStore dataGroupId null callback test
* @tc.desc relationalStore
getRdbStore
dataGroupId null callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Callback_0100', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -84,7 +84,7 @@ export default function relationalStoreDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0200
* @tc.name relationalStore dataGroupId undefined callback test
* @tc.desc relationalStore dataGroupId undefined callback test
* @tc.desc relationalStore
getRdbStore
dataGroupId undefined callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Callback_0200', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -95,7 +95,7 @@ export default function relationalStoreDataGroupIdCallback() {
try {
relationalStore.getRdbStore(globalThis.abilityContext, STORE_CONFIG, async function (err, rdbStore) {
console.info(TAG, `Get RdbStore successfully.`);
expect(
err !== null && rdbStore !== null
).assertFail();
expect().assertFail();
done();
await rdbStore.executeSql(CREATE_TABLE_TEST);
relationalStore.deleteRdbStore(globalThis.abilityContext, STORE_CONFIG, function (error) {
...
...
@@ -115,7 +115,7 @@ export default function relationalStoreDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0300
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
* @tc.desc relationalStore
getRdbStore
dataGroupId callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Callback_0300', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -126,7 +126,7 @@ export default function relationalStoreDataGroupIdCallback() {
try {
relationalStore.getRdbStore(globalThis.abilityContext, STORE_CONFIG, async function (err, rdbStore) {
console.info(TAG, `Get RdbStore successfully.`);
expect(
err !== null && rdbStore !== null
).assertFail();
expect().assertFail();
done();
await rdbStore.executeSql(CREATE_TABLE_TEST);
relationalStore.deleteRdbStore(globalThis.abilityContext, STORE_CONFIG, function (error) {
...
...
@@ -145,7 +145,7 @@ export default function relationalStoreDataGroupIdCallback() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0400
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
* @tc.desc relationalStore d
eleteRdbStore d
ataGroupId callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Callback_0400', 0, async function (done) {
const STORE_CONFIG = {
...
...
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdPromise.test.ets
浏览文件 @
4783e082
...
...
@@ -37,7 +37,7 @@ export default function relationalStoreDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Promise_0100
* @tc.name relationalStore dataGroupId null promise test
* @tc.desc relationalStore dataGroupId null promise test
* @tc.desc relationalStore
getRdbStore
dataGroupId null promise test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Promise_0100', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -75,7 +75,7 @@ export default function relationalStoreDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Promise_0200
* @tc.name relationalStore dataGroupId undefined callback test
* @tc.desc relationalStore dataGroupId undefined callback test
* @tc.desc relationalStore
getRdbStore
dataGroupId undefined callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Promise_0200', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -114,7 +114,7 @@ export default function relationalStoreDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Promise_0300
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
* @tc.desc relationalStore
getRdbStore
dataGroupId callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Promise_0300', 0, async function (done) {
const STORE_CONFIG = {
...
...
@@ -152,7 +152,7 @@ export default function relationalStoreDataGroupIdPromise() {
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Promise_0400
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
* @tc.desc relationalStore d
eleteRdbStore d
ataGroupId callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Promise_0400', 0, async function (done) {
const STORE_CONFIG = {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录