diff --git a/packing_tool/frameworks/test/unittest/json/module_json_test/module_json_test.cpp b/packing_tool/frameworks/test/unittest/json/module_json_test/module_json_test.cpp index d1f264366720343e6e5406a3dd9f3f351087a3e2..0f1caad883966d6352d73a3bd2f65b8e17d45015 100755 --- a/packing_tool/frameworks/test/unittest/json/module_json_test/module_json_test.cpp +++ b/packing_tool/frameworks/test/unittest/json/module_json_test/module_json_test.cpp @@ -531,6 +531,1022 @@ const std::string TSAN_ENABLED_TEST_JSON_STRING = "{" "\"asanEnabled\": true" "}" "}"; + +const std::string MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING = "{" + "\"app\": {" + "\"vendor\": \"\"," + "\"versionCode\": \"test\"," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": true," + "\"compileSdkVersion\": true," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": true," + "\"debug\": \"test_bundle_name\"," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": true," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": \"test_multiAppMode\"," + "\"tsanEnabled\": \"test_multiAppMode\"," + "\"compressNativeLibs\": \"test_multiAppMode\"," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_VERSIONBYAPPOBJ_VERSIONNAME_TEST_STRING = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": 1000000," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": \"test_compileSdkVersion\"," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"name\": true," + "\"type\": true," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": true," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_VERSIONBYAPPOBJ_MINIVERSIONCODE_TEST_STRING = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": \"test_compileSdkVersion\"," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": \"test_bundle_name\"" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": \"test_bundle_name\"," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"name\": \"entry\"," + "\"type\": \"entry\"," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deliveryWithInstall\": true," + "\"installationFree\": \"test_version_name\"," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": false," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_TEST_ONLYAPP = "{" +"\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}" +"}"; + +const std::string MODULE_JSON_TEST_NOMODULETYPE = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"name\": \"entry\"," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_STRING_NOVENDOR = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": false," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"name\": \"entry\"," + "\"type\": \"entry\"," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_STRING_NOMODULENAME = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"type\": \"entry\"," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": [" + "{" + "\"uri\": \"test_uri1\"" + "}," + "{" + "\"uri\": \"test_uri2\"" + "}" + "]," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + +const std::string MODULE_JSON_STRING_NOPROXY_DATAS = "{" + "\"app\": {" + "\"bundleName\": \"test_bundle_name\"," + "\"bundleType\": \"atomicService\"," + "\"vendor\": \"\"," + "\"versionCode\": 1000000," + "\"versionName\": \"test_version_name\"," + "\"icon\": \"media:app_icon\"," + "\"label\": \"string:app_name\"," + "\"apiReleaseType\": \"Canary\"," + "\"compileSdkVersion\": \"test_compileSdkVersion\"," + "\"targetAPIVersion\": 10," + "\"minAPIVersion\": 10," + "\"compileSdkType\": \"OpenHarmony\"," + "\"debug\": true," + "\"iconId\": 16777217," + "\"labelId\": 16777216," + "\"version\": {" + "\"code\": 666," + "\"name\": \"test_version\"," + "\"minCompatibleVersionCode\": 555" + "}," + "\"apiVersion\": {" + "\"compileSdkType\": \"OpenHarmony\"," + "\"compileSdkVersion\": \"test_apiVersion_compileSdkVersion\"," + "\"releaseType\": \"test_apiVersion_release\"," + "\"compatible\": 7," + "\"target\": 10" + "}," + "\"targetBundleName\": \"test_app_targetBundleName\"," + "\"multiAppMode\": {" + "\"multiAppModeType\": \"test_multiAppMode\"," + "\"maxCount\": 9" + "}," + "\"generateBuildHash\": true," + "\"minCompatibleVersionCode\": 99," + "\"asanEnabled\": true," + "\"tsanEnabled\": false," + "\"compressNativeLibs\": true," + "\"targetPriority\": 5" + "}," + "\"module\": {" + "\"name\": \"entry\"," + "\"type\": \"entry\"," + "\"description\": \"string:module_desc\"," + "\"mainElement\": \"EntryAbility\"," + "\"deviceTypes\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"deliveryWithInstall\": true," + "\"installationFree\": true," + "\"pages\": \"profile:main_pages\"," + "\"abilities\": [" + "{" + "\"name\": \"EntryAbility\"," + "\"moduleName\": \"test_module_name\"," + "\"srcEntry\": \"./ets/entryability/EntryAbility.ts\"," + "\"description\": \"string:EntryAbility_desc\"," + "\"icon\": \"media:icon\"," + "\"label\": \"string:EntryAbility_label\"," + "\"startWindowIcon\": \"media:icon\"," + "\"startWindowBackground\": \"color:start_window_background\"," + "\"exported\": true," + "\"skills\": [" + "{" + "\"entities\": [\"entity.system.home\"]," + "\"actions\": [\"action.system.home\"]" + "}" + "]," + "\"descriptionId\": 16777218," + "\"iconId\": 16777222," + "\"labelId\": 16777219," + "\"startWindowIconId\": 16777222," + "\"startWindowBackgroundId\": 16777221," + "\"continueType\":[]" + "}" + "]," + "\"virtualMachine\": \"test_virtualMachine\"," + "\"compileMode\": \"esmodule\"," + "\"dependencies\": [" + "{" + "\"bundleName\": \"test_modules_dependency_1\"," + "\"moduleName\": \"entry_1\"" + "}," + "{" + "\"bundleName\": \"test_modules_dependency_2\"," + "\"moduleName\": \"entry_1\"" + "}" + "]," + "\"descriptionId\": 16777220," + "\"distro\": {" + "\"installationFree\": false," + "\"moduleType\": \"entry\"," + "\"moduleName\": \"test_module_name\"" + "}," + "\"preloads\": [" + "{" + "\"name\": \"test_name_1\"," + "\"moduleName\": \"test_module_name_1\"" + "}" + "]," + "\"package\": \"test_package\"," + "\"deviceType\": [" + "\"default\"," + "\"tablet\"" + "]," + "\"targetModuleName\": \"test_module_targetBundleName\"," + "\"targetPriority\": 6," + "\"proxyDatas\": false," + "\"atomicService\": {" + "\"preloads\": [" + "{" + "\"atomicServiceObj\": \"test_atomicService\"" + "}" + "]" + + "}," + "\"metadata\": [" + "{" + "\"name\": \"test_metadata\"," + "\"value\": \"test_value\"," + "\"resource\": \"test_resource\"" + "}" + "]," + "\"extensionAbilities\": [" + "{" + "\"name\": \"test_extension_abilities\"" + "}" + "]" + "}," + "\"deviceConfig\": {" + "\"default\": {\"debug\": true}" + "}" +"}"; + } class ModuleJsonTest : public testing::Test { public: @@ -4575,297 +5591,627 @@ HWTEST_F(ModuleJsonTest, GetMultiAppModeByAppObj_0200, Function | MediumTest | L } /* - * @tc.name: GetMultiAppModeByAppObj_0300 - * @tc.desc: test GetMultiAppModeByAppObj + * @tc.name: GetMultiAppModeByAppObj_0300 + * @tc.desc: test GetMultiAppModeByAppObj + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, GetMultiAppModeByAppObj_0300, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_MULTI_APP_MODE_NUMBER_TEST_JSON_STRING)); + std::unique_ptr appObj; + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + MultiAppMode multiAppMode; + EXPECT_TRUE(moduleJson.GetMultiAppModeByAppObj(appObj, multiAppMode)); +} + +/* + * @tc.name: IsExistedStageRequestPermissions_0200 + * @tc.desc: test IsExistedStageRequestPermissions + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsExistedStageRequestPermissions_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.IsExistedStageRequestPermissions()); +} + +/* + * @tc.name: IsExistedStageModuleTargetPriority_0200 + * @tc.desc: test IsExistedStageModuleTargetPriority + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsExistedStageModuleTargetPriority_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.IsExistedStageModuleTargetPriority()); +} + +/* + * @tc.name: IsExistedStageAppTargetPriority_0200 + * @tc.desc: test IsExistedStageAppTargetPriority + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsExistedStageAppTargetPriority_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.IsExistedStageAppTargetPriority()); +} + +/* + * @tc.name: IsModuleAtomicServiceValid_0200 + * @tc.desc: test IsModuleAtomicServiceValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); +} + +/* + * @tc.name: IsModuleAtomicServiceValid_0300 + * @tc.desc: test IsModuleAtomicServiceValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0300, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_NAME_TEST_JSON_STRING)); + EXPECT_TRUE(moduleJson.IsModuleAtomicServiceValid()); +} + +/* + * @tc.name: IsModuleAtomicServiceValid_0400 + * @tc.desc: test IsModuleAtomicServiceValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0400, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_BUNDLE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); +} + +/* + * @tc.name: IsModuleAtomicServiceValid_0500 + * @tc.desc: test IsModuleAtomicServiceValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0500, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(APP_BUNDLE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); +} + +/* + * @tc.name: CheckEntryInAtomicService_0200 + * @tc.desc: test CheckEntryInAtomicService + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); +} + +/* + * @tc.name: CheckEntryInAtomicService_0300 + * @tc.desc: test CheckEntryInAtomicService + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0300, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_NAME_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); +} + +/* + * @tc.name: CheckEntryInAtomicService_0400 + * @tc.desc: test CheckEntryInAtomicService + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0400, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_TYPE_ERROE_TEST_JSON_STRING)); + EXPECT_TRUE(moduleJson.CheckEntryInAtomicService()); +} + +/* + * @tc.name: CheckEntryInAtomicService_0500 + * @tc.desc: test CheckEntryInAtomicService + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0500, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0200 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0300 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0300, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_MULTI_APP_MODE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0400 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0400, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(ABILITY_CONTINUE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0500 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0500, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_BUNDLE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0600 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0600, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(APP_BUNDLE_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckAtomicServiceInstallationFree_0700 + * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0700, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(SHARED_TYPE_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); +} + +/* + * @tc.name: CheckStageAsanTsanEnabledValid_0200 + * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0200, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); +} + +/* + * @tc.name: CheckStageAsanTsanEnabledValid_0300 + * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0300, Function | MediumTest | Level1) +{ + OHOS::AppPackingTool::ModuleJson moduleJson; + EXPECT_TRUE(moduleJson.ParseFromString(NO_BOOL_ASAN_ENABLED_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); +} + +/* + * @tc.name: CheckStageAsanTsanEnabledValid_0400 + * @tc.desc: test CheckStageAsanTsanEnabledValid * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, GetMultiAppModeByAppObj_0300, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0400, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_MULTI_APP_MODE_NUMBER_TEST_JSON_STRING)); - std::unique_ptr appObj; - EXPECT_TRUE(moduleJson.GetAppObject(appObj)); - MultiAppMode multiAppMode; - EXPECT_TRUE(moduleJson.GetMultiAppModeByAppObj(appObj, multiAppMode)); + EXPECT_TRUE(moduleJson.ParseFromString(NO_ASAN_ENABLED_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); } /* - * @tc.name: IsExistedStageRequestPermissions_0200 - * @tc.desc: test IsExistedStageRequestPermissions + * @tc.name: CheckStageAsanTsanEnabledValid_0500 + * @tc.desc: test CheckStageAsanTsanEnabledValid * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsExistedStageRequestPermissions_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0500, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.IsExistedStageRequestPermissions()); + EXPECT_TRUE(moduleJson.ParseFromString(NO_TSAN_ENABLED_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); } /* - * @tc.name: IsExistedStageModuleTargetPriority_0200 - * @tc.desc: test IsExistedStageModuleTargetPriority + * @tc.name: CheckStageAsanTsanEnabledValid_0600 + * @tc.desc: test CheckStageAsanTsanEnabledValid * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsExistedStageModuleTargetPriority_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0600, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.IsExistedStageModuleTargetPriority()); + EXPECT_TRUE(moduleJson.ParseFromString(TSAN_ENABLED_TEST_JSON_STRING)); + EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); } /* - * @tc.name: IsExistedStageAppTargetPriority_0200 - * @tc.desc: test IsExistedStageAppTargetPriority + * @tc.name: SetStageVersionCode + * @tc.desc: test set stage version code * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsExistedStageAppTargetPriority_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, SetStageVersionCode_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.IsExistedStageAppTargetPriority()); + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING)); + int32_t versionCode = 99; + EXPECT_FALSE(moduleJson.SetStageVersionCode(versionCode)); } /* - * @tc.name: IsModuleAtomicServiceValid_0200 - * @tc.desc: test IsModuleAtomicServiceValid + * @tc.name: SetStageVersionName + * @tc.desc: test set stage version name * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, SetStageVersionName_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING)); + std::string versionName = "1.0.0"; + EXPECT_FALSE(moduleJson.SetStageVersionName(versionName)); } + /* - * @tc.name: IsModuleAtomicServiceValid_0300 - * @tc.desc: test IsModuleAtomicServiceValid + * @tc.name: GetStageVersionByAppObj + * @tc.desc: test get stage version by obj * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0300, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageVersionByAppObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_NAME_TEST_JSON_STRING)); - EXPECT_TRUE(moduleJson.IsModuleAtomicServiceValid()); + std::unique_ptr appObj; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING)); + moduleJson.GetAppObject(appObj); + Version version; + EXPECT_FALSE(moduleJson.GetStageVersionByAppObj(appObj, version)); } /* - * @tc.name: IsModuleAtomicServiceValid_0400 - * @tc.desc: test IsModuleAtomicServiceValid + * @tc.name: GetStageVersionByAppObj + * @tc.desc: test get stage version by obj * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0400, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageVersionByAppObj_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_BUNDLE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); + std::unique_ptr appObj; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + moduleJson.GetAppObject(appObj); + Version version; + EXPECT_FALSE(moduleJson.GetStageVersionByAppObj(appObj, version)); } /* - * @tc.name: IsModuleAtomicServiceValid_0500 - * @tc.desc: test IsModuleAtomicServiceValid + * @tc.name: GetStageVersionByAppObj + * @tc.desc: test get stage version by obj * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, IsModuleAtomicServiceValid_0500, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageVersionByAppObj_0400, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(APP_BUNDLE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.IsModuleAtomicServiceValid()); + std::unique_ptr appObj; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONNAME_TEST_STRING)); + moduleJson.GetAppObject(appObj); + Version version; + EXPECT_FALSE(moduleJson.GetStageVersionByAppObj(appObj, version)); } /* - * @tc.name: CheckEntryInAtomicService_0200 - * @tc.desc: test CheckEntryInAtomicService + * @tc.name: GetStageVersionByAppObj + * @tc.desc: test get stage version by obj * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageVersionByAppObj_0500, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); + std::unique_ptr appObj; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_MINIVERSIONCODE_TEST_STRING)); + moduleJson.GetAppObject(appObj); + Version version; + EXPECT_FALSE(moduleJson.GetStageVersionByAppObj(appObj, version)); } /* - * @tc.name: CheckEntryInAtomicService_0300 - * @tc.desc: test CheckEntryInAtomicService + * @tc.name: GetStageInstallationFree + * @tc.desc: test get stage installation free * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0300, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageInstallationFree_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_NAME_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING_NOTHING)); + bool installationFree = true; + EXPECT_FALSE(moduleJson.GetStageInstallationFree(installationFree)); + EXPECT_EQ(installationFree, true); } /* - * @tc.name: CheckEntryInAtomicService_0400 - * @tc.desc: test CheckEntryInAtomicService + * @tc.name: GetStageInstallationFreeByModuleObj + * @tc.desc: test get stage installation free * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0400, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageInstallationFreeByModuleObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(MODULE_TYPE_ERROE_TEST_JSON_STRING)); - EXPECT_TRUE(moduleJson.CheckEntryInAtomicService()); + std::unique_ptr moduleObj = nullptr; + bool installationFree = true; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_MINIVERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetModuleObject(moduleObj)); + EXPECT_FALSE(moduleJson.GetStageInstallationFreeByModuleObj(moduleObj, installationFree)); + EXPECT_EQ(installationFree, false); } /* - * @tc.name: CheckEntryInAtomicService_0500 - * @tc.desc: test CheckEntryInAtomicService + * @tc.name: GetStageModuleApiVersion + * @tc.desc: test get stage module api version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckEntryInAtomicService_0500, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleApiVersion_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_ABILITY_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckEntryInAtomicService()); + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING_NOTHING)); + ModuleApiVersion moduleApiVersion; + EXPECT_FALSE(moduleJson.GetStageModuleApiVersion(moduleApiVersion)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0200 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleApiVersionByAppObj + * @tc.desc: test get stage module api version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleApiVersionByAppObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::unique_ptr appObj = nullptr; + ModuleApiVersion moduleApiVersion; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_MINIVERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageModuleApiVersionByAppObj(appObj, moduleApiVersion)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0300 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleApiVersionByAppObj + * @tc.desc: test get stage module api version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0300, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleApiVersionByAppObj_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_MULTI_APP_MODE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::unique_ptr appObj = nullptr; + ModuleApiVersion moduleApiVersion; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_MINIVERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageModuleApiVersionByAppObj(appObj, moduleApiVersion)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0400 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleApiVersionByAppObj + * @tc.desc: test get stage module api version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0400, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleApiVersionByAppObj_0400, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(ABILITY_CONTINUE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::unique_ptr appObj = nullptr; + ModuleApiVersion moduleApiVersion; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONNAME_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageModuleApiVersionByAppObj(appObj, moduleApiVersion)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0500 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleApiVersionByAppObj + * @tc.desc: test get stage module api version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0500, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleApiVersionByAppObj_0500, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_BUNDLE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::unique_ptr appObj = nullptr; + ModuleApiVersion moduleApiVersion; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageModuleApiVersionByAppObj(appObj, moduleApiVersion)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0600 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleName + * @tc.desc: test get stage module name * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0600, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleName_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(APP_BUNDLE_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::string stageModuleName = ""; + moduleJson.Release(); + EXPECT_FALSE(moduleJson.GetStageModuleName(stageModuleName)); } /* - * @tc.name: CheckAtomicServiceInstallationFree_0700 - * @tc.desc: test CheckAtomicServiceInstallationFree + * @tc.name: GetStageModuleNameByModuleObj + * @tc.desc: test get stage module name * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckAtomicServiceInstallationFree_0700, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageModuleNameByModuleObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(SHARED_TYPE_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckAtomicServiceInstallationFree()); + std::unique_ptr moduleObj = nullptr; + std::string stageModuleName = ""; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONNAME_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetModuleObject(moduleObj)); + EXPECT_FALSE(moduleJson.GetStageModuleNameByModuleObj(moduleObj, stageModuleName)); } /* - * @tc.name: CheckStageAsanTsanEnabledValid_0200 - * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.name: GetStageCompileSdkTypeByAppObj + * @tc.desc: test get stage compile sdk type * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0200, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageCompileSdkTypeByAppObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); + std::unique_ptr appObj = nullptr; + std::string compileSdkType = ""; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageCompileSdkTypeByAppObj(appObj, compileSdkType)); } /* - * @tc.name: CheckStageAsanTsanEnabledValid_0300 - * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.name: GetStageCompileSdkVersionByAppObj + * @tc.desc: test get stage compile sdk version * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0300, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageCompileSdkVersionByAppObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_BOOL_ASAN_ENABLED_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); + std::unique_ptr appObj = nullptr; + std::string compileSdkVersion = ""; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + EXPECT_TRUE(moduleJson.GetAppObject(appObj)); + EXPECT_FALSE(moduleJson.GetStageCompileSdkVersionByAppObj(appObj, compileSdkVersion)); } /* - * @tc.name: CheckStageAsanTsanEnabledValid_0400 - * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.name: GetStageDebugByAppObj + * @tc.desc: test get stage debug * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0400, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageDebugByAppObj_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_ASAN_ENABLED_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); + std::unique_ptr appObj = nullptr; + bool debug = true; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + EXPECT_FALSE(moduleJson.GetStageDebugByAppObj(appObj, debug)); + EXPECT_EQ(debug, true); } /* - * @tc.name: CheckStageAsanTsanEnabledValid_0500 - * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.name: GetStageEntry + * @tc.desc: test get stage entry * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0500, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageEntry_0200, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(NO_TSAN_ENABLED_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); + std::list deviceTypes; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_TEST_STRING_NOTHING)); + EXPECT_FALSE(moduleJson.GetStageEntry(deviceTypes)); + EXPECT_EQ(deviceTypes.size(), 0); } /* - * @tc.name: CheckStageAsanTsanEnabledValid_0600 - * @tc.desc: test CheckStageAsanTsanEnabledValid + * @tc.name: GetStageEntry + * @tc.desc: test get stage entry * @tc.type: FUNC * @tc.require: */ -HWTEST_F(ModuleJsonTest, CheckStageAsanTsanEnabledValid_0600, Function | MediumTest | Level1) +HWTEST_F(ModuleJsonTest, GetStageEntry_0300, Function | MediumTest | Level1) { OHOS::AppPackingTool::ModuleJson moduleJson; - EXPECT_TRUE(moduleJson.ParseFromString(TSAN_ENABLED_TEST_JSON_STRING)); - EXPECT_FALSE(moduleJson.CheckStageAsanTsanEnabledValid()); + std::list deviceTypes; + moduleJson.Release(); + EXPECT_TRUE(moduleJson.ParseFromString(MODULE_JSON_VERSIONBYAPPOBJ_VERSIONCODE_TEST_STRING)); + EXPECT_FALSE(moduleJson.GetStageEntry(deviceTypes)); + EXPECT_EQ(deviceTypes.size(), 0); } }