提交 45e05ecc 编写于 作者: W wangtiantian

IssueNo: #I4UPBF : modify bms api

Description: modify bms api
SIG_ApplicaitonFramework
Feature or Bugfix:BugFix
Binary Source:No
Signed-off-by: Nwangtiantian <wangtiantian19@huawei.com>
上级 ae4e3c46
...@@ -39,9 +39,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -39,9 +39,9 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, callback); bundle.getBundleInfo(bundleName, 1, callback);
async function callback(err, result) { async function callback(err, result) {
expect(result.hapModuleInfo.length).assertEqual(1); expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfo.length > 0) { if (result.hapModuleInfos.length > 0) {
let hapModuleInfo = result.hapModuleInfo[0]; let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
expect(hapModuleInfo.mainElementName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); expect(hapModuleInfo.mainElementName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility');
...@@ -105,14 +105,14 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -105,14 +105,14 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, async (err, result) => { bundle.getBundleInfo(bundleName, 1, async (err, result) => {
expect(result.hapModuleInfo.length).assertEqual(2); expect(result.hapModuleInfos.length).assertEqual(2);
if (result.hapModuleInfo.length == 2) { if (result.hapModuleInfos.length == 2) {
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual(firstMainAbility); expect(result.hapModuleInfos[0].mainAbilityName).assertEqual(firstMainAbility);
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); expect(result.hapModuleInfos[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfos[0]);
expect(result.hapModuleInfo[1].mainAbilityName).assertEqual(secondMainAbility); expect(result.hapModuleInfos[1].mainAbilityName).assertEqual(secondMainAbility);
expect(result.hapModuleInfo[1].moduleName).assertEqual('bmsmainabilitysecondscene'); expect(result.hapModuleInfos[1].moduleName).assertEqual('bmsmainabilitysecondscene');
checkHapModuleInfo(result.hapModuleInfo[1]); checkHapModuleInfo(result.hapModuleInfos[1]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -153,12 +153,12 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -153,12 +153,12 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1,).then(async (result) => { bundle.getBundleInfo(bundleName, 1,).then(async (result) => {
console.debug('=======get hapModule========' + JSON.stringify(result)) console.debug('=======get hapModule========' + JSON.stringify(result))
expect(result.hapModuleInfo.length).assertEqual(1); expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfo.length > 0) { if (result.hapModuleInfos.length > 0) {
console.debug('=======get hapModule mainAbilityName========' + result.hapModuleInfo[0].mainAbilityName) console.debug('=======get hapModule mainAbilityName========' + result.hapModuleInfos[0].mainAbilityName)
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual(''); expect(result.hapModuleInfos[0].mainAbilityName).assertEqual('');
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); expect(result.hapModuleInfos[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfos[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -203,11 +203,11 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -203,11 +203,11 @@ describe('ActsBmsHapModuleTest', function () {
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
bundle.getBundleInfo(bundleName, 1, async (err, result) => { bundle.getBundleInfo(bundleName, 1, async (err, result) => {
console.debug('=======get hapModule========' + JSON.stringify(result)) console.debug('=======get hapModule========' + JSON.stringify(result))
expect(result.hapModuleInfo.length).assertEqual(1); expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfo.length == 1) { if (result.hapModuleInfos.length == 1) {
expect(result.hapModuleInfo[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility'); expect(result.hapModuleInfos[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility');
expect(result.hapModuleInfo[0].moduleName).assertEqual('entry'); expect(result.hapModuleInfos[0].moduleName).assertEqual('entry');
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfos[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -256,9 +256,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -256,9 +256,9 @@ describe('ActsBmsHapModuleTest', function () {
}) })
}) })
function callback(err, result) { function callback(err, result) {
expect(result.hapModuleInfo.length).assertEqual(1); expect(result.hapModuleInfos.length).assertEqual(1);
if (result.hapModuleInfo.length == 1) { if (result.hapModuleInfos.length == 1) {
let hapModuleInfo = result.hapModuleInfo[0]; let hapModuleInfo = result.hapModuleInfos[0];
expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.moduleName).assertEqual('entry');
expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.third1.AMainAbility'); expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.third1.AMainAbility');
checkHapModuleInfo(hapModuleInfo); checkHapModuleInfo(hapModuleInfo);
...@@ -286,9 +286,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -286,9 +286,9 @@ describe('ActsBmsHapModuleTest', function () {
let bundleName = 'com.example.system1'; let bundleName = 'com.example.system1';
bundle.getBundleInfo(bundleName, 1, callback); bundle.getBundleInfo(bundleName, 1, callback);
function callback(err, data) { function callback(err, data) {
expect(data.hapModuleInfo.length).assertEqual(1); expect(data.hapModuleInfos.length).assertEqual(1);
if (data.hapModuleInfo.length == 1) { if (data.hapModuleInfos.length == 1) {
let hapModuleInfo = data.hapModuleInfo[0]; let hapModuleInfo = data.hapModuleInfos[0];
console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo))
console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName)
expect(hapModuleInfo.moduleName).assertEqual('entry'); expect(hapModuleInfo.moduleName).assertEqual('entry');
......
...@@ -42,12 +42,12 @@ describe('ActsBmsJsTest', function () { ...@@ -42,12 +42,12 @@ describe('ActsBmsJsTest', function () {
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1); let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(NUM_TWO); expect(result.abilityInfos.length).assertEqual(NUM_TWO);
if (result.abilityInfo.length == NUM_TWO) { if (result.abilityInfos.length == NUM_TWO) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos));
expect(result.abilityInfo[0].name).assertEqual(abilityName); expect(result.abilityInfos[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); expect(result.abilityInfos[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual(''); expect(result.abilityInfos[0].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -90,15 +90,15 @@ describe('ActsBmsJsTest', function () { ...@@ -90,15 +90,15 @@ describe('ActsBmsJsTest', function () {
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1) let result = await bundle.getBundleInfo(bundleName, 1)
console.debug('==========bundleInfo==========' + JSON.stringify(result)) console.debug('==========bundleInfo==========' + JSON.stringify(result))
expect(result.abilityInfo.length).assertEqual(NUM_FOUR); expect(result.abilityInfos.length).assertEqual(NUM_FOUR);
if (result.abilityInfo.length == NUM_FOUR) { if (result.abilityInfos.length == NUM_FOUR) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos));
expect(result.abilityInfo[0].name).assertEqual(abilityName1); expect(result.abilityInfos[0].name).assertEqual(abilityName1);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); expect(result.abilityInfos[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual(''); expect(result.abilityInfos[0].srcPath).assertEqual('');
expect(result.abilityInfo[1].name).assertEqual(abilityName2); expect(result.abilityInfos[1].name).assertEqual(abilityName2);
expect(result.abilityInfo[1].srcLanguage).assertEqual('js'); expect(result.abilityInfos[1].srcLanguage).assertEqual('js');
expect(result.abilityInfo[1].srcPath).assertEqual(''); expect(result.abilityInfos[1].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -138,12 +138,12 @@ describe('ActsBmsJsTest', function () { ...@@ -138,12 +138,12 @@ describe('ActsBmsJsTest', function () {
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1); let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(1); expect(result.abilityInfos.length).assertEqual(1);
if (result.abilityInfo.length == 1) { if (result.abilityInfos.length == 1) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos));
expect(result.abilityInfo[0].name).assertEqual(abilityName); expect(result.abilityInfos[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('js'); expect(result.abilityInfos[0].srcLanguage).assertEqual('js');
expect(result.abilityInfo[0].srcPath).assertEqual('default'); expect(result.abilityInfos[0].srcPath).assertEqual('default');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
...@@ -184,12 +184,12 @@ describe('ActsBmsJsTest', function () { ...@@ -184,12 +184,12 @@ describe('ActsBmsJsTest', function () {
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
let result = await bundle.getBundleInfo(bundleName, 1); let result = await bundle.getBundleInfo(bundleName, 1);
expect(result.abilityInfo.length).assertEqual(1); expect(result.abilityInfos.length).assertEqual(1);
if (result.abilityInfo.length == 1) { if (result.abilityInfos.length == 1) {
console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfo)); console.debug('========check abilityName ========' + JSON.stringify(result.abilityInfos));
expect(result.abilityInfo[0].name).assertEqual(abilityName); expect(result.abilityInfos[0].name).assertEqual(abilityName);
expect(result.abilityInfo[0].srcLanguage).assertEqual('c++'); expect(result.abilityInfos[0].srcLanguage).assertEqual('c++');
expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/'); expect(result.abilityInfos[0].srcPath).assertEqual('default/c++/');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
userId: 100, userId: 100,
......
...@@ -97,7 +97,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -97,7 +97,7 @@ describe('ActsBundleManagerTest', function () {
expect(datainfo.compatibleVersion).assertEqual(5) expect(datainfo.compatibleVersion).assertEqual(5)
expect(datainfo.targetVersion).assertEqual(5) expect(datainfo.targetVersion).assertEqual(5)
expect(datainfo.isCompressNativeLibs).assertEqual(false) 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].name).assertEqual("com.example.myapplication1")
expect(datainfo.moduleInfos[s].moduleName).assertEqual("entry") expect(datainfo.moduleInfos[s].moduleName).assertEqual("entry")
} }
...@@ -2426,8 +2426,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2426,8 +2426,7 @@ describe('ActsBundleManagerTest', function () {
}); });
async function getInfo() { async function getInfo() {
var bundleOptions = { var bundleOptions = {
userId: 100, userId: 100
networkId: ""
}; };
var dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions); var dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions);
expect(dataInfo.name).assertEqual(NAME1) expect(dataInfo.name).assertEqual(NAME1)
...@@ -2450,7 +2449,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2450,7 +2449,7 @@ describe('ActsBundleManagerTest', function () {
expect(dataInfo.compatibleVersion).assertEqual(5) expect(dataInfo.compatibleVersion).assertEqual(5)
expect(dataInfo.targetVersion).assertEqual(5) expect(dataInfo.targetVersion).assertEqual(5)
expect(dataInfo.isCompressNativeLibs).assertEqual(false) 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].name).assertEqual("com.example.myapplication1")
expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry") expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry")
} }
...@@ -2495,8 +2494,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2495,8 +2494,7 @@ describe('ActsBundleManagerTest', function () {
}); });
async function getInfo() { async function getInfo() {
var bundleOptions = { var bundleOptions = {
userId: 100, userId: 100
networkId: ""
}; };
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => { demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => {
expect(dataInfo.name).assertEqual(NAME1) expect(dataInfo.name).assertEqual(NAME1)
...@@ -2519,7 +2517,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2519,7 +2517,7 @@ describe('ActsBundleManagerTest', function () {
expect(dataInfo.compatibleVersion).assertEqual(5) expect(dataInfo.compatibleVersion).assertEqual(5)
expect(dataInfo.targetVersion).assertEqual(5) expect(dataInfo.targetVersion).assertEqual(5)
expect(dataInfo.isCompressNativeLibs).assertEqual(false) 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].name).assertEqual("com.example.myapplication1")
expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry") expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry")
} }
...@@ -2565,8 +2563,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2565,8 +2563,7 @@ describe('ActsBundleManagerTest', function () {
}); });
async function getInfo() { async function getInfo() {
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, {
userId: 1, userId: 1
networkId: ""
}).then(data => { }).then(data => {
expect().assertFail(); expect().assertFail();
}).catch(err => { }).catch(err => {
...@@ -2604,8 +2601,7 @@ describe('ActsBundleManagerTest', function () { ...@@ -2604,8 +2601,7 @@ describe('ActsBundleManagerTest', function () {
}); });
async function getInfo() { async function getInfo() {
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, { demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, {
userId: 1, userId: 1
networkId: ""
}, (err, dataInfo) => { }, (err, dataInfo) => {
expect(err).assertEqual(1); expect(err).assertEqual(1);
expect(dataInfo).assertEqual(undefined); expect(dataInfo).assertEqual(undefined);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册