diff --git a/appexecfwk/ams_standard/fwkdataaccessor/Test.json b/appexecfwk/ams_standard/fwkdataaccessor/Test.json deleted file mode 100644 index 775315860098491b46bcd5859ca7fe6774b7d2e4..0000000000000000000000000000000000000000 --- a/appexecfwk/ams_standard/fwkdataaccessor/Test.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.amsst.fwkdataaccessor", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "FWKDataAccessor.hap" - - ], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "remount", - "mkdir /system/vendor" - ] - }, - { - "type": "PushKit", - "push": [ - "./resource/appexecfwk/amsStDataAbility.hap->/system/vendor/amsStDataAbility.hap" - ] - - }, - { - "type": "ShellKit", - "run-command": [ - "chmod 644 /system/vendor/*.hap" - ] - } - ] -} diff --git a/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js b/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js deleted file mode 100644 index 55d4b2a6489523b4e4fcf2899a844539c3b51748..0000000000000000000000000000000000000000 --- a/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js +++ /dev/null @@ -1,2470 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility' -import ohos_data_ability from '@ohos.data.dataability' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('ActsDataAbilityHelperTest', function () { - let bundleName = "com.ix.verify.act"; - //let abilityName = "VerifyActDataAbility"; - //let dataAbilityUri = ("dataability:///com.ohos.amsst.AppDataC.AmsStDataAbilityDataC1"); - let dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility"); - - let DAHelper; - let g_setTimeout = 100 - - /* - * @tc.number: bms_getJsAbility_0100 - * @tc.name: test the multi js ability - * @tc.desc: 1.install a js hap which has an ability with full domain name - * 2.check the ability name by the interface of getBundleInfo - */ - it('bms_installAbility_0100', 0, async function (done) { - console.info('bms_installAbility_0100====" - + (" json data【") + JSON.stringify(data)+ (" 】;")); - //expect(data.abilityInfo.length).assertEqual(1); - done(); - }catch(err) { - console.error('=bms_installAbility_0100 install catch(err)====>:'+err); - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.info('=bms_installAbility_0100====> setTimeout'); - }, g_setTimeout) - console.log('bms_installAbility_0100====" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof err).assertEqual('object'); - expect(err.code).assertEqual(0); - expect(typeof data).assertEqual('object'); - expect(data.status).assertEqual(0); - expect(data.statusMessage).assertEqual('SUCCESS'); - } - }catch(err) { - console.error('=bms_installAbility_0100 getBundleInstaller catch(err)====>:'+err); - expect(false).assertTrue(); - } - } - -/* -* @tc.number: ACTS_AcquireDataAbilityHelper_0100 -* @tc.name: GetDataAbilityHelper : Connects an ability to a Service ability -* @tc.desc: Check the return value of the interface () -*/ - it('ACTS_AcquireDataAbilityHelper_0100',0, async function (done) { - console.log('ACTS_AcquireDataAbilityHelper_0100====" - + (" json dataAbilityUri 【") + JSON.stringify(dataAbilityUri)+ (" 】; ====>")) - let ret = false; - try{ - var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) -// .then(function (data) { -// console.debug("=ACTS_AcquireDataAbilityHelper_0100 then data====>" -// + (" json data 【") + JSON.stringify(data)+ (" 】; ====>")+data); -// expect(typeof(data)).assertEqual("object"); -// console.log('=ACTS_AcquireDataAbilityHelper_0100 promise JSON.stringify([object])====>:' + JSON.stringify(promise)+","+promise); -// ret = true; -// done() -// }).catch(function (err){ -// console.debug("=ACTS_AcquireDataAbilityHelper_0100 catch err====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ====>")+err); -// console.log('=ACTS_AcquireDataAbilityHelper_0100 promise====>:' + JSON.stringify(promise)) -// ret = false; -// done(); -// }); - DAHelper = abilityHelper; - ret = true; - done() - }catch(err) { - console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:'+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_AcquireDataAbilityHelper_0100====: ' + JSON.stringify(DAHelper)+","+ DAHelper) - let valueBucket - try{ - DAHelper.insert(dataAbilityUri,valueBucket) - .then(function (data){ - console.debug("=ACTS_Insert_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - ret = true; - done(); - }).catch(function (err){ - console.debug("=ACTS_Insert_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false; - done(); - }); - }catch(err) { - console.error('=ACTS_Insert_0100 catch(err)====>:'+err); - ret = false; - done(); - } - - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Insert_0100====: ' + DAHelper) - let valueBucket - try{ - var asyncCallback = await DAHelper.insert(dataAbilityUri,valueBucket, - (err,data)=>{ - console.debug("=ACTS_Insert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - console.log('=ACTS_Insert_0200 asyncCallback ====>:' + JSON.stringify(asyncCallback)) - ret = true; - done(); - } - ); - }catch(err) { - console.error('=ACTS_Insert_0200 catch(err)====>:'+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Insert_0200==== { - console.debug("=ACTS_Insert_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - ret = true; - done(); - }).catch((err)=>{ - console.debug("=ACTS_Insert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - //debugAnsErrorCodePrint(err.code); - ret = false; - done(); - }); - }catch(err) { - console.error('=ACTS_Insert_0300 catch(err)====>:'+err); - ret = false; - done(); - } - - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Insert_0300====: ' + DAHelper) - const valueBucket = { - "name": "ACTS_Insert_0400_rose1", - "age": 221, - "salary": 20.5, - "blobType": "u8", - } - try{ - var asyncCallback = await DAHelper.insert(dataAbilityUri,valueBucket, - (err,data)=>{ - console.debug("=ACTS_Insert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - ret = true; - done(); - } - ); - }catch(err) { - console.error('=ACTS_Insert_0400 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Insert_0400====: ' + DAHelper) - var valueBucket; - try{ - DAHelper.batchInsert( - dataAbilityUri, - valueBucket - ).then((data) => { - console.debug("=ACTS_BatchInsert_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】; ====>")); - expect(typeof(data)).assertEqual("number"); - ret = true; - done(); - }).catch((err)=>{ - console.debug("=ACTS_BatchInsert_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_BatchInsert_0100 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0100====: ' + DAHelper) - var valueBucket; - try{ - await DAHelper.batchInsert( - dataAbilityUri, - valueBucket, - (err,data) => { - console.debug("=ACTS_BatchInsert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true; - done(); - }, - ); - }catch(err) { - console.error('=ACTS_BatchInsert_0200 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0200====: ' + DAHelper) - var valueBucketArray = new Array({},{},{}) - try{ - DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】; ====>")); - expect(typeof(data)).assertEqual("number"); - ret = true; - done(); - }).catch((err)=>{ - console.debug("=ACTS_BatchInsert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_BatchInsert_0300 batchInsert AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0300====: ' + DAHelper) - var valueBucketArray = new Array({},{},{}) - try{ - await DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - (err,data) => { - console.debug("=ACTS_BatchInsert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_BatchInsert_0400 catch(err)====>:'+err); - ret = false - done(); - } - - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0400====: ' + DAHelper) - try{ - const valueBucket = { - "name": "ACTS_BatchInsert_0500_roe1", - "age": 21, - "salary": 20.5, - } - var valueBucketArray = new Array({"name": "BatchInsert_0500_roe11", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0500_roe12", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0500_roe13", "age": 21, "salary": 20.5, }) - - DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - ).then((data) => { - console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_BatchInsert_0500 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0500====: ' + DAHelper) - const valueBucket = { - "name": "BatchInsert_0600_roe1", - "age": 21, - "salary": 20.5, - } - var valueBucketArray = new Array({"name": "BatchInsert_0600_roe11", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0600_roe12", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0600_roe13", "age": 21, "salary": 20.5, }) - try{ - await DAHelper.batchInsert( - dataAbilityUri, - valueBucketArray, - (err,data) => { - console.debug("=ACTS_BatchInsert_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_BatchInsert_0600 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_BatchInsert_0600====:' -// + ("json columnsArray 【") + JSON.stringify(columnsArray) + (" 】 ")+","+columnsArray); -//// const valueBucket = { -//// "name": "ACTS_Query_0100_roe1", -//// } -// try{ -// //let predicates = new ohos_data_ability.DataAbilityPredicates() -// let predicates = null -// console.error('=ACTS_Query_0100 ====>:' -// + ("json predicates 【") + JSON.stringify(predicates) + (" 】 ")+","+predicates); -// DAHelper.query(dataAbilityUri,columnsArray,predicates -// ).then((data) => { -// console.debug("=ACTS_Query_0100 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// expect(ret).assertTrue(); -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Query_0100 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// expect(ret).assertTrue(); -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Query_0100 insert query AsyncCallback catch(err)====>:'+err); -// ret = false -// expect(ret).assertTrue(); -// done(); -// } -// setTimeout(function(){ -// console.error('=ACTS_Query_0100 setTimeout ret====>:'+ret); -// }, g_setTimeout); -// console.log('ACTS_Query_0100====: ' + DAHelper) -// try{ -// await DAHelper.query( -// dataAbilityUri, -// columnsArray, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Query_0200 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("object"); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Query_0200 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Query_0200==== { - console.debug("=ACTS_Query_0300 Query then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】") +" , " + data); - expect(typeof(data)).assertEqual("object"); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_Query_0300 Query catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - console.debug("=ACTS_Query_0300 queryPromise ====>" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ")); - }catch(err) { - console.error('=ACTS_Query_0300 query catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Query_0300==== { - console.debug("=ACTS_Query_0400 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;") + " , " +data); - expect(typeof(data)).assertEqual("object"); - ret = true - done(); - },); - }catch(err) { - console.error('=ACTS_Query_0400 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Query_0400====: ' + DAHelper) -//// const valueBucket = { -//// "name": "ACTS_Update_0100_roe1", -//// } -//// try{ -//// //let predicates = new ohos_data_ability.DataAbilityPredicates() -//// let valueBucketNull = null -//// let predicates = null -//// DAHelper.update( -//// dataAbilityUri, -//// valueBucketNull, -//// predicates -//// ).then((data) => { -//// console.debug("=ACTS_Update_0100 then data====>" -//// + ("json data 【") + JSON.stringify(data)+ (" 】")); -//// expect(typeof(data)).assertEqual("number"); -//// ret = true -//// done(); -//// }).catch((err)=>{ -//// console.debug("=ACTS_Update_0100 catch err ====>" -//// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -//// ret = false -//// done(); -//// }); -//// }catch(err) { -//// console.error('=ACTS_Update_0100 catch(err)====>:'+err); -//// ret = false -//// done(); -//// } -//// setTimeout(function(){ -//// expect(ret).assertTrue(); -//// }, g_setTimeout); -//// console.log('ACTS_Update_0100====: ' + DAHelper) -//// const valueBucket = { -//// "name": "ACTS_Update_0200_roe1", -//// "age": 21, -//// "salary": 20.5, -//// -//// } -//// try{ -//// //let predicates = new ohos_data_ability.DataAbilityPredicates() -//// let valueBucketNull = null -//// let predicates = null -//// await DAHelper.update( -//// dataAbilityUri, -//// valueBucketNull, -//// predicates, -//// (err,data) => { -//// console.debug("=ACTS_Update_0200 err,data=======>" -//// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -//// expect(typeof(data)).assertEqual("number"); -//// ret = true -//// done(); -//// }, -//// ); -//// }catch(err) { -//// console.error('=ACTS_Update_0200 catch(err)====>:'+err); -//// ret = false -//// done(); -//// } -//// setTimeout(function(){ -//// expect(ret).assertTrue(); -//// }, g_setTimeout); -//// console.log('ACTS_Update_0200====: ' + DAHelper) -// const valueBucket = {"name": "ACTS_Update_0300_roe1","age": 21,"salary": 20.5,} -// try{ -// let predicates = new ohos_data_ability.DataAbilityPredicates() -// DAHelper.update( -// dataAbilityUri, -// valueBucket, -// predicates -// ).then((data) => { -// console.debug("=ACTS_Update_0300 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Update_0300 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Update_0300 update catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Update_0300====: ' + DAHelper) -// const valueBucket = {"name": "ACTS_Update_0400_roe1","age": 21,"salary": 20.5,} -// try{ -// let predicates = new ohos_data_ability.DataAbilityPredicates() -// await DAHelper.update( -// dataAbilityUri, -// valueBucket, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Update_0400 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Update_0400 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Update_0400====: ' + DAHelper) -// try{ -// let predicates = null -// DAHelper.delete( -// dataAbilityUri, -// predicates -// ).then((data) => { -// console.debug("=ACTS_Delete_0100 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Delete_0100 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Delete_0100 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Delete_0100====: ' + DAHelper) -// try{ -// let predicates = null -// await DAHelper.delete( -// dataAbilityUri, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Delete_0200 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("number"); -// expect(data).assertEqual(0); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Delete_0200 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Delete_0200==== { - console.debug("=ACTS_Delete_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_Delete_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - console.debug("=ACTS_Delete_0300 datadelete====>" - + ("json datadelete 【") + JSON.stringify(datadelete)+ (" 】")+" , " + datadelete); - }catch(err) { - console.error('=ACTS_Delete_0300 catch(err)====>:'+err); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Delete_0300====: ' + DAHelper) - try{ - let predicates = new ohos_data_ability.DataAbilityPredicates() - await DAHelper.delete( - dataAbilityUri, - predicates, - (err,data) => { - console.debug("=ACTS_Delete_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }); - }catch(err) { - console.error('=ACTS_Delete_0400 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Delete_0400===={ - console.debug("=ACTS_GetFileTypes_0100 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0100 for data[' + i + '] ====>: ' + data[i]) - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0100 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - console.log('featureAbility getFileTypes promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0100 getFileTypes AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0100====: ' + DAHelper) - let mimeTypeFilter='*/*' - try{ - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err,data) => { - console.debug("=ACTS_GetFileTypes_0200 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('=ACTS_GetFileTypes_0200 data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0200 for data ====>: ' + err.code +" data[" + i + "]: " + data[i]); - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0200 getFileTypes AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0200===={ - console.debug("=ACTS_GetFileTypes_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('= =ACTS_GetFileTypes_0300 for data[' + i + '] ====>: ' + data[i]) - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('DataAbilityHelper getFileTypes error ====>: ' + err) - ret = false - done(); - }); - console.log('featureAbility getFileTypes promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0300 getFileTypes AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0300====: ' + DAHelper) - let mimeTypeFilter='image/*' - try{ - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err,data) => { - console.debug("=ACTS_GetFileTypes_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0400 for ====>: ' + err.code +" data[" + i + "]: " + data[i]); - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0400 getFileTypes AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0400===={ - console.debug("=ACTS_GetFileTypes_0500 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0500 for data [' + i + '] ====>: ' + data[i]) - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('DataAbilityHelper getFileTypes error ====>: ' + err) - ret = false - done(); - }); - console.log('=ACTS_GetFileTypes_0500 promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0500 getFileTypes AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0500====: ' + DAHelper) - let mimeTypeFilter='*/jpg' - try{ - await DAHelper.getFileTypes( - dataAbilityUri, - mimeTypeFilter, - (err,data) => { - console.debug("=ACTS_GetFileTypes_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('=ACTS_GetFileTypes_0600 data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0600 for errCode ====>: ' + err.code +" data[" + i + "]: " + data[i]); - expect(data[i]).assertEqual(""); - } - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0600 catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetFileTypes_0600===={ - console.debug("=ACTS_GetType_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - console.log('featureAbility getType promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetType_0100 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetType_0100====: ' + DAHelper) - try{ - await DAHelper.getType( - dataAbilityUri, - (err,data) => { - console.debug("=ACTS_GetType_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_GetType_0200 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_GetType_0200===={ - console.debug("=ACTS_OpenFile_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0100 getType catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0100===={ - console.debug("=ACTS_OpenFile_0200 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0200 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0200 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0200 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0200===={ - console.debug("=ACTS_OpenFile_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0300 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0300 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0300===={ - console.debug("=ACTS_OpenFile_0400 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0400 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0400 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0400 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0400===={ - console.debug("=ACTS_OpenFile_0500 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0500 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0500 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0500===={ - console.debug("=ACTS_OpenFile_0600 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") - console.log('DataAbilityHelper ACTS_OpenFile_0600 OpenFile promise ====>: ' + data) - ret = true - done(); - }).catch(err => { - console.debug("=ACTS_OpenFile_0600 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_OpenFile_0600 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0600====: ' + DAHelper) - var mode = "r"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_0700 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0700 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_0700 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0700====: ' + DAHelper) - var mode = "w"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0800 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_0800 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0800====: ' + DAHelper) - var mode = "wt"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_0900 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0900 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_0900 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_0900====: ' + DAHelper) - var mode = "wa"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_1000 err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_1000 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_1000 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_1000====: ' + DAHelper) - var mode = "rw"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_1100 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_1100 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_1100====: ' + DAHelper) - var mode = "rwt"; - try{ - DAHelper.openFile( - dataAbilityUri, - mode, - (err,data) => { - console.debug("=ACTS_OpenFile_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_OpenFile_1200 getType AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_OpenFile_1200====: ' + DAHelper) - try{ - var promise = DAHelper.release( - dataAbilityUri, - ).then((data) =>{ - console.debug("=ACTS_Release_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("boolean") - ret = true - done(); - }).catch(err =>{ - console.debug("=ACTS_Release_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_Release_0100 release promise catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Release_0100====: ' + DAHelper) - try{ - DAHelper.release( - dataAbilityUri, - (err,data) => { - console.debug("=ACTS_Release_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0100 data: ' + data) - expect(typeof(data)).assertEqual("boolean"); - console.log('DataAbilityHelper ACTS_Release_0200 asyncCallback errCode ====>: ' + err.code +" data: " + data); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_Release_0200 release AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_Release_0200====: ' + DAHelper) - try{ - var promise = DAHelper.normalizeUri( - dataAbilityUri, - ).then((data) =>{ - console.debug("=ACTS_NormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") - //expect(data).assertEqual("dataability:///com.ix.VerifyActDataAbility"); - ret = true - done(); - }).catch(err =>{ - console.debug("=ACTS_NormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_NormalizeUri_0100 normalizeUri promise catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_NormalizeUri_0100====: ' + DAHelper) - try{ - DAHelper.normalizeUri( - dataAbilityUri, - (err,data) => { - console.debug("=ACTS_NormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); - expect(data).assertEqual(dataAbilityUri); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_NormalizeUri_0200 normalizeUri AsyncCallback catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_NormalizeUri_0200====: ' + DAHelper) - try{ - var promise = DAHelper.denormalizeUri( - dataAbilityUri, - ).then((data) =>{ - console.debug("=ACTS_DenormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") - expect(data).assertEqual(dataAbilityUri); - ret = true - done(); - }).catch(err =>{ - console.debug("=ACTS_DenormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_DenormalizeUri_0100 denormalizeUri promise catch(err)====>:'+err); - ret = false - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_DenormalizeUri_0100====: ' + DAHelper) - try{ - DAHelper.denormalizeUri( - dataAbilityUri, - (err,data) => { - console.debug("=ACTS_DenormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); - expect(data).assertEqual(dataAbilityUri); - ret = true - done(); - }, - ); - }catch(err) { - console.error('=ACTS_DenormalizeUri_0200 denormalizeUri AsyncCallback catch(err)====>:'+err); - ret = true - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_DenormalizeUri_0200====" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback01++; -// console.debug("=ACTS_OnOff_ asyncCallback01 isFlagCallback01=======>" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// } -// function asyncCallback02(err,data){ -// console.debug("=ACTS_OnOff_ asyncCallback02 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback02++; -// console.debug("=ACTS_OnOff_ asyncCallback02 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// } -// function asyncCallback03(err,data){ -// console.debug("=ACTS_OnOff_ asyncCallback03 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback02++; -// console.debug("=ACTS_OnOff_ asyncCallback03 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// } -///* -//* @tc.number: ACTS_OnOff_0100 -//* @tc.name: On/Off : Registers an observer to observe data specified by the given Uri -//* @tc.desc: Check the return value of the interface () -//*/ -// it('ACTS_OnOff_0100', 0, async function (done) { -// console.log('ACTS_OnOff_0100==== { -// console.debug("=ACTS_OnOff_0100 notifyChange 1 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// await DAHelper.off("dataChange",dataAbilityUri,asyncCallback01); -// await DAHelper.notifyChange( -// dataAbilityUri, -// (err,data) => { -// console.debug("=ACTS_OnOff_0100 notifyChange 2 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// }catch(err) {console.error('=ACTS_OnOff_0100 catch(err)====>:'+err); } -// setTimeout(function(){console.log('ACTS_OnOff_0100==== { -// console.debug("=ACTS_OnOff_0200 notifyChange 1 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// }); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// expect(isFlagCallback02).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// expect(isFlagCallback03).assertEqual(1); -// await DAHelper.off("dataChange",dataAbilityUri,asyncCallback02); -// await DAHelper.notifyChange(dataAbilityUri, -// (err,data) => { -// console.debug("=ACTS_OnOff_0200 notifyChange 2 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0200====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(2); -// console.debug("=ACTS_OnOff_0200 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// expect(isFlagCallback02).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// expect(isFlagCallback03).assertEqual(2); -// }catch(err) { -// console.error('=ACTS_OnOff_0200 AsyncCallback catch(err)====>:'+err); -// } -// setTimeout(function(){console.log('ACTS_OnOff_0100==== { - console.debug("=ACTS_ExecuteBatch_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0100 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0100===={ - console.debug("=ACTS_ExecuteBatch_0200 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0200 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0200==== { - console.debug("=ACTS_ExecuteBatch_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0300 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0300===={ - console.debug("=ACTS_ExecuteBatch_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0400 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0400==== { - console.debug("=ACTS_ExecuteBatch_0500 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0500 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0500 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0500===={ - console.debug("=ACTS_ExecuteBatch_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0600 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0600==== { - console.debug("=ACTS_ExecuteBatch_0700 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0700 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0700 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0700===={ - console.debug("=ACTS_ExecuteBatch_0800 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0800 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0800====:'+err); - expect(false).assertTrue(); - } - } - - /* - * @tc.number: bms_uninstallAbility_0100 - * @tc.name: test the multi js ability - * @tc.desc: 1.install a js hap with two ability - * 2.check the ability name by the interface of getBundleInfo - */ - it('bms_uninstallAbility_0100', 0, async function (done) { - console.info('bms_uninstallAbility_0100====< begin'); - try{ - await uninstall(bundleName); - done(); - }catch(err) { - console.error('=bms_uninstallAbility_0100 uninstall catch(err)====>:'+err); - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.info('bms_uninstallAbility_0100====< setTimeout'); - }, g_setTimeout) - console.info('bms_uninstallAbility_0100====< end'); - }) -}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js index ed209f3c0360904376c897f15661edb733b84a96..d4068900a58b8067a8b7c11ff99be8ff584e237e 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js @@ -183,7 +183,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0300', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0300=================='); - bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => { + bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN, (err, data) => { expect(err.code).assertEqual(0); checkModuleUsageRecord(data); var result = checkIsExist(data, BUNDLE_NAME); @@ -208,7 +208,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0400', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0400=================='); - var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO); + var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN); checkModuleUsageRecord(records); var result = checkIsExist(records, BUNDLE_NAME); expect(result).assertTrue();