Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6cf2aa9d
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看板
提交
6cf2aa9d
编写于
7月 24, 2023
作者:
Y
yanglifeng1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<modified>
Signed-off-by:
N
yanglifeng1217
<
yanglifeng5@huawei.com
>
上级
4b707a6e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
326 addition
and
33 deletion
+326
-33
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdCallback.test.ets
...src/main/ets/test/preferencesDataGroupIdCallback.test.ets
+149
-0
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdPromise.test.ets
.../src/main/ets/test/preferencesDataGroupIdPromise.test.ets
+108
-0
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdCallback.test.ets
...main/ets/test/relationalStoreDataGroupIdCallback.test.ets
+32
-33
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdPromise.test.ets
.../main/ets/test/relationalStoreDataGroupIdPromise.test.ets
+37
-0
未找到文件。
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdCallback.test.ets
浏览文件 @
6cf2aa9d
...
@@ -107,6 +107,155 @@ export default function preferencesDataGroupIdCallback() {
...
@@ -107,6 +107,155 @@ export default function preferencesDataGroupIdCallback() {
}
}
})
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0400
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0400', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: '123456',
};
try {
dataPreferences.getPreferences(globalThis.abilityContext, Options, async function (err) {
if (err) {
console.error(TAG, `getPreferences failed, code is ${err.code},message is ${err.message}`);
return false;
}
console.info(TAG, `getPreferences successfully.`);
dataPreferences.deletePreferences(globalThis.abilityContext, Options, function (error) {
if (error) {
console.error(TAG, `deletePreferences failed, code is ${error.code},message is ${error.message}`);
return false;
}
console.info(TAG, `deletePreferences successfully.`);
expect(error === undefined).assertTrue();
done();
})
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo !== null).assertFail();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0500
* @tc.name preferences dataGroupId null callback test
* @tc.desc preferences dataGroupId null callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0500', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: null,
};
try {
dataPreferences.getPreferences(globalThis.abilityContext, Options, async function (err) {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options, function (error) {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
})
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('401');
done();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0600
* @tc.name preferences dataGroupId undefined callback test
* @tc.desc preferences dataGroupId undefined callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0600', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: undefined,
};
try {
dataPreferences.getPreferences(globalThis.abilityContext, Options, async function (err) {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options, function (error) {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
})
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('401');
done();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0700
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0700', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: '112233',
};
try {
dataPreferences.getPreferences(globalThis.abilityContext, Options, async function (err) {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options, function (error) {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
})
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('14801002');
done();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Callback_0800
* @tc.name preferences dataGroupId callback test
* @tc.desc preferences dataGroupId callback test
*/
it('SUB_DDM_Preferences_DataGroupId_Callback_0800', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: '123456',
};
try {
dataPreferences.getPreferences(globalThis.abilityContext, Options, async function (err) {
if (err) {
console.error(TAG, `getPreferences failed, code is ${err.code},message is ${err.message}`);
return false;
}
console.info(TAG, `getPreferences successfully.`);
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options, function (error) {
if (error) {
console.error(TAG, `removePreferencesFromCache failed, code is ${error.code},message is ${error.message}`);
return false;
}
console.info(TAG, `removePreferencesFromCache successfully.`);
expect(error === undefined).assertTrue();
done();
})
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo !== null).assertFail();
}
})
console.log(TAG + "*************Unit Test End*************");
console.log(TAG + "*************Unit Test End*************");
})
})
}
}
\ No newline at end of file
distributeddatamgr/preferencesdatagroupidtest/src/main/ets/test/preferencesDataGroupIdPromise.test.ets
浏览文件 @
6cf2aa9d
...
@@ -132,6 +132,114 @@ export default function preferencesDataGroupIdPromise() {
...
@@ -132,6 +132,114 @@ 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
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0400', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: null,
};
try{
dataPreferences.getPreferences(globalThis.abilityContext, Options).then(async (data) => {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options).then(async (val) => {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
}).catch((error) => {
console.error(TAG, `removePreferencesFromCache failed, code is ${error.code},message is ${error.message}`);
expect(error !== null).assertFail();
done();
})
}).catch((err) => {
console.error(TAG, `getPreferences failed, code is ${err.code},message is ${err.message}`);
expect(err !== null).assertFail();
done();
})
}catch(errInfo){
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('401');
done();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0500
* @tc.name preferences dataGroupId undefined promise test
* @tc.desc preferences dataGroupId undefined promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0500', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: undefined,
};
try{
dataPreferences.getPreferences(globalThis.abilityContext, Options).then(async (data) => {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options).then(async (val) => {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
}).catch((error) => {
console.error(TAG, `removePreferencesFromCache failed, code is ${error.code},message is ${error.message}`);
expect(error !== null).assertFail();
done();
})
}).catch((err) => {
console.error(TAG, `getPreferences failed, code is ${err.code},message is ${err.message}`);
expect(err !== null).assertFail();
done();
})
}catch(errInfo){
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('401');
done();
}
})
/**
* @tc.number SUB_DDM_Preferences_DataGroupId_Promise_0600
* @tc.name preferences dataGroupId promise test
* @tc.desc preferences dataGroupId promise test
*/
it('SUB_DDM_Preferences_DataGroupId_Promise_0600', 0, async function (done) {
const Options = {
name: "test_preferences_callback",
dataGroupId: '112233',
};
try{
dataPreferences.getPreferences(globalThis.abilityContext, Options).then(async (data) => {
console.info(TAG, `getPreferences successfully.`);
expect().assertFail();
done();
dataPreferences.removePreferencesFromCache(globalThis.abilityContext, Options).then(async (val) => {
console.info(TAG, `removePreferencesFromCache successfully.`);
expect().assertFail();
done();
}).catch((error) => {
console.error(TAG, `removePreferencesFromCache failed, code is ${error.code},message is ${error.message}`);
expect(error !== null).assertFail();
done();
})
}).catch((err) => {
console.error(TAG, `getPreferences failed, code is ${err.code},message is ${err.message}`);
expect(err !== null).assertFail();
done();
})
}catch(errInfo){
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo.code).assertEqual('14801002');
done();
}
})
console.log(TAG + "*************Unit Test End*************");
console.log(TAG + "*************Unit Test End*************");
})
})
}
}
\ No newline at end of file
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdCallback.test.ets
浏览文件 @
6cf2aa9d
...
@@ -143,42 +143,41 @@ export default function relationalStoreDataGroupIdCallback() {
...
@@ -143,42 +143,41 @@ export default function relationalStoreDataGroupIdCallback() {
})
})
/**
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0
1
00
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Callback_0
4
00
* @tc.name relationalStore dataGroupId callback test
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
*/
*/
// it('SUB_DDM_RelationalStore_DataGroupId_Callback_0100', 0, async function (done) {
it('SUB_DDM_RelationalStore_DataGroupId_Callback_0400', 0, async function (done) {
// const STORE_CONFIG = {
const STORE_CONFIG = {
// name: "RdbTest.db",
name: "RdbTest.db",
// securityLevel: relationalStore.SecurityLevel.S1,
securityLevel: relationalStore.SecurityLevel.S1,
// dataGroupId: '123456'
dataGroupId: '123456'
// };
};
// try {
try {
// relationalStore.getRdbStore(globalThis.abilityContext, STORE_CONFIG, async function (err, store) {
relationalStore.getRdbStore(globalThis.abilityContext, STORE_CONFIG, async function (err, rdbStore) {
// rdbStore = store;
if (err) {
// if (err) {
console.error(TAG, `Get RdbStore failed, code is ${err.code},message is ${err.message}`);
// console.error(TAG, `Get RdbStore failed, code is ${err.code},message is ${err.message}`);
return false;
// return false;
}
// }
console.info(TAG, `Get RdbStore successfully.` + ` rdbStore = ${rdbStore} , err = ${err}`);
// console.info(TAG, `Get RdbStore successfully.`);
await rdbStore.executeSql(CREATE_TABLE_TEST);
// await rdbStore.executeSql(CREATE_TABLE_TEST);
relationalStore.deleteRdbStore(globalThis.abilityContext, STORE_CONFIG, function (err) {
// relationalStore.deleteRdbStore(globalThis.abilityContext, STORE_CONFIG, function (err) {
if (err) {
// if (err) {
console.error(TAG, `Delete RdbStore failed, code is ${err.code},message is ${err.message}`);
// console.error(TAG, `Delete RdbStore failed, code is ${err.code},message is ${err.message}`);
return false;
// return false;
}
// }
console.info(TAG, `Delete RdbStore successfully.` + ` rdbStore = ${rdbStore} , err = ${err}`);
// console.info(TAG, `Delete RdbStore successfully.`);
expect(err === undefined).assertTrue()
// expect(err === null).assertTrue()
done();
// done();
})
// })
})
// })
} catch (errInfo) {
// } catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
// console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo !== undefined).assertFail()
// expect(errInfo !== null).assertFail()
done();
// done();
}
// }
})
//
// })
console.log(TAG + "*************Unit Test End*************");
console.log(TAG + "*************Unit Test End*************");
...
...
distributeddatamgr/relationalstoredatagroupidtest/src/main/ets/test/relationalStoreDataGroupIdPromise.test.ets
浏览文件 @
6cf2aa9d
...
@@ -149,6 +149,43 @@ export default function relationalStoreDataGroupIdPromise() {
...
@@ -149,6 +149,43 @@ export default function relationalStoreDataGroupIdPromise() {
}
}
})
})
/**
* @tc.number SUB_DDM_RelationalStore_DataGroupId_Promise_0400
* @tc.name relationalStore dataGroupId callback test
* @tc.desc relationalStore dataGroupId callback test
*/
it('SUB_DDM_RelationalStore_DataGroupId_Promise_0400', 0, async function (done) {
const STORE_CONFIG = {
name: "RdbTest.db",
securityLevel: relationalStore.SecurityLevel.S1,
dataGroupId: '123456',
};
try {
relationalStore.getRdbStore(globalThis.abilityContext, STORE_CONFIG).then(async (rdbStore) => {
console.info(TAG, `Get RdbStore successfully.`);
// await rdbStore.executeSql(CREATE_TABLE_TEST);
rdbStore.executeSql(CREATE_TABLE_TEST, [], async function (error) {
if (error) {
console.error(TAG, `ExecuteSql failed, code is ${error.code},message is ${error.message}`);
return;
}
console.info(TAG, `executeSql1 done.` + error);
expect(error === undefined).assertTrue();
await relationalStore.deleteRdbStore(globalThis.abilityContext, STORE_CONFIG)
done();
})
}).catch((err) => {
console.info(TAG, `Get RdbStore fail, code is ${err.code},message is ${err.message}.`);
expect(err !== null).assertFail();
done();
})
} catch (errInfo) {
console.error(TAG, `failed, code is ${errInfo.code},message is ${errInfo.message}`);
expect(errInfo !== null).assertFail();
done();
}
})
console.info(TAG + "*************Unit Test End*************");
console.info(TAG + "*************Unit Test End*************");
})
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录