分布式任务管理补充用例
Signed-off-by: chengxingzhen <chengxingzhen@huawei.com>
@ -18,6 +18,10 @@ group("ability") {
|
||||
deps = [
|
||||
"dmsfwk/dmsfwk:DctsDmsJsTest",
|
||||
"dmsfwk/dmsfwkserver:DctsDmsJsServer",
|
||||
"dmsfwk/dmsfwkstagetest:DctsDmsFwkStageTest",
|
||||
"dmsfwk/dmsfwkstageserver:DctsDmsFwkStageServer",
|
||||
"dmsfwk/dmsfwkstagepermissiontest:DctsDmsFwkStagePermissionTest",
|
||||
"dmsfwk/dmsfwkstagetestserver:DctsDmsFwkStageTestServer",
|
||||
]
|
||||
} else {
|
||||
deps = [ "wifi_standard:ActsWifiJSTest" ]
|
||||
|
21
ability/dmsfwk/dmsfwkstagepermissiontest/AppScope/app.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.acts.example.dmsfwkstagepermissiontest",
|
||||
"vendor": "huawei",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"debug": false,
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"description": "$string:description_application",
|
||||
"distributedNotificationEnabled": true,
|
||||
"keepAlive": true,
|
||||
"singleUser": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9,
|
||||
"car": {
|
||||
"apiCompatibleVersion": 9,
|
||||
"singleUser": false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string":[
|
||||
{
|
||||
"name":"app_name",
|
||||
"value":"LifecycleTest"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
44
ability/dmsfwk/dmsfwkstagepermissiontest/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# 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("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_js_hap_suite("DctsDmsFwkStagePermissionTest") {
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
js_build_mode = "debug"
|
||||
deps = [
|
||||
":dmsfwkstagepermissiontest_js_assets",
|
||||
":dmsfwkstagepermissiontest_resources",
|
||||
]
|
||||
ets2abc = true
|
||||
certificate_profile = "signature/openharmony_sx.p7b"
|
||||
hap_name = "DctsDmsFwkStagePermissionTest"
|
||||
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_app_scope("dmsfwkstagepermissiontest_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_js_assets("dmsfwkstagepermissiontest_js_assets") {
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("dmsfwkstagepermissiontest_resources") {
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":dmsfwkstagepermissiontest_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
20
ability/dmsfwk/dmsfwkstagepermissiontest/Test.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"description": "Configuration for hjunit demo Tests",
|
||||
"driver": {
|
||||
"type": "OHJSUnitTest",
|
||||
"test-timeout": "180000",
|
||||
"bundle-name": "com.acts.example.dmsfwkstagepermissiontest",
|
||||
"module-name": "phone",
|
||||
"shell-timeout": "600000",
|
||||
"testcase-timeout": 70000
|
||||
},
|
||||
"kits": [
|
||||
{
|
||||
"test-file-name": [
|
||||
"DctsDmsFwkStagePermissionTest.hap"
|
||||
],
|
||||
"type": "AppInstallKit",
|
||||
"cleanup-apps": true
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
globalThis.stageOnCreateRun = 1;
|
||||
globalThis.stageContext = this.context;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("[Demo] MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("[Demo] MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("[Demo] MainAbility onWindowStageCreate")
|
||||
globalThis.abilityContext = this.context;
|
||||
windowStage.setUIContent(this.context, "MainAbility/pages/MainAbility_pages", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("[Demo] MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("[Demo] MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("[Demo] MainAbility onBackground")
|
||||
}
|
||||
};
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
|
||||
import { Hypium } from '@ohos/hypium'
|
||||
import testsuite from '../../test/List.test'
|
||||
import AcCtrl from '@ohos.abilityAccessCtrl'
|
||||
let AcManager = AcCtrl.createAtManager()
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'MainAbility'
|
||||
|
||||
aboutToAppear() {
|
||||
console.info("start run testcase!!!!")
|
||||
AcManager.requestPermissionsFromUser(globalThis.abilityContext, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
|
||||
var abilityDelegator: any
|
||||
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
|
||||
var abilityDelegatorArguments: any
|
||||
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
|
||||
console.info('start run testcase!!!')
|
||||
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
|
||||
export default class TestAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log('TestAbility onCreate')
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log('TestAbility onDestroy')
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
console.log('TestAbility onWindowStageCreate')
|
||||
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
|
||||
if (err.code) {
|
||||
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
|
||||
});
|
||||
|
||||
globalThis.abilityContext = this.context;
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
console.log('TestAbility onWindowStageDestroy')
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
console.log('TestAbility onForeground')
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
console.log('TestAbility onBackground')
|
||||
}
|
||||
};
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
aboutToAppear() {
|
||||
console.info('TestAbility index aboutToAppear')
|
||||
}
|
||||
@State message: string = 'Hello World'
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Button() {
|
||||
Text('next page')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}.type(ButtonType.Capsule)
|
||||
.margin({
|
||||
top: 20
|
||||
})
|
||||
.backgroundColor('#0D9FFB')
|
||||
.width('35%')
|
||||
.height('5%')
|
||||
.onClick(()=>{
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import TestRunner from '@ohos.application.testRunner'
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
|
||||
|
||||
var abilityDelegator = undefined
|
||||
var abilityDelegatorArguments = undefined
|
||||
|
||||
function translateParamsToString(parameters) {
|
||||
const keySet = new Set([
|
||||
'-s class', '-s notClass', '-s suite', '-s it',
|
||||
'-s level', '-s testType', '-s size', '-s timeout',
|
||||
'-s dryRun'
|
||||
])
|
||||
let targetParams = '';
|
||||
for (const key in parameters) {
|
||||
if (keySet.has(key)) {
|
||||
targetParams = `${targetParams} ${key} ${parameters[key]}`
|
||||
}
|
||||
}
|
||||
return targetParams.trim()
|
||||
}
|
||||
|
||||
async function onAbilityCreateCallback() {
|
||||
console.log("onAbilityCreateCallback");
|
||||
}
|
||||
|
||||
async function addAbilityMonitorCallback(err: any) {
|
||||
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
|
||||
}
|
||||
|
||||
export default class OpenHarmonyTestRunner implements TestRunner {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
onPrepare() {
|
||||
console.info("OpenHarmonyTestRunner OnPrepare ")
|
||||
}
|
||||
|
||||
async onRun() {
|
||||
console.log('OpenHarmonyTestRunner onRun run')
|
||||
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
|
||||
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
|
||||
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
|
||||
let lMonitor = {
|
||||
abilityName: testAbilityName,
|
||||
onAbilityCreate: onAbilityCreateCallback,
|
||||
};
|
||||
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
|
||||
var cmd = 'aa start -d 0 -a com.example.lifecycletest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
|
||||
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
|
||||
var debug = abilityDelegatorArguments.parameters["-D"]
|
||||
if (debug == 'true')
|
||||
{
|
||||
cmd += ' -D'
|
||||
}
|
||||
console.info('cmd : '+cmd)
|
||||
abilityDelegator.executeShellCommand(cmd,
|
||||
(err: any, d: any) => {
|
||||
console.info('executeShellCommand : err : ' + JSON.stringify(err));
|
||||
console.info('executeShellCommand : data : ' + d.stdResult);
|
||||
console.info('executeShellCommand : data : ' + d.exitCode);
|
||||
})
|
||||
console.info('OpenHarmonyTestRunner onRun end')
|
||||
}
|
||||
};
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
|
||||
import deviceManager from '@ohos.distributedHardware.deviceManager';
|
||||
import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
import rpc from '@ohos.rpc';
|
||||
let abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
|
||||
let dvList;
|
||||
let dvId;
|
||||
let localDeviceId;
|
||||
let connectId;
|
||||
let connectId2;
|
||||
let subscriber
|
||||
let subscribeInfo = {
|
||||
events: ["DmsFwkService_ConnectAbility"]
|
||||
}
|
||||
export default function DmsFwkStageTest() {
|
||||
|
||||
describe('DmsFwkStageTest', function () {
|
||||
|
||||
beforeAll(async function (done) {
|
||||
function deviceManagerCallback(error, deviceManager) {
|
||||
console.info('LifeCycleTest before each called');
|
||||
let deviceList = deviceManager.getTrustedDeviceListSync();
|
||||
let deviceId = deviceList[0].deviceId;
|
||||
dvList = deviceList;
|
||||
dvId = deviceId;
|
||||
localDeviceId = deviceManager.getLocalDeviceInfoSync().deviceId;
|
||||
}
|
||||
deviceManager.createDeviceManager('com.acts.example.dmsfwkstageserver', deviceManagerCallback)
|
||||
await sleep(1000);
|
||||
done()
|
||||
});
|
||||
|
||||
beforeEach(async function (done) {
|
||||
console.info('LifeCycleTest before each called');
|
||||
await sleep(1000);
|
||||
done()
|
||||
});
|
||||
|
||||
afterEach(async function (done) {
|
||||
console.info('LifeCycleTest after each called');
|
||||
await sleep(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
var TAG;
|
||||
var listKeyTemp = [];
|
||||
var listKeyTemp1 = [];
|
||||
|
||||
|
||||
function sleep(time) {
|
||||
return new Promise((resolve) => setTimeout(resolve, time))
|
||||
}
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_StartControl_ConnectAbility_0200
|
||||
* @tc.name Connec the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_StartControl_ConnectAbility_0200", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_StartControl_ConnectAbility_0200 is start---------------")
|
||||
TAG = "SUB_DMS_StartControl_ConnectAbility_0200";
|
||||
try{
|
||||
globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.ohos.dmstest",
|
||||
abilityName: "com.ohos.dmstest.ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0200 onConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0200 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0200 onFailed: ' + code);
|
||||
expect(code).assertEqual(16000050)
|
||||
done();
|
||||
}
|
||||
});
|
||||
}catch(err){
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0200 catch: ' + err.code);
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0200 catch: ' + err.message);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
console.info("---------------SUB_DMS_StartControl_ConnectAbility_0200 is end---------------")
|
||||
});
|
||||
|
||||
})
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DmsFwkStageTest from './DmsFwkStageTest'
|
||||
|
||||
export default function List() {
|
||||
|
||||
DmsFwkStageTest()
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:phone_entry_dsc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"uiSyntax": "ets",
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.example.lifecycletest.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:phone_entry_main",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_label",
|
||||
"visible": true,
|
||||
"orientation": "portrait",
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
],
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.PERMISSION_START_INVISIBLE_ABILITY"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "phone_entry_dsc",
|
||||
"value": "i am an entry for phone"
|
||||
},
|
||||
{
|
||||
"name": "phone_entry_main",
|
||||
"value": "the phone entry ability"
|
||||
},
|
||||
{
|
||||
"name": "entry_label",
|
||||
"value": "ActsLifecycleMultihapTest"
|
||||
},
|
||||
{
|
||||
"name": "form_description",
|
||||
"value": "my form"
|
||||
},
|
||||
{
|
||||
"name": "description_application",
|
||||
"value": "demo for test"
|
||||
},
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"MainAbility/pages/MainAbility_pages"
|
||||
]
|
||||
}
|
20
ability/dmsfwk/dmsfwkstageserver/AppScope/app.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.acts.example.dmsfwkstageserver",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"debug": false,
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true,
|
||||
"keepAlive": true,
|
||||
"singleUser": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9,
|
||||
"car": {
|
||||
"apiCompatibleVersion": 9,
|
||||
"singleUser": false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "StageSupplement"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 6.6 KiB |
44
ability/dmsfwk/dmsfwkstageserver/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_hap_assist_suite("DctsDmsFwkStageServer") {
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
hap_name = "DctsDmsFwkStageServer"
|
||||
|
||||
testonly = true
|
||||
deps = [
|
||||
":dmsfwkstageserver_js_assets",
|
||||
":dmsfwkstageserver_resources",
|
||||
]
|
||||
ets2abc = true
|
||||
certificate_profile = "signature/openharmony_sx.p7b"
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_app_scope("dmsfwkstageserver_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_js_assets("dmsfwkstageserver_js_assets") {
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("dmsfwkstageserver_resources") {
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":dmsfwkstageserver_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.info("[Demo] MyAbilityStage onCreate")
|
||||
let directions = this.context.config.direction
|
||||
var CommonEventPublishData = {
|
||||
parameters: {
|
||||
"config": directions
|
||||
}
|
||||
}
|
||||
commonEvent.publish("AbilityStage_StartAbility", CommonEventPublishData, (err) => {
|
||||
console.info("AbilityStage_StartAbility onCreate");
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
import AcCtrl from '@ohos.abilityAccessCtrl'
|
||||
let AcManager = AcCtrl.createAtManager()
|
||||
var printLog1 = "Stage:MainAbility:";
|
||||
var listPush1 = "Stage_MainAbility_";
|
||||
var launchWant
|
||||
var lastRequestWant
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.info(printLog1 + "onCreate")
|
||||
AcManager.requestPermissionsFromUser(this.context, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
|
||||
})
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.info(printLog1 + "onDestroy")
|
||||
|
||||
commonEvent.publish(listPush1 + "onDestroy", (err) => {
|
||||
console.info(printLog1 + listPush1 + "onDestroy");
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.info(printLog1 + "onWindowStageCreate")
|
||||
|
||||
windowStage.setUIContent(this.context, "pages/index", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.info(printLog1 + "onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.info(printLog1 + "onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.info(printLog1 + "onBackground")
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'Hello World Stage'
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEventManager';
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
commonEvent.publish("DmsFwkService_RemoteObject", {
|
||||
parameters:{
|
||||
"msg":"receiveMessage = " + tmp1
|
||||
}
|
||||
}, (err, data) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends ServiceExtension {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCreate")
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onConnect")
|
||||
let CommonEventPublishData = {
|
||||
parameters: {
|
||||
"life": "onConnect"
|
||||
}
|
||||
}
|
||||
commonEvent.publish("DmsFwkService_ConnectAbility", CommonEventPublishData, (err, data) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("DmsFwkStageServer ServiceAbility onRequest")
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCronDestroyeate")
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends ServiceExtension {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onCreate")
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onConnect")
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onRequest")
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onCronDestroyeate")
|
||||
|
||||
}
|
||||
};
|
69
ability/dmsfwk/dmsfwkstageserver/entry/src/main/module.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:entry_desc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"visible": true,
|
||||
"launchType": "singleton",
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "ServiceAbility",
|
||||
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
|
||||
"label": "$string:MainAbility_label",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"type": "service",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"name": "ServiceAbility2",
|
||||
"srcEntrance": "./ets/serviceability2/ServiceAbility.ts",
|
||||
"label": "$string:MainAbility_label",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"type": "service",
|
||||
"visible": false
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name":"ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "white",
|
||||
"value": "#FFFFFF"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "StageSupplement"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility9_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility9_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 6.6 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/index"
|
||||
]
|
||||
}
|
BIN
ability/dmsfwk/dmsfwkstageserver/signature/openharmony_sx.p7b
Normal file
21
ability/dmsfwk/dmsfwkstagetest/AppScope/app.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.acts.example.dmsfwkstagetest",
|
||||
"vendor": "huawei",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"debug": false,
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"description": "$string:description_application",
|
||||
"distributedNotificationEnabled": true,
|
||||
"keepAlive": true,
|
||||
"singleUser": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9,
|
||||
"car": {
|
||||
"apiCompatibleVersion": 9,
|
||||
"singleUser": false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string":[
|
||||
{
|
||||
"name":"app_name",
|
||||
"value":"LifecycleTest"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
44
ability/dmsfwk/dmsfwkstagetest/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# 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("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_js_hap_suite("DctsDmsFwkStageTest") {
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
js_build_mode = "debug"
|
||||
deps = [
|
||||
":dmsfwkstagetest_js_assets",
|
||||
":dmsfwkstagetest_resources",
|
||||
]
|
||||
ets2abc = true
|
||||
certificate_profile = "signature/openharmony_sx.p7b"
|
||||
hap_name = "DctsDmsFwkStageTest"
|
||||
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_app_scope("dmsfwkstagetest_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_js_assets("dmsfwkstagetest_js_assets") {
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("dmsfwkstagetest_resources") {
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":dmsfwkstagetest_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
20
ability/dmsfwk/dmsfwkstagetest/Test.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"description": "Configuration for hjunit demo Tests",
|
||||
"driver": {
|
||||
"type": "OHJSUnitTest",
|
||||
"test-timeout": "180000",
|
||||
"bundle-name": "com.acts.example.dmsfwkstagetest",
|
||||
"module-name": "phone",
|
||||
"shell-timeout": "600000",
|
||||
"testcase-timeout": 70000
|
||||
},
|
||||
"kits": [
|
||||
{
|
||||
"test-file-name": [
|
||||
"DctsDmsFwkStageTest.hap"
|
||||
],
|
||||
"type": "AppInstallKit",
|
||||
"cleanup-apps": true
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
globalThis.stageOnCreateRun = 1;
|
||||
globalThis.stageContext = this.context;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("[Demo] MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("[Demo] MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("[Demo] MainAbility onWindowStageCreate")
|
||||
globalThis.abilityContext = this.context;
|
||||
windowStage.setUIContent(this.context, "MainAbility/pages/MainAbility_pages", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("[Demo] MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("[Demo] MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("[Demo] MainAbility onBackground")
|
||||
}
|
||||
};
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
|
||||
import { Hypium } from '@ohos/hypium'
|
||||
import testsuite from '../../test/List.test'
|
||||
import AcCtrl from '@ohos.abilityAccessCtrl'
|
||||
let AcManager = AcCtrl.createAtManager()
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'MainAbility'
|
||||
|
||||
aboutToAppear() {
|
||||
console.info("start run testcase!!!!")
|
||||
AcManager.requestPermissionsFromUser(globalThis.abilityContext, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
|
||||
var abilityDelegator: any
|
||||
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
|
||||
var abilityDelegatorArguments: any
|
||||
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
|
||||
console.info('start run testcase!!!')
|
||||
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
|
||||
export default class TestAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log('TestAbility onCreate')
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log('TestAbility onDestroy')
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
console.log('TestAbility onWindowStageCreate')
|
||||
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
|
||||
if (err.code) {
|
||||
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
|
||||
});
|
||||
|
||||
globalThis.abilityContext = this.context;
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
console.log('TestAbility onWindowStageDestroy')
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
console.log('TestAbility onForeground')
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
console.log('TestAbility onBackground')
|
||||
}
|
||||
};
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
aboutToAppear() {
|
||||
console.info('TestAbility index aboutToAppear')
|
||||
}
|
||||
@State message: string = 'Hello World'
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Button() {
|
||||
Text('next page')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}.type(ButtonType.Capsule)
|
||||
.margin({
|
||||
top: 20
|
||||
})
|
||||
.backgroundColor('#0D9FFB')
|
||||
.width('35%')
|
||||
.height('5%')
|
||||
.onClick(()=>{
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import TestRunner from '@ohos.application.testRunner'
|
||||
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
|
||||
|
||||
var abilityDelegator = undefined
|
||||
var abilityDelegatorArguments = undefined
|
||||
|
||||
function translateParamsToString(parameters) {
|
||||
const keySet = new Set([
|
||||
'-s class', '-s notClass', '-s suite', '-s it',
|
||||
'-s level', '-s testType', '-s size', '-s timeout',
|
||||
'-s dryRun'
|
||||
])
|
||||
let targetParams = '';
|
||||
for (const key in parameters) {
|
||||
if (keySet.has(key)) {
|
||||
targetParams = `${targetParams} ${key} ${parameters[key]}`
|
||||
}
|
||||
}
|
||||
return targetParams.trim()
|
||||
}
|
||||
|
||||
async function onAbilityCreateCallback() {
|
||||
console.log("onAbilityCreateCallback");
|
||||
}
|
||||
|
||||
async function addAbilityMonitorCallback(err: any) {
|
||||
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
|
||||
}
|
||||
|
||||
export default class OpenHarmonyTestRunner implements TestRunner {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
onPrepare() {
|
||||
console.info("OpenHarmonyTestRunner OnPrepare ")
|
||||
}
|
||||
|
||||
async onRun() {
|
||||
console.log('OpenHarmonyTestRunner onRun run')
|
||||
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
|
||||
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
|
||||
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
|
||||
let lMonitor = {
|
||||
abilityName: testAbilityName,
|
||||
onAbilityCreate: onAbilityCreateCallback,
|
||||
};
|
||||
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
|
||||
var cmd = 'aa start -d 0 -a com.example.lifecycletest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
|
||||
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
|
||||
var debug = abilityDelegatorArguments.parameters["-D"]
|
||||
if (debug == 'true')
|
||||
{
|
||||
cmd += ' -D'
|
||||
}
|
||||
console.info('cmd : '+cmd)
|
||||
abilityDelegator.executeShellCommand(cmd,
|
||||
(err: any, d: any) => {
|
||||
console.info('executeShellCommand : err : ' + JSON.stringify(err));
|
||||
console.info('executeShellCommand : data : ' + d.stdResult);
|
||||
console.info('executeShellCommand : data : ' + d.exitCode);
|
||||
})
|
||||
console.info('OpenHarmonyTestRunner onRun end')
|
||||
}
|
||||
};
|
@ -0,0 +1,62 @@
|
||||
import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
commonEvent.publish("DmsFwkService_RemoteObject", {
|
||||
parameters:{
|
||||
"msg":"receiveMessage = " + data.readInt()
|
||||
}
|
||||
}, (err, data) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends ServiceExtension {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCreate")
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onConnect")
|
||||
let CommonEventPublishData = {
|
||||
parameters: {
|
||||
"life": "onConnect"
|
||||
}
|
||||
}
|
||||
commonEvent.publish("DmsFwkService_ConnectAbility", CommonEventPublishData, (err) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("DmsFwkStageServer ServiceAbility onRequest")
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCronDestroyeate")
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,834 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
|
||||
import deviceManager from '@ohos.distributedHardware.deviceManager';
|
||||
import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
|
||||
import commonEvent from '@ohos.commonEventManager';
|
||||
import rpc from '@ohos.rpc';
|
||||
let abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
|
||||
let dvList;
|
||||
let dvId;
|
||||
let localDeviceId;
|
||||
let connectId;
|
||||
let connectId2;
|
||||
let subscriber
|
||||
let subscribeInfo = {
|
||||
events: ["DmsFwkService_ConnectAbility"]
|
||||
}
|
||||
export default function DmsFwkStageTest() {
|
||||
|
||||
describe('DmsFwkStageTest', function () {
|
||||
|
||||
beforeAll(async function (done) {
|
||||
function deviceManagerCallback(error, deviceManager) {
|
||||
console.info('LifeCycleTest before each called');
|
||||
let deviceList = deviceManager.getTrustedDeviceListSync();
|
||||
let deviceId = deviceList[0].deviceId;
|
||||
dvList = deviceList;
|
||||
dvId = deviceId;
|
||||
localDeviceId = deviceManager.getLocalDeviceInfoSync().deviceId;
|
||||
}
|
||||
deviceManager.createDeviceManager('com.acts.example.dmsfwkstageserver', deviceManagerCallback)
|
||||
await sleep(1000);
|
||||
done()
|
||||
});
|
||||
|
||||
beforeEach(async function (done) {
|
||||
console.info('LifeCycleTest before each called');
|
||||
await sleep(4000);
|
||||
done()
|
||||
});
|
||||
|
||||
afterEach(async function (done) {
|
||||
console.info('DmsFwkStageTest after each called');
|
||||
await globalThis.abilityContext.disconnectServiceExtensionAbility(connectId).then((data)=>{
|
||||
console.info('DmsFwkStageTest disconnectServiceExtensionAbility called success');
|
||||
}).catch((err)=>{
|
||||
console.info('DmsFwkStageTest disconnectServiceExtensionAbility called error ' + err.message);
|
||||
})
|
||||
await sleep(2000);
|
||||
done();
|
||||
});
|
||||
|
||||
var TAG;
|
||||
function sleep(time) {
|
||||
return new Promise((resolve) => setTimeout(resolve, time))
|
||||
}
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0100
|
||||
* @tc.name Connect the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0100", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0100 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0100";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0100 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0100 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0100 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0100 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0100 is end--------------- " + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0200
|
||||
* @tc.name ConnecAbility failed after connect the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0200", 0, async function (done) {
|
||||
console.log("------------SUB_DMS_ConnectAbility_0200 start-------------");
|
||||
TAG = "SUB_DMS_ConnectAbility_0200";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0200 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(3000);
|
||||
connectId2 = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstagetest",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0200 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg).assertEqual(100)
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0200 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.log("------------SUB_DMS_ConnectAbility_0200 end-------------" + connectId);
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0300
|
||||
* @tc.name Disconnect the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0300", 0, async function (done) {
|
||||
console.log("------------SUB_DMS_ConnectAbility_0300 start-------------");
|
||||
TAG = "SUB_DMS_ConnectAbility_0300";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0300 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0300 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0300 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0300 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(3000);
|
||||
globalThis.abilityContext.disconnectServiceExtensionAbility(connectId, (err, data)=>{
|
||||
expect(undefined).assertEqual(data)
|
||||
})
|
||||
await sleep(1000);
|
||||
console.log("------------SUB_DMS_ConnectAbility_0300 end-------------");
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0400
|
||||
* @tc.name Disconnect the remote Ability failed after connectAbility.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0400", 0, async function (done) {
|
||||
console.log("------------SUB_DMS_ConnectAbility_0400 start-------------");
|
||||
TAG = "SUB_DMS_ConnectAbility_0400";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0400 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(3000);
|
||||
connectId2 = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstagetest",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0400 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg).assertEqual(100)
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0400 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
globalThis.abilityContext.disconnectServiceExtensionAbility(connectId, (err, data)=>{
|
||||
expect(undefined).assertEqual(data)
|
||||
})
|
||||
await sleep(1000);
|
||||
globalThis.abilityContext.disconnectServiceExtensionAbility(connectId2, (err, data)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0400 disconnectServiceExtensionAbility: ' + err.message + " " + err.code);
|
||||
expect(undefined).assertEqual(data);
|
||||
done();
|
||||
})
|
||||
console.log("------------SUB_DMS_ConnectAbility_0400 end-------------");
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0500
|
||||
* @tc.name Connect the remote Ability with error deviceId.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0500", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0500 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0500";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:"1111212151561315616131515643115616",
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0500 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0500 code: ' + code);
|
||||
expect(code).assertEqual(16000050)
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0500 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0600
|
||||
* @tc.name Connect the remote Ability with local deviceId.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0600", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0600 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0600";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:localDeviceId,
|
||||
bundleName: "com.acts.example.dmsfwkstagetest",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0600 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0600 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0600 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0600 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0600 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0700
|
||||
* @tc.name Connect the remote Ability with empty deviceId.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0700", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0700 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0700";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:"",
|
||||
bundleName: "com.acts.example.dmsfwkstagetest",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0700 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0700 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0700 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0700 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0700 is end---------------" + connectId)
|
||||
});
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0800
|
||||
* @tc.name Connect the remote Ability with error bundle.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0800", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0800 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0800";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver.err",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0800 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0800 onFailed: ' + code);
|
||||
expect(code).assertEqual(16000050)
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0600 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0900
|
||||
* @tc.name Connect the remote Ability after kill process of softbus_server.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0900", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0900 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0900";
|
||||
abilityDelegator.executeShellCommand("pidof softbus_server", (err, data)=>{
|
||||
console.info("SUB_DMS_ConnectAbility_0900:" + data.stdResult)
|
||||
abilityDelegator.executeShellCommand("kill -9 " + data.stdResult, (err, data)=>{
|
||||
console.info("SUB_DMS_ConnectAbility_0900:" + data.stdResult)
|
||||
})
|
||||
})
|
||||
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0900 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0900 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0900 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0900 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0900 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0110
|
||||
* @tc.name Connect the remote Ability after kill process of distributedsche.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0110", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0110 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0110";
|
||||
abilityDelegator.executeShellCommand("pidof distributedsche", (err, data)=>{
|
||||
console.info("SUB_DMS_ConnectAbility_0900:" + data.stdResult)
|
||||
abilityDelegator.executeShellCommand("kill -9 " + data.stdResult, (err, data)=>{
|
||||
console.info("SUB_DMS_ConnectAbility_0900:" + data.stdResult)
|
||||
})
|
||||
})
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
if(proxy == null){
|
||||
return;
|
||||
}
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0110 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0110 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0110 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0110 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0110 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0180
|
||||
* @tc.name Connec the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0180", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0180 is start---------------")
|
||||
TAG = "SUB_DMS_ConnectAbility_0180";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect(proxy != null).assertTrue();
|
||||
expect(elementName.bundleName).assertEqual("com.acts.example.dmsfwkstageserver");
|
||||
expect(elementName.abilityName).assertEqual("ServiceAbility");
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0180 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0180 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done()
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0180 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0180 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(1000);
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0180 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_ConnectAbility_0190
|
||||
* @tc.name Connec the remote Ability.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_ConnectAbility_0190", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0190 is start---------------")
|
||||
let RemoteObj;
|
||||
TAG = "SUB_DMS_ConnectAbility_0190";
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect(proxy != null).assertTrue();
|
||||
RemoteObj = proxy;
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0190 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0190 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0190 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_ConnectAbility_0190 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
await sleep(2000);
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(123);
|
||||
RemoteObj.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_ConnectAbility_0190 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_ConnectAbility_0190 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 123).assertTrue();
|
||||
done();
|
||||
})
|
||||
console.info("---------------SUB_DMS_ConnectAbility_0190 is end---------------" + connectId)
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_StartControl_ConnectAbility_0100
|
||||
* @tc.name Filed connect remote invisible service without permission.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_StartControl_ConnectAbility_0100", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_StartControl_ConnectAbility_0100 is start---------------")
|
||||
TAG = "SUB_DMS_StartControl_ConnectAbility_0100";
|
||||
try{
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect(proxy != null).assertTrue();
|
||||
expect(elementName.bundleName).assertEqual("com.acts.example.dmsfwkstageserver");
|
||||
expect(elementName.abilityName).assertEqual("ServiceAbility");
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_StartControl_ConnectAbility_0100 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0100 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0100 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0100 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
}catch(err){
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0100 catch: ' + err.code);
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0100 catch: ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_StartControl_ConnectAbility_0400
|
||||
* @tc.name Filed connect remote invisible service without permission.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_StartControl_ConnectAbility_0400", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_StartControl_ConnectAbility_0400 is start---------------")
|
||||
TAG = "SUB_DMS_StartControl_ConnectAbility_0400";
|
||||
try{
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility2"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0400 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0400 onFailed: ' + code);
|
||||
done();
|
||||
}
|
||||
});
|
||||
}catch(err){
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0400 catch: ' + err.code);
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0400 catch: ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* @tc.number SUB_DMS_StartControl_ConnectAbility_0300
|
||||
* @tc.name Filed connect remote invisible service without permission.
|
||||
* @tc.desc Function test
|
||||
* @tc.level 0
|
||||
*/
|
||||
it("SUB_DMS_StartControl_ConnectAbility_0300", 0, async function (done) {
|
||||
console.info("---------------SUB_DMS_StartControl_ConnectAbility_0300 is start---------------")
|
||||
TAG = "SUB_DMS_StartControl_ConnectAbility_0300";
|
||||
try{
|
||||
connectId = globalThis.abilityContext.connectServiceExtensionAbility({
|
||||
deviceId:dvId,
|
||||
bundleName: "com.acts.example.dmsfwkstageserver",
|
||||
abilityName: "ServiceAbility"
|
||||
}, {
|
||||
onConnect: (elementName, proxy)=>{
|
||||
expect(proxy != null).assertTrue();
|
||||
expect(elementName.bundleName).assertEqual("com.acts.example.dmsfwkstageserver");
|
||||
expect(elementName.abilityName).assertEqual("ServiceAbility");
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageParcel();
|
||||
let reply = new rpc.MessageParcel();
|
||||
data.writeInt(1);
|
||||
data.writeInt(99);
|
||||
proxy.sendRequest(1, data, reply, option).then((result) => {
|
||||
console.log('SUB_DMS_StartControl_ConnectAbility_0300 sendRequest success');
|
||||
let msg = result.reply.readInt();
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0300 onConnectRemoteService001 msg: ' + msg);
|
||||
expect(msg == 100).assertTrue();
|
||||
done();
|
||||
})
|
||||
},
|
||||
onDisConnect: (elementName)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0300 onDisConnect: ' + JSON.stringify(elementName));
|
||||
expect().assertFail();
|
||||
done();
|
||||
},
|
||||
onFailed: (code)=>{
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0300 onFailed: ' + code);
|
||||
expect().assertFail();
|
||||
done();
|
||||
}
|
||||
});
|
||||
}catch(err){
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0300 catch: ' + err.code);
|
||||
console.info('SUB_DMS_StartControl_ConnectAbility_0300 catch: ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DmsFwkStageTest from './DmsFwkStageTest'
|
||||
|
||||
export default function List() {
|
||||
|
||||
DmsFwkStageTest()
|
||||
|
||||
}
|
59
ability/dmsfwk/dmsfwkstagetest/entry/src/main/module.json
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:phone_entry_dsc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"uiSyntax": "ets",
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.example.lifecycletest.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:phone_entry_main",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_label",
|
||||
"visible": true,
|
||||
"orientation": "portrait",
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
],
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "ServiceAbility",
|
||||
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
|
||||
"label": "$string:entry_label",
|
||||
"description": "$string:phone_entry_main",
|
||||
"type": "service",
|
||||
"visible": true
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "phone_entry_dsc",
|
||||
"value": "i am an entry for phone"
|
||||
},
|
||||
{
|
||||
"name": "phone_entry_main",
|
||||
"value": "the phone entry ability"
|
||||
},
|
||||
{
|
||||
"name": "entry_label",
|
||||
"value": "ActsLifecycleMultihapTest"
|
||||
},
|
||||
{
|
||||
"name": "form_description",
|
||||
"value": "my form"
|
||||
},
|
||||
{
|
||||
"name": "description_application",
|
||||
"value": "demo for test"
|
||||
},
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"MainAbility/pages/MainAbility_pages"
|
||||
]
|
||||
}
|
BIN
ability/dmsfwk/dmsfwkstagetest/signature/openharmony_sx.p7b
Normal file
21
ability/dmsfwk/dmsfwkstagetestserver/AppScope/app.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.acts.example.dmsfwkstagetest",
|
||||
"vendor": "huawei",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"debug": false,
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"description": "$string:description_application",
|
||||
"distributedNotificationEnabled": true,
|
||||
"keepAlive": true,
|
||||
"singleUser": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9,
|
||||
"car": {
|
||||
"apiCompatibleVersion": 9,
|
||||
"singleUser": false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string":[
|
||||
{
|
||||
"name":"app_name",
|
||||
"value":"LifecycleTest"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
44
ability/dmsfwk/dmsfwkstagetestserver/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# 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("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_hap_assist_suite("DctsDmsFwkStageTestServer") {
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
hap_name = "DctsDmsFwkStageTestServer"
|
||||
|
||||
testonly = true
|
||||
deps = [
|
||||
":dmsfwkstagetestserver_js_assets",
|
||||
":dmsfwkstagetestserver_resources",
|
||||
]
|
||||
ets2abc = true
|
||||
certificate_profile = "signature/openharmony_sx.p7b"
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_app_scope("dmsfwkstagetestserver_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_js_assets("dmsfwkstagetestserver_js_assets") {
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("dmsfwkstagetestserver_resources") {
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":dmsfwkstagetestserver_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
globalThis.stageOnCreateRun = 1;
|
||||
globalThis.stageContext = this.context;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import AcCtrl from '@ohos.abilityAccessCtrl'
|
||||
let AcManager = AcCtrl.createAtManager()
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("[Demo] MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
AcManager.requestPermissionsFromUser(this.context, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
|
||||
})
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("[Demo] MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("[Demo] MainAbility onWindowStageCreate")
|
||||
globalThis.abilityContext = this.context;
|
||||
windowStage.setUIContent(this.context, "MainAbility/pages/MainAbility_pages", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("[Demo] MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("[Demo] MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("[Demo] MainAbility onBackground")
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'MainAbility'
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
commonEvent.publish("DmsFwkService_RemoteObject", {
|
||||
parameters:{
|
||||
"msg":"receiveMessage = " + data.readInt()
|
||||
}
|
||||
}, (err, data) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends ServiceExtension {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCreate")
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onConnect")
|
||||
let CommonEventPublishData = {
|
||||
parameters: {
|
||||
"life": "onConnect"
|
||||
}
|
||||
}
|
||||
commonEvent.publish("DmsFwkService_ConnectAbility", CommonEventPublishData, (err) => {
|
||||
console.info("DmsFwkService_ConnectAbility onCreate");
|
||||
});
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("DmsFwkStageServer ServiceAbility onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("DmsFwkStageServer ServiceAbility onRequest")
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("DmsFwkStageServer ServiceAbility onCronDestroyeate")
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends ServiceExtension {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onCreate")
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onConnect")
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onRequest")
|
||||
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("DmsFwkStageServer ServiceAbility2 onCronDestroyeate")
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,67 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:phone_entry_dsc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"uiSyntax": "ets",
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.example.lifecycletest.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:phone_entry_main",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_label",
|
||||
"visible": true,
|
||||
"orientation": "portrait",
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
],
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "ServiceAbility",
|
||||
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
|
||||
"label": "$string:MainAbility_label",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"type": "service",
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"name": "ServiceAbility2",
|
||||
"srcEntrance": "./ets/serviceability2/ServiceAbility.ts",
|
||||
"label": "$string:MainAbility_label",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"type": "service",
|
||||
"visible": false
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name":"ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "phone_entry_dsc",
|
||||
"value": "i am an entry for phone"
|
||||
},
|
||||
{
|
||||
"name": "phone_entry_main",
|
||||
"value": "the phone entry ability"
|
||||
},
|
||||
{
|
||||
"name": "entry_label",
|
||||
"value": "ActsLifecycleMultihapTest"
|
||||
},
|
||||
{
|
||||
"name": "form_description",
|
||||
"value": "my form"
|
||||
},
|
||||
{
|
||||
"name": "description_application",
|
||||
"value": "demo for test"
|
||||
},
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"MainAbility/pages/MainAbility_pages"
|
||||
]
|
||||
}
|