数据分级

Signed-off-by: chenshuo <chenshuo42@huawei.com>
This commit is contained in:
chenshuo 2024-05-19 18:09:38 +08:00
parent e78a744a91
commit dc2b35b44d
15 changed files with 204 additions and 203 deletions

View File

@ -117,13 +117,13 @@ ohos_shared_library("distributed_device_profile") {
"device_manager:devicemanagersdk",
"dmsfwk:common_sdk",
"eventhandler:libeventhandler",
"relational_store:native_rdb",
"hilog:libhilog",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"init:libbegetutil",
"ipc:ipc_core",
"kv_store:distributeddata_inner",
"relational_store:native_rdb",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"syscap_codec:syscap_interface_shared",

View File

@ -23,7 +23,7 @@
#include "parameter.h"
#include "device_profile_log.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "device_profile_utils.h"
#include "distributed_device_profile_service.h"
#include "dm_constants.h"
@ -415,7 +415,7 @@ void DpDeviceManager::AutoSync(const DistributedHardware::DmDeviceInfo &deviceIn
}
HILOGI("osType=%{public}d", osType);
if (osType != DEFAULT_OS_TYPE) {
int32_t errCode = DistributedDeviceProfile::DynamicProfileManager::GetInstance()
int32_t errCode = DistributedDeviceProfile::DeviceProfileManager::GetInstance()
.DeviceOnlineAutoSync(deviceInfo.networkId);
HILOGI("DeviceOnlineAutoSync errCode=%{public}d, networdId=%{public}s", errCode,
DeviceProfileUtils::AnonymizeDeviceId(deviceInfo.networkId).c_str());

View File

@ -62,7 +62,7 @@ ohos_shared_library("distributed_device_profile_svr") {
"src/contentsensormanager/syscap_info_collector.cpp",
"src/contentsensormanager/switch_status_collector.cpp",
"src/contentsensormanager/system_info_collector.cpp",
"src/deviceprofilemanager/dynamic_profile_manager.cpp",
"src/deviceprofilemanager/device_profile_manager.cpp",
"src/deviceprofilemanager/static_profile_manager.cpp",
"src/deviceprofilemanager/switch_profile_manager.cpp",
"src/deviceprofilemanager/listener/kv_data_change_listener.cpp",

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_DP_DYNAMIC_PROFILE_MANAGER_H
#define OHOS_DP_DYNAMIC_PROFILE_MANAGER_H
#ifndef OHOS_DP_DEVICE_PROFILE_MANAGER_H
#define OHOS_DP_DEVICE_PROFILE_MANAGER_H
#include <unordered_map>
@ -33,8 +33,8 @@
namespace OHOS {
namespace DistributedDeviceProfile {
class DynamicProfileManager {
DECLARE_SINGLE_INSTANCE(DynamicProfileManager);
class DeviceProfileManager {
DECLARE_SINGLE_INSTANCE(DeviceProfileManager);
public:
int32_t Init();
@ -74,4 +74,4 @@ private:
};
} // namespace DeviceProfile
} // namespace OHOS
#endif // OHOS_DP_DYNAMIC_PROFILE_MANAGER_H
#endif // OHOS_DP_DEVICE_PROFILE_MANAGER_H

View File

@ -15,7 +15,7 @@
#include "collaboration_info_collector.h"
#include "content_sensor_manager_utils.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "distributed_device_profile_log.h"
#include "profile_utils.h"
@ -35,7 +35,7 @@ bool CollaborationInfoCollector::ConvertToProfile(std::vector<ServiceProfile> &s
auto deviceId = GetDeviceUdid();
for (auto it = COLLABORATION_SERVICE_ID_VECTOR.begin(); it != COLLABORATION_SERVICE_ID_VECTOR.end(); it++) {
ServiceProfile svrProfile;
if (DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, *it, svrProfile) == DP_SUCCESS) {
if (DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, *it, svrProfile) == DP_SUCCESS) {
continue;
}
svrProfile.SetDeviceId(deviceId);
@ -52,7 +52,7 @@ bool CollaborationInfoCollector::ConvertToProfile(std::vector<CharacteristicProf
auto deviceId = GetDeviceUdid();
for (auto it = COLLABORATION_SERVICE_ID_VECTOR.begin(); it != COLLABORATION_SERVICE_ID_VECTOR.end(); it++) {
CharacteristicProfile charProfile;
if (DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, *it,
if (DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, *it,
COLLABORATION_CHARACTERISTIC_KEY, charProfile) == DP_SUCCESS) {
continue;
}

View File

@ -32,7 +32,7 @@
#include "event_handler.h"
#include "collector.h"
#include "content_sensor_manager_utils.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
namespace OHOS {
namespace DistributedDeviceProfile {
@ -80,14 +80,14 @@ int32_t ContentSensorManager::Collect()
task->ConvertToProfile(charProfileList);
}
deviceProfile.SetDeviceId(ContentSensorManagerUtils::GetInstance().ObtainLocalUdid());
DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
if (!svrProfileList.empty()) {
DynamicProfileManager::GetInstance().PutServiceProfileBatch(svrProfileList);
DeviceProfileManager::GetInstance().PutServiceProfileBatch(svrProfileList);
} else {
HILOGI("svrProfileList is empty");
}
if (!charProfileList.empty()) {
DynamicProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfileList);
DeviceProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfileList);
} else {
HILOGI("charProfileList is empty");
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include <mutex>
#include <memory>
@ -34,15 +34,15 @@
namespace OHOS {
namespace DistributedDeviceProfile {
constexpr const char *LIB_DP_ADAPTER_NAME = "libdeviceprofileadapter.z.so";
IMPLEMENT_SINGLE_INSTANCE(DynamicProfileManager);
IMPLEMENT_SINGLE_INSTANCE(DeviceProfileManager);
namespace {
const std::string APP_ID = "distributed_device_profile_service";
const std::string STORE_ID = "dp_kv_store";
const std::string TAG = "DynamicProfileManager";
const std::string TAG = "DeviceProfileManager";
const std::string DP_MANAGER_HANDLER = "dp_manager_handler";
}
int32_t DynamicProfileManager::Init()
int32_t DeviceProfileManager::Init()
{
HILOGI("call!");
int32_t initResult = DP_MANAGER_INIT_FAIL;
@ -58,7 +58,7 @@ int32_t DynamicProfileManager::Init()
return initResult;
}
int32_t DynamicProfileManager::UnInit()
int32_t DeviceProfileManager::UnInit()
{
HILOGI("call!");
{
@ -70,14 +70,14 @@ int32_t DynamicProfileManager::UnInit()
return DP_SUCCESS;
}
int32_t DynamicProfileManager::ReInit()
int32_t DeviceProfileManager::ReInit()
{
HILOGI("call!");
UnInit();
return Init();
}
int32_t DynamicProfileManager::PutDeviceProfile(const DeviceProfile& deviceProfile)
int32_t DeviceProfileManager::PutDeviceProfile(const DeviceProfile& deviceProfile)
{
HILOGI("call!");
int32_t res;
@ -93,7 +93,7 @@ int32_t DynamicProfileManager::PutDeviceProfile(const DeviceProfile& deviceProfi
return DP_SUCCESS;
}
int32_t DynamicProfileManager::PutServiceProfile(const ServiceProfile& serviceProfile)
int32_t DeviceProfileManager::PutServiceProfile(const ServiceProfile& serviceProfile)
{
HILOGI("call!");
int32_t res;
@ -109,7 +109,7 @@ int32_t DynamicProfileManager::PutServiceProfile(const ServiceProfile& servicePr
return DP_SUCCESS;
}
int32_t DynamicProfileManager::PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles)
int32_t DeviceProfileManager::PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles)
{
HILOGI("call!");
int32_t res;
@ -125,7 +125,7 @@ int32_t DynamicProfileManager::PutServiceProfileBatch(const std::vector<ServiceP
return DP_SUCCESS;
}
int32_t DynamicProfileManager::PutCharacteristicProfile(const CharacteristicProfile& charProfile)
int32_t DeviceProfileManager::PutCharacteristicProfile(const CharacteristicProfile& charProfile)
{
HILOGI("call!");
int32_t res;
@ -141,7 +141,7 @@ int32_t DynamicProfileManager::PutCharacteristicProfile(const CharacteristicProf
return DP_SUCCESS;
}
int32_t DynamicProfileManager::PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile>& charProfiles)
int32_t DeviceProfileManager::PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile>& charProfiles)
{
HILOGI("call!");
int32_t res;
@ -157,7 +157,7 @@ int32_t DynamicProfileManager::PutCharacteristicProfileBatch(const std::vector<C
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetDeviceProfile(const std::string& deviceId, DeviceProfile& deviceProfile)
int32_t DeviceProfileManager::GetDeviceProfile(const std::string& deviceId, DeviceProfile& deviceProfile)
{
HILOGI("call!");
int32_t res;
@ -173,7 +173,7 @@ int32_t DynamicProfileManager::GetDeviceProfile(const std::string& deviceId, Dev
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetServiceProfile(const std::string& deviceId, const std::string& serviceName,
int32_t DeviceProfileManager::GetServiceProfile(const std::string& deviceId, const std::string& serviceName,
ServiceProfile& serviceProfile)
{
HILOGI("call!");
@ -191,7 +191,7 @@ int32_t DynamicProfileManager::GetServiceProfile(const std::string& deviceId, co
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
int32_t DeviceProfileManager::GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
const std::string& characteristicKey, CharacteristicProfile& charProfile)
{
HILOGI("call!");
@ -209,7 +209,7 @@ int32_t DynamicProfileManager::GetCharacteristicProfile(const std::string& devic
return DP_SUCCESS;
}
int32_t DynamicProfileManager::DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName)
int32_t DeviceProfileManager::DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName)
{
HILOGI("call!");
int32_t res;
@ -225,7 +225,7 @@ int32_t DynamicProfileManager::DeleteServiceProfile(const std::string& deviceId,
return DP_SUCCESS;
}
int32_t DynamicProfileManager::DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
int32_t DeviceProfileManager::DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
const std::string& characteristicKey)
{
HILOGI("call!");
@ -243,7 +243,7 @@ int32_t DynamicProfileManager::DeleteCharacteristicProfile(const std::string& de
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetAllDeviceProfile(std::vector<DeviceProfile>& deviceProfiles)
int32_t DeviceProfileManager::GetAllDeviceProfile(std::vector<DeviceProfile>& deviceProfiles)
{
HILOGI("call!");
int32_t res;
@ -259,7 +259,7 @@ int32_t DynamicProfileManager::GetAllDeviceProfile(std::vector<DeviceProfile>& d
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetAllServiceProfile(std::vector<ServiceProfile>& serviceProfiles)
int32_t DeviceProfileManager::GetAllServiceProfile(std::vector<ServiceProfile>& serviceProfiles)
{
HILOGI("call!");
int32_t res;
@ -275,7 +275,7 @@ int32_t DynamicProfileManager::GetAllServiceProfile(std::vector<ServiceProfile>&
return DP_SUCCESS;
}
int32_t DynamicProfileManager::GetAllCharacteristicProfile(std::vector<CharacteristicProfile>& charProfiles)
int32_t DeviceProfileManager::GetAllCharacteristicProfile(std::vector<CharacteristicProfile>& charProfiles)
{
HILOGI("call!");
int32_t res;
@ -291,7 +291,7 @@ int32_t DynamicProfileManager::GetAllCharacteristicProfile(std::vector<Character
return DP_SUCCESS;
}
int32_t DynamicProfileManager::SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions &syncOptions,
int32_t DeviceProfileManager::SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions &syncOptions,
sptr<IRemoteObject> syncCompletedCallback)
{
HILOGI("call!");
@ -329,9 +329,9 @@ int32_t DynamicProfileManager::SyncDeviceProfile(const DistributedDeviceProfile:
return DP_SUCCESS;
}
bool DynamicProfileManager::LoadDpSyncAdapter()
bool DeviceProfileManager::LoadDpSyncAdapter()
{
HILOGI("DynamicProfileManager::LoadDpSyncAdapter start.");
HILOGI("DeviceProfileManager::LoadDpSyncAdapter start.");
std::lock_guard<std::mutex> lock(isAdapterLoadLock_);
if (isAdapterSoLoaded_ && (dpSyncAdapter_ != nullptr)) {
return true;
@ -363,13 +363,13 @@ bool DynamicProfileManager::LoadDpSyncAdapter()
return false;
}
isAdapterSoLoaded_ = true;
HILOGI("DynamicProfileManager::LoadDpSyncAdapter sucess");
HILOGI("DeviceProfileManager::LoadDpSyncAdapter sucess");
return true;
}
void DynamicProfileManager::UnloadDpSyncAdapter()
void DeviceProfileManager::UnloadDpSyncAdapter()
{
HILOGI("DynamicProfileManager::UnloadDpSyncAdapter start.");
HILOGI("DeviceProfileManager::UnloadDpSyncAdapter start.");
std::lock_guard<std::mutex> lock(isAdapterLoadLock_);
if (dpSyncAdapter_ != nullptr) {
dpSyncAdapter_->Release();
@ -390,7 +390,7 @@ void DynamicProfileManager::UnloadDpSyncAdapter()
}
}
int32_t DynamicProfileManager::RunloadedFunction(std::string deviceId, sptr<IRemoteObject> syncCompletedCallback)
int32_t DeviceProfileManager::RunloadedFunction(std::string deviceId, sptr<IRemoteObject> syncCompletedCallback)
{
if (!LoadDpSyncAdapter()) {
HILOGE("dp service adapter load failed.");
@ -413,7 +413,7 @@ int32_t DynamicProfileManager::RunloadedFunction(std::string deviceId, sptr<IRem
return DP_SUCCESS;
}
int32_t DynamicProfileManager::DeviceOnlineAutoSync(const std::string& peerNetworkId)
int32_t DeviceProfileManager::DeviceOnlineAutoSync(const std::string& peerNetworkId)
{
HILOGI("call! peerNetworkId=%{public}s", ProfileUtils::GetAnonyString(peerNetworkId).c_str());
std::vector<std::string> deviceList{peerNetworkId};
@ -431,7 +431,7 @@ int32_t DynamicProfileManager::DeviceOnlineAutoSync(const std::string& peerNetwo
return errCode;
}
std::vector<DistributedKv::Entry> DynamicProfileManager::GetEntriesByKeys(const std::vector<std::string>& keys)
std::vector<DistributedKv::Entry> DeviceProfileManager::GetEntriesByKeys(const std::vector<std::string>& keys)
{
HILOGI("call!");
std::vector<DistributedKv::Entry> entries;

View File

@ -22,7 +22,7 @@
#include "distributed_device_profile_constants.h"
#include "distributed_device_profile_errors.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "profile_utils.h"
#include "profile_cache.h"
#include "subscribe_profile_manager.h"
@ -69,12 +69,12 @@ void KvDataChangeListener::OnChange(const DistributedKv::DataOrigin& origin, Key
{
HILOGI("Cloud data change. store=%{public}s", origin.store.c_str());
ProfileCache::GetInstance().RefreshProfileCache();
std::vector<DistributedKv::Entry> insertRecords = DynamicProfileManager::GetInstance()
std::vector<DistributedKv::Entry> insertRecords = DeviceProfileManager::GetInstance()
.GetEntriesByKeys(keys[ChangeOp::OP_INSERT]);
if (!insertRecords.empty() && insertRecords.size() <= MAX_DB_RECORD_SIZE) {
HandleAddChange(insertRecords);
}
std::vector<DistributedKv::Entry> updateRecords = DynamicProfileManager::GetInstance()
std::vector<DistributedKv::Entry> updateRecords = DeviceProfileManager::GetInstance()
.GetEntriesByKeys(keys[ChangeOp::OP_UPDATE]);
if (!updateRecords.empty() && updateRecords.size() <= MAX_DB_RECORD_SIZE) {
HandleUpdateChange(updateRecords);

View File

@ -15,7 +15,7 @@
#include "listener/kv_store_death_recipient.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "event_handler_factory.h"
#include "distributed_device_profile_log.h"
#include "distributed_device_profile_constants.h"
@ -55,7 +55,7 @@ void KvDeathRecipient::OnRemoteDied()
HILOGI("OnRemoteDied, recover db begin");
auto reInitTask = []() {
// how to recover kv_store
DynamicProfileManager::GetInstance().ReInit();
DeviceProfileManager::GetInstance().ReInit();
};
{
std::lock_guard<std::mutex> lock(reInitMutex_);

View File

@ -30,7 +30,7 @@
#include "distributed_device_profile_constants.h"
#include "distributed_device_profile_errors.h"
#include "dm_adapter.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "event_handler_factory.h"
#include "permission_manager.h"
#include "profile_cache.h"
@ -93,8 +93,8 @@ int32_t DistributedDeviceProfileServiceNew::PostInit()
HILOGE("SwitchProfileManager init failed");
return DP_DEVICE_PROFILE_MANAGER_INIT_FAIL;
}
if (DynamicProfileManager::GetInstance().Init() != DP_SUCCESS) {
HILOGE("DynamicProfileManager init failed");
if (DeviceProfileManager::GetInstance().Init() != DP_SUCCESS) {
HILOGE("DeviceProfileManager init failed");
return DP_DEVICE_PROFILE_MANAGER_INIT_FAIL;
}
if (StaticProfileManager::GetInstance().Init() != DP_SUCCESS) {
@ -134,8 +134,8 @@ int32_t DistributedDeviceProfileServiceNew::UnInit()
HILOGE("SwitchProfileManager UnInit failed");
return DP_DEVICE_PROFILE_MANAGER_UNINIT_FAIL;
}
if (DynamicProfileManager::GetInstance().UnInit() != DP_SUCCESS) {
HILOGE("DynamicProfileManager UnInit failed");
if (DeviceProfileManager::GetInstance().UnInit() != DP_SUCCESS) {
HILOGE("DeviceProfileManager UnInit failed");
return DP_DEVICE_PROFILE_MANAGER_UNINIT_FAIL;
}
if (StaticProfileManager::GetInstance().UnInit() != DP_SUCCESS) {
@ -271,7 +271,7 @@ int32_t DistributedDeviceProfileServiceNew::PutServiceProfile(const ServiceProfi
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface PutServiceProfile");
return DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile);
return DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile);
}
int32_t DistributedDeviceProfileServiceNew::PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles)
@ -281,7 +281,7 @@ int32_t DistributedDeviceProfileServiceNew::PutServiceProfileBatch(const std::ve
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface PutServiceProfileBatch");
return DynamicProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
return DeviceProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
}
int32_t DistributedDeviceProfileServiceNew::PutCharacteristicProfile(const CharacteristicProfile& charProfile)
@ -294,8 +294,8 @@ int32_t DistributedDeviceProfileServiceNew::PutCharacteristicProfile(const Chara
HILOGI("CheckCallerPermission success interface SwitchProfileManager::PutCharacteristicProfile");
return SwitchProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
}
HILOGI("CheckCallerPermission success interface DynamicProfileManager::PutCharacteristicProfile");
return DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
HILOGI("CheckCallerPermission success interface DeviceProfileManager::PutCharacteristicProfile");
return DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
}
int32_t DistributedDeviceProfileServiceNew::PutCharacteristicProfileBatch(
@ -327,7 +327,7 @@ int32_t DistributedDeviceProfileServiceNew::PutCharacteristicProfileBatch(
}
}
if (dynamicCharProfiles.size() > 0) {
res = DynamicProfileManager::GetInstance().PutCharacteristicProfileBatch(dynamicCharProfiles);
res = DeviceProfileManager::GetInstance().PutCharacteristicProfileBatch(dynamicCharProfiles);
if (res != DP_SUCCESS) {
HILOGE("PutCharacteristicProfileBatch fail, res:%d", res);
return DP_PUT_CHAR_BATCH_FAIL;
@ -344,7 +344,7 @@ int32_t DistributedDeviceProfileServiceNew::GetDeviceProfile(const std::string&
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface GetDeviceProfile");
return DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, deviceProfile);
return DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, deviceProfile);
}
int32_t DistributedDeviceProfileServiceNew::GetServiceProfile(const std::string& deviceId,
@ -355,7 +355,7 @@ int32_t DistributedDeviceProfileServiceNew::GetServiceProfile(const std::string&
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface GetServiceProfile");
return DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, serviceProfile);
return DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, serviceProfile);
}
int32_t DistributedDeviceProfileServiceNew::GetCharacteristicProfile(const std::string& deviceId,
@ -375,8 +375,8 @@ int32_t DistributedDeviceProfileServiceNew::GetCharacteristicProfile(const std::
return StaticProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName, characteristicKey,
charProfile);
}
HILOGI("CheckCallerPermission success interface DynamicProfileManager::GetCharacteristicProfile");
return DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName, characteristicKey,
HILOGI("CheckCallerPermission success interface DeviceProfileManager::GetCharacteristicProfile");
return DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName, characteristicKey,
charProfile);
}
@ -388,7 +388,7 @@ int32_t DistributedDeviceProfileServiceNew::DeleteServiceProfile(const std::stri
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface DeleteServiceProfile");
return DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
return DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
}
int32_t DistributedDeviceProfileServiceNew::DeleteCharacteristicProfile(const std::string& deviceId,
@ -399,7 +399,7 @@ int32_t DistributedDeviceProfileServiceNew::DeleteCharacteristicProfile(const st
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerPermission success interface DeleteCharacteristicProfile");
return DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName, characteristicKey);
return DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName, characteristicKey);
}
int32_t DistributedDeviceProfileServiceNew::SubscribeDeviceProfile(const SubscribeInfo& subscriberInfo)
@ -430,7 +430,7 @@ int32_t DistributedDeviceProfileServiceNew::SyncDeviceProfile(
return DP_PERMISSION_DENIED;
}
HILOGI("CheckCallerSyncPermission success interface SyncDeviceProfile");
return DynamicProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCompletedCallback);
return DeviceProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCompletedCallback);
}
int32_t DistributedDeviceProfileServiceNew::SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap)

View File

@ -15,7 +15,7 @@
#include "dm_adapter.h"
#include "cJSON.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "distributed_device_profile_constants.h"
#include "distributed_device_profile_errors.h"
#include "distributed_device_profile_log.h"
@ -110,7 +110,7 @@ void DMAdapter::AutoSync(const DistributedHardware::DmDeviceInfo &deviceInfo)
cJSON_Delete(extraData);
HILOGI("osType=%{public}d", osType);
if (osType != DEFAULT_OS_TYPE) {
int32_t errCode = DynamicProfileManager::GetInstance().DeviceOnlineAutoSync(deviceInfo.networkId);
int32_t errCode = DeviceProfileManager::GetInstance().DeviceOnlineAutoSync(deviceInfo.networkId);
HILOGI("DeviceOnlineAutoSync errCode=%{public}d, networdId=%{public}s", errCode,
ProfileUtils::GetAnonyString(deviceInfo.networkId).c_str());
}

View File

@ -22,7 +22,7 @@
#include "datetime_ex.h"
#include "device_manager.h"
#include "profile_utils.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "static_profile_manager.h"
#include "switch_profile_manager.h"
#include "sync_subscriber_death_recipient.h"
@ -346,13 +346,13 @@ int32_t ProfileCache::RefreshProfileCache()
{
int64_t beginTime = GetTickCount();
std::vector<DeviceProfile> deviceProfiles;
DynamicProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
DeviceProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
RefreshDeviceProfileCache(deviceProfiles);
std::vector<ServiceProfile> serviceProfiles;
DynamicProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
DeviceProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
RefreshServiceProfileCache(serviceProfiles);
std::vector<CharacteristicProfile> charProfiles;
DynamicProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
DeviceProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
StaticProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
RefreshCharProfileCache(charProfiles);
int64_t endTime = GetTickCount();

View File

@ -35,7 +35,7 @@
#include "characteristic_profile.h"
#include "i_sync_completed_callback.h"
#include "sync_completed_callback_stub.h"
#include "dynamic_profile_manager.h"
#include "device_profile_manager.h"
#include "kv_adapter.h"
#include "profile_cache.h"
#undef private
@ -83,7 +83,7 @@ void DeviceProfileManagerTest::SetUp()
tokenId = GetAccessTokenId(&infoInstance);
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
void DeviceProfileManagerTest::TearDown() {
@ -103,8 +103,8 @@ public:
*/
HWTEST_F(DeviceProfileManagerTest, Init001, TestSize.Level1)
{
DynamicProfileManager::GetInstance().UnInit();
int32_t ret = DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().UnInit();
int32_t ret = DeviceProfileManager::GetInstance().Init();
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -116,9 +116,9 @@ HWTEST_F(DeviceProfileManagerTest, Init001, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, UnInit001, TestSize.Level1)
{
int32_t ret = DynamicProfileManager::GetInstance().UnInit();
int32_t ret = DeviceProfileManager::GetInstance().UnInit();
EXPECT_EQ(ret, DP_SUCCESS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -129,7 +129,7 @@ HWTEST_F(DeviceProfileManagerTest, UnInit001, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, ReInit001, TestSize.Level1)
{
int32_t ret = DynamicProfileManager::GetInstance().ReInit();
int32_t ret = DeviceProfileManager::GetInstance().ReInit();
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -154,7 +154,7 @@ HWTEST_F(DeviceProfileManagerTest, PutDeviceProfile001, TestSize.Level1)
deviceProfile.SetOsVersion("anything");
deviceProfile.SetOsType(1);
int32_t ret = DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -179,7 +179,7 @@ HWTEST_F(DeviceProfileManagerTest, PutDeviceProfile002, TestSize.Level1)
deviceProfile.SetOsVersion("anything");
deviceProfile.SetOsType(1);
int32_t ret = DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -217,8 +217,8 @@ HWTEST_F(DeviceProfileManagerTest, PutDeviceProfile003, TestSize.Level1)
deviceProfile2.SetOsVersion("anything");
deviceProfile2.SetOsType(1);
DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile1);
int32_t ret = DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile1);
int32_t ret = DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
EXPECT_EQ(ret, DP_CACHE_EXIST);
}
@ -243,10 +243,10 @@ HWTEST_F(DeviceProfileManagerTest, PutDeviceProfile004, TestSize.Level1)
deviceProfile10.SetOsVersion("anything");
deviceProfile10.SetOsType(1);
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile10);
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile10);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -270,10 +270,10 @@ HWTEST_F(DeviceProfileManagerTest, PutDeviceProfile005, TestSize.Level1)
deviceProfile11.SetOsVersion("anything");
deviceProfile11.SetOsType(1);
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile11);
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile11);
EXPECT_EQ(ret, DP_PUT_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -289,7 +289,7 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfile001, TestSize.Level1)
serviceProfile.SetServiceName("serviceName");
serviceProfile.SetServiceType("serviceType");
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -306,7 +306,7 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfile002, TestSize.Level1)
serviceProfile.SetServiceName("serviceName");
serviceProfile.SetServiceType("serviceType");
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -328,8 +328,8 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfile003, TestSize.Level1)
serviceProfile2.SetServiceName("serviceName");
serviceProfile2.SetServiceType("serviceType");
DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile1);
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile2);
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile1);
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile2);
EXPECT_EQ(ret, DP_CACHE_EXIST);
}
@ -346,10 +346,10 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfile004, TestSize.Level1)
serviceProfile10.SetServiceName("serviceName10");
serviceProfile10.SetServiceType("serviceType10");
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile10);
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile10);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -365,10 +365,10 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfile005, TestSize.Level1)
serviceProfile11.SetServiceName("serviceName11");
serviceProfile11.SetServiceType("serviceType11");
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile11);
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile11);
EXPECT_EQ(ret, DP_PUT_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -392,7 +392,7 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfileBatch001, TestSize.Level1)
serviceProfile2.SetServiceType("serviceType3");
serviceProfiles.push_back(serviceProfile2);
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -417,7 +417,7 @@ HWTEST_F(DeviceProfileManagerTest, PutServiceProfileBatch002, TestSize.Level1)
serviceProfile4.SetServiceType("serviceType4");
serviceProfiles.push_back(serviceProfile4);
int32_t ret = DynamicProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfileBatch(serviceProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -435,7 +435,7 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfile001, TestSize.Level1)
charProfile.SetCharacteristicKey("characteristicKey");
charProfile.SetCharacteristicValue("characteristicValue");
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -453,7 +453,7 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfile002, TestSize.Level1)
charProfile.SetCharacteristicKey("characteristicKey");
charProfile.SetCharacteristicValue("characteristicValue");
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -477,8 +477,8 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfile003, TestSize.Level1)
charProfile2.SetCharacteristicKey("characteristicKey");
charProfile2.SetCharacteristicValue("characteristicValue");
DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile1);
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile2);
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile1);
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile2);
EXPECT_EQ(ret, DP_CACHE_EXIST);
}
@ -496,10 +496,10 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfile004, TestSize.Level1)
charProfile10.SetCharacteristicKey("characteristicKey10");
charProfile10.SetCharacteristicValue("characteristicValue10");
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile10);
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile10);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -516,10 +516,10 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfile005, TestSize.Level1)
charProfile11.SetCharacteristicKey("characteristicKey11");
charProfile11.SetCharacteristicValue("characteristicValue11");
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile11);
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile11);
EXPECT_EQ(ret, DP_PUT_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -545,7 +545,7 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfileBatch001, TestSize.Le
charProfile2.SetCharacteristicValue("characteristicValue3");
charProfiles.push_back(charProfile2);
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfiles);
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -572,7 +572,7 @@ HWTEST_F(DeviceProfileManagerTest, PutCharacteristicProfileBatch002, TestSize.Le
charProfile4.SetCharacteristicValue("characteristicValue4");
charProfiles.push_back(charProfile4);
int32_t ret = DynamicProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfiles);
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfileBatch(charProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -598,10 +598,10 @@ HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile001, TestSize.Level1)
deviceProfile2.SetOsVersion("anything");
deviceProfile2.SetOsType(1);
DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
DeviceProfile outDeviceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
EXPECT_EQ(ret, DP_SUCCESS);
string outDeviceId = outDeviceProfile.GetDeviceId();
@ -628,7 +628,7 @@ HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile002, TestSize.Level1)
{
string deviceId = "";
DeviceProfile outDeviceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -641,11 +641,11 @@ HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile002, TestSize.Level1)
HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile003, TestSize.Level1)
{
string deviceId = "anything12";
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfile outDeviceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -657,11 +657,11 @@ HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile003, TestSize.Level1)
HWTEST_F(DeviceProfileManagerTest, GetDeviceProfile004, TestSize.Level1)
{
string deviceId = "#anything13";
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfile outDeviceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -677,11 +677,11 @@ HWTEST_F(DeviceProfileManagerTest, GetServiceProfile001, TestSize.Level1)
serviceProfile5.SetDeviceId(deviceId);
serviceProfile5.SetServiceName("serviceName5");
serviceProfile5.SetServiceType("serviceType5");
DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile5);
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile5);
string serviceName = "serviceName5";
ServiceProfile outServiceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
EXPECT_EQ(ret, DP_SUCCESS);
string outDeviceId = outServiceProfile.GetDeviceId();
@ -701,12 +701,12 @@ HWTEST_F(DeviceProfileManagerTest, GetServiceProfile002, TestSize.Level1)
string deviceId = "";
string serviceName = "serviceName";
ServiceProfile outServiceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
deviceId = "deviceId";
serviceName = "";
ret = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
ret = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -720,11 +720,11 @@ HWTEST_F(DeviceProfileManagerTest, GetServiceProfile003, TestSize.Level1)
{
string deviceId = "deviceId12";
string serviceName = "serviceName12";
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
ServiceProfile outServiceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -737,11 +737,11 @@ HWTEST_F(DeviceProfileManagerTest, GetServiceProfile004, TestSize.Level1)
{
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
string serviceName = "serviceName13";
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
ServiceProfile outServiceProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
int32_t ret = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName, outServiceProfile);
EXPECT_EQ(ret, DP_GET_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -758,12 +758,12 @@ HWTEST_F(DeviceProfileManagerTest, GetCharacteristicProfile001, TestSize.Level1)
charProfile5.SetServiceName("serviceName5");
charProfile5.SetCharacteristicKey("characteristicKey5");
charProfile5.SetCharacteristicValue("characteristicValue5");
DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile5);
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile5);
string serviceName = "serviceName5";
string characteristicKey = "characteristicKey5";
CharacteristicProfile outCharProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
characteristicKey, outCharProfile);
EXPECT_EQ(ret, DP_SUCCESS);
@ -786,14 +786,14 @@ HWTEST_F(DeviceProfileManagerTest, GetCharacteristicProfile002, TestSize.Level1)
string serviceName = "serviceName";
string characteristicKey = "characteristicKey";
CharacteristicProfile outCharProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
characteristicKey, outCharProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
deviceId = "deviceId";
serviceName = "serviceName";
characteristicKey = "";
ret = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
ret = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
characteristicKey, outCharProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -809,12 +809,12 @@ HWTEST_F(DeviceProfileManagerTest, GetCharacteristicProfile003, TestSize.Level1)
string deviceId = "deviceId12";
string serviceName = "serviceName12";
string characteristicKey = "characteristicKey12";
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
CharacteristicProfile outCharProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
characteristicKey, outCharProfile);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -828,12 +828,12 @@ HWTEST_F(DeviceProfileManagerTest, GetCharacteristicProfile004, TestSize.Level1)
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
string serviceName = "serviceName13";
string characteristicKey = "characteristicKey13";
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
CharacteristicProfile outCharProfile;
int32_t ret = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName,
characteristicKey, outCharProfile);
EXPECT_EQ(ret, DP_GET_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -848,11 +848,11 @@ HWTEST_F(DeviceProfileManagerTest, DeleteServiceProfile001, TestSize.Level1)
serviceProfile6.SetDeviceId("deviceId6");
serviceProfile6.SetServiceName("serviceName6");
serviceProfile6.SetServiceType("serviceType6");
DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile6);
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile6);
string deviceId = "deviceId6";
string serviceName = "serviceName6";
int32_t ret = DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -866,12 +866,12 @@ HWTEST_F(DeviceProfileManagerTest, DeleteServiceProfile002, TestSize.Level1)
{
string deviceId = "";
string serviceName = "serviceName";
int32_t ret = DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
deviceId = "deviceId";
serviceName = "";
ret = DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -885,10 +885,10 @@ HWTEST_F(DeviceProfileManagerTest, DeleteServiceProfile003, TestSize.Level1)
{
string deviceId = "deviceId14";
string serviceName = "serviceName14";
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -901,10 +901,10 @@ HWTEST_F(DeviceProfileManagerTest, DeleteServiceProfile004, TestSize.Level1)
{
string deviceId = "deviceId15";
string serviceName = "serviceName15";
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DynamicProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
EXPECT_EQ(ret, DP_DEL_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -920,12 +920,12 @@ HWTEST_F(DeviceProfileManagerTest, DeleteCharacteristicProfile001, TestSize.Leve
charProfile6.SetServiceName("serviceName6");
charProfile6.SetCharacteristicKey("characteristicKey6");
charProfile6.SetCharacteristicValue("characteristicValue6");
DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile6);
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile6);
string deviceId = "deviceId6";
string serviceName = "serviceName6";
string characteristicKey = "characteristicKey6";
int32_t ret = DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
characteristicKey);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -941,14 +941,14 @@ HWTEST_F(DeviceProfileManagerTest, DeleteCharacteristicProfile002, TestSize.Leve
string deviceId = "";
string serviceName = "serviceName";
string characteristicKey = "characteristicKey";
int32_t ret = DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
int32_t ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
characteristicKey);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
deviceId = "deviceId";
serviceName = "serviceName";
characteristicKey = "";
ret = DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
characteristicKey);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
@ -964,11 +964,11 @@ HWTEST_F(DeviceProfileManagerTest, DeleteCharacteristicProfile003, TestSize.Leve
string deviceId = "deviceId14";
string serviceName = "serviceName14";
string characteristicKey = "characteristicKey14";
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
int32_t ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
characteristicKey);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -982,11 +982,11 @@ HWTEST_F(DeviceProfileManagerTest, DeleteCharacteristicProfile004, TestSize.Leve
string deviceId = "deviceId15";
string serviceName = "serviceName15";
string characteristicKey = "characteristicKey15";
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DynamicProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
int32_t ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
characteristicKey);
EXPECT_EQ(ret, DP_DEL_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -998,7 +998,7 @@ HWTEST_F(DeviceProfileManagerTest, DeleteCharacteristicProfile004, TestSize.Leve
HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile001, TestSize.Level1)
{
vector<DeviceProfile> deviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -1010,11 +1010,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile001, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile002, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
vector<DeviceProfile> deviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1025,11 +1025,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile002, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile003, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
vector<DeviceProfile> deviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllDeviceProfile(deviceProfiles);
EXPECT_EQ(ret, DP_GET_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1041,7 +1041,7 @@ HWTEST_F(DeviceProfileManagerTest, GetAllDeviceProfile003, TestSize.Level1)
HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile001, TestSize.Level1)
{
vector<ServiceProfile> serviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -1053,11 +1053,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile001, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile002, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
vector<ServiceProfile> serviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1068,11 +1068,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile002, TestSize.Level1)
*/
HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile003, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
vector<ServiceProfile> serviceProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllServiceProfile(serviceProfiles);
EXPECT_EQ(ret, DP_GET_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1084,7 +1084,7 @@ HWTEST_F(DeviceProfileManagerTest, GetAllServiceProfile003, TestSize.Level1)
HWTEST_F(DeviceProfileManagerTest, GetAllCharacteristicProfile001, TestSize.Level1)
{
vector<CharacteristicProfile> charProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
EXPECT_EQ(ret, DP_SUCCESS);
}
@ -1096,11 +1096,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllCharacteristicProfile001, TestSize.Leve
*/
HWTEST_F(DeviceProfileManagerTest, GetAllCharacteristicProfile002, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
DeviceProfileManager::GetInstance().dynamicProfileStore_ = nullptr;
vector<CharacteristicProfile> charProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1111,11 +1111,11 @@ HWTEST_F(DeviceProfileManagerTest, GetAllCharacteristicProfile002, TestSize.Leve
*/
HWTEST_F(DeviceProfileManagerTest, GetAllCharacteristicProfile003, TestSize.Level1)
{
DynamicProfileManager::GetInstance().dynamicProfileStore_->UnInit();
DeviceProfileManager::GetInstance().dynamicProfileStore_->UnInit();
vector<CharacteristicProfile> charProfiles;
int32_t ret = DynamicProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
int32_t ret = DeviceProfileManager::GetInstance().GetAllCharacteristicProfile(charProfiles);
EXPECT_EQ(ret, DP_GET_KV_DB_FAIL);
DynamicProfileManager::GetInstance().Init();
DeviceProfileManager::GetInstance().Init();
}
/**
@ -1133,7 +1133,7 @@ HWTEST_F(DeviceProfileManagerTest, SyncDeviceProfile001, TestSize.Level1)
syncOptions.AddDevice("deviceId2");
syncOptions.SetSyncMode(SyncMode::MIN);
int32_t errCode = DynamicProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCb);
int32_t errCode = DeviceProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCb);
EXPECT_EQ(errCode, DP_INVALID_PARAMS);
}
@ -1152,7 +1152,7 @@ HWTEST_F(DeviceProfileManagerTest, SyncDeviceProfile002, TestSize.Level1)
syncOptions.AddDevice("deviceId2");
syncOptions.SetSyncMode(SyncMode::MAX);
int32_t errCode = DynamicProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCb);
int32_t errCode = DeviceProfileManager::GetInstance().SyncDeviceProfile(syncOptions, syncCb);
EXPECT_EQ(errCode, DP_INVALID_PARAMS);
}
@ -1277,8 +1277,8 @@ HWTEST_F(DeviceProfileManagerTest, LoadDpSyncAdapter001, TestSize.Level1)
if ((soName.length() == 0) || (soName.length() > PATH_MAX) || (realpath(soName.c_str(), path) == nullptr)) {
ret = true;
} else {
DynamicProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DynamicProfileManager::GetInstance().LoadDpSyncAdapter();
DeviceProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DeviceProfileManager::GetInstance().LoadDpSyncAdapter();
}
EXPECT_EQ(true, ret);
}
@ -1304,20 +1304,20 @@ HWTEST_F(DeviceProfileManagerTest, GetInKvDB001, TestSize.Level1)
deviceProfile2.SetOsApiLevel(1);
deviceProfile2.SetOsVersion("GetInKvDB001_OsVersion");
deviceProfile2.SetOsType(1);
DynamicProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
DeviceProfileManager::GetInstance().PutDeviceProfile(deviceProfile2);
ServiceProfile serviceProfile5;
serviceProfile5.SetDeviceId(deviceId);
serviceProfile5.SetServiceName("GetInKvDB001_ServiceName");
serviceProfile5.SetServiceType("GetInKvDB001_ServiceType");
DynamicProfileManager::GetInstance().PutServiceProfile(serviceProfile5);
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile5);
CharacteristicProfile charProfile5;
charProfile5.SetDeviceId(deviceId);
charProfile5.SetServiceName("GetInKvDB001_ServiceName");
charProfile5.SetCharacteristicKey("GetInKvDB001_CharacteristicKey");
charProfile5.SetCharacteristicValue("GetInKvDB001_CharacteristicValue");
DynamicProfileManager::GetInstance().PutCharacteristicProfile(charProfile5);
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile5);
ProfileCache::GetInstance().DeleteDeviceProfile(deviceId);
ProfileCache::GetInstance().DeleteServiceProfile("GetInKvDB001_DeviceId", "GetInKvDB001_ServiceName");
@ -1325,18 +1325,18 @@ HWTEST_F(DeviceProfileManagerTest, GetInKvDB001, TestSize.Level1)
"GetInKvDB001_CharacteristicKey");
DeviceProfile outDeviceProfile;
int32_t ret1 = DynamicProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
int32_t ret1 = DeviceProfileManager::GetInstance().GetDeviceProfile(deviceId, outDeviceProfile);
EXPECT_EQ(ret1, DP_SUCCESS);
string serviceName2 = "GetInKvDB001_ServiceName";
ServiceProfile outServiceProfile;
int32_t ret2 = DynamicProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName2, outServiceProfile);
int32_t ret2 = DeviceProfileManager::GetInstance().GetServiceProfile(deviceId, serviceName2, outServiceProfile);
EXPECT_EQ(ret2, DP_SUCCESS);
string serviceName3 = "GetInKvDB001_ServiceName";
string characteristicKey3 = "GetInKvDB001_CharacteristicKey";
CharacteristicProfile outCharProfile;
int32_t ret3 = DynamicProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName3,
int32_t ret3 = DeviceProfileManager::GetInstance().GetCharacteristicProfile(deviceId, serviceName3,
characteristicKey3, outCharProfile);
EXPECT_EQ(ret3, DP_SUCCESS);
}
@ -1351,11 +1351,11 @@ HWTEST_F(DeviceProfileManagerTest, RunloadedFunction001, TestSize.Level1)
{
OHOS::sptr<OHOS::IRemoteObject> syncCb = new(nothrow) SyncCallback();
string deviceId = "DeviceId";
int32_t ret = DynamicProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
int32_t ret = DeviceProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
EXPECT_EQ(ret, DP_LOAD_SYNC_ADAPTER_FAILED);
DynamicProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DynamicProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
DeviceProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DeviceProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
EXPECT_EQ(ret, DP_LOAD_SYNC_ADAPTER_FAILED);
}
/**
@ -1368,11 +1368,11 @@ HWTEST_F(DeviceProfileManagerTest, RunloadedFunction002, TestSize.Level1)
{
OHOS::sptr<OHOS::IRemoteObject> syncCb = new(nothrow) SyncCallback();
string deviceId = ProfileUtils::GetLocalUdidFromDM();
int32_t ret = DynamicProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
int32_t ret = DeviceProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
EXPECT_EQ(ret, DP_LOAD_SYNC_ADAPTER_FAILED);
DynamicProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DynamicProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
DeviceProfileManager::GetInstance().isAdapterSoLoaded_ = true;
ret = DeviceProfileManager::GetInstance().RunloadedFunction(deviceId, syncCb);
EXPECT_EQ(ret, DP_LOAD_SYNC_ADAPTER_FAILED);
}
@ -1385,11 +1385,11 @@ HWTEST_F(DeviceProfileManagerTest, RunloadedFunction002, TestSize.Level1)
HWTEST_F(DeviceProfileManagerTest, DeviceOnlineAutoSync001, TestSize.Level1)
{
std::string peerNetworkId = "";
int32_t ret = DynamicProfileManager::GetInstance().DeviceOnlineAutoSync(peerNetworkId);
int32_t ret = DeviceProfileManager::GetInstance().DeviceOnlineAutoSync(peerNetworkId);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
peerNetworkId = ProfileUtils::GetLocalUdidFromDM();
ret = DynamicProfileManager::GetInstance().DeviceOnlineAutoSync(peerNetworkId);
ret = DeviceProfileManager::GetInstance().DeviceOnlineAutoSync(peerNetworkId);
EXPECT_EQ(ret, DP_INVALID_PARAMS);
}
} // namespace DistributedDeviceProfile

View File

@ -55,7 +55,8 @@ void KVAdapterTest::SetUpTestCase(void)
kvStore = make_shared<KVAdapter>(APP_ID, STORE_ID,
make_shared<KvDataChangeListener>(),
make_shared<KvSyncCompletedListener>(),
make_shared<KvDeathRecipient>());
make_shared<KvDeathRecipient>(),
DistributedKv::TYPE_DYNAMICAL);
}
void KVAdapterTest::TearDownTestCase(void) {

View File

@ -658,7 +658,7 @@ HWTEST_F(ProfileCacheTest, IsLocalOrOnlineDevice002, TestSize.Level1)
HWTEST_F(ProfileCacheTest, IsLocalOrOnlineDevice0013, TestSize.Level1)
{
std::string deviceId = "deviceId";
ProfileCache::GetInstance().onlineDevMap_.[deviceId] = deviceId;
ProfileCache::GetInstance().onlineDevMap_[deviceId] = deviceId;
bool ret = ProfileCache::GetInstance().IsLocalOrOnlineDevice(deviceId);
EXPECT_EQ(ret, true);
}