提交 70d6573e 编写于 作者: C chengxingzhen

xts签名文件整改

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 2571a676
......@@ -29,30 +29,13 @@ group("freeinstalltest") {
"connectabilityfatest/connectfamyapplication7:ConnectFaMyApplication7",
"connectabilityfatest/connectfamyapplication8:ConnectFaMyApplication8",
"connectabilityfatest/connectfamyapplication9:ConnectFaMyApplication9",
"connectabilitystagetest/actsfreeinstallconnectabilitystagetest:ActsFreeInstallConnectAbilityStageTest",
"connectabilitystagetest/connectstagemyapplication0:ConnectStageMyApplication0",
"connectabilitystagetest/connectstagemyapplication1:ConnectStageMyApplication1",
"connectabilitystagetest/connectstagemyapplication2:ConnectStageMyApplication2",
"connectabilitystagetest/connectstagemyapplication3:ConnectStageMyApplication3",
"connectabilitystagetest/connectstagemyapplication4:ConnectStageMyApplication4",
"connectabilitystagetest/connectstagemyapplication5:ConnectStageMyApplication5",
"connectabilitystagetest/connectstagemyapplication6:ConnectStageMyApplication6",
"connectabilitystagetest/connectstagemyapplication7:ConnectStageMyApplication7",
"connectabilitystagetest/connectstagemyapplication8:ConnectStageMyApplication8",
"mockservice:MockService",
"mockservicetimeout:MockServiceTimeout",
"startabilityfatest/actsfreeinstallstartabilityfatest:ActsFreeInstallStartAbilityFaTest",
"startabilityfatest/actsstartabilitynotargetbundlelistfatest:ActsStartAbilityNoTargetBundleListFaTest",
"startabilityfatest/atomizationfaentry:AtomizationFaEntry",
"startabilityfatest/atomizationfahm2:AtomizationFaHm2",
"startabilityfatest/atomizationfahm4:AtomizationFaHm4",
"startabilityfatest/famyapplication1:FaMyApplication1",
"startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest:ActsFreeInstallStartAbilityForResultFaTest",
"startabilityforresultfatest/actsstartabilityforresultnotargetfatest:ActsStartAbilityForResultNoTargetFaTest",
"startabilityforresultfatest/atomizationresulta:AtomizationResultA",
"startabilityforresultfatest/atomizationresultfaentry:AtomizationResultFaEntry",
"startabilityforresultfatest/atomizationresultfahm1:AtomizationResultFaHm1",
"startabilityforresultfatest/atomizationresultfahm2:AtomizationResultFaHm2",
"startabilityforresultfatest/faresultmyapplication1:FaResultMyApplication1",
"startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest:ActsFreeInstallStartAbilityForResultStageTest",
"startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest:ActsStartAbilityForResultNoTargetBundleListStageTest",
......
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility feature onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility feature op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility different onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility different onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility different onConnect');
console.info('stage_connectAbility connect different success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility different onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility different onReconnect');
}
onDestroy() {
console.info('ServiceAbility different onDestroy');
}
};
\ No newline at end of file
......@@ -33,18 +33,6 @@
}
]
}
],
"extensionAbilities": [
{
"name": "com.example.different.ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_FormAbility_label",
"description": "$string:form_FormAbility_desc",
"type": "service",
"visible": true,
"icon": "$media:icon"
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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_js_hap_suite("ActsFreeInstallConnectAbilityStageTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsfreeinstallconnectabilitystagetest_js_assets",
":actsfreeinstallconnectabilitystagetest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsFreeInstallConnectAbilityStageTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsfreeinstallconnectabilitystagetest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsfreeinstallconnectabilitystagetest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsfreeinstallconnectabilitystagetest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsfreeinstallconnectabilitystagetest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for freeinstallconnectabilitystagetest Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.myapplication.hmservice",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsFreeInstallConnectAbilityStageTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test/"
]
},
{
"type": "PushKit",
"push":[
"MockService.hap -> /data/test/MockService.hap",
"ConnectStageMyApplication0.hap -> /data/test/ConnectStageMyApplication0.hap",
"ConnectStageMyApplication1.hap -> /data/test/ConnectStageMyApplication1.hap",
"ConnectStageMyApplication2.hap -> /data/test/ConnectStageMyApplication2.hap",
"ConnectStageMyApplication3.hap -> /data/test/ConnectStageMyApplication3.hap",
"ConnectStageMyApplication4.hap -> /data/test/ConnectStageMyApplication4.hap",
"ConnectStageMyApplication5.hap -> /data/test/ConnectStageMyApplication5.hap",
"ConnectStageMyApplication6.hap -> /data/test/ConnectStageMyApplication6.hap",
"ConnectStageMyApplication7.hap -> /data/test/ConnectStageMyApplication7.hap",
"ConnectStageMyApplication8.hap -> /data/test/ConnectStageMyApplication8.hap",
"ConnectDifferentApplication.hap -> /data/test/ConnectDifferentApplication.hap"
]
}
]
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
import commonEvent from '@ohos.commonEvent';
let publishOptions = {
parameters: {
"assertData": "onconnect"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("Testevent service publish failed " + JSON.stringify(err));
} else {
console.info("Testevent service publish success!!!");
}
}
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, "pages/index", 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")
// commonEvent.publish("test_event",publishOptions,PublishCallBack);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* 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.application.Ability'
export default class MainAbility2 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.ability2 = this.context;
windowStage.setUIContent(this.context, "pages/index2", 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")
setTimeout(function () {
globalThis.ability2.terminateSelf()
.then((data) => {
console.info('[Demo] MainAbility2 terminateself succeeded: ' + data);
}).catch((error) => {
console.error('[Demo] MainAbility2 terminateself failed. Cause: ' + error);
})
}, 3200);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service publish success!!!");
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service onRequest');
let request = {
'deviceId': '',
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility6',
'moduleName': 'myapplication6',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service onConnect success!!!');
commonEvent.publish("service_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service onDisconnect success!!!');
commonEvent.publish("service_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service onFailed!!!');
commonEvent.publish("service_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service2 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service2 publish success!!!");
}
}
export default class ServiceAbility2 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service2 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service2 onRequest');
let request = {
'bundleName': 'com.example.different.hmservice',
'abilityName': 'com.example.different.ServiceAbility',
'moduleName': 'entry',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service2 onConnect success!!!');
commonEvent.publish("service2_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service2 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service2 onDisconnect success!!!');
commonEvent.publish("service2_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service2 onFailed!!!');
commonEvent.publish("service2_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service2 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service2 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service2 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service2 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service3 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service3 publish success!!!");
}
}
export default class ServiceAbility3 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service3 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service3 onRequest');
let request = {
'bundleName': 'com.example.different.hmservice',
'abilityName': 'com.example.different.ServiceAbility',
'moduleName': 'entry',
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service3 onConnect success!!!');
commonEvent.publish("service3_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service3 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service3 onDisconnect success!!!');
commonEvent.publish("service3_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service3 onFailed!!!');
commonEvent.publish("service3_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service3 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service3 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service3 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service3 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service4 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service4 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service4 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service4 onRequest');
let request = {
'deviceId': 'XXXXX',
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service4 onConnect success!!!');
commonEvent.publish("service4_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service4 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service4 onDisconnect success!!!');
commonEvent.publish("service4_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service4 onFailed!!!');
commonEvent.publish("service4_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service4 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service4 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service4 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service4 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service5 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service5 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service5 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service5 onRequest');
let request = {
'bundleName': 'com.example.xxx.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service5 onConnect success!!!');
commonEvent.publish("service5_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service5 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service5 onDisconnect success!!!');
commonEvent.publish("service5_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service5 onFailed!!!');
commonEvent.publish("service5_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service5 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service5 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service5 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service5 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service6 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service6 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service6 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service6 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': '',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service6 onConnect success!!!');
commonEvent.publish("service6_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service6 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service6 onDisconnect success!!!');
commonEvent.publish("service6_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service6 onFailed!!!');
commonEvent.publish("service6_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service6 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service6 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service6 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service6 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service7 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service7 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service7 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service7 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
'parameters': {
"key1": "value1", "key2": "let your heart guide you", "tag": "Every ending is a new beginning!"
}
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service7 onConnect success!!!');
commonEvent.publish("service7_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service7 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service7 onDisconnect success!!!');
commonEvent.publish("service7_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service7 onFailed!!!');
commonEvent.publish("service7_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service7 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service7 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service7 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service7 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service8 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service8 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service8 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service8 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'xxxxx',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service8 onConnect success!!!');
commonEvent.publish("service8_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service8 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service8 onDisconnect success!!!');
commonEvent.publish("service8_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service8 onFailed!!!');
commonEvent.publish("service8_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service8 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service8 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service8 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service8 onDestroy');
}
};
\ No newline at end of file
/**
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service9 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service9 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service9 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service9 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility6',
'moduleName': 'myapplication8',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service9 onConnect success!!!');
commonEvent.publish("service9_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service9 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service9 onDisconnect success!!!');
commonEvent.publish("service9_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service9 onFailed!!!');
commonEvent.publish("service9_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service9 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service9 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service9 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service9 onDestroy');
}
};
\ No newline at end of file
/**
* 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 -a' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
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);
})
globalThis.delegator = abilityDelegator;
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/**
* 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.
*/
// @ts-nocheck
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/ListTest'
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
aboutToAppear() {
console.info("start run testcase!!!!")
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%')
}
}
\ No newline at end of file
/**
* 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 Index2 {
@State message: string = 'Hello MainAbility2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
// @ts-nocheck
/**
* 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 commonEvent from '@ohos.commonEvent';
export default function ConnectAbilityTest_Ext(abilityContext) {
var TAG = "";
var dataAssert = "";
var subscriber;
var subscribeInfo = {
events: ["service_event", "service2_event", "service3_event",
"service4_event", "service5_event", "service6_event",
"service7_event", "service8_event", "service9_event"]
};
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
async function startService(msg, str) {
console.info(msg + ' startService successful. str: ' + JSON.stringify(str));
globalThis.abilityContext.startAbility(str)
.then((data) => {
console.info(msg + ' startService successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error(msg + ' startService failed. Cause: ' + JSON.stringify(error));
})
}
function checkParameters(msg1, data) {
for (var key in data.parameters) {
console.info(msg1 + " data.parameters is : " + data.parameters[key])
if (data.parameters[key] === "onFailed") {
dataAssert = "onFailed";
} else if (data.parameters[key] === "onDisconnect") {
dataAssert = "onDisconnect";
} else if (data.parameters[key] === "onConnect") {
dataAssert = "onConnect";
}
}
}
function SubscribeCallBack(err, data) {
if (err.code) {
console.error("commonEvent subscribe failed " + JSON.stringify(err));
} else {
if (data.event === "service_event") {
console.info("commonEvent subscribe service " + JSON.stringify(data));
checkParameters("commonEvent service", data)
} else if (data.event === "service2_event") {
console.info("commonEvent subscribe service2 " + JSON.stringify(data));
checkParameters("commonEvent service2", data)
} else if (data.event === "service3_event") {
console.info("commonEvent subscribe service3 " + JSON.stringify(data));
checkParameters("commonEvent service3", data)
} else if (data.event === "service4_event") {
console.info("commonEvent subscribe service4 " + JSON.stringify(data));
checkParameters("commonEvent service4", data)
} else if (data.event === "service5_event") {
console.info("commonEvent subscribe service5 " + JSON.stringify(data));
checkParameters("commonEvent service5", data)
} else if (data.event === "service6_event") {
console.info("commonEvent subscribe service6 " + JSON.stringify(data));
checkParameters("commonEvent service6", data)
} else if (data.event === "service7_event") {
console.info("commonEvent subscribe service7 " + JSON.stringify(data));
checkParameters("commonEvent service7", data)
} else if (data.event === "service8_event") {
console.info("commonEvent subscribe service8 " + JSON.stringify(data));
checkParameters("commonEvent service8", data)
} else if (data.event === "service9_event") {
console.info("commonEvent subscribe service9 " + JSON.stringify(data));
checkParameters("commonEvent service9", data)
}
}
}
function CreateSubscriberCallBack(err, commonEventSubscriber) {
if (err.code) {
console.error("commonEvent createSubscriber failed " + JSON.stringify(err));
} else {
console.info("----commonEvent createSubscriber------");
subscriber = commonEventSubscriber;
commonEvent.subscribe(subscriber, SubscribeCallBack);
}
}
describe('FreeInstall_Stage_ConnectAbility_Ext', function () {
beforeAll(async function (done) {
console.info("FreeInstall_Stage_ConnectAbility_Ext before all called");
console.info("FreeInstall_Stage_ConnectAbility_Ext commonEvent.createSubscriber start!!!");
commonEvent.createSubscriber(subscribeInfo, CreateSubscriberCallBack);
await sleep(2000);
var cmd = "bm install -p data/test/Mockservice.hap";
console.info("cmd : " + cmd)
globalThis.delegator.executeShellCommand(cmd, (err: any, d: any) => {
console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
globalThis.delegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
globalThis.delegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
done();
})
});
afterEach(async function (done) {
console.info("FreeInstall_Stage_ConnectAbility_Ext after each called");
dataAssert = ""
await sleep(1000);
if ("FreeInstall_Stage_ConnectAbility_Ext_1200" === TAG) {
var cmdUninstall = "bm uninstall -n com.ohos.hag.famanager";
globalThis.delegator.executeShellCommand(cmdUninstall, (err: any, d: any) => {
console.info("executeShellCommandUninstall : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
}
await sleep(500);
done();
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0100
* @tc.name Deviceid is empty,atomic service does not exist locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0100", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0100-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0100";
var cmdmyapp6 = "cp data/test/ConnectStageMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp6, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str1 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility",
};
startService(TAG, str1);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0100-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0200
* @tc.name Deviceid is empty,atomic service exists locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0200", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0200-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0200";
var str1 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility",
};
startService(TAG, str1);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0200-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0300
* @tc.name The bundleName passed in is different from the local
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0300", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0300-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0300";
var cmdum = "bm uninstall -n com.example.different.hmservice";
globalThis.delegator.executeShellCommand(cmdum, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str2 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility2",
};
startService(TAG, str2);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0300-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0400
* @tc.name Do not pass flags, atomic service does not exist locally
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0400", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0400-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0400";
var str3 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility3",
};
startService(TAG, str3);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0400-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0500
* @tc.name Do not pass flags, atomic service exists locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0500", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0500-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0500";
var cmdin = "bm install -p data/test/ConnectDifferentApplication.hap";
globalThis.delegator.executeShellCommand(cmdin, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str3 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility3",
};
startService(TAG, str3);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0500-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0600
* @tc.name Incorrect deviceid passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0600", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0600-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0600";
var str4 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility4",
};
startService(TAG, str4);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0600-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0700
* @tc.name Incorrect bundleName passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0700", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0700-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0700";
var str5 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility5",
};
startService(TAG, str5);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0700-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0800
* @tc.name Pass in an empty abilityName
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0800", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0800-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0800";
var str6 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility6",
};
startService(TAG, str6);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0800-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0900
* @tc.name No atomic service under path
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0900", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0900-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0900";
var cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*";
globalThis.delegator.executeShellCommand(cmdrm, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str7 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility7",
};
startService(TAG, str7);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0900-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1000
* @tc.name Incorrect moduleName passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1000", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1000-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1000";
var str8 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility8",
};
startService(TAG, str8);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1000-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1100
* @tc.name Pass in parameters
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1100", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1100-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1100";
var cmdmyapp7 = "cp data/test/ConnectStageMyApplication7.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp7, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(1000);
var str7 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility7",
};
startService(TAG, str7);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1100-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1200
* @tc.name The atomic service of the target differs only by moduleName
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1200", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1200-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1200";
var cmdmyapp8 = "cp data/test/ConnectStageMyApplication8.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp8, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(1000);
var str9 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility9",
};
startService(TAG, str9);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1200-------------");
done();
}, 4000);
});
}
)
}
/**
* 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 ConnectAbilityTest from './ConnectAbilityTest'
import ConnectAbilityTest_Ext from './ConnectAbilityTest_Ext'
export default function List(context) {
ConnectAbilityTest(context)
ConnectAbilityTest_Ext(context)
}
{
"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": "com.example.myapplication.hmservice.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "com.example.myapplication.MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:MainAbility2_desc",
"icon": "$media:icon",
"label": "$string:MainAbility2_label"
}
],
"extensionAbilities": [
{
"name": "com.example.myapplication.ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility2",
"srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts",
"label": "$string:form_ServiceAbility2_label",
"description": "$string:form_ServiceAbility2_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility3",
"srcEntrance": "./ets/ServiceAbility3/ServiceAbility3.ts",
"label": "$string:form_ServiceAbility3_label",
"description": "$string:form_ServiceAbility3_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility4",
"srcEntrance": "./ets/ServiceAbility4/ServiceAbility4.ts",
"label": "$string:form_ServiceAbility4_label",
"description": "$string:form_ServiceAbility4_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility5",
"srcEntrance": "./ets/ServiceAbility5/ServiceAbility5.ts",
"label": "$string:form_ServiceAbility5_label",
"description": "$string:form_ServiceAbility5_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility6",
"srcEntrance": "./ets/ServiceAbility6/ServiceAbility6.ts",
"label": "$string:form_ServiceAbility6_label",
"description": "$string:form_ServiceAbility6_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility7",
"srcEntrance": "./ets/ServiceAbility7/ServiceAbility7.ts",
"label": "$string:form_ServiceAbility7_label",
"description": "$string:form_ServiceAbility7_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility8",
"srcEntrance": "./ets/ServiceAbility8/ServiceAbility8.ts",
"label": "$string:form_ServiceAbility8_label",
"description": "$string:form_ServiceAbility8_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility9",
"srcEntrance": "./ets/ServiceAbility9/ServiceAbility9.ts",
"label": "$string:form_ServiceAbility9_label",
"description": "$string:form_ServiceAbility9_desc",
"type": "service"
}
],
"requestPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility2_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility2_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility3_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility3_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility4_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility4_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility5_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility5_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility6_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility6_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility7_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility7_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility8_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility8_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility9_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility9_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication0") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication0_js_assets",
":connectstagemyapplication0_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication0"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication0_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication0_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication0_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication0_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
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")
windowStage.setUIContent(this.context, "pages/index", 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")
}
};
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility myapp0 onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility myapp0 op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility myapp0 onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onConnect');
console.info('ConnectAbilityTest connect myapp0 Servcie success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onReconnect');
}
onDestroy() {
console.info('ServiceAbility myapp0 onDestroy');
}
};
\ No newline at end of file
/**
* 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 myapp0'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"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",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication1") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication1_js_assets",
":connectstagemyapplication1_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication1"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication1_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication1_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication1_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication1_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
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")
windowStage.setUIContent(this.context, "pages/index", 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")
}
};
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility feature onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility feature op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility_feature extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility feature onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility feature onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility feature onConnect');
console.info('ConnectAbilityTest connect myapp1 Servcie_feature success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility feature onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility feature onReconnect');
}
onDestroy() {
console.info('ServiceAbility feature onDestroy');
}
};
\ No newline at end of file
/**
* 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 myapp1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication1",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication1_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility_myapp1",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility_feature",
"srcEntrance": "./ets/ServiceAbility_feature/ServiceAbility_feature.ts",
"label": "$string:form_ServiceAbility_feature_label",
"description": "$string:form_ServiceAbility_feature_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication1_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_feature_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_feature_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication2") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication2_js_assets",
":connectstagemyapplication2_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication2"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication2_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication2_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication2_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication2_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
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.myapp2 = this.context;
windowStage.setUIContent(this.context, "pages/index", 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")
setTimeout(function () {
globalThis.myapp2.terminateSelf()
.then((data) => {
console.info('[Demo] myapp2 terminateself succeeded: ' + data);
}).catch((error) => {
console.error('[Demo] myapp2 terminateself failed. Cause: ' + error);
})
}, 3200);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility myapp2 onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility myapp2 op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility myapp2 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility myapp2 onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility myapp2 onConnect');
console.info('ConnectAbilityTest connect myapp2 Servcie success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp2 onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp2 onReconnect');
}
onDestroy() {
console.info('ServiceAbility myapp2 onDestroy');
}
};
\ No newline at end of file
/**
* 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 myapp2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication2",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication2_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility_myapp2",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility2",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication2_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication3") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication3_js_assets",
":connectstagemyapplication3_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication3"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication3_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication3_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication3_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication3_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
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")
windowStage.setUIContent(this.context, "pages/index", 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")
}
};
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility myapp3 onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility myapp3 op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility_feature extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility myapp3 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility myapp3 onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility myapp3 onConnect');
console.info('ConnectAbilityTest connect myapp3 Servcie_feature success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp3 onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp3 onReconnect');
}
onDestroy() {
console.info('ServiceAbility myapp3 onDestroy');
}
};
\ No newline at end of file
/**
* 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 myapp3'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication3",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication3_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility_myapp3",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility_feature",
"srcEntrance": "./ets/ServiceAbility_feature/ServiceAbility_feature.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication3_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication4") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication4_js_assets",
":connectstagemyapplication4_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication4"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication4_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication4_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication4_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication4_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* 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.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* 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.application.Ability'
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")
windowStage.setUIContent(this.context, "pages/index", 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")
}
};
/**
* 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 ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility myapp4 onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility myapp4 op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility myapp4 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility myapp4 onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility myapp4 onConnect');
console.info('ConnectAbilityTest connect myapp4 Servcie success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp4 onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp4 onReconnect');
}
onDestroy() {
console.info('ServiceAbility myapp4 onDestroy');
}
};
\ No newline at end of file
/**
* 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 myapp4'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication4",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication4_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility_myapp4",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility4",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication4_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# 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("ConnectStageMyApplication5") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication5_js_assets",
":connectstagemyapplication5_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication5"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication5_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication5_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication5_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication5_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册