From 59b2e7ca862fb285bd5500aae91acafe22db8c6a Mon Sep 17 00:00:00 2001 From: liangzhenyu123 Date: Tue, 16 Aug 2022 17:45:44 +0800 Subject: [PATCH] liangzhenyu6@huawei.com Signed-off-by: liangzhenyu123 --- distributeddatamgr/BUILD.gn | 2 +- distributeddatamgr/kvStoretest/BUILD.gn | 24 + .../kvStoreStagetest/AppScope/app.json | 20 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png} | Bin .../kvStoretest/kvStoreStagetest/BUILD.gn | 43 ++ .../kvStoretest/kvStoreStagetest/Test.json | 18 + .../src/main/ets/Application/AbilityStage.ts | 22 + .../src/main/ets/MainAbility/MainAbility.ts | 144 ++++ .../src/main/ets/MainAbility/pages/index.ets | 58 ++ .../src/main/ets/TestAbility/TestAbility.ts | 50 ++ .../src/main/ets/TestAbility/pages/index.ets | 48 ++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 ++ .../entry/src/main/ets/test/List.test.ets | 20 + .../test/kvStoreBackupCallbackJsunit.test.ets | 728 ++++++++++++++++++ ...StoreBackupCallbackPublicFunction.test.ets | 188 +++++ .../test/kvStoreBackupPromiseJsunit.test.ets | 722 +++++++++++++++++ ...vStoreBackupPromisePublicFunction.test.ets | 176 +++++ .../entry/src/main/module.json | 38 + .../main/resources/base/element/string.json | 16 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 5 + .../signature/openharmony_sx.p7b | Bin 0 -> 3443 bytes .../kvStorejstest/hap/BUILD.gn | 0 .../kvStorejstest/hap/Test.json | 0 .../hap/signature/openharmony_sx.p7b | Bin .../kvStorejstest/hap/src/main/config.json | 0 .../hap/src/main/js/MainAbility/app.js | 0 .../src/main/js/MainAbility/i18n/en-US.json | 0 .../src/main/js/MainAbility/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 0 .../main/js/MainAbility/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 0 .../hap/src/main/js/TestAbility/app.js | 0 .../src/main/js/TestAbility/i18n/en-US.json | 0 .../src/main/js/TestAbility/i18n/zh-CN.json | 0 .../main/js/TestAbility/pages/index/index.css | 0 .../main/js/TestAbility/pages/index/index.hml | 0 .../main/js/TestAbility/pages/index/index.js | 0 .../js/TestRunner/OpenHarmonyTestRunner.js | 0 .../test/DeviceKvStoreCallbackJsunit.test.js | 0 .../test/DeviceKvStorePromiseJsunit.test.js | 0 .../src/main/js/test/FieldNodeJsunit.test.js | 2 +- .../js/test/KvManagerCallbackJsunit.test.js | 3 + .../js/test/KvManagerPromiseJsunit.test.js | 0 .../js/test/KvStoreResultSetJsunit.test.js | 0 .../hap/src/main/js/test/List.test.js | 0 .../hap/src/main/js/test/QueryJsunit.test.js | 0 .../hap/src/main/js/test/SchemaJsunit.test.js | 0 .../test/SingleKvStoreCallbackJsunit.test.js | 0 .../js/test/SingleKvStoreEnumJsunit.test.js | 0 .../test/SingleKvStorePromiseJsunit.test.js | 0 .../main/resources/base/element/string.json | 0 .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes 54 files changed, 2411 insertions(+), 2 deletions(-) create mode 100644 distributeddatamgr/kvStoretest/BUILD.gn create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/app.json create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/element/string.json rename distributeddatamgr/{kvStorejstest/hap/src/main/resources/base/media/icon.png => kvStoretest/kvStoreStagetest/AppScope/resources/base/media/app_icon.png} (100%) create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/Test.json create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/Application/AbilityStage.ts create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/pages/index.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/List.test.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackJsunit.test.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackPublicFunction.test.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromiseJsunit.test.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromisePublicFunction.test.ets create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/element/string.json create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/media/icon.png create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/profile/main_pages.json create mode 100644 distributeddatamgr/kvStoretest/kvStoreStagetest/signature/openharmony_sx.p7b rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/BUILD.gn (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/Test.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/signature/openharmony_sx.p7b (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/config.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/app.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/i18n/en-US.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/i18n/zh-CN.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/pages/index/index.css (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/pages/index/index.hml (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/MainAbility/pages/index/index.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/app.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/i18n/en-US.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/i18n/zh-CN.json (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/pages/index/index.css (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/pages/index/index.hml (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestAbility/pages/index/index.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/TestRunner/OpenHarmonyTestRunner.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/DeviceKvStoreCallbackJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/DeviceKvStorePromiseJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/FieldNodeJsunit.test.js (99%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js (99%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/KvManagerPromiseJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/KvStoreResultSetJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/List.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/QueryJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/SchemaJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/SingleKvStoreCallbackJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/SingleKvStoreEnumJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/js/test/SingleKvStorePromiseJsunit.test.js (100%) rename distributeddatamgr/{ => kvStoretest}/kvStorejstest/hap/src/main/resources/base/element/string.json (100%) create mode 100644 distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/resources/base/media/icon.png diff --git a/distributeddatamgr/BUILD.gn b/distributeddatamgr/BUILD.gn index b0b894437..67048ff55 100644 --- a/distributeddatamgr/BUILD.gn +++ b/distributeddatamgr/BUILD.gn @@ -18,7 +18,7 @@ group("distributeddatamgr") { deps = [ "dataObjectjstest/hap:dataObject_js_test", "dataSharejstest/hap:dataShare_js_test", - "kvStorejstest/hap:kvStore_js_test", + "kvStoretest:kvStoretest", "preferencesjstest/hap:preferences_js_test", "relationalStorejstest/hap:relationalstore_js_test", ] diff --git a/distributeddatamgr/kvStoretest/BUILD.gn b/distributeddatamgr/kvStoretest/BUILD.gn new file mode 100644 index 000000000..e896f0bf9 --- /dev/null +++ b/distributeddatamgr/kvStoretest/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2022 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("//test/xts/tools/build/suite.gni") + +group("kvStoretest") { + testonly = true + if (is_standard_system) { + deps = [ + "kvStoreStagetest:ActsKvStoreStageTest", + "kvStorejstest/hap:kvStore_js_test", + ] + } +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/app.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/app.json new file mode 100644 index 000000000..6f2a0069b --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/app.json @@ -0,0 +1,20 @@ +{ + "app": { + "bundleName": "ohos.acts.kvStoreStage", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "debug": false, + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/element/string.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..743eebb13 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication2" + } + ] +} diff --git a/distributeddatamgr/kvStorejstest/hap/src/main/resources/base/media/icon.png b/distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from distributeddatamgr/kvStorejstest/hap/src/main/resources/base/media/icon.png rename to distributeddatamgr/kvStoretest/kvStoreStagetest/AppScope/resources/base/media/app_icon.png diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn b/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn new file mode 100644 index 000000000..7df872a94 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsKvStoreStageTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":kvStoreStage_js_assets", + ":kvStoreStage_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsKvStoreStageTest" + subsystem_name = "distributeddatamgr" + part_name = "distributeddatamgr" +} + +ohos_app_scope("kvStoreStage_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("kvStoreStage_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("kvStoreStage_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":kvStoreStage_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/Test.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/Test.json new file mode 100644 index 000000000..b1ab4e514 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "ohos.acts.kvStoreStage", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [{ + "test-file-name": [ + "ActsKvStoreStageTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/Application/AbilityStage.ts b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 000000000..02ecba3c3 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2022 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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/MainAbility.ts b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 000000000..cc6fdc5ef --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2022 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 Ability from '@ohos.application.Ability' +import dataShare from '@ohos.data.dataShare' +import rpc from "@ohos.rpc"; + +var seConnect = { + onConnect:function (elementName, proxy) { + console.log("[ttt] [DataShareTest] <> seConnect onConnect called."); + console.log("[ttt] [DataShareTest] <> seConnect onConnect elementName = " + elementName); + console.log("[ttt] [DataShareTest] <> seConnect onConnect proxy = " + proxy); + let data = rpc.MessageParcel.create(); + let reply = rpc.MessageParcel.create(); + let option = new rpc.MessageOption(); + data.writeInterfaceToken("connect-test"); + data.writeInt(111); + + console.log("[ttt] [DataShareTest] <> seConnect onConnect sendRequest."); + proxy.sendRequest(1, data, reply, option) + .then(function (result) { + if (result.errCode === 0) { + // let msg = reply.readString(); + let msg = result.reply.readInt(); + console.log("[ttt] [DataShareTest] <> seConnect reply msg: " + msg); + } else { + console.log("[ttt] [DataShareTest] <> seConnect sendRequest failed, errCode: " + result.errCode); + } + // callback没有返回值,默认返回undefined + }).catch(function (e) { + console.log("[ttt] [DataShareTest] <> seConnect sendRequest got exception: " + e); + }).finally (async () => { + console.log("[ttt] [DataShareTest] <> seConnect sendRequest ends, reclaim parcel"); + data.reclaim(); + reply.reclaim(); + }) + }, + onDisconnect:function (elementName) { + console.log("[ttt] [DataShareTest] <> seConnect onDisconnect"); + }, + onFailed:function (code) { + console.log("[ttt] [DataShareTest] <> seConnect onFailed"); + } +}; + +let dseProxy = 0; +let dseUri = ("datashare:///com.samples.datasharekvtest.DataShare"); + +var dseConnect = { + onConnect:function (elementName, proxy) { + console.log("[ttt] [DataShareTest] <> dseConnect onConnect called."); + // console.log("[ttt] [DataShareTest] <> dseConnect onConnect elementName = " + elementName); + // console.log("[ttt] [DataShareTest] <> dseConnect onConnect proxy = " + proxy); + dseProxy = proxy; + }, + onDisconnect:function (elementName) { + console.log("[ttt] [DataShareTest] <> dseConnect onDisconnect, elementName:" + elementName); + }, + onFailed:function (code) { + console.log("[ttt] [DataShareTest] <> dseConnect onFailed, code:" + code); + } +}; + +let seConnectionId = -1; +let dseConnectionId = -1; + +let seWant = { + "bundleName": "com.samples.datasharetest", + "abilityName": "ServiceExtAbility", +} + +let dseWant = { + "bundleName": "com.samples.datasharetest", + "abilityName": "DataShareExtAbility", +} + +export function onCallback() { + console.info("[ttt] [DataShareTest] <> **** Observer on callback ****"); +} + +export function offCallback() { + console.info("[ttt] [DataShareTest] <> **** Observer off callback ****"); +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("[ttt] [DataShareTest] <> MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[ttt] [DataShareTest] <> MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[ttt] [DataShareTest] <> MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + let context = this.context; + dseConnectionId = context.connectAbility(dseWant, dseConnect); + globalThis.connectDataShareExtAbility = (async () => { + console.log("[ttt] [DataShareTest] <> connectDataShareExtAbility begin"); + await dataShare.createDataShareHelper(globalThis.abilityContext, dseUri, (err,data)=>{ + globalThis.helper = data; + globalThis.testhelper = data; + console.info("[ttt] [DataShareTest] <> ----- 1 -----, globalThis.helper = " + globalThis.helper); + console.info("[ttt] [DataShareTest] <> ----- 2 -----, data = " + data); + console.info("[ttt] [DataShareTest] <> ----- 3 -----, err = " + err); + console.info("[ttt] [DataShareTest] <> ----- 4 -----, JSON.stringify(err) = " + JSON.stringify(err)); + }); + dseConnectionId = await context.connectAbility(dseWant, dseConnect); + }) + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[ttt] [DataShareTest] <> MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[ttt] [DataShareTest] <> MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[ttt] [DataShareTest] <> MainAbility onBackground") + } +}; diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/pages/index.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 000000000..3ee1f46bd --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2022 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 file from '@system.file'; +import router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +//InstrumentLog, ReportExtend + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/TestAbility.ts b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..89a847305 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 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 Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/pages/index.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..b93567f96 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..753ac1b0b --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ohos.acts.kvStoreStage.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/List.test.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..219b59aa8 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * 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 kvStoreBackupCallbackJsunittest from './kvStoreBackupCallbackJsunit.test.ets' +import kvStoreBackupPromiseJsunittest from './kvStoreBackupPromiseJsunit.test.ets' +export default function testsuite() { + kvStoreBackupCallbackJsunittest(globalThis.abilityContext); + kvStoreBackupPromiseJsunittest(globalThis.abilityContext); +} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackJsunit.test.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackJsunit.test.ets new file mode 100644 index 000000000..418ce9632 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackJsunit.test.ets @@ -0,0 +1,728 @@ +/* + * 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 request from '@ohos.request'; +import * as pubfun from './kvStoreBackupCallbackPublicFunction.test' +import distributedData from '@ohos.data.distributedData'; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +const optionLock = { + createIfMissing: true, + encrypt: true, + backup: true, + autoSync: false, + kvStoreType: distributedData.KVStoreType.SINGLE_VERSION, + securityLevel: distributedData.SecurityLevel.S0, +} + +var key = { + data1: 'number', + data2: 456789, +}; +var value = { + data1: 123456, + data2: 456789, +}; + +var file = ''; + +var files =new Array(); + +export default function kvStoreBackupCallbackJsunittest(context) { +describe('kvStoreBackupCallbackJsunittest', function () { + beforeAll( async function () { + console.info('TestDFX beforeAll: Prerequisites at the test suite level, ' + + 'which are executed before the test suite is executed.'); + await pubfun.publicgetKvStore(optionLock); + await sleep(5000); + console.info("TestDFX kvstore = " + globalThis.kvStore) + }) + beforeEach(function () { + console.info('beforeEach: Prerequisites at the test case level,' + + ' which are executed before each test case is executed.'); + }) + afterEach( async function () { + console.info('afterEach: Test case-level clearance conditions, ' + + 'which are executed after each test case is executed.'); + pubfun.publicdeleteBackup(globalThis.kvStore,files); + files = [] + await sleep(5000); + }) + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition, ' + + 'which is executed after the test suite is executed'); + console.info("TestDFX kvstore = " + globalThis.kvStore) + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORE_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreCallback0001', 0, async function (done) { + try{ + console.log("testManalRestoreCallback0001 before restore"); + await pubfun.publicrestore(globalThis.kvStore).then((data) => { + console.log("testManalRestoreCallback0001 going restore = " + JSON.stringify(data)); + expect(true).assertEqual(true); + done(); + }).catch((err) => { + console.log("testManalRestoreCallback0001 Manualrestore fail 1" + err); + expect(true).assertEqual(err == "Error: invalid arguments!"); + done(); + }) + } catch (e) { + console.log("testManalRestoreCallback0001 Manualrestore fail 2" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORE_CALLBACK_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreCallback0002', 0, async function (done) { + try { + console.log("testManalRestoreCallback0002 before getname"); + file = '123' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalRestoreCallback0002 before restore"); + await sleep(1000); + pubfun.publicrestore(globalThis.kvStore); + console.log("testManalRestoreCallback0002 going restore "); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreCallback0002 delResult = " + delResult); + console.info("testManalRestoreCallback0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreCallback0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreCallback0002 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBACKUP_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBackupCallback0001', 0, async function (done) { + try { + console.log("testDbBackupCallback0001 before getname"); + file = 'true' ; + files[0] = file ; + console.log("testDbBackupCallback0001 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testDbBackupCallback0001 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testDbBackupCallback0001 delResult = " + delResult); + console.info("testDbBackupCallback0001 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testDbBackupCallback0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testDbBackupCallback0001 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0002', 0, async function (done) { + try { + console.log("testManalBackupCallback0002 before getname"); + file = '1' ; + files[0] = file ; + console.log("testManalBackupCallback0002 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupCallback0002 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupCallback0002 delResult = " + delResult); + console.info("testManalBackupCallback0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupCallback0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0002 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0300 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0003', 0, async function (done) { + try { + console.log("testManalBackupCallback0003 before getname"); + file = '1.0' ; + files[0] = file ; + console.log("testManalBackupCallback0003 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupCallback0003 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupCallback0003 delResult = " + delResult); + console.info("testManalBackupCallback0003 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupCallback0003 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0003 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0004', 0, async function (done) { + try { + console.log("testManalBackupCallback0004 before getname"); + file = '' ; + console.log("testManalBackupCallback0004 before backup"); + await pubfun.publicbackup(globalThis.kvStore,file).then((data) => { + console.log("testManalBackupCallback0004 going backup"); + expect(true).assertEqual(data == "code数字"); + done(); + }).catch((err) => { + console.log("testManalBackupCallback0004 ManualbackupCallback002 fail1 " + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0004 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0500 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0005', 0, async function (done) { + try { + console.log("testManalBackupCallback0005 before getname"); + files = [] + var file = '1'; + var file1 = '2'; + var file2 = '3'; + var file3 = '4'; + var file4 = '5'; + files[0] = file ; + files[1] = file1 ; + files[2] = file2 ; + files[3] = file3 ; + files[4] = file4 ; + console.log("testManalBackupCallback0005 before backup"); + pubfun.publicbackup(globalThis.kvStore,file); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file1); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file2); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file3); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file4); + await sleep(500); + + console.log("testManalBackupCallback0005 before publicdeleteBackup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + + expect("1").assertEqual(globalThis.delresult[0][0]) + expect(0).assertEqual(globalThis.delresult[0][1]); + + expect("2").assertEqual(globalThis.delresult[1][0]) + expect(0).assertEqual(globalThis.delresult[1][1]) + + expect("3").assertEqual(globalThis.delresult[2][0]) + expect(0).assertEqual(globalThis.delresult[2][1]) + + expect("4").assertEqual(globalThis.delresult[3][0]) + expect(0).assertEqual(globalThis.delresult[3][1]) + + expect("5").assertEqual(globalThis.delresult[4][0]) + expect(27459591).assertEqual(globalThis.delresult[4][1]) + + console.log("testManalBackupCallback0005 publicdeleteBackup" + JSON.stringify(data)); + files = []; + console.log("TestDFX clear files"); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0005 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0600 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0006', 0, async function (done) { + try { + console.log("testManalBackupCallback0006 before getname"); + file = '1' ; + var file1 = '2'; + var file2 = '3'; + var file3 = '4'; + var file4 = '5'; + var file5 = '6'; + files[0] = file ; + files[1] = file1 ; + files[2] = file2 ; + files[3] = file3 ; + files[4] = file4 ; + files[5] = file5 ; + console.log("testManalBackupCallback0006 before backup"); + pubfun.publicbackup(globalThis.kvStore,file); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file1); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file2); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file3); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file4); + await sleep(500); + console.log("testManalBackupCallback0006 before Sixth backup"); + await pubfun.publicbackup(globalThis.kvStore,file5).then((data) => { + console.log("testManalBackupCallback0006 going backup"); + expect(true).assertEqual(data == "code数字"); + done(); + }).catch((err) => { + console.log("testManalBackupCallback0006 ManualbackupCallback002 fail1 " + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + console.log("testManalBackupCallback0006 Sixth backup err"); + }) + await sleep(1000); + console.log("testManalBackupCallback0006 before publicdeleteBackup"); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + + expect("1").assertEqual(globalThis.delresult[0][0]) + expect(0).assertEqual(globalThis.delresult[0][1]); + + expect("5").assertEqual(globalThis.delresult[4][0]) + expect(27459591).assertEqual(globalThis.delresult[4][1]); + + expect("6").assertEqual(globalThis.delresult[5][0]) + expect(27459591).assertEqual(globalThis.delresult[5][1]); + + console.log("testManalBackupCallback0006 publicdeleteBackup" + JSON.stringify(data)); + files = []; + console.log("TestDFX clear files"); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0006 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0001', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0001 before getname"); + file = 'legal' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0001 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0001 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVerisionCallback0001 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVerisionCallback0001 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVerisionCallback0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0001 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0002', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0002 before getname"); + file = 'true' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0002 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0002 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVerisionCallback0002 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVerisionCallback0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVerisionCallback0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0002 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0300 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0003', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0003 before getname"); + file = '1' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0003 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0003 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVerisionCallback0003 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVerisionCallback0003 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVerisionCallback0003 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0003 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0004', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0004 before getname"); + file = '1.0' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0004 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVerisionCallback0004 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVerisionCallback0004 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVerisionCallback0004 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVerisionCallback0004 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0004 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0500 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0005', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0005 before getname"); + file = '' ; + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalRestoreSpecifiedVerisionCallback0005 before restoresp"); + await sleep(1000); + await pubfun.publicrestoresp(globalThis.kvStore,file).then((data) => { + console.log("testManalRestoreSpecifiedVerisionCallback0005 going restoresp = " + JSON.stringify(data)); + expect(true).assertEqual(false); + done(); + }).catch((err) => { + console.log("testManalRestoreSpecifiedVerisionCallback0005 fail 1" + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0005 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_CALLBACK_0600 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVerisionCallback0006', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVerisionCallback0006 before getname"); + file = 'legal' ; + console.log("testManalRestoreSpecifiedVerisionCallback0006 before restoresp"); + await pubfun.publicrestoresp(globalThis.kvStore,file).then((data) => { + console.log("testManalRestoreSpecifiedVerisionCallback0006 going restoresp = " + JSON.stringify(data)); + expect(true).assertEqual(false); + done(); + }).catch((err) => { + console.log("testManalRestoreSpecifiedVerisionCallback0006 fail 1" + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVerisionCallback0006 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DELETEBACKUP_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDeleteBackupCallback0001', 0, async function (done) { + try { + console.log("testDeleteBackupCallback0001 before deleteBackup"); + file = '123' ; + files[0] = file ; + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testDeleteBackupCallback0001 delResult = " + delResult); + console.info("testDeleteBackupCallback0001 delResult[1] = " + delResult[1]); + expect(27459591).assertEqual(delResult[1]); + console.log("testDeleteBackupCallback0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + console.log("testDeleteBackupCallback0001 going deleteBackup"); + } catch (err) { + console.log("testDeleteBackupCallback0001 fail 2" + err); + expect(err).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupCallback0001', 0, async function (done) { + try{ + console.log("TestestManalBackupCallback0001tDFX before getname"); + files = [] + file = 'legal' ; + files[0] = "legal" ; + console.log("testManalBackupCallback0001 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupCallback0001 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupCallback0001 delResult = " + delResult); + console.info("testManalBackupCallback0001 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupCallback0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupCallback0001 export fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBACKUPPUT_CALLBACK_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBackupPutCallback0001', 0, async function (done) { + try { + console.log("testDbBackupPutCallback0001 before putdata"); + pubfun.publicput(globalThis.kvStore,"key","value") ; + console.log("testDbBackupPutCallback0001 going putdata"); + done(); + } catch (e) { + console.log("testDbBackupPutCallback0001 Backupinfo fail" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBACKUPPUT_CALLBACK_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBackupPutCallback0002', 0, async function (done) { + try { + console.log("testDbBackupPutCallback0002 before putdata"); + pubfun.publicput(globalThis.kvStore,"key","value") ; + console.log("testDbBackupPutCallback0002 going putdata"); + await pubfun.publicget(globalThis.kvStore,"key").then((data) => { + console.log("testDbBackupPutCallback0002 going getdata" + JSON.stringify(data)); + expect(true).assertEqual(data == "value"); + done(); + }).catch((err) => { + console.log("testDbBackupPutCallback0002 Get fail 1 " + err); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.log("testDbBackupPutCallback0002 Get fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBACKUPPUT_CALLBACK_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBackupPutCallback0004', 0, async function (done) { + try { + console.log("testDbBackupPutCallback0004 before putdata"); + pubfun.publicput(globalThis.kvStore,"putcallback004","value1") ; + console.log("testDbBackupPutCallback0004 going putdata"); + await pubfun.publicget(globalThis.kvStore,"putcallback").then((data) => { + console.log("testDbBackupPutCallback0004 going getdata" + JSON.stringify(data)); + expect(true).assertEqual(false); + done(); + }).catch((err) => { + console.log("testDbBackupPutCallback0004 Get fail 1 " + err); + expect(true).assertEqual(true); + done(); + }) + } catch (e) { + console.log("testDbBackupPutCallback0004 Get fail 2" + e); + expect(e).assertFail(); + done(); + } + }) +}) +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackPublicFunction.test.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackPublicFunction.test.ets new file mode 100644 index 000000000..ba2ec5759 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupCallbackPublicFunction.test.ets @@ -0,0 +1,188 @@ +/* + * 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, it, expect} from "@ohos/hypium" +import distributedData from '@ohos.data.distributedData'; +import deviceManager from '@ohos.distributedHardware.deviceManager'; +import prompt from '@system.prompt'; + +let BUNDLE_NAME = 'ohos.acts.kvStoreStage'; + +let STORE_ID = 'kvstoreBackupCallback'; + +let mKVMgrConfig = { + userInfo: { + userId: '0', + userType: distributedData.UserType.SAME_USER_ID + }, + bundleName: BUNDLE_NAME, + context : globalThis.abilityContext +}; + +//getKvStore公共方法 +function publicgetKvStore(optionsp){ + console.log(`TestDFX getKvStore `) + return new Promise(function(resolve, reject) { + distributedData.createKVManager(mKVMgrConfig, (err, data) => { + console.info('TestDFX createKVManager begin') + if (err) { + console.info('TestDFX createKVManager err = ' + err ); + reject(err); + } + console.info('TestDFX createKVManager data = ' + data); + + // this.log('create success: ' + JSON.stringify(data)); + globalThis.kvManager = data; + data.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('TestDFX getKVStore begin') + if (err) { + console.info('TestDFX getKVStore err = ' + err); + reject(err); + } + console.info('TestDFX getKVStore data = ' + data); + globalThis.kvStore = data; + resolve(data); + }); + }); + }) +} + +//closeKvStore公共方法 +function publiccloseKvStore() { + console.log(`TestDFX closeKvStore `) + return new Promise(function (resolve, reject) { + globalThis.kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, globalThis.kvStore, (err, data) => { + console.info('TestDFX closeKvStore begin') + if (err) { + console.info('TestDFX closeKvStore err = ' + err); + reject(err); + } + console.info('TestDFX closeKvStore data = ' + data); + globalThis.kvManager.deleteKVStore(BUNDLE_NAME, STORE_ID, (err, data) => { + console.info('TestDFX deleteKVStore begin') + if (err) { + console.info('TestDFX deleteKVStore err = ' + err); + reject(err); + } + console.info('TestDFX deleteKVStore data = ' + data); + }); + }); + }) +} + +//插入数据公共方法 +function publicput(kvStore,key,value){ + console.log(`TestDFX put ${JSON.stringify(key,value)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.put(key,value, function(err, data){ + console.log("TestDFX put task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX put err information: " + err ); + reject(err); + }else{ + resolve(data); + } + }) + }) +} + +//查询插入数据公共方法 +function publicget(kvStore,key){ + console.log(`TestDFX get ${JSON.stringify(key)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.get(key, function(err, data){ + console.log("TestDFX get task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX get err information: " + err ); + reject(err); + }else{ + resolve(data); + } + }) + }) +} + +//手动备份公共方法 +function publicbackup(kvStore,file){ + console.log(`TestDFX backup ${JSON.stringify(file)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.backup(file, function(err, data){ + console.log("TestDFX backup task =" + data); + if (err != undefined) { + console.log("TestDFX backup err information: " + err ); + reject(err); + }else{ + resolve(data); + } + }) + }) +} + +//删除公共方法 +function publicdeleteBackup(kvStore,files){ + console.log(`TestDFX deleteBackup ${JSON.stringify(files)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.deleteBackup(files, function(err, data){ + console.log("TestDFX deleteBackup BackUpInfo =" + data); + if (err != undefined) { + console.log("TestDFX deleteBackup err information: " + err ); + reject(err); + }else{ + var devices =new Array(); + devices = data; + globalThis.delresult = devices; + console.log("TestDFX deleteBackup pass "); + resolve(data); + } + }) + }) +} + +//恢复到指定版本公共方法 +function publicrestoresp(kvStore,file){ + console.log(`TestDFX restoresp ${JSON.stringify(file)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.restore(file, function(err, data){ + console.log("TestDFX restoresp task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX restoresp err information: " + err ); + reject(err); + }else{ + console.log("TestDFX restoresp backupinfo information: " + JSON.stringify(data) ); + resolve(data); + } + }) + }) +} + +//恢复到最近的备份公共方法 +function publicrestore(kvStore){ + console.log(`TestDFX restore `) + return new Promise(function(resolve, reject) { + globalThis.kvStore.restore(function(err,data){ + console.log("TestDFX restore task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX restore err information: " + err ); + reject(err); + }else{ + console.log("TestDFX restore backupinfo information: " + JSON.stringify(data) ); + resolve(data); + } + }) + }) +} + + +export{publicgetKvStore,publicput,publicget,publicbackup,publicdeleteBackup,publicrestoresp,publicrestore,publiccloseKvStore} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromiseJsunit.test.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromiseJsunit.test.ets new file mode 100644 index 000000000..ea691a406 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromiseJsunit.test.ets @@ -0,0 +1,722 @@ +/* + * 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 request from '@ohos.request'; +import * as pubfun from './kvStoreBackupPromisePublicFunction.test' +import distributedData from '@ohos.data.distributedData'; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +const optionLock = { + createIfMissing: true, + encrypt: true, + backup: true, + autoSync: false, + kvStoreType: distributedData.KVStoreType.SINGLE_VERSION, + securityLevel: distributedData.SecurityLevel.S0, +} + +var file = ''; + +var files =new Array(); + +var key = { + data1: 'number', + data2: 456789, +}; +var value = { + data1: 123456, + data2: 456789, +}; + +export default function kvStoreBackupPromiseJsunittest(context) { +describe('kvStoreBackupPromiseJsunittest', function () { + beforeAll( async function () { + console.info('TestDFX beforeAll: Prerequisites at the test suite level, ' + + 'which are executed before the test suite is executed.'); + await pubfun.publicgetKvStore(optionLock); + await sleep(5000); + console.info("TestDFX kvstore = " + globalThis.kvStore) + }) + beforeEach(function () { + console.info('beforeEach: Prerequisites at the test case level,' + + ' which are executed before each test case is executed.'); + }) + afterEach( async function () { + console.info('afterEach: Test case-level clearance conditions, ' + + 'which are executed after each test case is executed.'); + pubfun.publicdeleteBackup(globalThis.kvStore,files); + await sleep(5000); + }) + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition, ' + + 'which is executed after the test suite is executed'); + console.info("TestDFX kvstore = " + globalThis.kvStore) + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORE_PROMISE_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestorePromise0001', 0, async function (done) { + try { + console.log("testManalRestorePromise0001 before restore"); + await pubfun.publicrestore(globalThis.kvStore).then((data) => { + console.log("testManalRestorePromise0001 going restore = " + JSON.stringify(data)); + expect(true).assertEqual(data == 'code数字'); + done(); + }).catch((err) => { + console.log("testManalRestorePromise0001 Manualrestore fail 1" + err); + expect(true).assertEqual(JSON.stringify(err) == '{}'); + done(); + }) + } catch (e) { + console.log("testManalRestorePromise0001 Manualrestore fail 2" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORE_PROMISE_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestorePromise0002', 0, async function (done) { + try { + console.log("testManalRestorePromise0002 before getname"); + file = '123' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalRestorePromise0002 before restore"); + await sleep(1000); + pubfun.publicrestore(globalThis.kvStore); + console.log("testManalRestorePromise0002 going restore "); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestorePromise0002 delResult = " + delResult); + console.info("testManalRestorePromise0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestorePromise0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestorePromise0002 Manualrestore fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0001', 0, async function (done) { + try { + console.log("testManalBackupPromise0001 before getname"); + file = 'legal' ; + files[0] = "legal" ; + console.log("testManalBackupPromise0001 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupPromise0001 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupPromise0001 delResult = " + delResult); + console.info("testManalBackupPromise0001 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupPromise0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0001 export fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0002', 0, async function (done) { + try { + console.log("testManalBackupPromise0002 before getname"); + file = 'true' ; + files[0] = file ; + console.log("testManalBackupPromise0002 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupPromise0002 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupPromise0002 delResult = " + delResult); + console.info("testManalBackupPromise0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupPromise0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0002 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0300 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0003', 0, async function (done) { + try { + console.log("testManalBackupPromise0003 before getname"); + file = '1' ; + files[0] = file ; + console.log("testManalBackupPromise0003 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupPromise0003 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupPromise0003 delResult = " + delResult); + console.info("testManalBackupPromise0003 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupPromise0003 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0003 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0004', 0, async function (done) { + try { + console.log("testManalBackupPromise0004 before getname"); + file = '1.0' ; + files[0] = file ; + console.log("testManalBackupPromise0004 before backup"); + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalBackupPromise0004 going backup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalBackupPromise0004 delResult = " + delResult); + console.info("testManalBackupPromise0004 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalBackupPromise0004 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0004 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0500 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0005', 0, async function (done) { + try { + console.log("testManalBackupPromise0005 before getname"); + file = '' ; + console.log("testManalBackupPromise0005 before backup"); + await pubfun.publicbackup(globalThis.kvStore,file).then((data) => { + console.log("testManalBackupPromise0005 going backup"); + expect(true).assertEqual(data == "code数字"); + done(); + }).catch((err) => { + console.log("testManalBackupPromise0005 fail1 " + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0005 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0600 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0006', 0, async function (done) { + try { + console.log("testManalBackupPromise0006 before getname"); + file = '1' ; + var file1 = '2'; + var file2 = '3'; + var file3 = '4'; + var file4 = '5'; + files[0] = file ; + files[1] = file1 ; + files[2] = file2 ; + files[3] = file3 ; + files[4] = file4 ; + console.log("testManalBackupPromise0006 before backup"); + pubfun.publicbackup(globalThis.kvStore,file); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file1); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file2); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file3); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file4); + await sleep(500); + console.log("testManalBackupPromise0006 before publicdeleteBackup"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + + expect("1").assertEqual(globalThis.delresult[0][0]) + expect(0).assertEqual(globalThis.delresult[0][1]); + + expect("2").assertEqual(globalThis.delresult[1][0]) + expect(0).assertEqual(globalThis.delresult[1][1]) + + expect("3").assertEqual(globalThis.delresult[2][0]) + expect(0).assertEqual(globalThis.delresult[2][1]) + + expect("4").assertEqual(globalThis.delresult[3][0]) + expect(0).assertEqual(globalThis.delresult[3][1]) + + expect("5").assertEqual(globalThis.delresult[4][0]) + expect(27459591).assertEqual(globalThis.delresult[4][1]) + + console.log("testManalBackupPromise0006 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0006 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALBACKUP_PROMISE_0700 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalBackupPromise0007', 0, async function (done) { + try { + console.log("testManalBackupPromise0007 before getname"); + file = '1' ; + var file1 = '2'; + var file2 = '3'; + var file3 = '4'; + var file4 = '5'; + var file5 = '6'; + files[0] = file ; + files[1] = file1 ; + files[2] = file2 ; + files[3] = file3 ; + files[4] = file4 ; + files[5] = file5 ; + console.log("testManalBackupPromise0007 before backup"); + pubfun.publicbackup(globalThis.kvStore,file); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file1); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file2); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file3); + await sleep(500); + pubfun.publicbackup(globalThis.kvStore,file4); + await sleep(500); + console.log("testManalBackupPromise0007 before Sixth backup"); + await pubfun.publicbackup(globalThis.kvStore,file5).then((data) => { + console.log("testManalBackupPromise0007 going backup"); + expect(true).assertEqual(data == "code数字"); + done(); + }).catch((err) => { + console.log("testManalBackupPromise0007 fail1 " + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + console.log("testManalBackupPromise0007 Sixth backup err"); + }) + await sleep(1000); + console.log("testManalBackupPromise0007 before publicdeleteBackup"); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + + expect("1").assertEqual(globalThis.delresult[0][0]) + expect(0).assertEqual(globalThis.delresult[0][1]); + + expect("5").assertEqual(globalThis.delresult[4][0]) + expect(27459591).assertEqual(globalThis.delresult[4][1]); + + expect("6").assertEqual(globalThis.delresult[5][0]) + expect(27459591).assertEqual(globalThis.delresult[5][1]); + + console.log("testManalBackupPromise0007 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalBackupPromise0007 fail 2 " + e); + expect(e).assertFail(); + done(); + } + }) + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0001', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0001 before getname"); + file = 'legal' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0001 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0001 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[5]; + console.info("testManalRestoreSpecifiedVersionPromise0001 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVersionPromise0001 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVersionPromise0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0001 Manualrestoresp fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0002', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0002 before getname"); + file = 'true' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0002 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0002 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[5]; + console.info("testManalRestoreSpecifiedVersionPromise0002 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVersionPromise0002 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVersionPromise0002 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0002 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0300 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0003', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0003 before getname"); + file = '1' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0003 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0003 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVersionPromise0003 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVersionPromise0003 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVersionPromise0003 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0003 fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0004', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0004 before getname"); + file = '1.0' ; + files[0] = file ; + pubfun.publicbackup(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0004 before restoresp"); + await sleep(1000); + pubfun.publicrestoresp(globalThis.kvStore,file); + console.log("testManalRestoreSpecifiedVersionPromise0004 going restoresp"); + await sleep(1000); + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testManalRestoreSpecifiedVersionPromise0004 delResult = " + delResult); + console.info("testManalRestoreSpecifiedVersionPromise0004 delResult[1] = " + delResult[1]); + expect(0).assertEqual(delResult[1]); + console.log("testManalRestoreSpecifiedVersionPromise0004 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0004 Manualrestoresp fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0500 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0005', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0005 before getname"); + file = '' ; + pubfun.publicbackup(globalThis.kvStore,file) ; + console.log("testManalRestoreSpecifiedVersionPromise0005 before restoresp"); + await sleep(1000); + await pubfun.publicrestoresp(globalThis.kvStore,file).then((data) => { + console.log("testManalRestoreSpecifiedVersionPromise0005 going restoresp = " + JSON.stringify(data)); + expect(true).assertEqual(false); + done(); + }).catch((err) => { + console.log("testManalRestoreSpecifiedVersionPromise0005 Manualrestoresp fail 1" + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0005 Manualrestoresp fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_MANALRESTORESPECIFIEDVERSION_PROMISE_0600 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testManalRestoreSpecifiedVersionPromise0006', 0, async function (done) { + try { + console.log("testManalRestoreSpecifiedVersionPromise0006 before getname"); + file = 'legal' ; + console.log("testManalRestoreSpecifiedVersionPromise0006 before restoresp"); + await pubfun.publicrestoresp(globalThis.kvStore,file).then((data) => { + console.log("testManalRestoreSpecifiedVersionPromise0006 going restoresp = " + JSON.stringify(data)); + expect(true).assertEqual(false); + done(); + }).catch((err) => { + console.log("testManalRestoreSpecifiedVersionPromise0006 Manualrestoresp fail 1" + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testManalRestoreSpecifiedVersionPromise0006 Manualrestoresp fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DELETEBUCKUP_PROMISE_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDeleteBuckupPromise0001', 0, async function (done) { + try { + console.log("testDeleteBuckupPromise0001 before deleteBackup"); + file = '123' ; + files[0] = file ; + await pubfun.publicdeleteBackup(globalThis.kvStore,files).then((data) => { + let delResult = globalThis.delresult[0]; + console.info("testDeleteBuckupPromise0001 delResult = " + delResult); + console.info("testDeleteBuckupPromise0001 delResult[1] = " + delResult[1]); + expect(27459591).assertEqual(delResult[1]); + console.log("testDeleteBuckupPromise0001 publicdeleteBackup" + JSON.stringify(data)); + done(); + }) + console.log("testDeleteBuckupPromise0001 going deleteBackup"); + } catch (err) { + console.log("testDeleteBuckupPromise0001 deleteBackup fail 2" + err); + expect(err).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBUCKUPPUT_PROMISE_0100 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 0 + */ + it('testDbBuckupPutPromise0001', 0, async function (done) { + try { + console.log("testDbBuckupPutPromise0001 before putdata"); + pubfun.publicput(globalThis.kvStore,"key1","value1") ; + console.log("testDbBuckupPutPromise0001 going putdata"); + done(); + } catch (e) { + console.log("testDbBuckupPutPromise0001 Backupinfo fail" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBUCKUPPUT_PROMISE_0200 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBuckupPutPromise0002', 0, async function (done) { + try { + console.log("testDbBuckupPutPromise0002 before putdata"); + pubfun.publicput(globalThis.kvStore,"PutPromise0002","value") ; + console.log("testDbBuckupPutPromise0002 going putdata"); + await pubfun.publicget(globalThis.kvStore,"PutPromise0002").then((data) => { + console.log("testDbBuckupPutPromise0002 going getdata" + JSON.stringify(data)); + expect(true).assertEqual(data == "value"); + done(); + }).catch((err) => { + console.log("testDbBuckupPutPromise0002 Get fail 1 " + err); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.log("testDbBuckupPutPromise0002 Get fail 2" + e); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SUB_DISTRIBUTEDDATAMGR_DBBUCKUPPUT_PROMISE_0400 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 3 + */ + it('testDbBuckupPutPromise0004', 0, async function (done) { + try { + console.log("testDbBuckupPutPromise0004 before putdata"); + pubfun.publicput(globalThis.kvStore,"PutPromise0004","value1") ; + console.log("TestestDbBuckupPutPromise0004tDFX going putdata"); + await pubfun.publicget(globalThis.kvStore,"PutPromise").then((data) => { + console.log("testDbBuckupPutPromise0004 going getdata" + JSON.stringify(data)); + expect(true).assertEqual(JSON.stringify(data) == '{}'); + done(); + }).catch((err) => { + console.log("testDbBuckupPutPromise0004 Get fail 1 " + err); + expect(true).assertEqual(JSON.stringify(err) == "{}"); + done(); + }) + } catch (e) { + console.log("testDbBuckupPutPromise0004 Get fail 2" + e); + expect(e).assertFail(); + done(); + } + }) +}) +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromisePublicFunction.test.ets b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromisePublicFunction.test.ets new file mode 100644 index 000000000..f4a643d5c --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/ets/test/kvStoreBackupPromisePublicFunction.test.ets @@ -0,0 +1,176 @@ +/* + * 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, it, expect} from "@ohos/hypium" +import distributedData from '@ohos.data.distributedData'; +import deviceManager from '@ohos.distributedHardware.deviceManager'; +import prompt from '@system.prompt'; + +let BUNDLE_NAME = 'ohos.acts.kvStoreStage'; + +let STORE_ID = 'kvstoreBackupPromise'; + +let mKVMgrConfig = { + userInfo: { + userId: '0', + userType: distributedData.UserType.SAME_USER_ID + }, + bundleName: BUNDLE_NAME, + context : globalThis.abilityContext +}; + +//getKvStore公共方法 +function publicgetKvStore(optionsp){ + console.log(`TestDFX getKvStore `) + return new Promise(function(resolve, reject) { + distributedData.createKVManager(mKVMgrConfig, (err, data) => { + console.info('TestDFX createKVManager begin') + if (err) { + console.info('TestDFX createKVManager err = ' + err ); + reject(err); + } + console.info('TestDFX createKVManager data = ' + data); + + // this.log('create success: ' + JSON.stringify(data)); + globalThis.kvManager = data; + data.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('TestDFX getKVStore begin') + if (err) { + console.info('TestDFX getKVStore err = ' + err); + reject(err); + } + console.info('TestDFX getKVStore data = ' + data); + globalThis.kvStore = data; + resolve(data); + }); + }); + }) +} + +//closeKvStore公共方法 +function publiccloseKvStore() { + console.log(`TestDFX closeKvStore `) + return new Promise(function (resolve, reject) { + globalThis.kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, globalThis.kvStore, (err, data) => { + console.info('TestDFX closeKvStore begin') + if (err) { + console.info('TestDFX closeKvStore err = ' + err); + reject(err); + } + console.info('TestDFX closeKvStore data = ' + data); + globalThis.kvManager.deleteKVStore(BUNDLE_NAME, STORE_ID, (err, data) => { + console.info('TestDFX deleteKVStore begin') + if (err) { + console.info('TestDFX deleteKVStore err = ' + err); + reject(err); + } + console.info('TestDFX deleteKVStore data = ' + data); + }); + }); + }) +} + +//插入数据公共方法 +function publicput(kvStore,key,value){ + console.log(`TestDFX put ${JSON.stringify(key,value)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.put(key,value, function(err, data){ + console.log("TestDFX put task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX put err information: " + err ); + reject(err); + }else{ + resolve(data); + } + }) + }) +} + +//查询插入数据公共方法 +function publicget(kvStore,key){ + console.log(`TestDFX get ${JSON.stringify(key)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.get(key, function(err, data){ + console.log("TestDFX get task =" + JSON.stringify(data)); + if (err != undefined) { + console.log("TestDFX get err information: " + err ); + reject(err); + }else{ + resolve(data); + } + }) + }) +} + +//手动备份公共方法 +function publicbackup(kvStore,file){ + console.log(`TestDFX backup ${JSON.stringify(file)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.backup(file).then((data) => { + console.log("TestDFX backup task =" + data); + resolve(data); + }).catch((err) => { + console.log("TestDFX backup err information: " + err); + reject(err); + }) + }) +} + +//删除公共方法 +function publicdeleteBackup(kvStore,files) { + console.log(`TestDFX deleteBackup ${JSON.stringify(files)}`) + return new Promise(function (resolve, reject) { + globalThis.kvStore.deleteBackup(files).then((data) => { + console.log("TestDFX deleteBackup BackUpInfo =" + data); + var devices = new Array(); + devices = data; + globalThis.delresult = devices; + console.log("TestDFX deleteBackup pass "); + resolve(data); + }).catch((err) => { + console.log("test deleteBackup err information: " + err); + reject(err); + }) + }) +} + +//恢复到指定版本公共方法 +function publicrestoresp(kvStore,file){ + console.log(`TestDFX restoresp ${JSON.stringify(file)}`) + return new Promise(function(resolve, reject) { + globalThis.kvStore.restore(file).then((data) => { + console.log("TestDFX restoresp backupinfo information: " + JSON.stringify(data)); + resolve(data); + }).catch((err) => { + console.log("TestDFX restoresp err information: " + err ); + reject(err); + }) + }) +} + +//恢复到最近的备份公共方法 +function publicrestore(kvStore){ + console.log(`TestDFX restore `) + return new Promise(function(resolve, reject) { + globalThis.kvStore.restore.then((data) => { + console.log("TestDFX restore backupinfo information: " + JSON.stringify(data) ); + resolve(data); + }).catch((err) => { + console.log("TestDFX restore err information: " + err ); + reject(err); + }) + }) +} +export{publicgetKvStore,publicput,publicget,publicbackup,publicdeleteBackup,publicrestoresp,publicrestore,publiccloseKvStore} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json new file mode 100644 index 000000000..0623bfe39 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "package": "ohos.acts.kvStoreStage", + "name": "entry", + "mainAbility": "ohos.acts.kvStoreStage.MainAbility", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "ohos.acts.kvStoreStage.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/element/string.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..20a114250 --- /dev/null +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "ActsKvStoreStageTest" + } + ] +} \ No newline at end of file diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/media/icon.png b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4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