提交 af32a017 编写于 作者: O openharmony_ci 提交者: Gitee

!1432 update xts

Merge pull request !1432 from shilei91/master
...@@ -29,11 +29,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -29,11 +29,9 @@ describe('ActsBmsHapModuleTest', function () {
let bundleName = 'com.example.bmsmainabilityfirstscene'; let bundleName = 'com.example.bmsmainabilityfirstscene';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) { function onReceiveInstallEvent(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -72,11 +70,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -72,11 +70,9 @@ describe('ActsBmsHapModuleTest', function () {
} }
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -100,11 +96,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -100,11 +96,9 @@ describe('ActsBmsHapModuleTest', function () {
let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility'; let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -120,11 +114,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -120,11 +114,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[1]); checkHapModuleInfo(result.hapModuleInfo[1]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -147,11 +139,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -147,11 +139,9 @@ describe('ActsBmsHapModuleTest', function () {
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer); console.log('========install========' + typeof installer);
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
function onReceiveInstallEvent(err, data) { function onReceiveInstallEvent(err, data) {
console.info('========install Finish========'); console.info('========install Finish========');
...@@ -170,11 +160,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -170,11 +160,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfo[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveUninstallEvent); }, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) { function onReceiveUninstallEvent(err, data) {
...@@ -202,11 +190,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -202,11 +190,9 @@ describe('ActsBmsHapModuleTest', function () {
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
console.log('========install========' + typeof installer); console.log('========install========' + typeof installer);
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========install Finish========'); console.info('========install Finish========');
expect(typeof err).assertEqual('object'); expect(typeof err).assertEqual('object');
...@@ -223,11 +209,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -223,11 +209,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(result.hapModuleInfo[0]); checkHapModuleInfo(result.hapModuleInfo[0]);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveUninstallEvent); }, onReceiveUninstallEvent);
function onReceiveUninstallEvent(err, data) { function onReceiveUninstallEvent(err, data) {
...@@ -252,21 +236,17 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -252,21 +236,17 @@ describe('ActsBmsHapModuleTest', function () {
let bundleName = 'com.example.third1'; let bundleName = 'com.example.third1';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, { installer.install(bundlePath1, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, { installer.install(bundlePath2, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -283,11 +263,9 @@ describe('ActsBmsHapModuleTest', function () { ...@@ -283,11 +263,9 @@ describe('ActsBmsHapModuleTest', function () {
checkHapModuleInfo(hapModuleInfo); checkHapModuleInfo(hapModuleInfo);
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
......
...@@ -29,11 +29,9 @@ describe('ActsBmsJsTest', function () { ...@@ -29,11 +29,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = 'com.example.third2.MainAbility'; let abilityName = 'com.example.third2.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest2.hap'], { installer.install(['/data/test/bmsThirdBundleTest2.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -52,11 +50,9 @@ describe('ActsBmsJsTest', function () { ...@@ -52,11 +50,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual(''); expect(result.abilityInfo[0].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -80,11 +76,9 @@ describe('ActsBmsJsTest', function () { ...@@ -80,11 +76,9 @@ describe('ActsBmsJsTest', function () {
let abilityName2 = 'com.example.third5.BMainAbility'; let abilityName2 = 'com.example.third5.BMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest5.hap'], { installer.install(['/data/test/bmsThirdBundleTest5.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -107,11 +101,9 @@ describe('ActsBmsJsTest', function () { ...@@ -107,11 +101,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[1].srcPath).assertEqual(''); expect(result.abilityInfo[1].srcPath).assertEqual('');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -133,11 +125,9 @@ describe('ActsBmsJsTest', function () { ...@@ -133,11 +125,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = 'com.example.js.MainAbility'; let abilityName = 'com.example.js.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleJs.hap'], { installer.install(['/data/test/bmsThirdBundleJs.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -156,11 +146,9 @@ describe('ActsBmsJsTest', function () { ...@@ -156,11 +146,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual('default'); expect(result.abilityInfo[0].srcPath).assertEqual('default');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -183,11 +171,9 @@ describe('ActsBmsJsTest', function () { ...@@ -183,11 +171,9 @@ describe('ActsBmsJsTest', function () {
let abilityName = '.MainAbility'; let abilityName = '.MainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleC.hap'], { installer.install(['/data/test/bmsThirdBundleC.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveInstallEvent); }, onReceiveInstallEvent);
async function onReceiveInstallEvent(err, data) { async function onReceiveInstallEvent(err, data) {
...@@ -206,11 +192,9 @@ describe('ActsBmsJsTest', function () { ...@@ -206,11 +192,9 @@ describe('ActsBmsJsTest', function () {
expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/'); expect(result.abilityInfo[0].srcPath).assertEqual('default/c++/');
} }
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('========uninstall Finish========'); console.info('========uninstall Finish========');
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
......
...@@ -96,11 +96,11 @@ describe('ActsBmsKitTest', function () { ...@@ -96,11 +96,11 @@ describe('ActsBmsKitTest', function () {
for (let i = 0; i < STRESSLEVEL; i++) { for (let i = 0; i < STRESSLEVEL; i++) {
bundle.getAllShortcutInfo(bundleName, async (err, data) => { bundle.getAllShortcutInfo(bundleName, async (err, data) => {
expect(data.length).assertEqual(1); expect(data.length).assertEqual(1);
expect(err.code).assertEqual(0); expect(err).assertEqual(0);
checkShortcutIsExist(data, 'id.third1', 'third1'); checkShortcutIsExist(data, 'id.third1', 'third1');
if (count == STRESSLEVEL - 1) { if (count == STRESSLEVEL - 1) {
done(); done();
} else if (err.code != 0) { } else if (err != 0) {
console.log('call function level is: ' + count); console.log('call function level is: ' + count);
expect().assertFail(); expect().assertFail();
flag = false; flag = false;
......
...@@ -25,47 +25,34 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -25,47 +25,34 @@ describe('ActsBmsMetaDataTest', function () {
*/ */
it('bms_getMetaData_0100', 0, async function (done) { it('bms_getMetaData_0100', 0, async function (done) {
console.info('=====================bms_getMetaData_0100=================='); console.info('=====================bms_getMetaData_0100==================');
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
let abilityName1 = 'com.example.third1.MainAbility'; let abilityName1 = 'com.example.third1.MainAbility';
let abilityName2 = 'com.example.third3.MainAbility';
let dataMap = new Map(); let dataMap = new Map();
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', "bundleName": 'com.example.third1',
entities: ['entity.system.home'], "abilityName": 'com.example.third1.MainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) { for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData) dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
} }
expect(dataMap.has(abilityName1)).assertTrue(); })
expect(dataMap.has(abilityName2)).assertTrue(); if (dataMap.has(abilityName1)) {
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data1'); checkMetaData(dataMap.get(abilityName1), 'Data1');
checkMetaData(dataMap.get(abilityName2), 'Data3');
} }
installer.uninstall('com.example.third1', { installer.uninstall('com.example.third1', {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -89,49 +76,37 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -89,49 +76,37 @@ describe('ActsBmsMetaDataTest', function () {
let abilityName1 = 'com.example.third1.AMainAbility'; let abilityName1 = 'com.example.third1.AMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, { installer.install(bundlePath1, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.install(bundlePath2, { installer.install(bundlePath2, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home', "bundleName": 'com.example.third1',
entities: ['entity.system.home'], "abilityName": 'com.example.third1.AMainAbility',
elementName: { }, 32, 0).then(dataInfos => {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.AMainAbility',
},
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) { for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData) dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
} }
expect(dataMap.has(abilityName1)).assertTrue(); })
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'DataA1'); checkMetaData(dataMap.get(abilityName1), 'DataA1');
} }
installer.uninstall('com.example.third1', { installer.uninstall('com.example.third1', {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -153,37 +128,25 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -153,37 +128,25 @@ describe('ActsBmsMetaDataTest', function () {
let bundleName = 'com.example.third1'; let bundleName = 'com.example.third1';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
installer.uninstall(bundleName, { installer.uninstall(bundleName, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); bundle.queryAbilityByWant(
expect(data.status).assertEqual(0); {
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1', bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility', abilityName: 'com.example.third1.MainAbility',
}, }, 32, 0).then(dataInfos => {
}
}, 0, 0);
expect(dataInfos.length).assertEqual(0); expect(dataInfos.length).assertEqual(0);
});
done(); done();
}); });
}); });
...@@ -192,52 +155,39 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -192,52 +155,39 @@ describe('ActsBmsMetaDataTest', function () {
/* /*
* @tc.number: bms_getMetaData_0400 * @tc.number: bms_getMetaData_0400
* @tc.name: test to get meta data for an application. * @tc.name: test to get meta data for an application.
* @tc.desc: get an application's meta data which has two abilities. * @tc.desc: get an application's meta data which has one ability.
*/ */
it('bms_getMetaData_0400', 0, async function (done) { it('bms_getMetaData_0400', 0, async function (done) {
console.info('=====================bms_getMetaData_0400=================='); console.info('=====================bms_getMetaData_0400==================');
var bundlePath = ['/data/test/bmsThirdBundleTest5.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest5.hap']
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.third5.AMainAbility'; let abilityName1 = 'com.example.third5.AMainAbility';
let abilityName2 = 'com.example.third5.BMainAbility';
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveinstallEvent); }, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) { async function onReceiveinstallEvent(err, data) {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS'); expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third5', bundleName: 'com.example.third5',
abilityName: 'com.example.third5.AMainAbility', abilityName: 'com.example.third5.AMainAbility',
}, }, 32, 0).then(dataInfos => {
}
}, 0, 0)
for (let i = 0, len = dataInfos.length; i < len; i++) { for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData) dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
} }
expect(dataMap.has(abilityName1)).assertTrue(); })
expect(dataMap.has(abilityName2)).assertTrue(); if (dataMap.has(abilityName1)) {
if (dataMap.has(abilityName1) && dataMap.has(abilityName2)) {
checkMetaData(dataMap.get(abilityName1), 'Data5A'); checkMetaData(dataMap.get(abilityName1), 'Data5A');
checkMetaData(dataMap.get(abilityName2), 'Data5B');
} }
installer.uninstall('com.example.third5', { installer.uninstall('com.example.third5', {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -254,18 +204,13 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -254,18 +204,13 @@ describe('ActsBmsMetaDataTest', function () {
*/ */
it('bms_getMetaData_0500', 0, async function (done) { it('bms_getMetaData_0500', 0, async function (done) {
console.info('=====================bms_getMetaData_0500=================='); console.info('=====================bms_getMetaData_0500==================');
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.noexist', bundleName: 'com.example.noexist',
abilityName: 'com.example.noexist.MainAbility', abilityName: 'com.example.noexist.MainAbility',
}, }, 32, 0).then(dataInfos => {
}
}, 0, 0)
expect(dataInfos.length).assertEqual(0); expect(dataInfos.length).assertEqual(0);
})
done(); done();
}) })
...@@ -278,21 +223,15 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -278,21 +223,15 @@ describe('ActsBmsMetaDataTest', function () {
console.info('=====================bms_getMetaData_0600=================='); console.info('=====================bms_getMetaData_0600==================');
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.system1.MainAbility'; let abilityName1 = 'com.example.system1.MainAbility';
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.system1', bundleName: 'com.example.system1',
abilityName: 'com.example.system1.MainAbility', abilityName: 'com.example.system1.MainAbility',
}, }, 32, 0).then(dataInfos => {
}
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) { for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData) dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
} }
expect(dataMap.has(abilityName1)).assertTrue(); })
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
checkMetaData(dataMap.get(abilityName1), 'Data1S'); checkMetaData(dataMap.get(abilityName1), 'Data1S');
} }
...@@ -308,21 +247,15 @@ describe('ActsBmsMetaDataTest', function () { ...@@ -308,21 +247,15 @@ describe('ActsBmsMetaDataTest', function () {
console.info('=====================bms_getMetaData_0700=================='); console.info('=====================bms_getMetaData_0700==================');
let dataMap = new Map(); let dataMap = new Map();
let abilityName1 = 'com.example.vendor1.MainAbility'; let abilityName1 = 'com.example.vendor1.MainAbility';
var dataInfos = await bundle.queryAbilityByWant({ bundle.queryAbilityByWant(
want: { {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.vendor1', bundleName: 'com.example.vendor1',
abilityName: 'com.example.vendor1.MainAbility', abilityName: 'com.example.vendor1.MainAbility',
}, }, 32, 0).then(dataInfos => {
}
}, 0, 0);
for (let i = 0, len = dataInfos.length; i < len; i++) { for (let i = 0, len = dataInfos.length; i < len; i++) {
dataMap.set(dataInfos[i].name, dataInfos[i].metaData) dataMap.set(dataInfos[i].name, dataInfos[i].metaData)
} }
expect(dataMap.has(abilityName1)).assertTrue(); });
if (dataMap.has(abilityName1)) { if (dataMap.has(abilityName1)) {
let data = dataMap.get(abilityName1); let data = dataMap.get(abilityName1);
var parameters = data.parameters; var parameters = data.parameters;
......
...@@ -75,11 +75,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -75,11 +75,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=======start ability========') console.debug('=======start ability========')
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
console.debug('========install Finish========'); console.debug('========install Finish========');
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
...@@ -100,11 +98,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -100,11 +98,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
if (err.code != 0 && data.name.length == 0) { if (err.code != 0 && data.name.length == 0) {
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
console.debug('========install Finish========' + JSON.stringify(data)); console.debug('========install Finish========' + JSON.stringify(data));
done(); done();
...@@ -183,7 +179,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -183,7 +179,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/ */
it('bms_getModuleUsageRecordTest_0300', 0, async function (done) { it('bms_getModuleUsageRecordTest_0300', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0300=================='); console.debug('=====================bms_getModuleUsageRecordTest_0300==================');
bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN, (err, data) => { bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
checkModuleUsageRecord(data); checkModuleUsageRecord(data);
var result = checkIsExist(data, BUNDLE_NAME); var result = checkIsExist(data, BUNDLE_NAME);
...@@ -208,7 +204,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -208,7 +204,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
*/ */
it('bms_getModuleUsageRecordTest_0400', 0, async function (done) { it('bms_getModuleUsageRecordTest_0400', 0, async function (done) {
console.debug('=====================bms_getModuleUsageRecordTest_0400=================='); console.debug('=====================bms_getModuleUsageRecordTest_0400==================');
var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TEN); bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO).then(records => {
checkModuleUsageRecord(records); checkModuleUsageRecord(records);
var result = checkIsExist(records, BUNDLE_NAME); var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertTrue(); expect(result).assertTrue();
...@@ -222,6 +218,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -222,6 +218,7 @@ describe('ActsBmsModuleUsageRecordTest', function () {
} }
expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT);
} }
});
done(); done();
}) })
...@@ -235,11 +232,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -235,11 +232,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0500=================='); console.debug('=====================bms_getModuleUsageRecordTest_0500==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, onReceiveinstallEvent); }, onReceiveinstallEvent);
async function onReceiveinstallEvent(err, data) { async function onReceiveinstallEvent(err, data) {
...@@ -253,11 +248,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -253,11 +248,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var result = checkIsExist(records, BUNDLE_NAME); var result = checkIsExist(records, BUNDLE_NAME);
expect(result).assertEqual(false); expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -277,11 +270,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -277,11 +270,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_0600=================='); console.debug('=====================bms_getModuleUsageRecordTest_0600==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -291,11 +282,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -291,11 +282,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
var result = checkIsExist(moduleUsageRecord, BUNDLE_NAME); var result = checkIsExist(moduleUsageRecord, BUNDLE_NAME);
expect(result).assertEqual(false); expect(result).assertEqual(false);
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -371,22 +360,18 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -371,22 +360,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_1100=================='); console.debug('=====================bms_getModuleUsageRecordTest_1100==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']; var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'];
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -408,22 +393,18 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -408,22 +393,18 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=====================bms_getModuleUsageRecordTest_1200=================='); console.debug('=====================bms_getModuleUsageRecordTest_1200==================');
var installer = await bundle.getBundleInstaller(); var installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']
installer.install(bundlePath, { installer.install(bundlePath, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -476,21 +457,17 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -476,21 +457,17 @@ describe('ActsBmsModuleUsageRecordTest', function () {
} }
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -545,21 +522,17 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -545,21 +522,17 @@ describe('ActsBmsModuleUsageRecordTest', function () {
} }
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual("SUCCESS"); expect(data.statusMessage).assertEqual("SUCCESS");
installer.install(['/data/test/bmsThirdBundleTest1.hap'], { installer.install(['/data/test/bmsThirdBundleTest1.hap'], {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, async (err, data) => { }, async (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0); expect(data.status).assertEqual(0);
...@@ -700,11 +673,9 @@ describe('ActsBmsModuleUsageRecordTest', function () { ...@@ -700,11 +673,9 @@ describe('ActsBmsModuleUsageRecordTest', function () {
console.debug('=======after all install========'); console.debug('=======after all install========');
let installer = await bundle.getBundleInstaller(); let installer = await bundle.getBundleInstaller();
installer.uninstall(BUNDLE_NAME, { installer.uninstall(BUNDLE_NAME, {
param: {
userId: 0, userId: 0,
installFlag: 1, installFlag: 1,
isKeepData: false isKeepData: false
}
}, (err, data) => { }, (err, data) => {
console.info('uninstall finish'); console.info('uninstall finish');
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册