From 45e05ecc70e310beeb54aba6354d8628916dafc5 Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Tue, 22 Feb 2022 15:58:46 +0800 Subject: [PATCH] IssueNo: #I4UPBF : modify bms api Description: modify bms api SIG_ApplicaitonFramework Feature or Bugfix:BugFix Binary Source:No Signed-off-by: wangtiantian --- .../main/js/test/ActsBmsHapModuleTest.test.js | 56 +++++++++---------- .../src/main/js/test/ActsBmsJsTest.test.js | 54 +++++++++--------- .../src/main/js/test/ExampleJsunit.test.js | 18 +++--- 3 files changed, 62 insertions(+), 66 deletions(-) diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js index 8009dda75..310c4fe44 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js @@ -39,9 +39,9 @@ describe('ActsBmsHapModuleTest', function () { expect(data.statusMessage).assertEqual('SUCCESS'); bundle.getBundleInfo(bundleName, 1, callback); async function callback(err, result) { - expect(result.hapModuleInfo.length).assertEqual(1); - if (result.hapModuleInfo.length > 0) { - let hapModuleInfo = result.hapModuleInfo[0]; + expect(result.hapModuleInfos.length).assertEqual(1); + if (result.hapModuleInfos.length > 0) { + let hapModuleInfo = result.hapModuleInfos[0]; expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); expect(hapModuleInfo.mainElementName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); @@ -105,14 +105,14 @@ describe('ActsBmsHapModuleTest', function () { expect(data.status).assertEqual(0); expect(data.statusMessage).assertEqual('SUCCESS'); bundle.getBundleInfo(bundleName, 1, async (err, result) => { - expect(result.hapModuleInfo.length).assertEqual(2); - if (result.hapModuleInfo.length == 2) { - expect(result.hapModuleInfo[0].mainAbilityName).assertEqual(firstMainAbility); - expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); - checkHapModuleInfo(result.hapModuleInfo[0]); - expect(result.hapModuleInfo[1].mainAbilityName).assertEqual(secondMainAbility); - expect(result.hapModuleInfo[1].moduleName).assertEqual('bmsmainabilitysecondscene'); - checkHapModuleInfo(result.hapModuleInfo[1]); + expect(result.hapModuleInfos.length).assertEqual(2); + if (result.hapModuleInfos.length == 2) { + expect(result.hapModuleInfos[0].mainAbilityName).assertEqual(firstMainAbility); + expect(result.hapModuleInfos[0].moduleName).assertEqual('entry'); + checkHapModuleInfo(result.hapModuleInfos[0]); + expect(result.hapModuleInfos[1].mainAbilityName).assertEqual(secondMainAbility); + expect(result.hapModuleInfos[1].moduleName).assertEqual('bmsmainabilitysecondscene'); + checkHapModuleInfo(result.hapModuleInfos[1]); } installer.uninstall(bundleName, { userId: 100, @@ -153,12 +153,12 @@ describe('ActsBmsHapModuleTest', function () { expect(data.statusMessage).assertEqual('SUCCESS'); bundle.getBundleInfo(bundleName, 1,).then(async (result) => { console.debug('=======get hapModule========' + JSON.stringify(result)) - expect(result.hapModuleInfo.length).assertEqual(1); - if (result.hapModuleInfo.length > 0) { - console.debug('=======get hapModule mainAbilityName========' + result.hapModuleInfo[0].mainAbilityName) - expect(result.hapModuleInfo[0].mainAbilityName).assertEqual(''); - expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); - checkHapModuleInfo(result.hapModuleInfo[0]); + expect(result.hapModuleInfos.length).assertEqual(1); + if (result.hapModuleInfos.length > 0) { + console.debug('=======get hapModule mainAbilityName========' + result.hapModuleInfos[0].mainAbilityName) + expect(result.hapModuleInfos[0].mainAbilityName).assertEqual(''); + expect(result.hapModuleInfos[0].moduleName).assertEqual('entry'); + checkHapModuleInfo(result.hapModuleInfos[0]); } installer.uninstall(bundleName, { userId: 100, @@ -203,11 +203,11 @@ describe('ActsBmsHapModuleTest', function () { expect(data.statusMessage).assertEqual('SUCCESS'); bundle.getBundleInfo(bundleName, 1, async (err, result) => { console.debug('=======get hapModule========' + JSON.stringify(result)) - expect(result.hapModuleInfo.length).assertEqual(1); - if (result.hapModuleInfo.length == 1) { - expect(result.hapModuleInfo[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility'); - expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); - checkHapModuleInfo(result.hapModuleInfo[0]); + expect(result.hapModuleInfos.length).assertEqual(1); + if (result.hapModuleInfos.length == 1) { + expect(result.hapModuleInfos[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility'); + expect(result.hapModuleInfos[0].moduleName).assertEqual('entry'); + checkHapModuleInfo(result.hapModuleInfos[0]); } installer.uninstall(bundleName, { userId: 100, @@ -256,9 +256,9 @@ describe('ActsBmsHapModuleTest', function () { }) }) function callback(err, result) { - expect(result.hapModuleInfo.length).assertEqual(1); - if (result.hapModuleInfo.length == 1) { - let hapModuleInfo = result.hapModuleInfo[0]; + expect(result.hapModuleInfos.length).assertEqual(1); + if (result.hapModuleInfos.length == 1) { + let hapModuleInfo = result.hapModuleInfos[0]; expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.third1.AMainAbility'); checkHapModuleInfo(hapModuleInfo); @@ -286,9 +286,9 @@ describe('ActsBmsHapModuleTest', function () { let bundleName = 'com.example.system1'; bundle.getBundleInfo(bundleName, 1, callback); function callback(err, data) { - expect(data.hapModuleInfo.length).assertEqual(1); - if (data.hapModuleInfo.length == 1) { - let hapModuleInfo = data.hapModuleInfo[0]; + expect(data.hapModuleInfos.length).assertEqual(1); + if (data.hapModuleInfos.length == 1) { + let hapModuleInfo = data.hapModuleInfos[0]; console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) expect(hapModuleInfo.moduleName).assertEqual('entry'); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js index 77d40f63e..cd8badb2d 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js @@ -42,12 +42,12 @@ describe('ActsBmsJsTest', function () { expect(data.status).assertEqual(0); expect(data.statusMessage).assertEqual('SUCCESS'); let result = await bundle.getBundleInfo(bundleName, 1); - expect(result.abilityInfo.length).assertEqual(NUM_TWO); - if (result.abilityInfo.length == NUM_TWO) { - console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); - expect(result.abilityInfo[0].name).assertEqual(abilityName); - expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); - expect(result.abilityInfo[0].srcPath).assertEqual(''); + expect(result.abilityInfos.length).assertEqual(NUM_TWO); + if (result.abilityInfos.length == NUM_TWO) { + console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos)); + expect(result.abilityInfos[0].name).assertEqual(abilityName); + expect(result.abilityInfos[0].srcLanguage).assertEqual('js'); + expect(result.abilityInfos[0].srcPath).assertEqual(''); } installer.uninstall(bundleName, { userId: 100, @@ -90,15 +90,15 @@ describe('ActsBmsJsTest', function () { expect(data.statusMessage).assertEqual('SUCCESS'); let result = await bundle.getBundleInfo(bundleName, 1) console.debug('==========bundleInfo==========' + JSON.stringify(result)) - expect(result.abilityInfo.length).assertEqual(NUM_FOUR); - if (result.abilityInfo.length == NUM_FOUR) { - console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); - expect(result.abilityInfo[0].name).assertEqual(abilityName1); - expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); - expect(result.abilityInfo[0].srcPath).assertEqual(''); - expect(result.abilityInfo[1].name).assertEqual(abilityName2); - expect(result.abilityInfo[1].srcLanguage).assertEqual('js'); - expect(result.abilityInfo[1].srcPath).assertEqual(''); + expect(result.abilityInfos.length).assertEqual(NUM_FOUR); + if (result.abilityInfos.length == NUM_FOUR) { + console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos)); + expect(result.abilityInfos[0].name).assertEqual(abilityName1); + expect(result.abilityInfos[0].srcLanguage).assertEqual('js'); + expect(result.abilityInfos[0].srcPath).assertEqual(''); + expect(result.abilityInfos[1].name).assertEqual(abilityName2); + expect(result.abilityInfos[1].srcLanguage).assertEqual('js'); + expect(result.abilityInfos[1].srcPath).assertEqual(''); } installer.uninstall(bundleName, { userId: 100, @@ -138,12 +138,12 @@ describe('ActsBmsJsTest', function () { expect(data.status).assertEqual(0); expect(data.statusMessage).assertEqual('SUCCESS'); let result = await bundle.getBundleInfo(bundleName, 1); - expect(result.abilityInfo.length).assertEqual(1); - if (result.abilityInfo.length == 1) { - console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); - expect(result.abilityInfo[0].name).assertEqual(abilityName); - expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); - expect(result.abilityInfo[0].srcPath).assertEqual('default'); + expect(result.abilityInfos.length).assertEqual(1); + if (result.abilityInfos.length == 1) { + console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos)); + expect(result.abilityInfos[0].name).assertEqual(abilityName); + expect(result.abilityInfos[0].srcLanguage).assertEqual('js'); + expect(result.abilityInfos[0].srcPath).assertEqual('default'); } installer.uninstall(bundleName, { userId: 100, @@ -184,12 +184,12 @@ describe('ActsBmsJsTest', function () { expect(data.status).assertEqual(0); expect(data.statusMessage).assertEqual('SUCCESS'); let result = await bundle.getBundleInfo(bundleName, 1); - expect(result.abilityInfo.length).assertEqual(1); - if (result.abilityInfo.length == 1) { - console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); - expect(result.abilityInfo[0].name).assertEqual(abilityName); - expect(result.abilityInfo[0].srcLanguage).assertEqual('c++'); - expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/'); + expect(result.abilityInfos.length).assertEqual(1); + if (result.abilityInfos.length == 1) { + console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos)); + expect(result.abilityInfos[0].name).assertEqual(abilityName); + expect(result.abilityInfos[0].srcLanguage).assertEqual('c++'); + expect(result.abilityInfos[0].srcPath).assertEqual('default/c++/'); } installer.uninstall(bundleName, { userId: 100, diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js index 7e5d581b1..d74e44b6b 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js @@ -97,7 +97,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.compatibleVersion).assertEqual(5) expect(datainfo.targetVersion).assertEqual(5) expect(datainfo.isCompressNativeLibs).assertEqual(false) - for (var s = 0; s < datainfo.hapModuleInfo; s++) { + for (var s = 0; s < datainfo.hapModuleInfos; s++) { expect(datainfo.moduleInfos[s].name).assertEqual("com.example.myapplication1") expect(datainfo.moduleInfos[s].moduleName).assertEqual("entry") } @@ -2426,8 +2426,7 @@ describe('ActsBundleManagerTest', function () { }); async function getInfo() { var bundleOptions = { - userId: 100, - networkId: "" + userId: 100 }; var dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions); expect(dataInfo.name).assertEqual(NAME1) @@ -2450,7 +2449,7 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.compatibleVersion).assertEqual(5) expect(dataInfo.targetVersion).assertEqual(5) expect(dataInfo.isCompressNativeLibs).assertEqual(false) - for (var s = 0; s < dataInfo.hapModuleInfo; s++) { + for (var s = 0; s < dataInfo.hapModuleInfos; s++) { expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1") expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry") } @@ -2495,8 +2494,7 @@ describe('ActsBundleManagerTest', function () { }); async function getInfo() { var bundleOptions = { - userId: 100, - networkId: "" + userId: 100 }; demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => { expect(dataInfo.name).assertEqual(NAME1) @@ -2519,7 +2517,7 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.compatibleVersion).assertEqual(5) expect(dataInfo.targetVersion).assertEqual(5) expect(dataInfo.isCompressNativeLibs).assertEqual(false) - for (var s = 0; s < dataInfo.hapModuleInfo; s++) { + for (var s = 0; s < dataInfo.hapModuleInfos; s++) { expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1") expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry") } @@ -2565,8 +2563,7 @@ describe('ActsBundleManagerTest', function () { }); async function getInfo() { demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { - userId: 1, - networkId: "" + userId: 1 }).then(data => { expect().assertFail(); }).catch(err => { @@ -2604,8 +2601,7 @@ describe('ActsBundleManagerTest', function () { }); async function getInfo() { demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { - userId: 1, - networkId: "" + userId: 1 }, (err, dataInfo) => { expect(err).assertEqual(1); expect(dataInfo).assertEqual(undefined); -- GitLab