diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn index 7c331f8936cb103262fa0e0e88c5eb04455d365c..155ab947049e0159917910070adaf1b2b9c8ec71 100644 --- a/aafwk/aafwk_standard/BUILD.gn +++ b/aafwk/aafwk_standard/BUILD.gn @@ -22,6 +22,24 @@ group("aafwk_standard") { "amsabilitymanager/amsMissionSnapshotTestSingleton:amsMissionSnapshotTestSingleton", "amsabilitymanager/amsMissionSnapshotTestSingletonS:amsMissionSnapshotTestSingletonS", "amsdatauriutils:ActsAmsDataUriUtilsTest", + "amsmultiapp/MultiAppPage:ActsAmsMultiPageApp", + "amsmultiapp/MultiAppPageConnectService:ActsAmsMultiPageAppConnectService", + "amsmultiapp/MultiAppPageConnect_Service:ActsAmsMultiAppPageConnectService", + "amsmultiapp/MultiAppPagePermission:ActsAmsMultiPageAppPermission", + "amsmultiapp/MultiAppPagePermission_Page:ActsAmsMultiAppPagePermission", + "amsmultiapp/MultiAppPage_PSS:ActsAmsMultiPageAppS", + "amsmultiapp/MultiAppPage_Page:ActsAmsMultiAppPage", + "amsmultiapp/MultiAppPage_Service:ActsAmsMultiAppPageService", + "amsmultiapp/MultiAppSimultaneousOnline:ActsAmsMultiAppSimultaneousOnline", + "amsmultiapp/MultiAppSimultaneousOnline_test:ActsAmsMultiAppPageClone", + "amsmultiapp/MultiAppTermination:ActsAmsMultiAppTermination", + "amsmultiapp/MultiAppTermination_test:ActsAmsMultiAppPageCloneTermination", + "amsmultiapp/amsmultiapppageexecutor:MultiAppPageExecutor", + "amsmultiapp/amsmultiappserviceexecutor:MultiAppServiceExecutor", + "amsmultiapp/amsmultiappservicestarter:MultiAppServiceStarter", + "amsmultiapp/amsmultiapptester:MultiAppTester", + "amsmultiapp/amsmultidataabilityclone:amsMultiDataAbilityClone", + "amsmultiapp/amsmultidataabilityself:amsMultiDataAbilitySelf", "amszipfileunzipfilest:ActsAmsZipfileUnzipfileSTest", "context:context", "featureability:featureability", diff --git a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json index 4300a64be9af93e37a31f6b5c6fc734e8f1b4563..20ee72c3cb5ba0a7b8940db3973b03625d76dab1 100644 --- a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json +++ b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json @@ -1,3 +1,20 @@ { - "description": "Configuration for hjunit demo Tests" + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "18000", + "package": "com.amsst.amsMissionSnapshotTest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "amsMissionSnapshotTest.hap", + "amsMissionSnapshotTestSingleton.hap", + "amsMissionSnapshotTestSingletonS.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] } diff --git a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js index 02bb00896bb750e6be2fc88cb6826f580f1f5a81..bb2b80b9f7548a5f45c22bb0a769782c778e964d 100644 --- a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js +++ b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js @@ -31,11 +31,13 @@ export default { }, onShow() { console.debug('ACTS_MissionSnapshot_onShow'); - commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{ - console.debug("=ACTS_MissionSnapshot_onShow err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】") - + ("json data【") + JSON.stringify(data) + (" 】") - + " ,err=" + err + " ,data=" + data); - }); + setTimeout(()=>{ + commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{ + console.debug("=ACTS_MissionSnapshot_onShow err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, 3000); }, } \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js index 02bb00896bb750e6be2fc88cb6826f580f1f5a81..336d0e28dab4ddbeb10f46fa1c745e75456e9f6c 100644 --- a/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js +++ b/aafwk/aafwk_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js @@ -31,11 +31,13 @@ export default { }, onShow() { console.debug('ACTS_MissionSnapshot_onShow'); + setTimeout(()=>{ commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{ console.debug("=ACTS_MissionSnapshot_onShow err,data=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); }); + }, 3000); }, } \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5634310ddf27e970a8c49d30dbce004412d05acc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiPageApp") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiPageApp" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..59a95e60d58f689b16c10a96dc95bbd6e411c233 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultipageapp", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiPageApp.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..af8609290b655e1bd3f28e867af4e0f7fd98bc1a --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultipageapp", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultipageapp", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultipageapp.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bef9e1611a20a0ca4298e94c75102f5dc24c3462 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonevent' + +describe('ActsAmsMultiPageApp', function () { + console.info('----ActsAmsMultiPageApp----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppage", + abilityName: "com.example.actsamsmultiapppage.MainAbility", + }, + }, + ); + }); +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..feb66fcc16112403bac2e225ff4a6a95e375a463 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiPageAppConnectService") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiPageAppConnectService" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..bb845c3924246605a1b8832b68df1252efb9579d --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultipageappconnectservice", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiPageAppConnectService.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..36fcb5995c4d4a0d97ebfd2c073b45c09851ba0e --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultipageappconnectservice", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultipageappconnectservice", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultipageappconnectservice.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..234e04c1cbe7361b39af02578a34786ffb2cf3a3 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppPageConnectServiceA + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..013956da296e94bab7f28690f0ceed903d69f1b6 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import bundle from "@ohos.bundle" +import featureAbility from '@ohos.ability.featureability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonevent' + + +describe('ActsAmsMultiPageAppConnectService', function () { + console.info('----ActsAmsMultiPageAppConnectService----'); + beforeAll(async function (done) { + console.info('----ActsAmsMultiPageAppConnectService----'); + var connId = await featureAbility.connectAbility( + { + bundleName: "com.example.actsamsmultiapppageconnectservice", + abilityName: "com.example.actsamsmultiapppageconnectservice.MainAbility", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, + ); + console.log('ActsAmsMultiPageAppConnectService ConnectAbility connId : ' + connId); + done(); + function onConnectCallback(element, remote) { + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.deviceId : ' + + element.deviceId) + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.bundleName : ' + + element.bundleName) + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect element.abilityName : ' + + element.abilityName) + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect remote : ' + remote); + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onConnect remote 是否为proxy:' + + (remote instanceof rpc.RemoteProxy)); + } + + function onDisconnectCallback(element) { + commonEvent.publish("DISCONNECT", ()=>{console.log('disconnect finish')}); + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.deviceId : ' + + element.deviceId) + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.bundleName : ' + + element.bundleName) + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onDisconnect element.abilityName : ' + + element.abilityName) + } + + function onFailedCallback(code) { + console.log('ActsAmsMultiPageAppConnectService ConnectAbility onFailed errCode : ' + code) + } + }); + + + /* + * @tc.number : AMS_MultiApp_0300 + * @tc.name : connectAbility : connect pageAbility + * @tc.desc : pageAbility->serviceAbility + */ + it('AMS_MultiApp_0300', 0, async function (done) { + var subscriber; + var CommonEventSubscribeInfo = { + events: ["ACTS_MultiAppPageConnectService_onConnect1", + "ACTS_MultiAppPageConnectService_onConnect2"], + }; + function unsubscribe(caller, subscriber) { + commonEvent.unsubscribe(subscriber, (err, data) => { + console.debug("=ACTS_MissionSnapshot_unsubscribe (err,data)=======>" + + (caller) + + (" , json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + done(); + }); + } + commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => { + console.debug("=AMS_MultiApp_0300 createSubscriber .then(data)=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,data=" + data); + subscriber = data; + await commonEvent.subscribe(subscriber, async (err, data) => { + console.debug("=AMS_MultiApp_0300 subscribe (err,data)=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + if (data.event == "ACTS_MultiAppPageConnectService_onConnect2") + { + console.debug("=======AMS_MultiApp_0300 Ontology======="); + expect(data.event).assertEqual("ACTS_MultiAppPageConnectService_onConnect2"); + } + else if (data.event == "ACTS_MultiAppPageConnectService_onConnect1") + { + console.debug("=======AMS_MultiApp_0300 Clone======="); + expect(data.event).assertEqual("ACTS_MultiAppPageConnectService_onConnect1"); + } + unsubscribe("subscribe", subscriber); + }); + }); + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnectService/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6aa4773aaabbc7cc8b03e33546eb82ea12566f05 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPageConnectService") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPageConnectService" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..715ac0d28d9dd6a58f2bffa17d0b11a127630509 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppageconnectservice", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPageConnectService.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a210792ef0978b1b1a9a31a13cdf670ee69fe50b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppageconnectservice", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppageconnectservice", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppageconnectservice.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "service", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..3126a2aea15a57a5a69e4ac2bc77177196595663 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppPageConnectServiceB + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3a7359c993fb9784a0ff1e40d534577d81f010e7 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' +import rpc from "@ohos.rpc" +import commonEvent from '@ohos.commonevent' +import particleAbility from '@ohos.ability.particleability' +import bundle from "@ohos.bundle" + + +let mMyStub; +const MIN_CLONEUID = 20000000; + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish ') + + }, + onStart(want) { + console.debug('AMS_MultiApp ====>onStart' + + want + " , JSON." + JSON.stringify(want)); + class MyStub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, message, reply, option) { + console.log("AMS_MultiApp code:" + code); + if (code === 1) { + let getContextObject = rpc.IPCSkeleton.getContextObject(); + let getCallingPid = rpc.IPCSkeleton.getCallingPid(); + let getCallingUid = rpc.IPCSkeleton.getCallingUid(); + let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); + let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); + let isLocalCalling = rpc.IPCSkeleton.isLocalCalling(); + let remoteObject = new rpc.RemoteObject("aaa", 3); + let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject); + let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity(); + let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3); + let num = message.readInt(); + let msg = message.readString(); + console.log("num is " + num + "msg is " + msg); + reply.writeString("Success"); + return true; + } + } + } + mMyStub = new MyStub("ServiceAbility-test"); + }, + async onConnect(want) { + console.info('onConnect finish') + console.info('AMS_MultiApp_0800 want' + + JSON.stringify(want)); + + console.info('particleAbility--------------------------1'); + var featureData = await particleAbility.getWant(); + console.info('particleAbility--------------------------2'); + console.info('AMS_MultiApp_0800 featureData' + featureData); + console.info('AMS_MultiApp_0800 featureData' + JSON.stringify(featureData)); + console.info('AMS_MultiApp_0800 featureData-->bundleName' + featureData.bundleName); + + var flag=0; + if((featureData.bundleName) == ("com.example.actsamsmultiapppageconnectservice")) + { + if ((featureData.abilityName) == ("com.example.actsamsmultiapppageconnectservice.MainAbility")) + { + flag = 1; + } + } + console.info('AMS_MultiApp_0800 flag' + JSON.stringify(flag)); + var info = await particleAbility.getAbilityInfo(); + console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() ' + + JSON.stringify(info)); + console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() ' + + info); + console.info('AMS_MultiApp_0800 particleAbility.getAbilityInfo() ' + + JSON.stringify(info.applicationInfo)); + bundle.getBundleInfo("com.example.actsamsmultiapppageconnectservice", 1, async(err, data) => { + console.info('AMS_MultiApp_0800 bundle.getBundleInfo ' + + JSON.stringify(data)); + if (data.uid >= MIN_CLONEUID) { + console.info('AMS_MultiApp_0800 Clone info ' + JSON.stringify(info.applicationInfo)); + if (info.applicationInfo.isCloned == true) + { + flag = 1; + + } + } else { + console.info('AMS_MultiApp_0800 Ontology info ' + JSON.stringify(info.applicationInfo)); + if (info.applicationInfo.isCloned == false) + { + flag = 2; + } + } + commonEvent.publish("ACTS_MultiAppPageConnectService_onConnect" + flag, err =>{ + console.info('AMS_MultiApp resultflag' + JSON.stringify(flag)); + console.debug("=ACTS_MultiAppPageConnectService_onConnect err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json flag【") + JSON.stringify(flag) + (" 】") + + " ,err=" + err + " ,flag=" + flag); + }); + return mMyStub; + }) + }, + onCommand(want,restart,startId) { + console.info('onCommand finish') + commonEvent.publish("ACTS_MultiAppPageConnectService_onCommand", (err,data) =>{ + console.debug("=ACTS_MultiAppPageConnectService_onCommand err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPageConnect_Service/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3dd2d8d118d012dbf3158ec7f6a2a8c201ef1dad --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiPageAppPermission") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiPageAppPermission" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fa8d2c9fff99d964063544e8803f5153b635bdbb --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultipageapppermission", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiPageAppPermission.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3e4ee8a4a7f0f50fdb446ed671ba7e6eefdae677 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultipageapppermission", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultipageapppermission", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultipageapppermission.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..8b91515e491bf43bc427a3f35d474c5ead942df0 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppPagePermissionA + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..08ee9e4a2513298def047824fd0e906dd77576e9 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonevent' + +var subscriberInfoStartAbility = { + events: ["ACTS_StartAbility_CommonEvent"], +}; + +describe('ActsAmsMultiAppPermission', function () { + console.info('----ActsAmsMultiAppPermission----'); + + /* + * @tc.number : AMS_MultiApp_Permission_Verification_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : pageAbility start pageAbility without permission + */ + it('AMS_MultiApp_Permission_Verification_0100', 0, async function (done) { + var subscriber; + commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + console.debug("====>Create Subscriber====> subscriber" + subscriber); + await commonEvent.subscribe(subscriber, subscribeCallBack); + + }) + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppagepermission", + abilityName: "com.example.actsamsmultiapppagepermission.MainAbility", + }, + }, + ); + function subscribeCallBack(err, data) { + console.debug("====>subscribeCallBack====> data.event " + data.event); + expect(data.event).assertEqual("ACTS_StartAbility_CommonEvent error"); + done(); + } + setTimeout(()=>{ + unsubscribe("subscribe", subscriber); + expect("true").assertEqual("true"); + }, 5000); + function unsubscribe(caller, subscriber) { + commonEvent.unsubscribe(subscriber, (err, data) => { + console.debug("=ACTS_AmsMultiAppPermission_unsubscribe (err,data)=======>" + + (caller) + + (" , json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + done(); + }); + } + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bc6af8bac6c74084bdeab9f786c6d74803e9000b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPagePermission") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPagePermission" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..8db0f524fc5c7204b3bdeda98ba760c80b45993c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppagepermission", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPagePermission.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..dfc60520c9db12a858d6a102440385150654ee0e --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppagepermission", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppagepermission", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppagepermission.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ea89742ed4a4a54e043d870d5d68856d933738a3 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +import commonEvent from '@ohos.commonevent' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish LJ') + commonEvent.publish("ACTS_StartAbility_CommonEvent", (err,data) =>{ + console.debug("=ACTS_StartAbility_CommonEvent err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPagePermission_Page/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7585b59e19a317688fdbad854fd86868dc3a8394 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiPageAppS") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiPageAppS" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0add4e295b9278d9b8a92b229f5608a029517a3e --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultipageapps", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiPageAppS.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8a5af3fe5be3dca02ddca229af9a32b7474a2f99 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultipageapps", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultipageapps", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultipageapps.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..675493838c9ce6ac1d4644b1639ec739cd26dd6c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppPageStartServiceA + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..959558bca1d3efa9d5a8d04f96d44c346ba47406 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonevent' + +describe('ActsAmsMultiPageAppS', function () { + console.info('----ActsAmsMultiPageAppS----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultipageappservice", + abilityName: "com.example.actsamsmultipageappservice.MainAbility", + }, + }, + ); + done(); + + }); + + /* + * @tc.number : AMS_MultiApp_0200 + * @tc.name : startAbility : start serviceAbility + * @tc.desc : pageAbility->ServiceAbility + */ + it('AMS_MultiApp_0200', 0, async function (done) { + var subscriber; + var CommonEventSubscribeInfo = { + events: ["ACTS_MultiAppPageService_onConnect1","ACTS_MultiAppPageService_onConnect2"], + + }; + + commonEvent.createSubscriber(CommonEventSubscribeInfo).then(async (data) => { + console.debug("=AMS_MultiApp_0200 createSubscriber .then(data)=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,data=" + data); + subscriber = data; + commonEvent.subscribe(subscriber, async (err, data) => { + console.debug("=AMS_MultiApp_0200 subscribe (err,data)=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + if (data.event == "ACTS_MultiAppPageService_onConnect2") + { + console.debug("=======AMS_MultiApp_0200 Ontology======="); + expect(data.event).assertEqual("ACTS_MultiAppPageService_onConnect2"); + } + else if (data.event == "ACTS_MultiAppPageService_onConnect1") + { + console.debug("=======AMS_MultiApp_0200 Clone======="); + expect(data.event).assertEqual("ACTS_MultiAppPageService_onConnect1"); + } + unsubscribe("subscribe", subscriber); + }); + }) + function unsubscribe(caller, subscriber) { + commonEvent.unsubscribe(subscriber, (err, data) => { + console.debug("=ACTS_MultiAppPageService_unsubscribe (err,data)=======>" + + (caller) + + (" , json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + done(); + }); + } + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_PSS/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..de7f57f288c3c8494a0f776bddf8eb1b1a1c0403 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPage") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPage" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..62b9ad531b7e76fbb35f6ed6a12f0da2368dbffd --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppage", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPage.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2b6dd0237bedae21851df0654c50d0eb11741f9e --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppage", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppage", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppage.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d933cc3e5fd098b117c83f069ff7c9d00e9cf4ff --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import bundle from "@ohos.bundle" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const MIN_CLONEUID = 20000000; + +describe('ActsAmsMultiAppPage', function () { + console.info('----ActsAmsMultiAppPage----'); + + /* + * @tc.number : AMS_MultiApp_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : pageAbility->pageAbility + */ + it('AMS_MultiApp_0100', 0, async function (done) { + var data = await featureAbility.getWant(); + expect(data.bundleName).assertEqual("com.example.actsamsmultiapppage"); + expect(data.abilityName).assertEqual("com.example.actsamsmultiapppage.MainAbility"); + console.info('AMS_MultiApp_0100 data.bundleName ' + + JSON.stringify(data.bundleName)); + console.info('AMS_MultiApp_0100 data.abilityName ' + + JSON.stringify(data.abilityName)); + + var info = await featureAbility.getAbilityInfo(); + bundle.getBundleInfo("com.example.actsamsmultiapppage", 1, (err, data) => { + console.debug("=AMS_MultiApp_0100 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + console.info('AMS_MultiApp Clone info.applicationInfo ' + + JSON.stringify(info.applicationInfo)); + if (data.uid >= MIN_CLONEUID) { + console.info('AMS_MultiApp_0100 Clone info.applicationInfo.isCloned ' + + JSON.stringify(info.applicationInfo.isCloned)); + console.debug("=======AMS_MultiApp_0100 Clone======="); + expect(info.applicationInfo.isCloned).assertEqual(true); + done(); + } else { + console.info('AMS_MultiApp_0100 Clone info.applicationInfo.isCloned ' + + JSON.stringify(info.applicationInfo.isCloned)); + console.debug("=======AMS_MultiApp_0100 Ontology======="); + expect(info.applicationInfo.isCloned).assertEqual(false); + done(); + } + }) + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Page/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c0654ef06c3c85d0d27b6db10e9465c2d59adf16 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPageService") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPageService" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..369d9556ae0071fee2875959ce47b6de4a5720c7 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultipageappservice", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPageService.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a60da49a99893dbc37eed81d704b994d1924f52f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultipageappservice", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultipageappservice", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultipageappservice.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "service", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..63cfd9ee3860328a201c44a37f613b801e2b6ba3 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + MultiAppPageStartServiceB + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..02972edf482a5f217d67d58e7d4fa2a8ada19cd1 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' +import rpc from "@ohos.rpc" +import commonEvent from '@ohos.commonevent' +import particleAbility from '@ohos.ability.particleability' +import bundle from "@ohos.bundle" + +let mMyStub; +const MIN_CLONEUID = 20000000; + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onReady() { + console.debug('ACTS_SerivceAbilityServer ====onReconnect=' + + want + " , JSON." + JSON.stringify(want)); + }, + onActive() { + console.debug('ACTS_SerivceAbilityServer ====onConnect=') + }, + onStart(want) { + console.debug('AMS_MultiApp ====>onStart=' + + want + " , JSON." + JSON.stringify(want)); + class MyStub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, message, reply, option) { + console.log("AMS_MultiApp called "); + console.log("AMS_MultiApp code:" + code); + if (code === 1) { + let getContextObject = rpc.IPCSkeleton.getContextObject(); + let getCallingPid = rpc.IPCSkeleton.getCallingPid(); + let getCallingUid = rpc.IPCSkeleton.getCallingUid(); + let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); + let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); + let isLocalCalling = rpc.IPCSkeleton.isLocalCalling(); + let remoteObject = new rpc.RemoteObject("aaa", 3); + let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject); + let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity(); + let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3); + let num = message.readInt(); + let msg = message.readString(); + console.log("num is " + num + "msg is " + msg); + reply.writeString("Success"); + return true; + } + } + } + mMyStub = new MyStub("ServiceAbility-test"); + }, + async onCommand(want, restart, startId) { + console.info('onCommand finish') + console.info('AMS_MultiApp want' + + JSON.stringify(want)); + + console.info('particleAbility--------------------------1'); + var featureData = await particleAbility.getWant(); + console.info('particleAbility--------------------------2'); + console.info('AMS_MultiApp featureData' + featureData); + console.info('AMS_MultiApp featureData' + JSON.stringify(featureData)); + console.info('AMS_MultiApp featureData-->bundleName' + featureData.bundleName); + + var flag = 0; + if((featureData.bundleName) == ("com.example.actsamsmultipageappservice")) + { + if ((featureData.abilityName) == ("com.example.actsamsmultipageappservice.MainAbility")) + { + flag = 1; + } + } + console.info('AMS_MultiApp flag' + JSON.stringify(flag)); + var info = await particleAbility.getAbilityInfo(); + console.info('AMS_MultiApp particleAbility.getAbilityInfo() ' + + JSON.stringify(info)); + console.info('AMS_MultiApp particleAbility.getAbilityInfo() ' + + info); + console.info('AMS_MultiApp particleAbility.getAbilityInfo() ' + + JSON.stringify(info.applicationInfo)); + bundle.getBundleInfo("com.example.actsamsmultipageappservice", 1, async(err, data) => { + console.info('AMS_MultiApp bundle.getBundleInfo ' + + JSON.stringify(data)); + if (data.uid >= MIN_CLONEUID) { + console.info('AMS_MultiApp Clone info ' + JSON.stringify(info.applicationInfo)); + if (info.applicationInfo.isCloned == true) + { + flag = 1; + + } + } else { + console.info('AMS_MultiApp Ontology info ' + JSON.stringify(info.applicationInfo)); + if (info.applicationInfo.isCloned == false) + { + flag = 2; + } + } + commonEvent.publish("ACTS_MultiAppPageService_onConnect" + flag, err =>{ + console.info('AMS_MultiApp resultflag' + JSON.stringify(flag)); + console.debug("=ACTS_MultiAppPageService_onConnect err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json flag【") + JSON.stringify(flag) + (" 】") + + " ,err=" + err + " ,flag=" + flag); + }); + return mMyStub; + }) + }, + OnAbilityConnectDone(element, remoteObject,resultCode){ + console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone=' + + element + " , JSON." + JSON.stringify(element) + + remoteObject + " , JSON." + JSON.stringify(remoteObject) + + resultCode + " , JSON." + JSON.stringify(resultCode) + ); + }, + onDisconnect(want) { + console.debug('ACTS_SerivceAbilityServer ====>onDisConnect=' + + want + " , JSON." + JSON.stringify(want)); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppPage_Service/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3cc0707df739766e572ccd2f361d9ac8e8937e77 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppSimultaneousOnline") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppSimultaneousOnline" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..8bfcc0be0ddd4b8ad2409d5b5f8e6084cffc4d96 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppageontology", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPageOntology.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5a350906b938281f0fa75aef0e10b107998c3727 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppageontology", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppageontology", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppageontology.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..5383a78a56e21d13c0afd746a442dd43220249e5 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppSimultaneousOnlineA + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0729cadda047e2b349fa190d05693d1aa60a99ea --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import commonEvent from "@ohos.commonevent" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +var subscriberInfoStartAbility = { + events: ["ACTS_StartAbility_CommonEvent", "ACTS_StartAbility_FinishEvent", "DISCONNECT"], +}; +const MIN_CLONEUID = 20000000; + +describe('ActsAmsMultiAppSimultaneousOnline', function () { + console.info('----ActsAmsMultiAppSimultaneousOnline----'); + + /* + * @tc.number : AMS_MultiApp_Simultaneous_Online_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : Ontology application and clone application are online at the same time + */ + it('AMS_MultiApp_Simultaneous_Online_0100', 0, async function (done) { + var subscriber; + commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + console.debug("====>subscriber====>" + JSON.stringify(subscriber)); + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppageclone", + abilityName: "com.example.actsamsmultiapppageclone.MainAbility", + }, + }, + ); + + async function subscribeCallBack(err, data) { + console.debug("====>ActsAmsMultiAppSimultaneousOnline CallBack data:====>" + + JSON.stringify(data)); + console.debug("====>ActsAmsMultiAppSimultaneousOnline CallBack data.event:====>" + + JSON.stringify(data.event)); + if(data.event == "ACTS_StartAbility_CommonEvent"){ + console.debug("====> if data.event====>"); + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppageclone", + abilityName: "com.example.actsamsmultiapppageclone.MainAbility", + }, + }, + ); + } + if(data.event == "ACTS_StartAbility_FinishEvent") { + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + done(); + } + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + } + } + var processInfos = await abilitymanager.getActiveProcessInfos(); + var cloneFlag = 0; + var selfFlag = 0; + for (var i = 0; i < processInfos.length; i++) { + console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName); + if (processInfos[i].processName == "com.example.actsamsmultiapppageclonetermination") { + console.info('process uid = ' + processInfos[i].uid); + if (processInfos[i].uid >= MIN_CLONEUID) { + cloneFlag = 1; + } else { + selfFlag = 1; + } + } + } + expect(cloneFlag).assertEqual(1); + expect(selfFlag).assertEqual(1); + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..85e2f20567775858698f59c8c058ed8d966bf647 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPageClone") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPageClone" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..881cc7500c27d9607059490cb6375bd3ffcc7390 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppageclone", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppClone.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..775bdeb8aa1b9fb3aa4d27533eda599210b06bb6 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppageclone", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppageclone", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppageclone.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..dbcf15de4eb82362f1985578728344ea2e43b47a --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppSimultaneousOnlineB + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..30aeba7a626c7793e994f0456eb28a3e25420975 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import commonEvent from '@ohos.commonevent' +import bundle from "@ohos.bundle" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const MIN_CLONEUID = 20000000; + +describe('ActsAmsMultiAppPageClone', function () { + console.info('----ActsAmsMultiAppPageClone----'); + + /* + * @tc.number : AMS_MultiApp_Simultaneous_Online_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : Ontology application and clone application are online at the same time + */ + it('AMS_MultiApp_Simultaneous_Online_0100', 0, async function (done) { + function PublishCallBackOne(err) { + console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Ontology ====>"+err); + done(); + } + function PublishCallBackTwo(err) { + console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Clone ====>"+err); + done(); + } + + var data = await featureAbility.getWant(); + expect(data.bundleName).assertEqual("com.example.actsamsmultiapppageclone"); + expect(data.abilityName).assertEqual("com.example.actsamsmultiapppageclone.MainAbility"); + var info = await featureAbility.getAbilityInfo(); + bundle.getBundleInfo("com.example.actsamsmultiapppageclone", 1, (err, data) => { + console.info('AMS_MultiApp_Simultaneous_Online_0100 data.uid ' + + JSON.stringify(data.uid)); + if (data.uid >= MIN_CLONEUID) { + console.info('AMS_MultiApp_Simultaneous_Online_0100 Clone info ' + + JSON.stringify(info.applicationInfo)); + expect(info.applicationInfo.isCloned).assertEqual(true); + commonEvent.publish("ACTS_StartAbility_CommonEvent", PublishCallBackTwo); + } else { + console.info('AMS_MultiApp_Simultaneous_Online_0100 Ontology info ' + + JSON.stringify(info.applicationInfo)); + expect(info.applicationInfo.isCloned).assertEqual(false); + commonEvent.publish("ACTS_StartAbility_FinishEvent", PublishCallBackOne); + } + }) + + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppSimultaneousOnline_test/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3b9721bf0f0b909e47221a788fd266c7cc4c9d90 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppTermination") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppTermination" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..8dd23d23c56e70c0d7aae9a9803bf6d29b1b9953 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapptermination", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppTermination.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d9553ca8981dc53ffba4942b229389c7aa475db4 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapptermination", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapptermination", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapptermination.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d02fe6feadf73d7d59bd460202030358708988c2 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import commonEvent from "@ohos.commonevent" +import abilitymanager from '@ohos.app.abilitymanager' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +var subscriberInfoStartAbility = { + events: ["ACTS_StartAbility_CommonEvent", "ACTS_StartAbility_Terminate", "DISCONNECT"], +}; +const MIN_CLONEUID = 20000000; + +function sleep(delay) { + var start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } +} + +describe('ActsAmsMultiAppTermination', function () { + console.info('----ActsAmsMultiAppTermination----'); + + /* + * @tc.number : AMS_MultiApp_Termination_Ontology_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : The Ontology application and the clone application are online at the same time, + * and the Ontology application is terminated + */ + it('AMS_MultiApp_Termination_Ontology_0100', 0, async function (done) { + var subscriber; + commonEvent.createSubscriber(subscriberInfoStartAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + + }) + + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppageclonetermination", + abilityName: "com.example.actsamsmultiapppageclonetermination.MainAbility", + }, + }, + ); + async function subscribeCallBack(err, data) { + if(data.event == "ACTS_StartAbility_CommonEvent"){ + console.debug("====> if data.event====>"); + await featureAbility.startAbility( + { + want: + { + bundleName: "com.example.actsamsmultiapppageclonetermination", + abilityName: "com.example.actsamsmultiapppageclonetermination.MainAbility", + }, + }, + ); + } + if(data.event == "ACTS_StartAbility_Terminate") { + async function unSubscribeCallback() { + console.info('ActsAmsMultiAppTermination unSubscribe'); + } + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + console.debug("====>ActsAmsMultiAppTermination unSubscribeCallback====>" ); + } + } + sleep(3000); + var processInfos = await abilitymanager.getActiveProcessInfos(); + var cloneFlag = 0; + var selfFlag = 0; + for (var i = 0; i < processInfos.length; i++) { + console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName); + if (processInfos[i].processName == "com.example.actsamsmultiapppageclonetermination") { + console.info('process uid = ' + processInfos[i].uid); + if (processInfos[i].uid >= MIN_CLONEUID) { + cloneFlag = 1; + } else { + selfFlag = 1; + } + } + } + console.info('ActsAmsMultiAppTermination cloneFlag ' + cloneFlag); + console.info('ActsAmsMultiAppTermination selfFlag ' + selfFlag); + expect(cloneFlag).assertEqual(1); + expect(selfFlag).assertEqual(0); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..497bea734ea78f7ac4c4409414fc665b3f0c502e --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAmsMultiAppPageCloneTermination") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAmsMultiAppPageCloneTermination" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/Test.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a75298f8b845548e4293d0972269294472503618 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsamsmultiapppageclonetermination", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsMultiAppPageCloneTermination.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5c86ec1bb86e4aeba67f2d1f4a05311b920a19bd --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.actsamsmultiapppageclonetermination", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsamsmultiapppageclonetermination", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.actsamsmultiapppageclonetermination.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0ba77d9f36c3429fcf048ae3a5ca91ee5185300b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + MultiAppTerminationB + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4ffc6e989692914c9817a44eab1eb363864dabdd --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import commonEvent from '@ohos.commonevent' +import bundle from "@ohos.bundle" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const MIN_CLONEUID = 20000000; + +describe('ActsAmsMultiAppPageCloneTermination', function () { + console.info('----ActsAmsMultiAppPageCloneTermination----'); + + /* + * @tc.number : AMS_MultiApp_PageClone_Termination_0100 + * @tc.name : startAbility : start pageAbility + * @tc.desc : The Ontology application and the clone application are online at the same time, + * and the Ontology application is terminated + */ + it('AMS_MultiApp_PageClone_Termination_0100', 0, async function (done) { + function PublishCallBackOne(err) { + console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Ontology ====>"+err); + done(); + } + function PublishCallBackTwo(err) { + console.debug("====>Publish CallBack ACTS_StartAbility_CommonEvent Clone ====>"+err); + done(); + } + + var data = await featureAbility.getWant(); + console.info('AMS_MultiApp_PageClone_Termination_0100 data ' + + JSON.stringify(data)); + expect(data.bundleName).assertEqual("com.example.actsamsmultiapppageclonetermination"); + expect(data.abilityName).assertEqual("com.example.actsamsmultiapppageclonetermination.MainAbility"); + var info = await featureAbility.getAbilityInfo(); + console.info('AMS_MultiApp_PageClone_Termination_0100 Clone info ' + + JSON.stringify(info.applicationInfo)); + bundle.getBundleInfo("com.example.actsamsmultiapppageclonetermination", 1, async (err, data) => { + console.info('AMS_MultiApp_PageClone_Termination_0100 data.uid ' + + JSON.stringify(data.uid)); + if (data.uid >= MIN_CLONEUID) { + expect(info.applicationInfo.isCloned).assertEqual(true); + commonEvent.publish("ACTS_StartAbility_CommonEvent",PublishCallBackTwo); + } else { + expect(info.applicationInfo.isCloned).assertEqual(false); + console.info('AMS_MultiApp_PageClone_Termination_0100 terminateSelf1 '); + featureAbility.terminateSelf(async () => { + commonEvent.publish("ACTS_StartAbility_Terminate",PublishCallBackOne); + console.info('AMS_MultiApp_PageClone_Termination_0100 terminateSelf async callback publish '); + }); + } + }) + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/MultiAppTermination_test/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8c8ae3c7b45f6b701ceabee3b22008b35e04f626 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap("MultiAppPageExecutor") { + hap_profile = "./src/main/config.json" + hap_name = "MultiAppPageExecutor" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/js/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..46a04fd87886f1d05df87433097e443f742823ca --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.amsmultiapppageexecutor", + "vendor": "neusoft", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.amsmultiapppageexecutor", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.amsmultiapppageexecutor.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f7aacfa3239a9ea008a239871310a8388a3f7f09 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/default/pages/index/index.js @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import bundle from "@ohos.bundle" +import commonEvent from '@ohos.commonevent' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let code; +const MIN_CLONEUID = 20000000; + +function publishCallBack() { + console.debug("====>Publish CallBack ====>"); +} + +async function onStartTest() { + var abilityWant = await featureAbility.getWant(); + var result = ""; + var bundleInfo; + console.log('PageExecutor bundleName' + abilityWant.bundleName); + console.log('PageExecutor abilityName' + abilityWant.abilityName); + if ((abilityWant.bundleName == "com.example.amsmultiapppageexecutor") && + (abilityWant.abilityName == "com.example.amsmultiapppageexecutor.MainAbility")) { + code = 1; + } else { + code = 2; + } + console.log('PageExecutor onStart code =' + code ); + var info = await featureAbility.getAbilityInfo(); + console.log('PageExecutor onStart info =' + JSON.stringify(info)); + bundleInfo = await bundle.getBundleInfo("com.example.amsmultiapppageexecutor", 1); + console.info('PageExecutor getBundleInfo =' + JSON.stringify(bundleInfo)); + if (bundleInfo.uid >= MIN_CLONEUID) { + if (info.applicationInfo.isCloned == true) { + result = "isCloned"; + } + } else { + if (info.applicationInfo.isCloned == false) { + result = "notCloned"; + } + } + var CommonEventPublishData = { + code: code, + data: result, + isOrdered: false + } + console.log('PageExecutor onStart publish'); + commonEvent.publish("subscriberInfoMultiAppPageByServiceStart", CommonEventPublishData, publishCallBack); +} + +export default { + data: { + title: "PageExecutor" + }, + onInit() { + this.title = "PageExecutor"; + }, + onShow() { + console.log('PageExecutor onShow start'); + try { + onStartTest(); + } catch (err) { + console.log('PageExecutor err = ' + err); + } + }, + onStart() { + console.log('PageExecutor onStart'); + }, + onStop() { + console.log('PageExecutor onStop'); + }, +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..30c8e117945b483c0a31987861b29cd3b07a4ff6 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "particletestserver" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiapppageexecutor/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..befe4297c499ea84e38e82d7c54278704c22f6db --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap("MultiAppServiceExecutor") { + hap_profile = "./src/main/config.json" + hap_name = "MultiAppServiceExecutor" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/js/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..825a25f646bee9659e8ef680c7ede7971bb22967 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.example.amsmultiappserviceexecutor", + "vendor": "neusoft", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.amsmultiappserviceexecutor", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.amsmultiappserviceexecutor.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "service", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..63dc8185cf8f79c7779ab23a015d53b9e4a33be5 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/default/pages/index/index.js @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import rpc from "@ohos.rpc" +import particleAbility from '@ohos.ability.particleability' +import bundle from "@ohos.bundle" +import commonEvent from '@ohos.commonevent' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let mMyStub; +let code; +const MIN_CLONEUID = 20000000; + +function publishCallBack() { + console.debug("====>Publish CallBack ====>"); +} + +async function onCommandTest(want) { + var abilityWant = await particleAbility.getWant(); + var result = ""; + var bundleInfo; + console.log('ServiceExecutor onCommandTest'); + if ((abilityWant.bundleName == "com.example.amsmultiappserviceexecutor") && + (abilityWant.abilityName == "com.example.amsmultiappserviceexecutor.MainAbility")) { + code = 1; + } else { + code = 2; + } + console.log('ServiceExecutor onCommand code =' + code ); + var info = await particleAbility.getAbilityInfo(); + console.log('ServiceExecutor onCommand info =' + JSON.stringify(info)); + bundleInfo = await bundle.getBundleInfo("com.example.amsmultiappserviceexecutor", 1); + console.info('ServiceExecutor getBundleInfo =' + JSON.stringify(bundleInfo)); + if (bundleInfo.uid >= MIN_CLONEUID) { + if (info.applicationInfo.isCloned == true) { + result = "isCloned"; + } + } else { + if (info.applicationInfo.isCloned == false) { + result = "notCloned"; + } + } + var CommonEventPublishData = { + code: code, + data: result, + isOrdered: false + } + if (want.action == 'StartSerciveExecutor') { + console.log('ServiceExecutor onCommand publish'); + commonEvent.publish("subscriberInfoMultiAppServiceByServiceStart", CommonEventPublishData, publishCallBack); + } +} + +async function onConnectTest(want) { + var abilityWant = await particleAbility.getWant(); + var result = ""; + var bundleInfo; + console.log('ServiceExecutor onConnectTest'); + if ((abilityWant.bundleName == "com.example.amsmultiappserviceexecutor") && + (abilityWant.abilityName == "com.example.amsmultiappserviceexecutor.MainAbility")) { + code = 1; + } else { + code = 2; + } + console.log('ServiceExecutor onCommand code =' + code); + var info = await particleAbility.getAbilityInfo(); + console.info('ServiceExecutor MultiApp service executor info ' + JSON.stringify(info)); + bundleInfo = await bundle.getBundleInfo("com.example.amsmultiappserviceexecutor", 1); + console.info('ServiceExecutor MultiApp service executor bundleInfo ' + JSON.stringify(bundleInfo)); + if (bundleInfo.uid >= MIN_CLONEUID) { + if (info.applicationInfo.isCloned == true) { + result = "isCloned"; + } + } else { + if (info.applicationInfo.isCloned == false) { + result = "notCloned"; + } + } + var CommonEventPublishData = { + code: code, + data: result, + isOrdered: false + } + if (want.action == 'ConnectSerciveExecutor') { + console.log('ServiceExecutor onConnect publish' + want.action); + commonEvent.publish("subscriberInfoMultiAppServiceByServiceConnect", CommonEventPublishData, publishCallBack); + } +} + +export default { + data: { + title: "ServiceExecutor" + }, + onInit() { + this.title = "ServiceExecutor"; + }, + onStart(want) { + console.log('ServiceExecutor onStart'); + class MyStub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, message, reply, option) { + console.log("RPCTestServer onRemoteRequest called 1111"); + console.log("RPCTestServer onRemoteRequest code:" + code); + if (code === 1) { + let getContextObject = rpc.IPCSkeleton.getContextObject(); + let getCallingPid = rpc.IPCSkeleton.getCallingPid(); + let getCallingUid = rpc.IPCSkeleton.getCallingUid(); + let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); + let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); + let isLocalCalling = rpc.IPCSkeleton.isLocalCalling(); + let remoteObject = new rpc.RemoteObject("aaa", 3); + let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject); + let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity(); + let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3); + let num = message.readInt(); + let msg = message.readString(); + console.log("num is " + num + "msg is " + msg); + reply.writeString("Success"); + return true; + } + } + } + mMyStub = new MyStub("ServiceStarter-test"); + }, + onStop() { + console.log('ServiceExecutor onStop'); + }, + onConnect(want) { + console.log('stub ServiceExecutor OnConnect' + JSON.stringify(want)); + onConnectTest(want); + return mMyStub; + }, + onReconnect(want) { + console.log('ServiceExecutor onReconnect'); + }, + onDisconnect() { + console.log('ServiceExecutor OnDisConnect'); + }, + onCommand(want, restart, startId) { + console.log('ServiceExecutor onCommand' + JSON.stringify(want)); + onCommandTest(want); + }, +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..30c8e117945b483c0a31987861b29cd3b07a4ff6 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "particletestserver" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiappserviceexecutor/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5ce3c1deed9d9dc7d3c9829e818b4601a02d96a6 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap("MultiAppServiceStarter") { + hap_profile = "./src/main/config.json" + hap_name = "MultiAppServiceStarter" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/js/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a3db5b8b12260ab494d900bb2d4cb98bbfdbc0bd --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.example.amsmultiappservicestarter", + "vendor": "neusoft", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.amsmultiappservicestarter", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.amsmultiappservicestarter.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "service", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b81007c51ea677752e59c7b62e86bf1fa3562c81 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/default/pages/index/index.js @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import rpc from "@ohos.rpc" +import particleAbility from '@ohos.ability.particleability' +import commonEvent from '@ohos.commonevent' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let mMyStub; +let bundleName = "com.example.amsmultiappserviceexecutor"; +let abilityName = "com.example.amsmultiappserviceexecutor.MainAbility"; +let pageBundleName = "com.example.amsmultiapppageexecutor"; +let pageAbilityName = "com.example.amsmultiapppageexecutor.MainAbility"; +let connId; +var mRemote; + +function onConnectCallback(element, remote) { + console.log('ServiceStarter ConnectAbility onConnect element.deviceId : ' + element.deviceId) + console.log('ServiceStarter ConnectAbility onConnect element.bundleName : ' + element.bundleName) + console.log('ServiceStarter ConnectAbility onConnect element.abilityName : ' + element.abilityName) + console.log('ServiceStarter ConnectAbility onConnect element.uri : ' + element.uri) + console.log('ServiceStarter ConnectAbility onConnect element.shortName : ' + element.shortName) + console.log('ServiceStarter ConnectAbility onConnect remote : ' + remote); + mRemote = remote; + console.log('ServiceStarter ConnectAbility onConnect remote 是否为proxy:' + (remote instanceof rpc.RemoteProxy)); + particleAbility.disconnectAbility( + connId, + (error, data) => { + console.log('MultiAppService DisconnectAbility result errCode : ' + error.code + " data: " + data) + }, + ); +} +function onDisconnectCallback(element) { + commonEvent.publish("DISCONNECT_0100", ()=>{console.log('disconnect finish1')}); + console.log('ServiceStarter ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) + console.log('ServiceStarter ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ServiceStarter ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) + console.log('ServiceStarter ConnectAbility onDisconnect element.uri : ' + element.uri) + console.log('ServiceStarter ConnectAbility onDisconnect element.shortName : ' + element.shortName) +} +function onFailedCallback(code) { + console.log('ServiceStarter ConnectAbility onFailed errCode : ' + code) +} + +async function connectSerciveExecutor() { + console.log('ServiceStarter StartSerciveExecutor ConnectAbility set time before : '); + connId = await particleAbility.connectAbility( + { + bundleName: bundleName, + abilityName: abilityName, + action: "ConnectSerciveExecutor" + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, + ); + console.log('ServiceStarter StartSerciveExecutor ConnectAbility connId : ' + connId); +} + +export default { + data: { + title: "ServiceStarter" + }, + onInit() { + this.title = "ServiceStarter"; + }, + onStart(want) { + console.log('ServiceStarter onStart'); + + class MyStub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, message, reply, option) { + console.log("RPCTestServer onRemoteRequest called 1111"); + console.log("RPCTestServer onRemoteRequest code:" + code); + if (code === 1) { + let getContextObject = rpc.IPCSkeleton.getContextObject(); + let getCallingPid = rpc.IPCSkeleton.getCallingPid(); + let getCallingUid = rpc.IPCSkeleton.getCallingUid(); + let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); + let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); + let isLocalCalling = rpc.IPCSkeleton.isLocalCalling(); + let remoteObject = new rpc.RemoteObject("aaa", 3); + let flushCommands = rpc.IPCSkeleton.flushCommands(remoteObject); + let resetCallingIdentity = rpc.IPCSkeleton.resetCallingIdentity(); + let setCallingIdentity = rpc.IPCSkeleton.setCallingIdentity("aaa", 3); + let num = message.readInt(); + let msg = message.readString(); + console.log("num is " + num + "msg is " + msg); + reply.writeString("Success"); + return true; + } + } + } + mMyStub = new MyStub("ServiceStarter-test"); + }, + onStop() { + console.log('ServiceStarter onStop'); + }, + onConnect(want) { + console.log('stub ServiceStarter OnConnect' + JSON.stringify(want)); + if (want.action == 'ConnectSerciveExecutor') { + console.log('ServiceStarter ConnectSerciveExecutor IN') + connectSerciveExecutor(); + } + if (want.action == 'StartSerciveExecutor') { + console.log('stub ServiceStarter OnConnect start service executor') + particleAbility.startAbility( + { + want: + { + action: "StartSerciveExecutor", + type: "MIMETYPE", + deviceId: "", + bundleName: bundleName, + abilityName: abilityName, + uri: "" + }, + } + ); + } + if (want.action == 'StartPageExecutor') { + console.log('stub ServiceStarter start page executor') + particleAbility.startAbility( + { + want: + { + action: "StartPageExecutor", + deviceId: "", + bundleName: pageBundleName, + abilityName: pageAbilityName, + uri: "" + }, + } + ); + } + return mMyStub; + }, + onReconnect(want) { + console.log('ServiceStarter onReconnect'); + }, + onDisconnect() { + console.log('ServiceStarter OnDisConnect'); + }, + onCommand(want, restart, startId) { + console.log('ServiceStarter onCommand'); + }, +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..da97ef2a831393f11c5d7368d5c64f02a4f8eb12 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "amsmultiappservicestarter" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiappservicestarter/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2f2fd2fe213b90086f4db118d13f88175a4ad5de --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("MultiAppTester") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "MultiAppTester" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..948eaf7a641bcc1e50b3c4e65af270943be2161f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.amsmultiapptester", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "MultiAppTester.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..fb8141170a4e3aaee40640ae2e0c420fe9bdf1dc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.amsmultiapptester", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.amsmultiapptester", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.amsmultiapptester.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..a6053c61f9615fcd50fefb51f878568f3e39e59b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ff8fdb13cd10090c035441c760a1b3bc704dbc --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c282338f488137b3385950256daceaa29f6cee4f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..437a300fd097384d83ffd51d955fcc4f639ef6a1 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureability' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import commonEvent from '@ohos.commonevent' + +const START_ABILITY_TIMEOUT = 4000; +var subscriberInfoMultiApp0700 = { + events: ["subscriberInfoMultiAppServiceByServiceStart", "DISCONNECT"] +}; +var subscriberInfoMultiApp0800 = { + events: ["subscriberInfoMultiAppServiceByServiceConnect", "DISCONNECT"] +}; +var subscriberInfoMultiApp0600 = { + events: ["subscriberInfoMultiAppPageByServiceStart", "DISCONNECT"] +}; +describe('MultiAppTester', function () { + console.info('----MultiAppTester----'); + let bundleName = "com.example.amsmultiappservicestarter"; + let abilityName = "com.example.amsmultiappservicestarter.MainAbility"; + var mRemote; + function onConnectCallback(element, remote) { + console.log('StartMultiAppTester ConnectAbility onConnect element.deviceId : ' + element.deviceId) + console.log('StartMultiAppTester ConnectAbility onConnect element.bundleName : ' + element.bundleName) + console.log('StartMultiAppTester ConnectAbility onConnect element.abilityName : ' + element.abilityName) + console.log('StartMultiAppTester ConnectAbility onConnect element.uri : ' + element.uri) + console.log('StartMultiAppTester ConnectAbility onConnect element.shortName : ' + element.shortName) + console.log('StartMultiAppTester ConnectAbility onConnect remote : ' + remote); + mRemote = remote; + console.log('StartMultiAppTester ConnectAbility onConnect remote 是否为proxy:' + + (remote instanceof rpc.RemoteProxy)); + } + function onDisconnectCallback(element) { + commonEvent.publish("DISCONNECT", ()=>{console.log('disconnect finish1')}); + console.log('StartMultiAppTester ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) + console.log('StartMultiAppTester ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('StartMultiAppTester ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) + console.log('StartMultiAppTester ConnectAbility onDisconnect element.uri : ' + element.uri) + console.log('StartMultiAppTester ConnectAbility onDisconnect element.shortName : ' + element.shortName) + } + function onFailedCallback(code) { + console.log('StartMultiAppTester ConnectAbility onFailed errCode : ' + code) + } + + /* + * @tc.number: AMS_MultiApp_0700 + * @tc.name: Connects a service ability, which is used to start another cloned service ability. + * @tc.desc: Check the event data of executor service ability publishes + */ + it('AMS_MultiApp_0700', 0, async function (done) { + console.log('AMS_MultiApp_0700====Subscribe CallBack data:====>" + JSON.stringify(data)); + events.set(data.event, 0); + if(events.size == 1) { + if(data.event == "DISCONNECT") { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } else { + clearTimeout(id); + expect(data.event).assertEqual("subscriberInfoMultiAppServiceByServiceStart"); + expect(data.data).assertEqual("notCloned"); + expect(data.code).assertEqual(1); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('MultiAppService DisconnectAbility result errCode : ' + + error.code + " data: " + data) + }, + ); + } + } else { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + + } + + commonEvent.createSubscriber(subscriberInfoMultiApp0700).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.debug('StartMultiAppTester timeout'); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('StartMultiAppTester DisconnectAbility result errCode : ' + + error.code + " data: " + data) + }, + ); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('StartMultiAppTester ConnectAbility id : ' + id); + connId = await featureAbility.connectAbility( + { + bundleName: bundleName, + abilityName: abilityName, + action: "StartSerciveExecutor" + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, + ); + console.log('StartMultiAppTester ConnectAbility connId : ' + connId); + }) + + /* + * @tc.number: AMS_MultiApp_0800 + * @tc.name: Connects a service ability, which is used to connect another cloned service ability. + * @tc.desc: Check the event data of executor service ability publishes + */ + it('AMS_MultiApp_0800', 0, async function (done) { + console.log('AMS_MultiApp_0800====Subscribe CallBack data:====>" + JSON.stringify(data)); + events.set(data.event, 0); + if(events.size == 1) { + if(data.event == "DISCONNECT") { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } else { + clearTimeout(id); + expect(data.event).assertEqual("subscriberInfoMultiAppServiceByServiceConnect"); + expect(data.data).assertEqual("notCloned"); + expect(data.code).assertEqual(1); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('MultiAppService DisconnectAbility result errCode : ' + + error.code + " data: " + data) + }, + ); + } + } else { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + + } + + commonEvent.createSubscriber(subscriberInfoMultiApp0800).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.debug('StartMultiAppTester timeout'); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('StartMultiAppTester DisconnectAbility result errCode : ' + + error.code + " data: " + data) + }, + ); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('StartMultiAppTester ConnectAbility id : ' + id); + connId = await featureAbility.connectAbility( + { + bundleName: bundleName, + abilityName: abilityName, + action: "ConnectSerciveExecutor" + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, + ); + console.log('StartMultiAppTester ConnectAbility connId : ' + connId); + }) + + /* + * @tc.number: AMS_MultiApp_0600 + * @tc.name: Connects a service ability, which is used to start a cloned page ability. + * @tc.desc: Check the event data of executor page ability publishes + */ + it('AMS_MultiApp_0600', 0, async function (done) { + console.log('AMS_MultiApp_0600====Subscribe CallBack data:====>" + JSON.stringify(data)); + events.set(data.event, 0); + + if(events.size == 1) { + if(data.event == "DISCONNECT") { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } else { + clearTimeout(id); + expect(data.event).assertEqual("subscriberInfoMultiAppPageByServiceStart"); + expect(data.data).assertEqual("notCloned"); + expect(data.code).assertEqual(1); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('MultiAppService DisconnectAbility result errCode : ' + + error.code + " data: " + data); + }, + ); + } + } else { + expect(data.event).assertEqual("DISCONNECT"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + + } + commonEvent.createSubscriber(subscriberInfoMultiApp0600).then(async (data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + await commonEvent.subscribe(subscriber, subscribeCallBack); + }) + + function unSubscribeCallback() { + console.debug("====>UnSubscribe CallBack====>"); + } + + function timeout() { + expect().assertFail(); + console.debug('StartMultiAppTester timeout'); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('StartMultiAppTester DisconnectAbility result errCode : ' + + error.code + " data: " + data); + }, + ); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.log('StartMultiAppTester AMS_MultiApp_0600 ConnectAbility id : ' + id); + connId = await featureAbility.connectAbility( + { + bundleName: bundleName, + abilityName: abilityName, + action: "StartPageExecutor" + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, + ); + console.log('StartMultiAppTester AMS_MultiApp_0600 ConnectAbility connId : ' + connId); + }) +}) diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultiapptester/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f56abb232d9892e8eb31d7ae2614379684402552 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("amsMultiDataAbilityClone") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "amsMultiDataAbilityClone" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..02bbb03c63deb1c9beceb29eb9a5e7288365abe9 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.amsst.amsmultidataabilityclone", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "amsMultiDataAbility.hap", + "./resource/appexecfwk/amsStDataAbility.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..11dd171882ef36ff60991197ec0d6c06e73a8f4b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.amsst.amsmultidataabilityclone", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.amsmultidataabilityclone", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.amsst.amsmultidataabilityclone.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6724ec055a554cf3f9c7be83780c30df2274875b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,12 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} +.titleST { + font-size: 32px; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..4f779dcdff4fa69413976fe7032ca3656758793a --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + + STDataAbility + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4bfa4f7e4a4085d7336a97befffb8d52882d281d --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('====onShow finish====<') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..baf5b3c1c2a555bed22561a88aca6d857522d425 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "STDataAbility" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8e91c8b1d7604505b6af573cee780ff49a1ce76b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MultiDataAbilityJsSt.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/MultiDataAbilityJsSt.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/MultiDataAbilityJsSt.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1d2a55ef560737a236679227b05e299d1d75ddd4 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/entry/src/main/js/test/MultiDataAbilityJsSt.test.js @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import abilitymanager from '@ohos.app.abilitymanager' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const MIN_CLONEUID = 20000000; + +describe('ActsDataAbilityHelperTest', function () { + var dataAbilityProcessName = ("com.ix.verify.act"); + var dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility"); + var DAHelper; + + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====" + dataAbilityUri) + var cloneFlag = 0; + var selfFlag = 0; + var processInfos = await abilitymanager.getActiveProcessInfos(); + console.info('ActsAmsMultiAppTermination processInfos length' + processInfos.length); + for (var i = 0; i < processInfos.length; i++) { + console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName); + if (processInfos[i].processName == dataAbilityProcessName) { + console.info('process uid = ' + processInfos[i].uid); + if (processInfos[i].uid >= MIN_CLONEUID) { + cloneFlag = 1; + } else { + selfFlag = 1; + } + } + } + + console.log('AMS_MultiApp_0500====cloneFlag' + cloneFlag); + console.log('AMS_MultiApp_0500====selfFlag' + selfFlag); + expect(cloneFlag).assertEqual(1); + expect(selfFlag).assertEqual(0); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityclone/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/BUILD.gn b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b21842afb62818a399e156edfe26493cc4e73a81 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("amsMultiDataAbilitySelf") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "amsMultiDataAbilitySelf" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/Test.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..74d5e56dc94ba3264d34e8b946e785a76c089eb0 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.amsst.amsmultidataabilityself", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "amsMultiDataAbility.hap", + "./resource/appexecfwk/amsStDataAbility.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/config.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2c26ab15393a7fd8f693ae71b4cdb3702b85f2d1 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.amsst.amsmultidataabilityself", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.amsmultidataabilityself", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.amsst.amsmultidataabilityself.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6724ec055a554cf3f9c7be83780c30df2274875b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,12 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} +.titleST { + font-size: 32px; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..4f779dcdff4fa69413976fe7032ca3656758793a --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + + STDataAbility + +
diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4bfa4f7e4a4085d7336a97befffb8d52882d281d --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('====onShow finish====<') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..baf5b3c1c2a555bed22561a88aca6d857522d425 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "STDataAbility" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8e91c8b1d7604505b6af573cee780ff49a1ce76b --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./MultiDataAbilityJsSt.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/MultiDataAbilityJsSt.test.js b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/MultiDataAbilityJsSt.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5630ad9f43dc38530928c345e7bc79322b205cd0 --- /dev/null +++ b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/entry/src/main/js/test/MultiDataAbilityJsSt.test.js @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import featureAbility from '@ohos.ability.featureAbility' +import abilitymanager from '@ohos.app.abilitymanager' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const MIN_CLONEUID = 20000000; + +describe('ActsDataAbilityHelperTest', function () { + var dataAbilityProcessName = ("com.ix.verify.act"); + var dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility"); + var DAHelper; + + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====" + dataAbilityUri) + var cloneFlag = 0; + var selfFlag = 0; + var processInfos = await abilitymanager.getActiveProcessInfos(); + console.info('ActsAmsMultiAppTermination processInfos length' + processInfos.length); + for (var i = 0; i < processInfos.length; i++) { + console.info('ActsAmsMultiAppTermination process name ' + processInfos[i].processName); + if (processInfos[i].processName == dataAbilityProcessName) { + console.info('process uid = ' + processInfos[i].uid); + if (processInfos[i].uid >= MIN_CLONEUID) { + cloneFlag = 1; + } else { + selfFlag = 1; + } + } + } + + console.log('AMS_MultiApp_0400====cloneFlag' + cloneFlag); + console.log('AMS_MultiApp_0400====selfFlag' + selfFlag); + expect(cloneFlag).assertEqual(0); + expect(selfFlag).assertEqual(1); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/amsmultiapp/amsmultidataabilityself/signature/openharmony_sx.p7b differ