diff --git a/BUILD.gn b/BUILD.gn
index 0ce4679e62519e9860ab5a60c557da0678a0f3d1..24bd61d772822da6cbbd891acd5ad17169b32556 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -11,13 +11,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-group("cust_components") {
+group("config_policy_components") {
if (os_level == "standard") {
deps = [
- "//base/global/cust_lite/frameworks/cust_lite:cust_util",
- "//base/global/cust_lite/interfaces/js/kits:configpolicy",
+ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util",
+ "//base/customization/config_policy/interfaces/kits/js:configpolicy",
]
} else {
- deps = [ "//base/global/cust_lite/frameworks/cust_lite:cust_util" ]
+ deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ]
}
}
diff --git a/README.md b/README.md
index b98b6b4bacb950aafe99577dbf19afedc0713799..915a9365dcde983881092f3f9ab6a0e03ceeb87f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# cust
+# Config Policy
- [Introduction](#section1881113251316)
- [Directory Structure](#section196561842161316)
@@ -15,15 +15,15 @@ The customization framework, namely, cust, provides APIs for each service module
The directory structure for the customization framework is as follows:
```
-/base/global/
-├── cust_lite # Code repository for the customization framework
+/base/customization/
+├── config_policy # Code repository for the customization framework
│ ├── frameworks # Core code of the customization framework
-│ │ ├── cust_lite # Customization framework
-│ │ │ ├── src # Implementation code
-│ │ │ └── test # Test code
+│ │ ├── config_policy # Customization framework
+│ │ │ └── src # Implementation code
│ ├── interfaces # APIs of the customization framework
│ │ ├── innerkits # APIs of the customization framework for internal subsystems
-│ │ └── js # JavaScript APIs
+│ │ └── kits # JavaScript APIs
+│ └── test # Test code
```
## Usage
@@ -32,7 +32,7 @@ Call the APIs of the customization framework to obtain the configuration directo
```
#include
-#include "cust_utils.h"
+#include "config_policy_utils.h"
const char *testPathSuffix = "user.xml"; // Set the name of the configuration file.
char buf[MAX_PATH_LEN];
@@ -42,14 +42,3 @@ char *filePath = GetOneCfgFile(testPathSuffix, CUST_TYPE_CONFIG, buf, MAX_PATH_L
## Constraints
**Programming language**: C/C++
-
-## Repositories Involved
-
-[Globalization subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/globalization.md)
-
-[global\_resmgr\_lite](https://gitee.com/openharmony/global_resmgr_lite/blob/master/README.md)
-
-[global\_i18n\_lite](https://gitee.com/openharmony/global_i18n_lite/blob/master/README.md)
-
-**global\_cust\_lite**
-
diff --git a/README_zh.md b/README_zh.md
index 0fd2e61978e978ced3794b8fc65200963a6a18e4..9b069b7dbf0325512c1eddd233a5e1ecf95ba39c 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -15,15 +15,15 @@
定制框架组件源代码目录结构如下所示:
```
-/base/global/
-├── cust_lite # 定制框架代码仓
+/base/customization/
+├── config_policy # 定制框架代码仓
│ ├── frameworks # 定制框架核心代码
-│ │ ├── cust_lite # 定制框架模块
-│ │ │ ├── src # 实现代码
-│ │ │ └── test # 测试代码
+│ │ ├── config_policy # 定制框架模块
+│ │ │ └── src # 实现代码
│ ├── interfaces # 定制框架接口
│ │ ├── innerkits # 定制框架子系统间接口
-│ │ └── js # 定制框架JavaScript接口
+│ │ └── kits # 定制框架JavaScript接口
+│ └── test # 测试代码
```
## 说明
@@ -32,7 +32,7 @@
```
#include
-#include "cust_utils.h"
+#include "config_policy_utils.h"
const char *testPathSuffix = "user.xml"; //设置配置文件名称
char buf[MAX_PATH_LEN];
@@ -42,14 +42,3 @@ char *filePath = GetOneCfgFile(testPathSuffix, CUST_TYPE_CONFIG, buf, MAX_PATH_L
## 约束
**语言限制**:C/C++语言
-
-## 相关仓
-
-[全球化子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%85%A8%E7%90%83%E5%8C%96%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
-
-[global\_resmgr\_lite](https://gitee.com/openharmony/global_resmgr_lite/blob/master/README_zh.md)
-
-[global\_i18n\_lite](https://gitee.com/openharmony/global_i18n_lite/blob/master/README_zh.md)
-
-**global\_cust\_lite**
-
diff --git a/bundle.json b/bundle.json
index 4480c0ab3e59d5369945552878efd32a6e6c033d..b89ab5b451bbd17e49ca941ec10c8c9967f53888 100644
--- a/bundle.json
+++ b/bundle.json
@@ -1,17 +1,17 @@
{
- "name": "@ohos/global_cust_lite",
+ "name": "@ohos/customization_config_policy",
"description": "The customization framework, namely, cust, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths.",
"version": "3.1",
"license": "Apache License 2.0",
"publishAs": "code-segment",
"segment": {
- "destPath": "base/global/cust_lite"
+ "destPath": "base/customization/config_policy"
},
"dirs": {},
"scripts": {},
"component": {
- "name": "cust_lite",
- "subsystem": "global",
+ "name": "config_policy",
+ "subsystem": "customization",
"syscap": [ "SystemCapability.Customization.ConfigPolicy" ],
"features": [],
"adapted_system_type": [ "standard", "small" ],
@@ -28,21 +28,21 @@
},
"build": {
"sub_component": [
- "//base/global/cust_lite:cust_components"
+ "//base/customization/config_policy:config_policy_components"
],
"inner_kits": [
{
"header": {
- "header_base": "//base/global/cust_lite/interfaces/innerkits/include",
+ "header_base": "//base/customization/config_policy/interfaces/innerkits/include",
"header_files": [
- "cust_utils.h"
+ "config_policy_utils.h"
]
},
- "name": "//base/global/cust_lite/frameworks/cust_lite:cust_util"
+ "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util"
}
],
"test": [
- "//base/global/cust_lite/frameworks/cust_lite/test:CustUtilsTest"
+ "//base/customization/config_policy/test/unittest:ConfigPolicyUtilsTest"
]
}
}
diff --git a/frameworks/cust_lite/BUILD.gn b/frameworks/config_policy/BUILD.gn
similarity index 67%
rename from frameworks/cust_lite/BUILD.gn
rename to frameworks/config_policy/BUILD.gn
index 13b56d70dc917b3972574e8c959709e328bb46a5..de798194f3aae199ca5abea00efa990ffab9ef52 100644
--- a/frameworks/cust_lite/BUILD.gn
+++ b/frameworks/config_policy/BUILD.gn
@@ -17,29 +17,26 @@ if (defined(ohos_lite)) {
import("//build/ohos.gni")
}
-cust_sources = [ "src/cust_utils.c" ]
-config("cust_config") {
+config_policy_sources = [ "src/config_policy_utils.c" ]
+config("config_policy_config") {
include_dirs = [
- "//base/global/cust_lite/interfaces/innerkits/include",
+ "//base/customization/config_policy/interfaces/innerkits/include",
"//third_party/bounds_checking_function/include",
]
}
if (defined(ohos_lite)) {
- shared_library("cust_util") {
- sources = cust_sources
- public_configs = [ ":cust_config" ]
+ shared_library("configpolicy_util") {
+ sources = config_policy_sources
+ public_configs = [ ":config_policy_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
}
- lite_component("global_cust_lite") {
- features = [ ":cust_util" ]
- }
} else {
- ohos_shared_library("cust_util") {
- sources = cust_sources
- public_configs = [ ":cust_config" ]
+ ohos_shared_library("configpolicy_util") {
+ sources = config_policy_sources
+ public_configs = [ ":config_policy_config" ]
deps = [ "//third_party/bounds_checking_function:libsec_static" ]
- subsystem_name = "global"
- part_name = "cust_lite"
+ subsystem_name = "customization"
+ part_name = "config_policy"
}
}
diff --git a/frameworks/cust_lite/src/cust_utils.c b/frameworks/config_policy/src/config_policy_utils.c
similarity index 99%
rename from frameworks/cust_lite/src/cust_utils.c
rename to frameworks/config_policy/src/config_policy_utils.c
index cfeb4084ee0c026427a3c6eff9bdff8dadc7d510..8845290f0da5e986aeea625119ff7b3457327713 100644
--- a/frameworks/cust_lite/src/cust_utils.c
+++ b/frameworks/config_policy/src/config_policy_utils.c
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "cust_utils.h"
+#include "config_policy_utils.h"
#include
#include
diff --git a/interfaces/innerkits/include/cust_utils.h b/interfaces/innerkits/include/config_policy_utils.h
similarity index 95%
rename from interfaces/innerkits/include/cust_utils.h
rename to interfaces/innerkits/include/config_policy_utils.h
index ddaa762ab6a7032d966b68b519cb703d462f0aea..ce4a9c22c465788b2042aa950c35ab29074921ca 100644
--- a/interfaces/innerkits/include/cust_utils.h
+++ b/interfaces/innerkits/include/config_policy_utils.h
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#ifndef GLOBAL_CUST_UTILS_H
-#define GLOBAL_CUST_UTILS_H
+#ifndef CUSTOMIZATION_CONFIG_POLICY_UTILS_H
+#define CUSTOMIZATION_CONFIG_POLICY_UTILS_H
#ifdef __cplusplus
#if __cplusplus
@@ -78,4 +78,4 @@ CfgDir *GetCfgDirList(void);
#endif
#endif // __cplusplus
-#endif // GLOBAL_CUST_UTILS_H
+#endif // CUSTOMIZATION_CONFIG_POLICY_UTILS_H
diff --git a/interfaces/js/kits/BUILD.gn b/interfaces/kits/js/BUILD.gn
similarity index 74%
rename from interfaces/js/kits/BUILD.gn
rename to interfaces/kits/js/BUILD.gn
index 7eb5f2dbfa3b26f10c68c725baee79659cb53d0b..5628b086916cb928b849a647f1a462bc650a3e7e 100644
--- a/interfaces/js/kits/BUILD.gn
+++ b/interfaces/kits/js/BUILD.gn
@@ -15,22 +15,22 @@ import("//build/ohos.gni")
ohos_shared_library("configpolicy") {
include_dirs = [
- "//base/global/cust_lite/interfaces/innerkits/include",
+ "//base/customization/config_policy/interfaces/innerkits/include",
"//third_party/bounds_checking_function/include",
- "//base/global/cust_lite/interfaces/js/kits/include",
+ "//base/customization/config_policy/interfaces/kits/js/include",
"//base/hiviewdfx/interfaces/native/innerkits/include",
"//foundation/ace/napi/native_engine",
"//foundation/ace/napi/interfaces/kits",
]
- sources = [ "src/cust_napi.cpp" ]
+ sources = [ "src/config_policy_napi.cpp" ]
- deps = [ "//base/global/cust_lite/frameworks/cust_lite:cust_util" ]
+ deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ]
external_deps = [
"hiviewdfx_hilog_native:libhilog",
"napi:ace_napi",
]
relative_install_dir = "module"
- subsystem_name = "global"
- part_name = "cust_lite"
+ subsystem_name = "customization"
+ part_name = "config_policy"
}
diff --git a/interfaces/js/kits/include/cust_napi.h b/interfaces/kits/js/include/config_policy_napi.h
similarity index 81%
rename from interfaces/js/kits/include/cust_napi.h
rename to interfaces/kits/js/include/config_policy_napi.h
index 4bd3a64c9a6979e73dbf14dec17d66e65e58078a..9aa5c4d37bf3f3ecd41527188511e83b3b038f10 100644
--- a/interfaces/js/kits/include/cust_napi.h
+++ b/interfaces/kits/js/include/config_policy_napi.h
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#ifndef CUST_NAPI_H
-#define CUST_NAPI_H
+#ifndef CONFIG_POLICY_NAPI_H
+#define CONFIG_POLICY_NAPI_H
#include
@@ -23,15 +23,15 @@
#include "napi/native_api.h"
namespace OHOS {
-namespace Global {
-namespace Cust {
-struct CustAsyncContext {
+namespace Customization {
+namespace ConfigPolicy {
+struct ConfigAsyncContext {
bool success_ = true;
napi_async_work work_;
napi_deferred deferred_;
napi_ref callbackRef_;
std::string errMsg_;
- typedef napi_value (*CreateNapiValue)(napi_env env, CustAsyncContext &context);
+ typedef napi_value (*CreateNapiValue)(napi_env env, ConfigAsyncContext &context);
CreateNapiValue createValueFunc_;
int32_t custType_ = 0;
@@ -42,10 +42,10 @@ struct CustAsyncContext {
void SetErrorMsg(const std::string &msg);
};
-class CustNapi {
+class ConfigPolicyNapi {
public:
- CustNapi();
- ~CustNapi() = default;
+ ConfigPolicyNapi();
+ ~ConfigPolicyNapi() = default;
static napi_value Init(napi_env env, napi_value exports);
private:
@@ -54,7 +54,7 @@ private:
static napi_value NAPIGetCfgDirList(napi_env env, napi_callback_info info);
static napi_value CreateUndefined(napi_env env);
static std::string GetStringFromNAPI(napi_env env, napi_value value);
- static napi_value HandleAsyncWork(napi_env env, CustAsyncContext *context, std::string workName,
+ static napi_value HandleAsyncWork(napi_env env, ConfigAsyncContext *context, std::string workName,
napi_async_execute_callback execute, napi_async_complete_callback complete);
static bool MatchValueType(napi_env env, napi_value value, napi_valuetype targetType);
static void NativeGetOneCfgFile(napi_env env, void *data);
@@ -63,7 +63,7 @@ private:
static void NativeCallbackComplete(napi_env env, napi_status status, void *data);
static napi_value ParseRelPath(napi_env env, std::string ¶m, napi_value args);
};
-} // namespace Cust
-} // namespace Global
+} // namespace ConfigPolicy
+} // namespace Customization
} // namespace OHOS
#endif
\ No newline at end of file
diff --git a/interfaces/js/kits/src/cust_napi.cpp b/interfaces/kits/js/src/config_policy_napi.cpp
similarity index 78%
rename from interfaces/js/kits/src/cust_napi.cpp
rename to interfaces/kits/js/src/config_policy_napi.cpp
index cc87176694ace2117f6934e94b975784f86d94b6..140ba9928722513906c15c4c8ac36f3b1ef731df 100644
--- a/interfaces/js/kits/src/cust_napi.cpp
+++ b/interfaces/kits/js/src/config_policy_napi.cpp
@@ -13,16 +13,16 @@
* limitations under the License.
*/
-#include "cust_napi.h"
+#include "config_policy_napi.h"
#include
#include "hilog/log.h"
-#include "cust_utils.h"
+#include "config_policy_utils.h"
namespace OHOS {
-namespace Global {
-namespace Cust {
+namespace Customization {
+namespace ConfigPolicy {
using namespace OHOS::HiviewDFX;
static constexpr size_t ARGS_SIZE_ONE = 1;
@@ -31,20 +31,20 @@ static constexpr int32_t ARR_INDEX_ZERO = 0;
static constexpr int32_t ARR_INDEX_ONE = 1;
static constexpr int32_t NAPI_RETURN_ZERO = 0;
static constexpr int32_t NAPI_RETURN_ONE = 1;
-static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD001E00, "CustJs" };
+static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD001E00, "ConfigPolicyJs" };
-napi_value CustNapi::Init(napi_env env, napi_value exports)
+napi_value ConfigPolicyNapi::Init(napi_env env, napi_value exports)
{
napi_property_descriptor property[] = {
- DECLARE_NAPI_FUNCTION("getOneCfgFile", CustNapi::NAPIGetOneCfgFile),
- DECLARE_NAPI_FUNCTION("getCfgFiles", CustNapi::NAPIGetCfgFiles),
- DECLARE_NAPI_FUNCTION("getCfgDirList", CustNapi::NAPIGetCfgDirList)
+ DECLARE_NAPI_FUNCTION("getOneCfgFile", ConfigPolicyNapi::NAPIGetOneCfgFile),
+ DECLARE_NAPI_FUNCTION("getCfgFiles", ConfigPolicyNapi::NAPIGetCfgFiles),
+ DECLARE_NAPI_FUNCTION("getCfgDirList", ConfigPolicyNapi::NAPIGetCfgDirList)
};
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(property) / sizeof(property[0]), property));
return exports;
}
-napi_value CustNapi::NAPIGetOneCfgFile(napi_env env, napi_callback_info info)
+napi_value ConfigPolicyNapi::NAPIGetOneCfgFile(napi_env env, napi_callback_info info)
{
size_t argc = ARGS_SIZE_TWO;
napi_value argv[ARGS_SIZE_TWO] = {nullptr};
@@ -53,7 +53,7 @@ napi_value CustNapi::NAPIGetOneCfgFile(napi_env env, napi_callback_info info)
napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
NAPI_ASSERT(env, argc >= ARGS_SIZE_ONE, "parameter count error");
- auto asyncContext = (std::make_unique()).release();
+ auto asyncContext = (std::make_unique()).release();
ParseRelPath(env, asyncContext->relPath_, argv[ARR_INDEX_ZERO]);
if (argc == ARGS_SIZE_TWO) {
bool matchFlag = MatchValueType(env, argv[ARR_INDEX_ONE], napi_function);
@@ -63,7 +63,7 @@ napi_value CustNapi::NAPIGetOneCfgFile(napi_env env, napi_callback_info info)
return HandleAsyncWork(env, asyncContext, "NAPIGetOneCfgFile", NativeGetOneCfgFile, NativeCallbackComplete);
}
-napi_value CustNapi::NAPIGetCfgFiles(napi_env env, napi_callback_info info)
+napi_value ConfigPolicyNapi::NAPIGetCfgFiles(napi_env env, napi_callback_info info)
{
size_t argc = ARGS_SIZE_TWO;
napi_value argv[ARGS_SIZE_TWO] = {nullptr};
@@ -72,7 +72,7 @@ napi_value CustNapi::NAPIGetCfgFiles(napi_env env, napi_callback_info info)
napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
NAPI_ASSERT(env, argc >= ARGS_SIZE_ONE, "parameter count error");
- auto asyncContext = (std::make_unique()).release();
+ auto asyncContext = (std::make_unique()).release();
ParseRelPath(env, asyncContext->relPath_, argv[ARR_INDEX_ZERO]);
if (argc == ARGS_SIZE_TWO) {
bool matchFlag = MatchValueType(env, argv[ARR_INDEX_ONE], napi_function);
@@ -82,7 +82,7 @@ napi_value CustNapi::NAPIGetCfgFiles(napi_env env, napi_callback_info info)
return HandleAsyncWork(env, asyncContext, "NAPIGetCfgFiles", NativeGetCfgFiles, NativeCallbackComplete);
}
-napi_value CustNapi::NAPIGetCfgDirList(napi_env env, napi_callback_info info)
+napi_value ConfigPolicyNapi::NAPIGetCfgDirList(napi_env env, napi_callback_info info)
{
size_t argc = ARGS_SIZE_ONE;
napi_value argv[ARGS_SIZE_ONE] = {nullptr};
@@ -90,7 +90,7 @@ napi_value CustNapi::NAPIGetCfgDirList(napi_env env, napi_callback_info info)
void *data = nullptr;
napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
- auto asyncContext = (std::make_unique()).release();
+ auto asyncContext = (std::make_unique()).release();
if (argc == ARGS_SIZE_ONE) {
bool matchFlag = MatchValueType(env, argv[ARR_INDEX_ZERO], napi_function);
NAPI_ASSERT(env, matchFlag, "parameter type error");
@@ -99,14 +99,14 @@ napi_value CustNapi::NAPIGetCfgDirList(napi_env env, napi_callback_info info)
return HandleAsyncWork(env, asyncContext, "NAPIGetCfgDirList", NativeGetCfgDirList, NativeCallbackComplete);
}
-napi_value CustNapi::CreateUndefined(napi_env env)
+napi_value ConfigPolicyNapi::CreateUndefined(napi_env env)
{
napi_value result = nullptr;
napi_get_undefined(env, &result);
return result;
}
-std::string CustNapi::GetStringFromNAPI(napi_env env, napi_value value)
+std::string ConfigPolicyNapi::GetStringFromNAPI(napi_env env, napi_value value)
{
std::string result;
size_t size = 0;
@@ -124,7 +124,7 @@ std::string CustNapi::GetStringFromNAPI(napi_env env, napi_value value)
return result;
}
-napi_value CustNapi::HandleAsyncWork(napi_env env, CustAsyncContext *context, std::string workName,
+napi_value ConfigPolicyNapi::HandleAsyncWork(napi_env env, ConfigAsyncContext *context, std::string workName,
napi_async_execute_callback execute, napi_async_complete_callback complete)
{
napi_value result = nullptr;
@@ -141,24 +141,24 @@ napi_value CustNapi::HandleAsyncWork(napi_env env, CustAsyncContext *context, st
return result;
}
-bool CustNapi::MatchValueType(napi_env env, napi_value value, napi_valuetype targetType)
+bool ConfigPolicyNapi::MatchValueType(napi_env env, napi_value value, napi_valuetype targetType)
{
napi_valuetype valueType = napi_undefined;
napi_typeof(env, value, &valueType);
return valueType == targetType;
}
-void CustNapi::NativeGetOneCfgFile(napi_env env, void *data)
+void ConfigPolicyNapi::NativeGetOneCfgFile(napi_env env, void *data)
{
if (data == nullptr) {
HiLog::Error(LABEL, "data is nullptr");
return;
}
- CustAsyncContext *asyncCallbackInfo = (CustAsyncContext *)data;
+ ConfigAsyncContext *asyncCallbackInfo = (ConfigAsyncContext *)data;
char outBuf[MAX_PATH_LEN];
GetOneCfgFile(asyncCallbackInfo->relPath_.c_str(), asyncCallbackInfo->custType_, outBuf, MAX_PATH_LEN);
asyncCallbackInfo->pathValue_ = std::string(outBuf);
- asyncCallbackInfo->createValueFunc_ = [](napi_env env, CustAsyncContext &context) -> napi_value {
+ asyncCallbackInfo->createValueFunc_ = [](napi_env env, ConfigAsyncContext &context) -> napi_value {
napi_value result;
napi_status status = napi_create_string_utf8(env, context.pathValue_.c_str(), NAPI_AUTO_LENGTH, &result);
if (status != napi_ok) {
@@ -169,14 +169,14 @@ void CustNapi::NativeGetOneCfgFile(napi_env env, void *data)
};
}
-void CustNapi::NativeGetCfgFiles(napi_env env, void *data)
+void ConfigPolicyNapi::NativeGetCfgFiles(napi_env env, void *data)
{
if (data == nullptr) {
HiLog::Error(LABEL, "data is nullptr");
return;
}
- CustAsyncContext *asyncCallbackInfo = (CustAsyncContext *)data;
+ ConfigAsyncContext *asyncCallbackInfo = (ConfigAsyncContext *)data;
CfgFiles *cfgFiles = GetCfgFiles(asyncCallbackInfo->relPath_.c_str(), asyncCallbackInfo->custType_);
for (size_t i = 0; i < MAX_CFG_POLICY_DIRS_CNT; i++) {
if (cfgFiles != nullptr && cfgFiles->paths[i] != nullptr) {
@@ -184,7 +184,7 @@ void CustNapi::NativeGetCfgFiles(napi_env env, void *data)
}
}
FreeCfgFiles(cfgFiles);
- asyncCallbackInfo->createValueFunc_ = [](napi_env env, CustAsyncContext &context) -> napi_value {
+ asyncCallbackInfo->createValueFunc_ = [](napi_env env, ConfigAsyncContext &context) -> napi_value {
napi_value result = nullptr;
napi_status status = napi_create_array_with_length(env, context.paths_.size(), &result);
if (status != napi_ok) {
@@ -208,14 +208,14 @@ void CustNapi::NativeGetCfgFiles(napi_env env, void *data)
};
}
-void CustNapi::NativeGetCfgDirList(napi_env env, void *data)
+void ConfigPolicyNapi::NativeGetCfgDirList(napi_env env, void *data)
{
if (data == nullptr) {
HiLog::Error(LABEL, "data is nullptr.");
return;
}
- CustAsyncContext *asyncCallbackInfo = (CustAsyncContext *)data;
+ ConfigAsyncContext *asyncCallbackInfo = (ConfigAsyncContext *)data;
CfgDir *cfgDir = GetCfgDirListType(asyncCallbackInfo->custType_);
for (size_t i = 0; i < MAX_CFG_POLICY_DIRS_CNT; i++) {
if (cfgDir != nullptr && cfgDir->paths[i] != nullptr) {
@@ -223,7 +223,7 @@ void CustNapi::NativeGetCfgDirList(napi_env env, void *data)
}
}
FreeCfgDirList(cfgDir);
- asyncCallbackInfo->createValueFunc_ = [](napi_env env, CustAsyncContext &context) -> napi_value {
+ asyncCallbackInfo->createValueFunc_ = [](napi_env env, ConfigAsyncContext &context) -> napi_value {
napi_value result = nullptr;
napi_status status = napi_create_array_with_length(env, context.paths_.size(), &result);
if (status != napi_ok) {
@@ -247,7 +247,7 @@ void CustNapi::NativeGetCfgDirList(napi_env env, void *data)
};
}
-void CustNapi::NativeCallbackComplete(napi_env env, napi_status status, void *data)
+void ConfigPolicyNapi::NativeCallbackComplete(napi_env env, napi_status status, void *data)
{
if (data == nullptr) {
HiLog::Error(LABEL, "data is nullptr");
@@ -255,7 +255,7 @@ void CustNapi::NativeCallbackComplete(napi_env env, napi_status status, void *da
}
napi_value finalResult = nullptr;
- CustAsyncContext *asyncContext = (CustAsyncContext *)data;
+ ConfigAsyncContext *asyncContext = (ConfigAsyncContext *)data;
if (asyncContext->createValueFunc_ != nullptr) {
finalResult = asyncContext->createValueFunc_(env, *asyncContext);
}
@@ -288,7 +288,7 @@ void CustNapi::NativeCallbackComplete(napi_env env, napi_status status, void *da
delete asyncContext;
}
-napi_value CustNapi::ParseRelPath(napi_env env, std::string ¶m, napi_value args)
+napi_value ConfigPolicyNapi::ParseRelPath(napi_env env, std::string ¶m, napi_value args)
{
bool matchFlag = MatchValueType(env, args, napi_string);
NAPI_ASSERT(env, matchFlag, "Wrong argument type, string expected.");
@@ -299,32 +299,32 @@ napi_value CustNapi::ParseRelPath(napi_env env, std::string ¶m, napi_value a
return result;
}
-void CustAsyncContext::SetErrorMsg(const std::string &msg)
+void ConfigAsyncContext::SetErrorMsg(const std::string &msg)
{
errMsg_ = msg;
success_ = false;
HiLog::Error(LABEL, "%{public}s", msg.c_str());
}
-static napi_value CustInit(napi_env env, napi_value exports)
+static napi_value ConfigPolicyInit(napi_env env, napi_value exports)
{
- return CustNapi::Init(env, exports);
+ return ConfigPolicyNapi::Init(env, exports);
}
-static napi_module g_custModule = {
+static napi_module g_configPolicyModule = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = nullptr,
- .nm_register_func = CustInit,
+ .nm_register_func = ConfigPolicyInit,
.nm_modname = "configPolicy",
.nm_priv = ((void *)0),
.reserved = { 0 }
};
-extern "C" __attribute__((constructor)) void CustRegister()
+extern "C" __attribute__((constructor)) void ConfigPolicyRegister()
{
- napi_module_register(&g_custModule);
+ napi_module_register(&g_configPolicyModule);
}
-} // namespace Cust
-} // namespace Global
+} // namespace ConfigPolicy
+} // namespace Customization
} // namespace OHOS
diff --git a/test/resource/ohos_test.xml b/test/resource/ohos_test.xml
index 31890a1ca9140bba81906dc2aaf4bb0dbd81a517..4fff2f72b4734b2c87b160014a2cb440ecba9b29 100644
--- a/test/resource/ohos_test.xml
+++ b/test/resource/ohos_test.xml
@@ -13,7 +13,7 @@
limitations under the License.
-->
-
+
diff --git a/frameworks/cust_lite/test/BUILD.gn b/test/unittest/BUILD.gn
similarity index 53%
rename from frameworks/cust_lite/test/BUILD.gn
rename to test/unittest/BUILD.gn
index 4ce22cc51f7ce2fc321367f1a629e37de484d05b..6d12c5d9b0f870fdffb7f79ca3ad106bb21b48f1 100644
--- a/frameworks/cust_lite/test/BUILD.gn
+++ b/test/unittest/BUILD.gn
@@ -18,29 +18,28 @@ if (defined(ohos_lite)) {
import("//build/test.gni")
}
-cust_sources = [ "unittest/lite/common/cust_utils_test.cpp" ]
-cust_include_dirs = [
- "unittest/lite/common",
- "//base/global/cust_lite/interfaces/innerkits/include",
+config_policy_sources = [ "config_policy_utils_test.cpp" ]
+config_policy_include_dirs = [
+ "//base/customization/config_policy/interfaces/innerkits/include",
]
-cust_deps = [ "//base/global/cust_lite/frameworks/cust_lite:cust_util" ]
+config_policy_deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ]
if (defined(ohos_lite)) {
- unittest("CustUtilsTest") {
+ unittest("ConfigPolicyUtilsTest") {
output_extension = "bin"
- sources = cust_sources
- include_dirs = cust_include_dirs
- deps = cust_deps
+ sources = config_policy_sources
+ include_dirs = config_policy_include_dirs
+ deps = config_policy_deps
}
group("unittest") {
- deps = [ ":CustUtilsTest" ]
+ deps = [ ":ConfigPolicyUtilsTest" ]
}
} else {
- ohos_unittest("CustUtilsTest") {
- module_out_path = "cust_lite/CustUtilsTest"
- sources = cust_sources
- include_dirs = cust_include_dirs
- deps = cust_deps
- resource_config_file = "//base/global/cust_lite/test/resource/ohos_test.xml"
+ ohos_unittest("ConfigPolicyUtilsTest") {
+ module_out_path = "config_policy/ConfigPolicyUtilsTest"
+ sources = config_policy_sources
+ include_dirs = config_policy_include_dirs
+ deps = config_policy_deps
+ resource_config_file = "//base/customization/config_policy/test/resource/ohos_test.xml"
}
}
diff --git a/frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.cpp b/test/unittest/config_policy_utils_test.cpp
similarity index 79%
rename from frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.cpp
rename to test/unittest/config_policy_utils_test.cpp
index 044ed611c11b65cc19442dbd074f2fc66c42c6c3..4d8119264ccbcfb53481093df346b7fa2bb60198 100644
--- a/frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.cpp
+++ b/test/unittest/config_policy_utils_test.cpp
@@ -13,16 +13,16 @@
* limitations under the License.
*/
-#include "cust_utils_test.h"
+#include "config_policy_utils_test.h"
#include
-#include "cust_utils.h"
+#include "config_policy_utils.h"
using namespace testing::ext;
namespace OHOS {
-class CustUtilsTest : public testing::Test {};
+class ConfigPolicyUtilsTest : public testing::Test {};
bool TestGetCfgFile(const char *testPathSuffix)
{
@@ -46,55 +46,55 @@ bool TestGetCfgFile(const char *testPathSuffix)
}
/**
- * @tc.name: CustUtilsFuncTest001
+ * @tc.name: CfgPolicyUtilsFuncTest001
* @tc.desc: Test GetOneCfgFile & GetCfgFiles function, none file case.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest001, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest001, TestSize.Level1)
{
const char *testPathSuffix = "custxmltest/none.xml";
EXPECT_FALSE(TestGetCfgFile(testPathSuffix));
}
/**
- * @tc.name: CustUtilsFuncTest002
+ * @tc.name: CfgPolicyUtilsFuncTest002
* @tc.desc: Test GetOneCfgFile & GetCfgFiles function, system file case.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest002, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest002, TestSize.Level1)
{
const char *testPathSuffix = "custxmltest/system.xml";
EXPECT_TRUE(TestGetCfgFile(testPathSuffix));
}
/**
- * @tc.name: CustUtilsFuncTest003
+ * @tc.name: CfgPolicyUtilsFuncTest003
* @tc.desc: Test GetOneCfgFile & GetCfgFiles function, user file case.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest003, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest003, TestSize.Level1)
{
const char *testPathSuffix = "custxmltest/user.xml";
EXPECT_TRUE(TestGetCfgFile(testPathSuffix));
}
/**
- * @tc.name: CustUtilsFuncTest004
+ * @tc.name: CfgPolicyUtilsFuncTest004
* @tc.desc: Test GetOneCfgFile & GetCfgFiles function, both files case.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest004, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest004, TestSize.Level1)
{
const char *testPathSuffix = "custxmltest/both.xml";
EXPECT_TRUE(TestGetCfgFile(testPathSuffix));
}
/**
- * @tc.name: CustUtilsFuncTest005
+ * @tc.name: CfgPolicyUtilsFuncTest005
* @tc.desc: Test struct CfgDir *GetCfgDirListType(int type) function.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest005, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest005, TestSize.Level1)
{
CfgDir *cfgDir = GetCfgDirListType(CUST_TYPE_RFU);
EXPECT_TRUE(cfgDir != NULL);
@@ -111,11 +111,11 @@ HWTEST_F(CustUtilsTest, CustUtilsFuncTest005, TestSize.Level1)
}
/**
- * @tc.name: CustUtilsFuncTest006
+ * @tc.name: CfgPolicyUtilsFuncTest006
* @tc.desc: Test struct CfgDir *GetCfgDirList(void) function.
* @tc.type: FUNC
*/
-HWTEST_F(CustUtilsTest, CustUtilsFuncTest006, TestSize.Level1)
+HWTEST_F(ConfigPolicyUtilsTest, CfgPolicyUtilsFuncTest006, TestSize.Level1)
{
CfgDir *cfgDir = GetCfgDirList();
EXPECT_TRUE(cfgDir != NULL);
diff --git a/frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.h b/test/unittest/config_policy_utils_test.h
similarity index 64%
rename from frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.h
rename to test/unittest/config_policy_utils_test.h
index 5a993c87af3c303940954ff5ba528cf5663cd1d7..b81e974e2efe523e741fde29b763d6eba4136a4f 100644
--- a/frameworks/cust_lite/test/unittest/lite/common/cust_utils_test.h
+++ b/test/unittest/config_policy_utils_test.h
@@ -13,14 +13,14 @@
* limitations under the License.
*/
-#ifndef GLOBAL_CUST_UTILS_TEST_H
-#define GLOBAL_CUST_UTILS_TEST_H
+#ifndef CUSTOMIZATION_CONFIG_POLICY_UTILS_TEST_H
+#define CUSTOMIZATION_CONFIG_POLICY_UTILS_TEST_H
-int CustUtilsFuncTest001(void);
-int CustUtilsFuncTest002(void);
-int CustUtilsFuncTest003(void);
-int CustUtilsFuncTest004(void);
-int CustUtilsFuncTest005(void);
-int CustUtilsFuncTest006(void);
+int CfgPolicyUtilsFuncTest001(void);
+int CfgPolicyUtilsFuncTest002(void);
+int CfgPolicyUtilsFuncTest003(void);
+int CfgPolicyUtilsFuncTest004(void);
+int CfgPolicyUtilsFuncTest005(void);
+int CfgPolicyUtilsFuncTest006(void);
#endif