Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
761c6fdb
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
761c6fdb
编写于
3月 14, 2023
作者:
I
inter515
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增api覆盖
Signed-off-by:
N
inter515
<
ry.renyi@huawei.com
>
上级
bf02a40b
变更
53
展开全部
显示空白变更内容
内联
并排
Showing
53 changed file
with
3534 addition
and
0 deletion
+3534
-0
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
+1
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/BUILD.gn
...andard/bundlemanager/actsbmsatomicserviceetstest/BUILD.gn
+24
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/AppScope/app.json
...serviceetstest/actsbmsatomicservicetest/AppScope/app.json
+25
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/AppScope/resources/base/element/string.json
...icservicetest/AppScope/resources/base/element/string.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/BUILD.gn
...bmsatomicserviceetstest/actsbmsatomicservicetest/BUILD.gn
+42
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/Test.json
...msatomicserviceetstest/actsbmsatomicservicetest/Test.json
+28
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/Application/AbilityStage.ts
...ervicetest/entry/src/main/ets/Application/AbilityStage.ts
+9
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/FormAbility/FormAbility.ts
...servicetest/entry/src/main/ets/FormAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/MainAbility.ts
...servicetest/entry/src/main/ets/MainAbility/MainAbility.ts
+36
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/pages/index/index.ets
...test/entry/src/main/ets/MainAbility/pages/index/index.ets
+57
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/ServiceAbility/FormAbility.ts
...vicetest/entry/src/main/ets/ServiceAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestAbility/TestAbility.ts
...servicetest/entry/src/main/ets/TestAbility/TestAbility.ts
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestAbility/pages/index.ets
...ervicetest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+58
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
...est/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
+61
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/List.test.ets
...msatomicservicetest/entry/src/main/ets/test/List.test.ets
+20
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/Utils.ets
...ctsbmsatomicservicetest/entry/src/main/ets/test/Utils.ets
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/module.json
...stest/actsbmsatomicservicetest/entry/src/main/module.json
+391
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/element/string.json
...icetest/entry/src/main/resources/base/element/string.json
+44
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/media/icon.png
...cservicetest/entry/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/form_config.json
...st/entry/src/main/resources/base/profile/form_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/form_config1.txt
...st/entry/src/main/resources/base/profile/form_config1.txt
+1
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/invalid.txt
...icetest/entry/src/main/resources/base/profile/invalid.txt
+5
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/shortcuts_config.json
...try/src/main/resources/base/profile/shortcuts_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/signature/openharmony_sx.p7b
...est/actsbmsatomicservicetest/signature/openharmony_sx.p7b
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/AppScope/app.json
...tomicserviceetstest/bmsatomicserviceone/AppScope/app.json
+25
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/AppScope/resources/base/element/string.json
...micserviceone/AppScope/resources/base/element/string.json
+8
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/BUILD.gn
.../actsbmsatomicserviceetstest/bmsatomicserviceone/BUILD.gn
+42
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/Test.json
...actsbmsatomicserviceetstest/bmsatomicserviceone/Test.json
+4
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/Application/AbilityStage.ts
...serviceone/entry/src/main/ets/Application/AbilityStage.ts
+9
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/FormAbility/FormAbility.ts
...cserviceone/entry/src/main/ets/FormAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/MainAbility.ts
...cserviceone/entry/src/main/ets/MainAbility/MainAbility.ts
+36
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/pages/index/index.ets
...eone/entry/src/main/ets/MainAbility/pages/index/index.ets
+57
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/pages/second/second.ets
...ne/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/ServiceAbility/FormAbility.ts
...rviceone/entry/src/main/ets/ServiceAbility/FormAbility.ts
+37
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
...one/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
+1097
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetProfileByAbility.test.ets
...eone/entry/src/main/ets/test/GetProfileByAbility.test.ets
+423
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets
...y/src/main/ets/test/GetProfileByExtensionAbility.test.ets
+424
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetSecondModule.test.ets
...rviceone/entry/src/main/ets/test/GetSecondModule.test.ets
+75
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/List.test.ets
...bmsatomicserviceone/entry/src/main/ets/test/List.test.ets
+26
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/Utils.ets
...est/bmsatomicserviceone/entry/src/main/ets/test/Utils.ets
+30
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/module.json
...iceetstest/bmsatomicserviceone/entry/src/main/module.json
+39
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/element/string.json
...viceone/entry/src/main/resources/base/element/string.json
+44
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/media/icon.png
...icserviceone/entry/src/main/resources/base/media/icon.png
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/form_config.json
...ne/entry/src/main/resources/base/profile/form_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/form_config1.txt
...ne/entry/src/main/resources/base/profile/form_config1.txt
+1
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/invalid.txt
...viceone/entry/src/main/resources/base/profile/invalid.txt
+5
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/main_pages.json
...one/entry/src/main/resources/base/profile/main_pages.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/shortcuts_config.json
...try/src/main/resources/base/profile/shortcuts_config.json
+6
-0
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/signature/openharmony_sx.p7b
...eetstest/bmsatomicserviceone/signature/openharmony_sx.p7b
+0
-0
bundlemanager/bundle_standard/bundlemanager/actsbundlemanagerstagetest/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
...est/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
+1
-0
未找到文件。
bundlemanager/bundle_standard/bundlemanager/BUILD.gn
浏览文件 @
761c6fdb
...
@@ -18,6 +18,7 @@ group("bundlemanager") {
...
@@ -18,6 +18,7 @@ group("bundlemanager") {
if (is_standard_system) {
if (is_standard_system) {
deps = [
deps = [
"actsbmsaccesstokentest:ActsBmsAccessTokenTest",
"actsbmsaccesstokentest:ActsBmsAccessTokenTest",
"actsbmsatomicserviceetstest:actsbmsatomicserviceetstest",
"actsbmsetsunpermissiontest:ActsBmsEtsUnPermissionTest",
"actsbmsetsunpermissiontest:ActsBmsEtsUnPermissionTest",
"actsbmsgetinfostest:ActsBmsGetInfosTest",
"actsbmsgetinfostest:ActsBmsGetInfosTest",
"actsbmshapmoduletest:ActsBmsHapModuleTest",
"actsbmshapmoduletest:ActsBmsHapModuleTest",
...
...
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/BUILD.gn
0 → 100644
浏览文件 @
761c6fdb
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("actsbmsatomicserviceetstest") {
testonly = true
if (is_standard_system) {
deps = [
"actsbmsatomicservicetest:ActsBmsAtomicServiceTest",
"bmsatomicserviceone:BmsAtomicService1",
]
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/AppScope/app.json
0 → 100644
浏览文件 @
761c6fdb
{
"app"
:{
"bundleName"
:
"ohos.acts.atomic.service.test"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"debug"
:
false
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"description"
:
"$string:description_application"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"atomicService"
:{
"split"
:
true
,
"main"
:
"testModule"
},
"car"
:{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
761c6fdb
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/BUILD.gn
0 → 100644
浏览文件 @
761c6fdb
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsAtomicServiceTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":actsbmsatomicservicetest_js_assets",
":actsbmsatomicservicetest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsBmsAtomicServiceTest"
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
}
ohos_app_scope("actsbmsatomicservicetest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsbmsatomicservicetest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsbmsatomicservicetest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsbmsatomicservicetest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/Test.json
0 → 100644
浏览文件 @
761c6fdb
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"180000"
,
"bundle-name"
:
"ohos.acts.atomic.service.test"
,
"module-name"
:
"testModule"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
70000
},
"kits"
:
[
{
"test-file-name"
:
[
"BmsAtomicService1.hap"
,
"ActsBmsAtomicServiceTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"teardown-command"
:[
"bm uninstall -n ohos.acts.atomic.service.test"
]
}
]
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
761c6fdb
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
globalThis
.
stageOnCreateRun
=
1
;
globalThis
.
stageContext
=
this
.
context
;
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/FormAbility/FormAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
FormExtension
from
'
@ohos.app.form.FormExtensionAbility
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
Ability
from
'
@ohos.app.ability.UIAbility
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
[Demo] MainAbility onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
//Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility onBackground
"
)
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/ServiceAbility/FormAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
FormExtension
from
'
@ohos.app.form.FormExtensionAbility
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
Ability
from
'
@ohos.app.ability.UIAbility
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
TestAbility/pages/index
'
,
null
)
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
761c6fdb
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a ohos.acts.atomic.service.test.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
0 → 100644
浏览文件 @
761c6fdb
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impligetProfileByAbilityEmptyAbilityCalled.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bundle from '@ohos.bundle.bundleManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
export default function getBundleInfoForSelf() {
describe('getBundleInfoForSelf', function () {
/*
* @tc.number: SUB_BMS_SERVICE_SPLIT_0031
* @tc.name: getBundleInfoForSelfAtomicService
* @tc.desc: Test getBundleInfoForSelf with AtomicService
*/
it('getBundleInfoForSelfAtomicService', 0, async function (done) {
await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE).then(data => {
let preloadItemTest: bundle.PreloadItem = data.hapModulesInfo[1].preloads[0];
expect(typeof (preloadItemTest.moduleName)).assertEqual('string');
let dependencyTest: bundle.Dependency = data.hapModulesInfo[1].dependencies[0];
expect(typeof (dependencyTest.moduleName)).assertEqual('string');
console.info("getBundleInfoForSelfApplicationPro" + JSON.stringify(data.appInfo));
for (let i = 0; i < data.hapModulesInfo.length; i++) {
console.info("getBundleInfoForSelfApplicationPro : " + i + " ==" + JSON.stringify(data.hapModulesInfo[i]));
}
expect(data.appInfo.bundleType).assertEqual(bundle.BundleType.ATOMIC_SERVICE);
expect(data.appInfo.split).assertEqual(true);
expect(bundle.ModuleType.SHARED).assertEqual(3);
expect(data.hapModulesInfo[0].type).assertEqual(bundle.ModuleType.FEATURE);
expect(data.hapModulesInfo[0].atomicServiceModuleType).assertEqual(bundle.AtomicServiceModuleType.NORMAL);
expect(data.hapModulesInfo[0].preloads.length).assertEqual(0);
expect(data.hapModulesInfo[0].dependencies.length).assertEqual(0);
expect(data.hapModulesInfo[1].type).assertEqual(bundle.ModuleType.ENTRY);
expect(data.hapModulesInfo[1].atomicServiceModuleType).assertEqual(bundle.AtomicServiceModuleType.MAIN);
expect(data.hapModulesInfo[1].preloads.length).assertEqual(1);
expect(data.hapModulesInfo[1].preloads[0].moduleName).assertEqual("feature");
expect(data.hapModulesInfo[1].dependencies.length).assertEqual(1);
expect(data.hapModulesInfo[1].dependencies[0].moduleName).assertEqual("feature");
done();
}).catch(err => {
console.info("getBundleInfoForSelf fail" + JSON.stringify(err));
expect(err).assertFail();
done();
})
})
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import getBundleInfoForSelf from './GetBundleInfoForSelf.test.ets';
export default function testsuite() {
getBundleInfoForSelf();
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/ets/test/Utils.ets
0 → 100644
浏览文件 @
761c6fdb
/**
* 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 class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout((data) => {
resolve(data)
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/module.json
0 → 100644
浏览文件 @
761c6fdb
{
"module"
:
{
"name"
:
"testModule"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:testModule_entry_dsc"
,
"mainElement"
:
"ohos.acts.atomic.service.test.MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"dependencies"
:[
{
"moduleName"
:
"feature"
}
],
"atomicService"
:{
"preloads"
:[
{
"moduleName"
:
"feature"
}
]
},
"deliveryWithInstall"
:
true
,
"installationFree"
:
true
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"metadata"
:
[
{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"false"
}
],
"abilities"
:
[
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"singleton"
,
"orientation"
:
"portrait"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:[
"entity.system.home"
]
}
],
"metadata"
:
[
{
"name"
:
"ohos.ability.form"
,
"value"
:
""
,
"resource"
:
"$profile:shortcuts_config"
},
{
"name"
:
"ohos.ability.form1"
,
"value"
:
""
,
"resource"
:
"$profile:form_config"
},
{
"name"
:
"ohos.ability.form2"
,
"value"
:
""
,
"resource"
:
"@profile:form_config"
},
{
"name"
:
"ohos.ability.form3"
,
"value"
:
""
,
"resource"
:
"$profile:form_config1"
},
{
"name"
:
"ohos.ability.form4"
,
"value"
:
""
,
"resource"
:
"$profile:invalid"
}
]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility1"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"standard"
,
"orientation"
:
"landscape"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility2"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"landscape_inverted"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility3"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"portrait_inverted"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility4"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility5"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation_landscape"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility6"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation_portrait"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility7"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation_restricted"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility8"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation_landscape_restricted"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility9"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"auto_rotation_portrait_restricted"
,
"skills"
:
[]
},
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility10"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"specified"
,
"orientation"
:
"locked"
,
"skills"
:
[]
}
],
"extensionAbilities"
:
[
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"metadata"
:
[
{
"name"
:
"ohos.extension.form"
,
"value"
:
""
,
"resource"
:
"$profile:shortcuts_config"
},
{
"name"
:
"ohos.extension.form1"
,
"value"
:
""
,
"resource"
:
"$profile:form_config"
},
{
"name"
:
"ohos.extension.form2"
,
"value"
:
""
,
"resource"
:
"@profile:form_config"
},
{
"name"
:
"ohos.extension.form3"
,
"value"
:
""
,
"resource"
:
"$profile:form_config1"
},
{
"name"
:
"ohos.extension.form4"
,
"value"
:
""
,
"resource"
:
"$profile:invalid"
}
],
"name"
:
"Form"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"form"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"Form1"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"form"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"workScheduler"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"workScheduler"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"inputMethod"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"inputMethod"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"accessibility"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"accessibility"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"fileShare"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"fileShare"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"staticSubscriber"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"staticSubscriber"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"wallpaper"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"wallpaper"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"backup"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"backup"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"window"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"window"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"enterpriseAdmin"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"enterpriseAdmin"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"thumbnail"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"thumbnail"
,
"visible"
:
true
},
{
"description"
:
"$string:form_description"
,
"descriptionId"
:
16777219
,
"icon"
:
"$media:icon"
,
"iconId"
:
16777225
,
"label"
:
"$string:entry_label"
,
"name"
:
"preview"
,
"srcEntrance"
:
"./ets/FormAbility/FormAbility.ts"
,
"type"
:
"preview"
,
"visible"
:
true
}
],
"requestPermissions"
:
[
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
"reason"
:
"$string:permission_reason"
,
"usedScene"
:
{
"abilities"
:
[
"MainAbility"
],
"when"
:
"always"
}
},
{
"name"
:
"ohos.permission.READ_CALENDAR"
,
"reason"
:
"$string:permission_reason"
,
"usedScene"
:
{
"abilities"
:
[
"MainAbility"
],
"when"
:
"inuse"
}
}
],
"metadata"
:
[
{
"name"
:
"MetaData1"
,
"value"
:
"MetaDataValue"
,
"resource"
:
"$profile:shortcuts_config"
}
]
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
761c6fdb
{
"string"
:
[
{
"name"
:
"testModule_entry_dsc"
,
"value"
:
"i am an entry for testModule"
},
{
"name"
:
"testModule_entry_main"
,
"value"
:
"the testModule entry ability"
},
{
"name"
:
"entry_label"
,
"value"
:
"ActsContextTest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"my whether"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
},
{
"name"
:
"form_FormAbility_desc"
,
"value"
:
"form_description"
},
{
"name"
:
"form_FormAbility_label"
,
"value"
:
"form_label"
},
{
"name"
:
"permission_reason"
,
"value"
:
"Need permission"
}
]
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
761c6fdb
15.1 KB
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/form_config.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/form_config1.txt
0 → 100644
浏览文件 @
761c6fdb
{"src": ["MainAbility/pages/index/index","MainAbility/pages/second/second"]}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/invalid.txt
0 → 100644
浏览文件 @
761c6fdb
{
"src": [
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/entry/src/main/resources/base/profile/shortcuts_config.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/actsbmsatomicservicetest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
761c6fdb
文件已添加
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/AppScope/app.json
0 → 100644
浏览文件 @
761c6fdb
{
"app"
:{
"bundleName"
:
"ohos.acts.atomic.service.test"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"debug"
:
false
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"description"
:
"$string:description_application"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"atomicService"
:{
"split"
:
true
,
"main"
:
"testModule"
},
"car"
:{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
761c6fdb
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/BUILD.gn
0 → 100644
浏览文件 @
761c6fdb
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("BmsAtomicService1") {
hap_profile = "entry/src/main/module.json"
hap_name = "BmsAtomicService1"
subsystem_name = "bundlemanager"
part_name = "bundle_framework"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("bmsatomicserviceone_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("hjs_demo_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":bmsatomicserviceone_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/Test.json
0 → 100644
浏览文件 @
761c6fdb
{
"description"
:
"Configuration for hjunit demo Tests"
,
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
761c6fdb
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
globalThis
.
stageOnCreateRun
=
1
;
globalThis
.
stageContext
=
this
.
context
;
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/FormAbility/FormAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
FormExtension
from
'
@ohos.app.form.FormExtensionAbility
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
Ability
from
'
@ohos.app.ability.UIAbility
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
[Demo] MainAbility onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
//Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility onBackground
"
)
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/ServiceAbility/FormAbility.ts
0 → 100644
浏览文件 @
761c6fdb
import
FormExtension
from
'
@ohos.app.form.FormExtensionAbility
'
;
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
export
default
class
FormAbility
extends
FormExtension
{
onCreate
(
want
)
{
// Called to return a FormBindingData object.
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
onVisibilityChange
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
0 → 100644
浏览文件 @
761c6fdb
此差异已折叠。
点击以展开。
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetProfileByAbility.test.ets
0 → 100644
浏览文件 @
761c6fdb
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impligetProfileByAbilityEmptyAbilityCalled.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import manager from '@ohos.bundle.bundleManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "testModule"
const MODULE_NAME_TEST = "testModule1"
const ABILITY_NAME = "ohos.acts.bundle.stage.test.MainAbility"
const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1"
const ABILITY_NAME_TEST = "ohos.acts.bundle.stage.test.MainAbilityTest"
const METADATA_NAME = "ohos.ability.form"
const METADATA_NAME1 = "ohos.ability.form1"
const METADATA_NAME2 = "ohos.ability.form2"
const METADATA_NAME3 = "ohos.ability.form3"
const METADATA_NAME4 = "ohos.ability.form4"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}"
const ERROR_ABILITY_NOT_EXIST = 17700003
const ERROR_PROFILE_NOT_EXIST = 17700024
const ERROR_MODULE_NOT_EXIST = 17700002
export default function getProfileByAbility() {
describe('getProfileByAbility', function () {
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011
* @tc.name: getProfileByAbilityInvalidModulePro
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityInvalidModulePro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbilityInvalidModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbilityInvalidModulePro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015
* @tc.name: getProfileByAbilityEmptyModulePro
* @tc.desc: Check the empty moduleName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityEmptyModulePro', 0, async function (done) {
await manager.getProfileByAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByAbilityEmptyModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbilityEmptyModulePro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017
* @tc.name: getProfileByAbilityInvalidModuleCall
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityInvalidModuleCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByAbilityInvalidModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034
* @tc.name: getProfileByAbilityEmptyModuleCall
* @tc.desc: Check the empty moduleName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityEmptyModuleCall', 0, async function (done) {
manager.getProfileByAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST);
console.error('[getProfileByAbilityEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012
* @tc.name: getProfileByAbilityInvalidAbilityPro
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityInvalidAbilityPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByAbilityInvalidAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbilityInvalidAbilityPro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029
* @tc.name: getProfileByAbilityEmptyAbilityPro
* @tc.desc: Check the empty abilityName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityEmptyAbilityPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByAbilityEmptyAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByAbilityEmptyAbilityPro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022
* @tc.name: getProfileByAbilityInvalidAbilityCall
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityInvalidAbilityCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByAbilityInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029
* @tc.name: getProfileByAbilityEmptyAbilityCall
* @tc.desc: Check the empty abilityName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityEmptyAbilityCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByAbilityEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024
* @tc.name: getProfileByAbilityCallback
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityCallback', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
console.info('[getProfileByAbilityCallback] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026
* @tc.name: getProfileByAbilityInvalidMetaDataCall
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityInvalidMetaDataCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
console.error('[getProfileByAbilityInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036
* @tc.name: getProfileByAbilityEmptyMetaDataCall
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByAbilityEmptyMetaDataCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
console.info('[getProfileByAbilityEmptyMetaDataCall] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002
* @tc.name: getProfileByAbilityPromise
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityPromise', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByAbilityPromise] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004
* @tc.name: getProfileByAbilityInvalidMetaDataPro
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityInvalidMetaDataPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByAbilityInvalidMetaDataPro] getProfileByAbility callback data is: ' + JSON.stringify(data));
done()
}).catch(err => {
console.error('[getProfileByAbilityInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030
* @tc.name: getProfileByAbilityEmptyMetaDataPro
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityEmptyMetaDataPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByAbilityEmptyMetaDataPro] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbilityEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009
* @tc.name: getProfileByAbilityNoMetaDataPro
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByAbilityNoMetaDataPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByAbilityNoMetaDataPro] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048
* @tc.name: getProfileByAbilityNoProfilePro
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByAbilityNoProfilePro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByAbilityNoProfilePro] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045
* @tc.name: getProfileByAbilityNotPrefixPro
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByAbilityNotPrefixPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByAbilityNotPrefixPro] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(data).assertFail()
done();
}).catch(err => {
console.error('[getProfileByAbilityNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044
* @tc.name: getProfileByAbilityNotPrefixCall
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByAbilityNotPrefixCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
console.error('[getProfileByAbilityNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007
* @tc.name: getProfileByAbilityNotSuffixPro
* @tc.desc: profile is .txt suffix (by promise)
* @tc.level 0
*/
it('getProfileByAbilityNotSuffixPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByAbilityNotSuffixPro] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
done();
}).catch(err => {
console.error('[getProfileByAbilityNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040
* @tc.name: getProfileByAbilityNotSuffixCall
* @tc.desc: profile is .txt suffix (by callback)
* @tc.level 0
*/
it('getProfileByAbilityNotSuffixCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
console.info('[getProfileByAbilityNotSuffixCall] getProfileByAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008
* @tc.name: getProfileByAbilityNoJsonPro
* @tc.desc: profile is invalid json format (by promise)
* @tc.level 0
*/
it('getProfileByAbilityNoJsonPro', 0, async function (done) {
await manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => {
console.info('[getProfileByAbilityNoJsonPro] data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByAbilityNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046
* @tc.name: getProfileByAbilityNoJsonCall
* @tc.desc: profile is invalid json format (by callback)
* @tc.level 0
*/
it('getProfileByAbilityNoJsonCall', 0, async function (done) {
manager.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => {
console.info('[getProfileByAbilityNoJsonCall] err: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
});
})
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets
0 → 100644
浏览文件 @
761c6fdb
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import manager from '@ohos.bundle.bundleManager';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "testModule"
const MODULE_NAME_TEST = "testModule1"
const ABILITY_NAME = "Form"
const ABILITY_NAME1 = "Form1"
const ABILITY_NAME_TEST = "FromTest"
const METADATA_NAME = "ohos.extension.form"
const METADATA_NAME1 = "ohos.extension.form1"
const METADATA_NAME2 = "ohos.extension.form2"
const METADATA_NAME3 = "ohos.extension.form3"
const METADATA_NAME4 = "ohos.extension.form4"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}"
const ERROR_ABILITY_NOT_EXIST = 17700003
const ERROR_PROFILE_NOT_EXIST = 17700024
const ERROR_MODULE_NOT_EXIST = 17700002
export default function getProfileByExtensionAbility() {
describe('getProfileByExtensionAbility', function () {
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011
* @tc.name: getProfileByExtensionAbilityInvalidModulePro
* @tc.desc: Check the invalid moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidModulePro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbilityInvalidModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbilityInvalidModulePro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015
* @tc.name: getProfileByExtensionAbilityEmptyModulePro
* @tc.desc: Check the empty moduleName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyModulePro', 0, async function (done) {
await manager.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbilityEmptyModulePro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbilityEmptyModulePro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017
* @tc.name: getProfileByExtensionAbilityInvalidModuleCall
* @tc.desc: Check the invalid moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidModuleCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByExtensionAbilityInvalidModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034
* @tc.name: getProfileByExtensionAbilityEmptyModuleCall
* @tc.desc: Check the empty moduleName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyModuleCall', 0, async function (done) {
manager.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST);
console.error('[getProfileByExtensionAbilityEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012
* @tc.name: getProfileByExtensionAbilityInvalidAbilityPro
* @tc.desc: Check the invalid abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidAbilityPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbilityInvalidAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbilityInvalidAbilityPro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029
* @tc.name: getProfileByExtensionAbilityEmptyAbilityPro
* @tc.desc: Check the empty abilityName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyAbilityPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME).then(data => {
console.info("getProfileByExtensionAbilityEmptyAbilityPro success" + JSON.stringify(data))
expect(data).assertFail()
done()
}).catch(err => {
console.info("getProfileByExtensionAbilityEmptyAbilityPro failed" + JSON.stringify(err))
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST)
done()
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022
* @tc.name: getProfileByExtensionAbilityInvalidAbilityCall
* @tc.desc: Check the invalid abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidAbilityCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByExtensionAbilityInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029
* @tc.name: getProfileByExtensionAbilityEmptyAbilityCall
* @tc.desc: Check the empty abilityName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyAbilityCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => {
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
console.error('[getProfileByExtensionAbilityEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024
* @tc.name: getProfileByExtensionAbilityCallback
* @tc.desc: Check the valid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityCallback', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => {
console.info('[getProfileByExtensionAbilityCallback] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026
* @tc.name: getProfileByExtensionAbilityInvalidMetaDataCall
* @tc.desc: Check the invalid metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidMetaDataCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => {
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
console.error('[getProfileByExtensionAbilityInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036
* @tc.name: getProfileByExtensionAbilityEmptyMetaDataCall
* @tc.desc: Check the empty metadataName (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyMetaDataCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => {
console.info('[getProfileByExtensionAbilityEmptyMetaDataCall] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002
* @tc.name: getProfileByExtensionAbilityPromise
* @tc.desc: Check the valid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityPromise', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => {
console.info('[getProfileByExtensionAbilityPromise] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004
* @tc.name: getProfileByExtensionAbilityInvalidMetaDataPro
* @tc.desc: Check the invalid metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityInvalidMetaDataPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => {
console.info('[getProfileByExtensionAbilityInvalidMetaDataPro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect().assertFail();
done()
}).catch(err => {
console.error('[getProfileByExtensionAbilityInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030
* @tc.name: getProfileByExtensionAbilityEmptyMetaDataPro
* @tc.desc: Check the empty metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityEmptyMetaDataPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '').then(data => {
console.info('[getProfileByExtensionAbilityEmptyMetaDataPro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009
* @tc.name: getProfileByExtensionAbilityNoMetaDataPro
* @tc.desc: without metadataName (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNoMetaDataPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME).then(data => {
console.info('[getProfileByExtensionAbilityNoMetaDataPro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048
* @tc.name: getProfileByExtensionAbilityNoProfilePro
* @tc.desc: no profile configured under the ability (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNoProfilePro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME1).then(data => {
console.info('[getProfileByExtensionAbilityNoProfilePro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045
* @tc.name: getProfileByExtensionAbilityNotPrefixPro
* @tc.desc: resource has no prefix '$profile:' (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNotPrefixPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => {
console.info('[getProfileByExtensionAbilityNotPrefixPro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044
* @tc.name: getProfileByExtensionAbilityNotPrefixCall
* @tc.desc: resource has no prefix '$profile:' (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNotPrefixCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => {
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
console.error('[getProfileByExtensionAbilityNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err));
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007
* @tc.name: getProfileByExtensionAbilityNotSuffixPro
* @tc.desc: profile is .txt suffix (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNotSuffixPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => {
console.info('[getProfileByExtensionAbilityNotSuffixPro] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040
* @tc.name: getProfileByExtensionAbilityNotSuffixCall
* @tc.desc: profile is .txt suffix (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNotSuffixCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => {
console.info('[getProfileByExtensionAbilityNotSuffixCall] getProfileByExtensionAbility callback data is: ' + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008
* @tc.name: getProfileByExtensionAbilityNoJsonPro
* @tc.desc: profile is invalid json format (by promise)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNoJsonPro', 0, async function (done) {
await manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => {
console.info('[getProfileByExtensionAbilityNoJsonPro] data is: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch(err => {
console.error('[getProfileByExtensionAbilityNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
})
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046
* @tc.name: getProfileByExtensionAbilityNoJsonCall
* @tc.desc: profile is invalid json format (by callback)
* @tc.level 0
*/
it('getProfileByExtensionAbilityNoJsonCall', 0, async function (done) {
manager.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => {
console.info('[getProfileByExtensionAbilityNoJsonCall] err: ' + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
});
})
})
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/GetSecondModule.test.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bundle from '@ohos.bundle.bundleManager';
import { describe, beforeAll, it, expect } from '@ohos/hypium'
export default function GetSecondModuleTest() {
describe('getSecondModuleTest', function () {
/**
* @tc.number SUB_BMS_APPINFO_QUERY_0138
* @tc.name GetSecondModuleTest
* @tc.desc Test the bundleManager secondary module
*/
it('GetSecondModuleTest', 0, async function (done) {
let bundleInfo = await bundle.getBundleInfoForSelf(
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundle.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION)
let applicationInfoTest: bundle.ApplicationInfo = bundleInfo.appInfo;
expect(typeof (applicationInfoTest.name)).assertEqual('string');
let metadataTest: bundle.Metadata = bundleInfo.hapModulesInfo[0].metadata[0];
expect(typeof (metadataTest.name)).assertEqual('string');
let bundleInfoTest: bundle.BundleInfo = bundleInfo;
expect(typeof (bundleInfoTest.name)).assertEqual('string');
let usedSceneTest: bundle.UsedScene = bundleInfo.reqPermissionDetails[0].usedScene
expect(typeof (usedSceneTest.abilities[0])).assertEqual('string');
let reqPermissionDetailsTest: bundle.ReqPermissionDetail = bundleInfo.reqPermissionDetails[0]
expect(typeof (reqPermissionDetailsTest.name)).assertEqual('string');
let signatureInfoTest: bundle.SignatureInfo = bundleInfo.signatureInfo;
expect(typeof (signatureInfoTest.appId)).assertEqual('string');
let hapModuleInfoTest: bundle.HapModuleInfo = bundleInfo.hapModulesInfo[0];
expect(typeof (hapModuleInfoTest.name)).assertEqual('string');
let abilityInfoTest: bundle.AbilityInfo = bundleInfo.hapModulesInfo[0].abilitiesInfo[0];
expect(typeof (abilityInfoTest.bundleName)).assertEqual('string');
let windowSizeTest: bundle.WindowSize = bundleInfo.hapModulesInfo[0].abilitiesInfo[0].windowSize;
expect(windowSizeTest.maxWindowRatio).assertEqual(0);
let extensionAbilityInfoTest: bundle.ExtensionAbilityInfo = bundleInfo.hapModulesInfo[0].extensionAbilitiesInfo[0];
expect(typeof (extensionAbilityInfoTest.bundleName)).assertEqual('string');
let elementNameExample = {
deviceId: "123456789",
bundleName: "bundleName",
moduleName:"moduleName",
abilityName: "abilityName",
uri:"uri",
shortName:"shortName"
}
let elementNameTest: bundle.ElementName = elementNameExample;
expect(elementNameTest.deviceId).assertEqual("123456789");
expect(elementNameTest.bundleName).assertEqual("bundleName");
expect(elementNameTest.moduleName).assertEqual("moduleName");
expect(elementNameTest.abilityName).assertEqual("abilityName");
expect(elementNameTest.uri).assertEqual("uri");
expect(elementNameTest.shortName).assertEqual("shortName");
done();
})
})
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
761c6fdb
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import getProfileByAbility from './GetProfileByAbility.test.ets';
import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets';
import getBundleInfoForSelf from './GetBundleInfoForSelf.test.ets';
import getSecondModuleTest from './GetSecondModule.test.ets';
export default function testsuite() {
getProfileByAbility();
getProfileByExtensionAbility();
getBundleInfoForSelf();
getSecondModuleTest();
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/ets/test/Utils.ets
0 → 100644
浏览文件 @
761c6fdb
/**
* 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 class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout((data) => {
resolve(data)
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/module.json
0 → 100644
浏览文件 @
761c6fdb
{
"module"
:
{
"name"
:
"feature"
,
"type"
:
"feature"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:testModule_entry_dsc"
,
"mainElement"
:
"ohos.acts.atomic.service.test.MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
true
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"ohos.acts.atomic.service.test.MainAbility1"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:testModule_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"singleton"
,
"orientation"
:
"portrait"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:[
"entity.system.home"
]
}
]
}
]
}
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
761c6fdb
{
"string"
:
[
{
"name"
:
"testModule_entry_dsc"
,
"value"
:
"i am an entry for testModule"
},
{
"name"
:
"testModule_entry_main"
,
"value"
:
"the testModule entry ability"
},
{
"name"
:
"entry_label"
,
"value"
:
"ActsContextTest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"my whether"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
},
{
"name"
:
"form_FormAbility_desc"
,
"value"
:
"form_description"
},
{
"name"
:
"form_FormAbility_label"
,
"value"
:
"form_label"
},
{
"name"
:
"permission_reason"
,
"value"
:
"Need permission"
}
]
}
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
761c6fdb
15.1 KB
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/form_config.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/form_config1.txt
0 → 100644
浏览文件 @
761c6fdb
{"src": ["MainAbility/pages/index/index","MainAbility/pages/second/second"]}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/invalid.txt
0 → 100644
浏览文件 @
761c6fdb
{
"src": [
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/entry/src/main/resources/base/profile/shortcuts_config.json
0 → 100644
浏览文件 @
761c6fdb
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
bundlemanager/bundle_standard/bundlemanager/actsbmsatomicserviceetstest/bmsatomicserviceone/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
761c6fdb
文件已添加
bundlemanager/bundle_standard/bundlemanager/actsbundlemanagerstagetest/entry/src/main/ets/test/GetBundleInfoForSelf.test.ets
浏览文件 @
761c6fdb
...
@@ -94,6 +94,7 @@ export default function getBundleInfoForSelf() {
...
@@ -94,6 +94,7 @@ export default function getBundleInfoForSelf() {
await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then(data => {
await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then(data => {
console.info("getBundleInfoForSelfApplicationPro" + JSON.stringify(data.appInfo));
console.info("getBundleInfoForSelfApplicationPro" + JSON.stringify(data.appInfo));
checkCommonBundleInfo(data);
checkCommonBundleInfo(data);
expect(data.appInfo.bundleType).assertEqual(bundle.BundleType.APP);
expect(data.appInfo.name).assertEqual(BUNDLE_NAME);
expect(data.appInfo.name).assertEqual(BUNDLE_NAME);
expect(data.appInfo.description).assertEqual("$string:description_application");
expect(data.appInfo.description).assertEqual("$string:description_application");
expect(data.appInfo.descriptionId).assertLarger(0);
expect(data.appInfo.descriptionId).assertLarger(0);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录