Merge branch 'master' of gitee.com:openharmony/ability_dmsfwk into master

Signed-off-by: zhx <zhuhuixuan@huawei.com>
This commit is contained in:
zhx 2024-07-08 10:26:40 +00:00 committed by Gitee
commit 36bbfacde4
74 changed files with 1772 additions and 269 deletions

View File

@ -38,6 +38,7 @@ std::string Base64Encode(const unsigned char *toEncode, unsigned int len);
std::string Base64Decode(const std::string& basicString);
bool IsBase64(unsigned char c);
std::string GetAnonymStr(const std::string &value);
std::string GetAnonymInt32(const int32_t value);
bool IsInt32(const cJSON *paramValue);
bool IsString(const cJSON *paramValue);
bool CJsonParamCheck(const cJSON *jsonObj, const std::initializer_list<std::string> &keys);

View File

@ -462,6 +462,10 @@ enum {
* Result(29360230) for sink Ability abnormal termination during continuation.
*/
CONTINUE_SINK_ABILITY_TERMINATED = 29360230,
/**
* Result(29360231) for all connect manager reject connect apply.
*/
DMS_CONNECT_APPLY_REJECT_FAILED = 29360231,
};
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -24,6 +24,7 @@
#include "ability_manager_client.h"
#include "config_policy_utils.h"
#include "securec.h"
#include "dms_constant.h"
#include "dtbschedmgr_log.h"
@ -75,6 +76,10 @@ bool IsValidPath(const std::string &inFilePath, std::string &realFilePath)
}
realFilePath = std::string(path);
if (realFilePath.empty()) {
HILOGE("Real file path is empty.");
return false;
}
if (!std::filesystem::exists(realFilePath)) {
HILOGE("The real file path %{public}s does not exist in the file system.", realFilePath.c_str());
realFilePath = "";
@ -207,7 +212,10 @@ int32_t GetCurrentMissionId()
return INVALID_MISSION_ID;
}
int32_t missionId = INVALID_MISSION_ID;
AAFwk::AbilityManagerClient::GetInstance()->GetMissionIdByToken(token, missionId);
if (AAFwk::AbilityManagerClient::GetInstance()->GetMissionIdByToken(token, missionId) != ERR_OK) {
HILOGE("GetMissionIdByToken failed");
return INVALID_MISSION_ID;
}
return missionId;
}
@ -359,6 +367,12 @@ std::string GetAnonymStr(const std::string &value)
return res;
}
std::string GetAnonymInt32(const int32_t value)
{
std::string tmpStr = std::to_string(value);
return GetAnonymStr(tmpStr);
}
bool IsInt32(const cJSON *paramValue)
{
if (paramValue == nullptr) {
@ -411,6 +425,10 @@ bool CJsonParamCheck(const cJSON *jsonObj, const std::initializer_list<std::stri
HILOGE("Check is not supported yet, key %{public}s.", (*it).c_str());
return false;
}
if (iter->second == nullptr) {
HILOGE("JsonTypeCheckFunc for key %{public}s is nullptr.", (*it).c_str());
return false;
}
JsonTypeCheckFunc &func = iter->second;
bool res = (*func)(paramValue);
if (!res) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -32,6 +32,10 @@ constexpr const char* DMS_CHAR_ID = "static_capability";
constexpr const char* PACKAGE_NAMES = "packageNames";
constexpr const char* VERSIONS = "versions";
constexpr const char* DMS_SERVICE_TYPE = "appInfo";
const std::string EXTRO_INFO_JSON_KEY_ACCOUNT_ID = "accountId";
const std::string EXTRO_INFO_JSON_KEY_USERID_ID = "userId";
const std::string EXTRO_INFO_JSON_KEY_CALLER_INFO_EX = "callerInfo_ExtraInfoJson";
} // Constants
} // DistributedSchedule
} // OHOS

View File

@ -0,0 +1,90 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_IDMS_SRV_COLLABORATION_MGR_CAPI_H
#define OHOS_IDMS_SRV_COLLABORATION_MGR_CAPI_H
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum ServiceCollaborationManagerHardwareType {
SCM_UNKNOWN_TYPE = 0,
SCM_DISPLAY = 1,
SCM_MIC = 2,
SCM_SPEAKER = 3,
SCM_CAMERA = 4,
} ServiceCollaborationManagerHardwareType;
typedef enum ServiceCollaborationManagerBussinessStatus {
SCM_IDLE = 1,
SCM_PREPARE = 2,
SCM_CONNECTING = 3,
SCM_CONNECTED = 4
} ServiceCollaborationManagerBussinessStatus;
typedef enum ServiceCollaborationManagerResultCode {
PASS = 1004720001,
REJECT = 1004720002
} ServiceCollaborationManagerResultCode;
typedef struct ServiceCollaborationManager_HardwareRequestInfo {
ServiceCollaborationManagerHardwareType hardWareType;
bool canShare;
} ServiceCollaborationManager_HardwareRequestInfo;
typedef struct ServiceCollaborationManager_CommunicationRequestInfo {
int32_t minBandwidth;
int32_t maxLatency;
int32_t minLatency;
int32_t maxWaitTime;
const char *dataType;
} ServiceCollaborationManager_CommunicationRequestInfo;
typedef struct ServiceCollaborationManager_ResourceRequestInfoSets {
uint32_t remoteHardwareListSize;
ServiceCollaborationManager_HardwareRequestInfo *remoteHardwareList;
uint32_t localHardwareListSize;
ServiceCollaborationManager_HardwareRequestInfo *localHardwareList;
ServiceCollaborationManager_CommunicationRequestInfo *communicationRequest;
} ServiceCollaborationManager_ResourceRequestInfoSets;
typedef struct ServiceCollaborationManager_Callback {
int32_t (*OnStop)(const char *peerNetworkId);
int32_t (*ApplyResult)(int32_t errorcode, int32_t result, const char *reason);
} ServiceCollaborationManager_Callback;
typedef struct ServiceCollaborationManager_API {
int32_t (*ServiceCollaborationManager_PublishServiceState)(const char *peerNetworkId, const char *serviceName,
const char *extraInfo, ServiceCollaborationManagerBussinessStatus state);
int32_t (*ServiceCollaborationManager_ApplyAdvancedResource)(const char *peerNetworkId, const char *serviceName,
ServiceCollaborationManager_ResourceRequestInfoSets *resourceRequest,
ServiceCollaborationManager_Callback *callback);
int32_t (*ServiceCollaborationManager_RegisterLifecycleCallback)(const char *serviceName,
ServiceCollaborationManager_Callback *callback);
int32_t (*ServiceCollaborationManager_UnRegisterLifecycleCallback)(const char *serviceName);
} ServiceCollaborationManager_API;
int32_t ServiceCollaborationManager_Export(ServiceCollaborationManager_API *exportapi);
#ifdef __cplusplus
}
#endif
#endif // OHOS_IDMS_SRV_COLLABORATION_MGR_CAPI_H

View File

@ -57,6 +57,10 @@ int32_t DistributedClient::RegisterDSchedEventListener(const DSchedEventType& ty
return ERR_FLATTEN_OBJECT;
}
PARCEL_WRITE_HELPER(data, Uint8, type);
if (obj == nullptr) {
HILOG_ERROR("Received null IDSchedEventListener object");
return AAFwk::INVALID_PARAMETERS_ERR;
}
PARCEL_WRITE_HELPER(data, RemoteObject, obj->AsObject());
PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_DSCHED_EVENT_LISTENER),
data, reply);
@ -78,6 +82,10 @@ int32_t DistributedClient::UnRegisterDSchedEventListener(const DSchedEventType&
return ERR_FLATTEN_OBJECT;
}
PARCEL_WRITE_HELPER(data, Uint8, type);
if (obj == nullptr) {
HILOG_ERROR("Received null IDSchedEventListener object");
return AAFwk::INVALID_PARAMETERS_ERR;
}
PARCEL_WRITE_HELPER(data, RemoteObject, obj->AsObject());
PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_DSCHED_EVENT_LISTENER),
data, reply);

View File

@ -57,6 +57,10 @@ int32_t DSchedEventListenerStub::OnRemoteRequest(uint32_t code,
}
auto memberFunc = itFunc->second;
if (!memberFunc) {
HILOGE("memberFunc is null for code %u", code);
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
}
(this->*memberFunc)(data, reply);
return 0;
}

View File

@ -26,7 +26,16 @@ DmsSaClient &DmsSaClient::GetInstance()
bool DmsSaClient::SubscribeDmsSA()
{
HILOGD("called.");
if (!saMgrProxy_) {
HILOGE("saMgrProxy_ is null.");
return false;
}
sptr<DmsSystemAbilityStatusChange> callback(new DmsSystemAbilityStatusChange());
if (!callback) {
HILOGE("Failed to create callback object.");
return false;
}
int32_t ret = saMgrProxy_->SubscribeSystemAbility(DISTRIBUTED_SCHED_SA_ID, callback);
if (ret != ERR_OK) {
HILOGE("Failed to subscribe system ability DISTRIBUTED_SCHED_SA_ID ret:%{public}d", ret);

View File

@ -376,7 +376,7 @@ napi_value JsContinuationManager::OnRegisterDeviceSelectionCallback(napi_env env
napi_create_reference(env, jsListenerObj, 1, &tempRef);
std::unique_ptr<NativeReference> callbackRef;
callbackRef.reset(reinterpret_cast<NativeReference*>(tempRef));
sptr<JsDeviceSelectionListener> deviceSelectionListener = new JsDeviceSelectionListener(env);
sptr<JsDeviceSelectionListener> deviceSelectionListener(new JsDeviceSelectionListener(env));
if (deviceSelectionListener == nullptr) {
HILOGE("deviceSelectionListener is nullptr!");
errCode = SYSTEM_WORK_ABNORMALLY;
@ -806,6 +806,10 @@ bool JsContinuationManager::UnWrapContinuationExtraParams(const napi_env &env, c
HILOGE("options is invalid.");
return false;
}
if (!continuationExtraParams) {
HILOGE("continuationExtraParams is nullptr.");
return false;
}
std::vector<std::string> deviceTypes;
if (UnwrapStringArrayByPropertyName(env, options, "deviceType", deviceTypes)) {
continuationExtraParams->SetDeviceType(deviceTypes);

View File

@ -96,6 +96,11 @@ void JsDeviceSelectionListener::CallJsMethodInner(const std::string& methodName,
const std::vector<ContinuationResult>& continuationResults)
{
std::lock_guard<std::mutex> jsCallBackMapLock(jsCallBackMapMutex_);
auto it = jsCallBackMap_.find(methodName);
if (it == jsCallBackMap_.end()) {
HILOGE("Callback method %s not found in jsCallBackMap_", methodName.c_str());
return;
}
napi_value method = jsCallBackMap_[methodName]->GetNapiValue();
if (method == nullptr) {
HILOGE("Failed to get %{public}s from object", methodName.c_str());
@ -135,6 +140,11 @@ void JsDeviceSelectionListener::CallJsMethodInner(const std::string& methodName,
const std::vector<std::string>& deviceIds)
{
std::lock_guard<std::mutex> jsCallBackMapLock(jsCallBackMapMutex_);
auto it = jsCallBackMap_.find(methodName);
if (it == jsCallBackMap_.end()) {
HILOGE("Callback method %s not found in jsCallBackMap_", methodName.c_str());
return;
}
napi_value method = jsCallBackMap_[methodName]->GetNapiValue();
if (method == nullptr) {
HILOGE("Failed to get %{public}s from object", methodName.c_str());

View File

@ -14,6 +14,11 @@
"name": "deviceonline",
"value": "on"
}
],
"commonevent":[
{
"name":"usual.event.BOOT_COMPLETED"
}
]
},
"stop-on-demand": {

View File

@ -640,7 +640,7 @@ void DistributedAbilityManagerService::HandleStartDeviceManager(int32_t token,
PARCEL_WRITE_HELPER_NORET(data, Int32, VALUE_OBJECT);
PARCEL_WRITE_HELPER_NORET(data, Parcelable, continuationExtraParams.get());
}
sptr<AppDeviceCallbackStub> callback = new AppDeviceCallbackStub();
sptr<AppDeviceCallbackStub> callback(new AppDeviceCallbackStub());
PARCEL_WRITE_HELPER_NORET(data, RemoteObject, callback);
// query whether the connect status needs to be send
{

View File

@ -196,7 +196,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_001, TestS
int32_t token = -1;
int32_t result1 = DistributedAbilityManagerClient::GetInstance().Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = DistributedAbilityManagerClient::GetInstance().RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -217,7 +217,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_001, TestS
HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_002, TestSize.Level1)
{
DTEST_LOG << "ContinuationManagerTest RegisterDeviceSelectionCallbackTest_002 start" << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result1 = DistributedAbilityManagerClient::GetInstance().RegisterDeviceSelectionCallback(
UNREGISTER_TOKEN, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result1:" << result1 << std::endl;
@ -240,7 +240,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_003, TestS
int32_t token = -1;
int32_t result1 = DistributedAbilityManagerClient::GetInstance().Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = DistributedAbilityManagerClient::GetInstance().RegisterDeviceSelectionCallback(
token, INVALID_CALLBACK_TYPE, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -272,7 +272,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_004, TestS
int32_t token = -1;
int32_t result1 = dtbabilitymgrService_->Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = dtbabilitymgrService_->RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -310,7 +310,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_005, TestS
int32_t token = -1;
int32_t result1 = dtbabilitymgrService_->Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = dtbabilitymgrService_->RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE2, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -348,7 +348,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_006, TestS
int32_t token = -1;
int32_t result1 = dtbabilitymgrService_->Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = dtbabilitymgrService_->RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE2, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -386,7 +386,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_007, TestS
int32_t token = -1;
int32_t result1 = dtbabilitymgrService_->Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = dtbabilitymgrService_->RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -457,7 +457,7 @@ HWTEST_F(ContinuationManagerTest, RegisterDeviceSelectionCallbackTest_009, TestS
DTEST_LOG << "dtbabilitymgrService_ is nullptr" << std::endl;
return;
}
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result1 = dtbabilitymgrService_->RegisterDeviceSelectionCallback(
UNREGISTER_TOKEN, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result1:" << result1 << std::endl;
@ -531,7 +531,7 @@ HWTEST_F(ContinuationManagerTest, UnregisterDeviceSelectionCallbackTest_001, Tes
int32_t token = -1;
int32_t result1 = DistributedAbilityManagerClient::GetInstance().Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = DistributedAbilityManagerClient::GetInstance().RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -711,7 +711,7 @@ HWTEST_F(ContinuationManagerTest, UpdateConnectStatusTest_001, TestSize.Level1)
int32_t token = -1;
int32_t result1 = DistributedAbilityManagerClient::GetInstance().Register(nullptr, token);
DTEST_LOG << "result1:" << result1 << std::endl;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t result2 = DistributedAbilityManagerClient::GetInstance().RegisterDeviceSelectionCallback(
token, CALLBACK_TYPE1, notifier);
DTEST_LOG << "result2:" << result2 << std::endl;
@ -1013,7 +1013,7 @@ HWTEST_F(ContinuationManagerTest, IsNotifierRegisteredTest_004, TestSize.Level1)
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
bool result = dtbabilitymgrService_->IsNotifierRegistered(TEST_TOKEN);
@ -1035,7 +1035,7 @@ HWTEST_F(ContinuationManagerTest, IsNotifierRegisteredLockedTest_005, TestSize.L
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
bool result = dtbabilitymgrService_->IsNotifierRegisteredLocked(TEST_TOKEN, CALLBACK_TYPE2);
@ -1057,7 +1057,7 @@ HWTEST_F(ContinuationManagerTest, IsNotifierRegisteredLockedTest_006, TestSize.L
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
bool result = dtbabilitymgrService_->IsNotifierRegisteredLocked(UNREGISTER_TOKEN, CALLBACK_TYPE1);
@ -1080,7 +1080,7 @@ HWTEST_F(ContinuationManagerTest, IsNotifierRegisteredLockedTest_007, TestSize.L
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
bool result = dtbabilitymgrService_->IsNotifierRegisteredLocked(TEST_TOKEN, CALLBACK_TYPE1);
@ -1102,7 +1102,7 @@ HWTEST_F(ContinuationManagerTest, QueryTokenByNotifier_001, TestSize.Level1)
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
int32_t token = -1;
@ -1125,7 +1125,7 @@ HWTEST_F(ContinuationManagerTest, QueryTokenByNotifier_002, TestSize.Level1)
return;
}
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(CALLBACK_TYPE1, notifier);
dtbabilitymgrService_->callbackMap_[TEST_TOKEN] = std::move(notifierInfo);
int32_t token = -1;
@ -1814,7 +1814,7 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_008, TestSize.Level3)
/**
* @tc.steps: step2. DeviceSelectionNotifierProxy::OnDeviceConnect when continuationResults is nullptr.
*/
sptr<IRemoteObject> impl = new MockRemoteStub();
sptr<IRemoteObject> impl(new MockRemoteStub());
DeviceSelectionNotifierProxy deviceSelectionNotifierProxy(impl);
std::vector<ContinuationResult> continuationResults;
deviceSelectionNotifierProxy.OnDeviceConnect(continuationResults);

View File

@ -393,7 +393,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, RegisterDeviceSelectionCallback_0
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(ret, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
@ -426,7 +426,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, RegisterDeviceSelectionCallback_0
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(ret, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_DISCONNECT, notifier);
@ -460,7 +460,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, RegisterDeviceSelectionCallback_0
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(ret, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
{
std::lock_guard<std::mutex> callbackMapLock(dtbabilitymgrService_->callbackMapMutex_);
dtbabilitymgrService_->callbackMap_[token] = nullptr;
@ -541,7 +541,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UnregisterDeviceSelectionCallback
/**
* @tc.steps: step5. test UnregisterDeviceSelectionCallback when callback is registered.
*/
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
@ -572,7 +572,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UnregisterDeviceSelectionCallback
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(ret, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_DISCONNECT, notifier);
@ -622,7 +622,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UpdateConnectStatus_001, TestSize
/**
* @tc.steps: step4. test UpdateConnectStatus when callback is registered.
*/
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
ret = dtbabilitymgrService_->UpdateConnectStatus(token, DEVICE_ID, DeviceConnectStatus::IDLE);
@ -691,7 +691,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, OnDeviceDisconnect_001, TestSize.
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(ret, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_DISCONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
ret = dtbabilitymgrService_->OnDeviceDisconnect(token, continuationResults);
@ -825,7 +825,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, HandleDeviceDisconnect_002, TestS
* @tc.steps: step2. test HandleDeviceConnect when continuationHandler_ is not nullptr.
*/
dtbabilitymgrService_->continuationHandler_ = std::make_shared<ffrt::queue>("ContinuationMgr");
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
std::vector<ContinuationResult> continuationResults;
bool ret = dtbabilitymgrService_->HandleDeviceDisconnect(notifier, continuationResults);
EXPECT_EQ(ret, true);
@ -871,7 +871,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, QueryTokenByNotifier_001, TestSiz
dtbabilitymgrService_->callbackMap_.clear();
dtbabilitymgrService_->callbackMap_[INVALID_CODE] = nullptr;
}
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
int32_t token;
bool ret = dtbabilitymgrService_->QueryTokenByNotifier(notifier, token);
EXPECT_FALSE(ret);
@ -926,7 +926,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, HandleNotifierDied_001, TestSize.
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
int32_t res = dtbabilitymgrService_->Register(continuationExtraParams, token);
EXPECT_EQ(res, ERR_OK);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
notifierInfo->SetNotifier(EVENT_CONNECT, notifier);
{
@ -995,7 +995,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, DumpNotifierLocked_002, TestSize.
std::vector<int32_t> tokenVec;
std::string info;
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(EVENT_CONNECT, notifier);
{
std::lock_guard<std::mutex> autoLock(dtbabilitymgrService_->callbackMapMutex_);
@ -1076,7 +1076,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UpdateConnectStatus_003, TestSize
int32_t token = 0;
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
EXPECT_EQ(ret, ERR_OK);
dtbabilitymgrService_->ScheduleStartDeviceManager(dtbabilitymgrService_, 1, continuationExtraParams);
@ -1234,7 +1234,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, OnDeviceConnect_002, TestSize.Lev
int32_t token = 0;
std::vector<ContinuationResult> continuationResults;
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
notifierInfo->SetNotifier(EVENT_CONNECT, notifier);
{
std::lock_guard<std::mutex> autoLock(dtbabilitymgrService_->callbackMapMutex_);
@ -1319,7 +1319,7 @@ HWTEST_F(DistributedAbilityManagerServiceTest, HandleNotifierDied_002, TestSize.
return;
}
int32_t token = 0;
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
sptr<DeviceSelectionNotifierTest> notifier(new DeviceSelectionNotifierTest());
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
notifierInfo->SetNotifier(EVENT_CONNECT, notifier);
{

View File

@ -76,7 +76,7 @@ HWTEST_F(DmsSaClientTest, AddDSchedEventListener_001, TestSize.Level3)
dmssaClient_->OnAddSystemAbility(systemAbilityId, DEVICE_ID);
DTEST_LOG << "DmsSaClientTest OnAddSystemAbility_002 end" << std::endl;
sptr<IDSchedEventListenerTest> listener = new IDSchedEventListenerTest();
sptr<IDSchedEventListenerTest> listener(new IDSchedEventListenerTest());
dmssaClient_->hasSubscribeDmsSA_ = true;
int32_t result = dmssaClient_->AddDSchedEventListener(DMS_CONTINUE, listener);;
EXPECT_EQ(result, NO_ERROR);
@ -105,7 +105,7 @@ HWTEST_F(DmsSaClientTest, AddDSchedEventListener_002, TestSize.Level3)
dmssaClient_->OnRemoveSystemAbility(systemAbilityId, DEVICE_ID);
DTEST_LOG << "DmsSaClientTest OnRemoveSystemAbility_001 end" << std::endl;
sptr<IDSchedEventListenerTest> listener = new IDSchedEventListenerTest();
sptr<IDSchedEventListenerTest> listener(new IDSchedEventListenerTest());
int32_t result = dmssaClient_->AddDSchedEventListener(DMS_CONTINUE, listener);;
EXPECT_EQ(result, NO_ERROR);
DTEST_LOG << "DmsSaClientTest AddDSchedEventListener_002 end" << std::endl;
@ -131,7 +131,7 @@ HWTEST_F(DmsSaClientTest, DelDSchedEventListener_001, TestSize.Level3)
DTEST_LOG << "DmsSaClientTest OnAddSystemAbility_001 end" << std::endl;
DTEST_LOG << "DmsSaClientTest DelDSchedEventListener_001 start" << std::endl;
sptr<IDSchedEventListenerTest> listener = new IDSchedEventListenerTest();
sptr<IDSchedEventListenerTest> listener(new IDSchedEventListenerTest());
int32_t result1 = dmssaClient_->AddDSchedEventListener(DMS_CONTINUE, listener);;
EXPECT_EQ(result1, NO_ERROR);
int32_t result2 = dmssaClient_->DelDSchedEventListener(DMS_CONTINUE, listener);;
@ -211,7 +211,7 @@ HWTEST_F(DmsSaClientTest, OnAddSystemAbility_001, TestSize.Level3)
DTEST_LOG << "DmsSaClientTest OnAddSystemAbility_001 end" << std::endl;
DTEST_LOG << "DmsSaClientTest DelDSchedEventListener_001 start" << std::endl;
sptr<IDSchedEventListenerTest> listener = new IDSchedEventListenerTest();
sptr<IDSchedEventListenerTest> listener(new IDSchedEventListenerTest());
int32_t result = dmssaClient_->AddDSchedEventListener(DMS_CONTINUE, listener);;
EXPECT_EQ(result, NO_ERROR);
DTEST_LOG << "DmsSaClientTest OnAddSystemAbility_001 end" << std::endl;
@ -237,7 +237,7 @@ HWTEST_F(DmsSaClientTest, OnRemoveSystemAbility_001, TestSize.Level3)
DTEST_LOG << "DmsSaClientTest OnRemoveSystemAbility_001 end" << std::endl;
DTEST_LOG << "DmsSaClientTest AddDSchedEventListener_001 start" << std::endl;
sptr<IDSchedEventListenerTest> listener = new IDSchedEventListenerTest();
sptr<IDSchedEventListenerTest> listener(new IDSchedEventListenerTest());
int32_t result = dmssaClient_->AddDSchedEventListener(DMS_CONTINUE, listener);;
EXPECT_EQ(result, NO_ERROR);
DTEST_LOG << "DmsSaClientTest OnRemoveSystemAbility_001 end" << std::endl;

View File

@ -35,6 +35,7 @@ config("distributed_sched_config") {
"include/continue/state/sink_state",
"include/distributedWant",
"include/softbus_adapter/transport",
"include/softbus_adapter/allconnectmgr",
]
defines = []
if (dmsfwk_mission_manager) {
@ -77,6 +78,7 @@ ohos_shared_library("distributedschedsvr") {
cflags = [
"-DDMSFWK_SAME_ACCOUNT",
"-DDMSFWK_INTERACTIVE_ADAPTER",
"-DDMSFWK_ALL_CONNECT_MGR",
]
}
@ -130,6 +132,7 @@ ohos_shared_library("distributedschedsvr") {
"src/dms_token_callback.cpp",
"src/dms_version_manager.cpp",
"src/dtbschedmgr_device_info_storage.cpp",
"src/softbus_adapter/allconnectmgr/dsched_all_connect_manager.cpp",
"src/softbus_adapter/transport/dsched_data_buffer.cpp",
"src/softbus_adapter/transport/dsched_softbus_session.cpp",
"src/softbus_adapter/transport/dsched_transport_softbus_adapter.cpp",
@ -179,6 +182,7 @@ ohos_shared_library("distributedschedsvr") {
"init:libbegetutil",
"ipc:ipc_core",
"kv_store:distributeddata_inner",
"os_account:libaccountkits",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"wifi:wifi_sdk",

View File

@ -206,6 +206,7 @@ private:
bool CheckQuickStartConfiguration();
std::string GetAbilityNameByContinueType();
void SetEventData();
void UpdateState(DSchedContinueStateType stateType);
private:
std::shared_ptr<DSchedContinueStateMachine> stateMachine_;

View File

@ -51,9 +51,9 @@ public:
void Init();
void UnInit();
void NotifyAllConnectDecision(std::string peerDeviceId, bool isSupport);
void OnDataRecv(int32_t sessionId, std::shared_ptr<DSchedDataBuffer> dataBuffer);
void OnShutdown(int32_t socket, bool isSelfCalled);
void OnBind();
int32_t GetContinueInfo(std::string &srcDeviceId, std::string &dstDeviceId);
std::shared_ptr<DSchedContinue> GetDSchedContinueByWant(const OHOS::AAFwk::Want& want, int32_t missionId);
@ -77,6 +77,7 @@ private:
void NotifyContinueDataRecv(int32_t sessionId, int32_t command, const std::string& jsonStr,
std::shared_ptr<DSchedDataBuffer> dataBuffer);
int32_t CheckContinuationLimit(const std::string& srcDeviceId, const std::string& dstDeviceId);
void WaitAllConnectDecision(int32_t direction, const DSchedContinueInfo &info, int32_t timeout);
void SetTimeOut(const DSchedContinueInfo& info, int32_t timeout);
void RemoveTimeout(const DSchedContinueInfo& info);
@ -87,6 +88,10 @@ private:
};
private:
#ifdef DMSFWK_ALL_CONNECT_MGR
static constexpr int32_t CONNECT_DECISION_WAIT_S = 60;
#endif
std::thread eventThread_;
std::condition_variable eventCon_;
std::mutex eventMutex_;
@ -96,6 +101,10 @@ private:
std::map<DSchedContinueInfo, std::shared_ptr<DSchedContinue>> continues_;
std::mutex continueMutex_;
std::mutex connectDecisionMutex_;
std::condition_variable connectDecisionCond_;
std::map<std::string, std::atomic<bool>> peerConnectDecision_;
std::atomic<int32_t> cntSink_ {0};
std::atomic<int32_t> cntSource_ {0};
};

View File

@ -45,11 +45,15 @@ public:
struct AccountInfo {
int32_t accountType = DIFF_ACCOUNT_TYPE;
std::vector<std::string> groupIdList;
std::string activeAccountId = "";
int32_t userId = 0;
};
enum {
CALLER = 0,
CALLEE,
};
enum {
CONNECT = 0,
CALL,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -59,7 +59,11 @@ public:
void MarkUriPermission(OHOS::AAFwk::Want& want, uint32_t accessToken);
private:
bool CheckAclList(const std::string& udid, const std::vector<std::string>& bundleNames);
bool GetOsAccountData(AccountInfo& dmsAccountInfo);
bool CheckDstSameAccount(const std::string& dstNetworkId, const AccountInfo& dmsAccountInfo,
const CallerInfo& callerInfo);
bool CheckAclList(const std::string& dstNetworkId, const AccountInfo& dmsAccountInfo,
const CallerInfo& callerInfo);
bool GetRelatedGroups(const std::string& udid, const std::vector<std::string>& bundleNames,
AccountInfo& accountInfo);
bool ParseGroupInfos(const std::string& returnGroupStr, std::vector<GroupInfo>& groupInfos);

View File

@ -88,8 +88,10 @@ class DistributedSchedService : public SystemAbility, public DistributedSchedStu
public:
~DistributedSchedService() = default;
void OnStart() override;
void OnStop() override;
void OnStart(const SystemAbilityOnDemandReason &startReason) override;
void OnStop(const SystemAbilityOnDemandReason &stopReason) override;
void OnActive(const SystemAbilityOnDemandReason &activeReason) override;
void HandleBootStart(const SystemAbilityOnDemandReason &startReason);
int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override;
void DeviceOnlineNotify(const std::string& deviceId);
void DeviceOfflineNotify(const std::string& deviceId);

View File

@ -90,7 +90,7 @@ private:
int32_t StartAbilityByCallFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t ReleaseAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t StartRemoteFreeInstallInner(MessageParcel& data, MessageParcel& reply);
int32_t CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo);
int32_t CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo, AccountInfo& accountInfo);
int32_t StartFreeInstallFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t ReadDataForFreeInstall(MessageParcel& data,
CallerInfo &callerInfo, AccountInfo &accountInfo, int64_t &taskId);
@ -107,7 +107,9 @@ private:
bool EnforceInterfaceToken(MessageParcel& data);
bool CallerInfoUnmarshalling(CallerInfo& callerInfo, MessageParcel& data);
bool IsUsingQos(const std::string& remoteDeviceId);
void SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo);
void SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo, AccountInfo& accountInfo);
void SaveSendResultExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo,
AccountInfo& accountInfo);
void InitExtendedLocalFuncsInner();
void InitLocalFuncsInner();
void InitLocalMissionManagerInner();

View File

@ -97,8 +97,6 @@ private:
std::shared_ptr<DmsDeviceInfo> FindDeviceInfoInStorage(const std::string& networkId);
void ClearAllDevices();
bool WaitForDnetworkReady();
bool GetLocalDeviceFromDnet(std::string& networkId);
bool GetLocalDeviceUdid(std::string& udid);
void RegisterUuidNetworkIdMap(const std::string& networkId);
void UnregisterUuidNetworkIdMap(const std::string& networkId);
std::mutex deviceLock_;

View File

@ -0,0 +1,77 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_DSCHED_ALL_CONNECT_MANAGER_H
#define OHOS_DSCHED_ALL_CONNECT_MANAGER_H
#include <map>
#include <mutex>
#include <queue>
#include <string>
#include "service_collaboration_manager_capi.h"
#include "single_instance.h"
namespace OHOS {
namespace DistributedSchedule {
class DSchedAllConnectManager {
DECLARE_SINGLE_INSTANCE_BASE(DSchedAllConnectManager);
public:
int32_t InitAllConnectManager();
int32_t UninitAllConnectManager();
int32_t PublishServiceState(const std::string &peerNetworkId, const std::string &extraInfo,
ServiceCollaborationManagerBussinessStatus state);
int32_t ApplyAdvanceResource(const std::string &peerNetworkId,
ServiceCollaborationManager_ResourceRequestInfoSets reqInfoSets);
void GetResourceRequest(ServiceCollaborationManager_ResourceRequestInfoSets &reqInfoSets);
private:
DSchedAllConnectManager() = default;
~DSchedAllConnectManager() = default;
int32_t GetServiceCollaborationManagerProxy();
int32_t RegistLifecycleCallback();
int32_t UnregistLifecycleCallback();
int32_t WaitAllConnectApplyCb(const std::string &peerNetworkId);
void NotifyAllConnectDecision(const std::string &peerNetworkId, bool isSupport);
static int32_t OnStop(const char *peerNetworkId);
static int32_t ApplyResult(int32_t errorcode, int32_t result, const char *reason);
private:
static constexpr int32_t DSCHED_QOS_TYPE_MIN_BW = 40 * 1024 * 1024;
static constexpr int32_t DSCHED_QOS_TYPE_MAX_LATENCY = 6000;
static constexpr int32_t DSCHED_QOS_TYPE_MIN_LATENCY = 1000;
static ServiceCollaborationManager_HardwareRequestInfo locReqInfo_;
static ServiceCollaborationManager_HardwareRequestInfo rmtReqInfo_;
static ServiceCollaborationManager_CommunicationRequestInfo communicationRequest_;
static std::queue<std::string> peerConnectCbQueue_;
const char *DMS_BIND_MGR_SRV_NAME = "TaskContinue";
std::mutex allConnectMgrLock_;
void *dllHandle_ = nullptr;
ServiceCollaborationManager_API allConnectMgrApi_ = {
.ServiceCollaborationManager_PublishServiceState = nullptr,
.ServiceCollaborationManager_ApplyAdvancedResource = nullptr,
.ServiceCollaborationManager_RegisterLifecycleCallback = nullptr,
.ServiceCollaborationManager_UnRegisterLifecycleCallback = nullptr,
};
std::mutex connectDecisionMutex_;
std::condition_variable connectDecisionCond_;
std::map<std::string, std::atomic<bool>> peerConnectDecision_;
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif // OHOS_DSCHED_ALL_CONNECT_MANAGER_H

View File

@ -66,7 +66,7 @@ private:
~DSchedTransportSoftbusAdapter();
int32_t CreateServerSocket();
int32_t CreateClientSocket(const std::string &peerDeviceId);
int32_t AddClientSession(int32_t sessionId, std::string &peerDeviceId);
int32_t AddNewPeerSession(const std::string &peerDeviceId, int32_t &sessionId);
bool GetSessionIdByDeviceId(const std::string &peerDeviceId, int32_t &sessionId);
private:

View File

@ -92,6 +92,10 @@ DSchedContinue::DSchedContinue(int32_t subServiceType, int32_t direction, const
DSchedContinue::DSchedContinue(std::shared_ptr<DSchedContinueStartCmd> startCmd, int32_t sessionId)
{
HILOGI("DSchedContinue create by start command");
if (startCmd == nullptr) {
HILOGE("startCmd is null");
return;
}
version_ = startCmd->version_;
subServiceType_ = startCmd->subServiceType_;
continueByType_ = startCmd->continueByType_;
@ -156,9 +160,9 @@ int32_t DSchedContinue::Init()
auto dContinue = std::shared_ptr<DSchedContinue>(shared_from_this());
stateMachine_ = std::make_shared<DSchedContinueStateMachine>(dContinue);
if (direction_ == CONTINUE_SOURCE) {
stateMachine_->UpdateState(DSCHED_CONTINUE_SOURCE_START_STATE);
UpdateState(DSCHED_CONTINUE_SOURCE_START_STATE);
} else {
stateMachine_->UpdateState(DSCHED_CONTINUE_SINK_START_STATE);
UpdateState(DSCHED_CONTINUE_SINK_START_STATE);
}
eventThread_ = std::thread(&DSchedContinue::StartEventHandler, this);
@ -245,6 +249,10 @@ int32_t DSchedContinue::OnReplyCmd(std::shared_ptr<DSchedContinueReplyCmd> cmd)
int32_t DSchedContinue::PostReplyTask(std::shared_ptr<DSchedContinueReplyCmd> cmd)
{
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
HILOGI("PostReplyTask called, replyCmd: %{public}d, result: %{public}d, reason: %{public}s", cmd->replyCmd_,
cmd->result_, cmd->reason_.c_str());
@ -368,6 +376,10 @@ int32_t DSchedContinue::OnNotifyComplete(int32_t missionId, bool isSuccess)
int32_t DSchedContinue::OnContinueEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd)
{
HILOGI("called");
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
return PostNotifyCompleteTask(cmd->result_);
}
@ -464,7 +476,7 @@ int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams
return ret;
}
if (direction_ == CONTINUE_SINK) {
stateMachine_->UpdateState(DSCHED_CONTINUE_DATA_STATE);
UpdateState(DSCHED_CONTINUE_DATA_STATE);
DmsContinueTime::GetInstance().SetDurationEnd(CONTINUE_FIRST_TRANS_TIME, GetTickCount());
}
HILOGI("ExecuteContinueReq end");
@ -561,6 +573,10 @@ void DSchedContinue::DurationDumperStart()
int32_t DSchedContinue::PackStartCmd(std::shared_ptr<DSchedContinueStartCmd>& cmd,
std::shared_ptr<DistributedWantParams> wantParams)
{
if (cmd == nullptr || wantParams == nullptr) {
HILOGE("cmd or wantParams is null");
return INVALID_PARAMETERS_ERR;
}
cmd->version_ = version_;
cmd->serviceType_ = SERVICE_TYPE_CONTINUE;
cmd->subServiceType_ = subServiceType_;
@ -618,8 +634,7 @@ int32_t DSchedContinue::ExecuteContinueAbility(int32_t appVersion)
if (result != ERR_OK) {
return CONTINUE_CALL_CONTINUE_ABILITY_FAILED;
}
stateMachine_->UpdateState(DSCHED_CONTINUE_ABILITY_STATE);
UpdateState(DSCHED_CONTINUE_ABILITY_STATE);
HILOGI("ExecuteContinueAbility end");
return result;
}
@ -678,7 +693,8 @@ int32_t DSchedContinue::ExecuteContinueReply()
HILOGE("ExecuteContinueReply send reply cmd failed, ret %{public}d", ret);
return ret;
}
stateMachine_->UpdateState(DSCHED_CONTINUE_DATA_STATE);
UpdateState(DSCHED_CONTINUE_DATA_STATE);
HILOGI("ExecuteContinueReply end");
return ERR_OK;
}
@ -686,21 +702,22 @@ int32_t DSchedContinue::ExecuteContinueReply()
int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data)
{
HILOGI("ExecuteContinueSend start, continueInfo: %{public}s", continueInfo_.toString().c_str());
if (data == nullptr) {
return INVALID_PARAMETERS_ERR;
}
DurationDumperBeforeStartRemoteAbility();
SetCleanMissionFlag(data->want);
AAFwk::Want newWant = data->want;
auto flags = newWant.GetFlags();
if ((flags & AAFwk::Want::FLAG_ABILITY_CONTINUATION) == 0) {
if ((newWant.GetFlags() & AAFwk::Want::FLAG_ABILITY_CONTINUATION) == 0) {
HILOGE("StartContinuation want continuation flags invalid!");
return INVALID_REMOTE_PARAMETERS_ERR;
}
int result = SetWantForContinuation(newWant);
if (result != ERR_OK) {
if (SetWantForContinuation(newWant) != ERR_OK) {
HILOGE("set new want failed");
return result;
return INVALID_PARAMETERS_ERR;
}
AppExecFwk::AbilityInfo abilityInfo;
@ -735,8 +752,7 @@ int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData>
}
DmsContinueTime::GetInstance().SetDurationEnd(CONTINUE_DATA_TRANS_TIME, GetTickCount());
stateMachine_->UpdateState(DSCHED_CONTINUE_SOURCE_WAIT_END_STATE);
UpdateState(DSCHED_CONTINUE_SOURCE_WAIT_END_STATE);
HILOGI("ExecuteContinueSend end");
return ERR_OK;
}
@ -795,6 +811,10 @@ int32_t DSchedContinue::PackDataCmd(std::shared_ptr<DSchedContinueDataCmd>& cmd,
const OHOS::AAFwk::Want& want, const AppExecFwk::AbilityInfo& abilityInfo, const CallerInfo& callerInfo,
const AccountInfo& accountInfo)
{
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
cmd->version_ = version_;
cmd->serviceType_ = SERVICE_TYPE_CONTINUE;
cmd->subServiceType_ = subServiceType_;
@ -821,6 +841,11 @@ int32_t DSchedContinue::PackDataCmd(std::shared_ptr<DSchedContinueDataCmd>& cmd,
int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd)
{
HILOGI("ExecuteContinueData start, continueInfo: %{public}s", continueInfo_.toString().c_str());
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
DurationDumperBeforeStartAbility(cmd);
std::string localDeviceId;
@ -859,7 +884,7 @@ int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCm
ret = StartAbility(want, cmd->requestCode_);
if (ret == ERR_OK) {
stateMachine_->UpdateState(DSCHED_CONTINUE_SINK_WAIT_END_STATE);
UpdateState(DSCHED_CONTINUE_SINK_WAIT_END_STATE);
HILOGI("ExecuteContinueData end");
}
return ret;
@ -882,7 +907,7 @@ int32_t DSchedContinue::UpdateWantForContinueType(OHOS::AAFwk::Want& want)
void DSchedContinue::DurationDumperBeforeStartAbility(std::shared_ptr<DSchedContinueDataCmd> cmd)
{
if (subServiceType_ == CONTINUE_PULL) {
if (subServiceType_ == CONTINUE_PULL && cmd != nullptr) {
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
DmsContinueTime::GetInstance().SetSrcBundleName(cmd->want_.GetElement().GetBundleName());
@ -955,7 +980,7 @@ int32_t DSchedContinue::ExecuteNotifyComplete(int32_t result)
return ret;
}
stateMachine_->UpdateState(DSCHED_CONTINUE_SINK_END_STATE);
UpdateState(DSCHED_CONTINUE_SINK_END_STATE);
HILOGI("ExecuteNotifyComplete end");
return ERR_OK;
}
@ -968,7 +993,7 @@ int32_t DSchedContinue::ExecuteNotifyComplete(int32_t result)
return ret;
}
stateMachine_->UpdateState(DSCHED_CONTINUE_SOURCE_END_STATE);
UpdateState(DSCHED_CONTINUE_SOURCE_END_STATE);
PostContinueEndTask(result);
HILOGI("ExecuteNotifyComplete end");
@ -978,6 +1003,10 @@ int32_t DSchedContinue::ExecuteNotifyComplete(int32_t result)
int32_t DSchedContinue::PackReplyCmd(std::shared_ptr<DSchedContinueReplyCmd> cmd, int32_t replyCmd, int32_t appVersion,
int32_t result, const std::string reason)
{
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
cmd->version_ = version_;
cmd->serviceType_ = SERVICE_TYPE_CONTINUE;
cmd->subServiceType_ = subServiceType_;
@ -1087,9 +1116,9 @@ int32_t DSchedContinue::ExecuteContinueError(int32_t result)
PackEndCmd(cmd, result);
SendCommand(cmd);
if (direction_ == CONTINUE_SOURCE) {
stateMachine_->UpdateState(DSCHED_CONTINUE_SINK_END_STATE);
UpdateState(DSCHED_CONTINUE_SINK_END_STATE);
} else {
stateMachine_->UpdateState(DSCHED_CONTINUE_SOURCE_END_STATE);
UpdateState(DSCHED_CONTINUE_SOURCE_END_STATE);
}
OnContinueEnd(result);
HILOGI("ExecuteNotifyComplete end");
@ -1098,6 +1127,10 @@ int32_t DSchedContinue::ExecuteContinueError(int32_t result)
int32_t DSchedContinue::PackEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd, bool result)
{
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
cmd->version_ = version_;
cmd->serviceType_ = SERVICE_TYPE_CONTINUE;
cmd->subServiceType_ = subServiceType_;
@ -1117,6 +1150,10 @@ int32_t DSchedContinue::PackEndCmd(std::shared_ptr<DSchedContinueEndCmd> cmd, bo
int32_t DSchedContinue::SendCommand(std::shared_ptr<DSchedContinueCmdBase> cmd)
{
if (cmd == nullptr) {
HILOGE("cmd is null");
return INVALID_PARAMETERS_ERR;
}
HILOGI("SendCommand start, cmd %{public}d", cmd->command_);
std::string jsonStr;
int32_t ret = cmd->Marshal(jsonStr);
@ -1190,6 +1227,10 @@ bool DSchedContinue::CheckDeviceIdFromRemote(const std::string& localDevId, cons
void DSchedContinue::OnDataRecv(int32_t command, std::shared_ptr<DSchedDataBuffer> dataBuffer)
{
HILOGI("called, command %{public}d", command);
if (dataBuffer == nullptr) {
HILOGE("dataBuffer is null");
return;
}
int32_t ret = 0;
uint8_t *data = dataBuffer->Data();
std::string jsonStr(reinterpret_cast<const char *>(data), dataBuffer->Capacity());
@ -1236,6 +1277,15 @@ void DSchedContinue::OnDataRecv(int32_t command, std::shared_ptr<DSchedDataBuffe
return;
}
void DSchedContinue::UpdateState(DSchedContinueStateType stateType)
{
if (stateMachine_ == nullptr) {
HILOGE("stateMachine is null");
return;
}
stateMachine_->UpdateState(stateType);
}
void DSchedContinue::OnShutDown()
{
}

View File

@ -19,6 +19,7 @@
#include "parcel.h"
#include "distributed_sched_utils.h"
#include "dms_constant.h"
#include "dtbschedmgr_log.h"
namespace OHOS {
@ -316,6 +317,10 @@ int32_t DSchedContinueDataCmd::MarshalAccountInfo(std::string &jsonStr)
}
cJSON_AddItemToObject(accountInfoJson, "GroupIdList", groupIdList);
cJSON_AddStringToObject(accountInfoJson, Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID.c_str(),
accountInfo_.activeAccountId.c_str());
cJSON_AddNumberToObject(accountInfoJson, Constants::EXTRO_INFO_JSON_KEY_USERID_ID.c_str(), accountInfo_.userId);
char *data = cJSON_Print(accountInfoJson);
if (data == nullptr) {
cJSON_Delete(accountInfoJson);
@ -548,6 +553,19 @@ int32_t DSchedContinueDataCmd::UnmarshalAccountInfo(std::string &jsonStr)
}
accountInfo_.groupIdList = groupIdList;
cJSON *accountId = cJSON_GetObjectItemCaseSensitive(rootValue, Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID.c_str());
if (accountId == nullptr || !cJSON_IsString(accountId)) {
cJSON_Delete(rootValue);
return INVALID_PARAMETERS_ERR;
}
accountInfo_.activeAccountId = accountId->valuestring;
cJSON *userId = cJSON_GetObjectItemCaseSensitive(rootValue, Constants::EXTRO_INFO_JSON_KEY_USERID_ID.c_str());
if (userId == nullptr || !cJSON_IsNumber(userId)) {
cJSON_Delete(rootValue);
return INVALID_PARAMETERS_ERR;
}
accountInfo_.userId = userId->valueint;
cJSON_Delete(rootValue);
return ERR_OK;
}

View File

@ -15,8 +15,8 @@
#include "dsched_continue_manager.h"
#include <chrono>
#include <sys/prctl.h>
#include <map>
#include "cJSON.h"
@ -33,7 +33,6 @@ namespace {
const std::string TAG = "DSchedContinueManager";
const std::string DSCHED_CONTINUE_MANAGER = "dsched_continue_manager";
const std::string CONTINUE_TIMEOUT_TASK = "continue_timeout_task";
}
IMPLEMENT_SINGLE_INSTANCE(DSchedContinueManager);
@ -99,6 +98,15 @@ void DSchedContinueManager::UnInit()
HILOGI("UnInit end");
}
void DSchedContinueManager::NotifyAllConnectDecision(std::string peerDeviceId, bool isSupport)
{
HILOGI("Notify all connect decision, peerDeviceId %{public}s, isSupport %{public}d.",
GetAnonymStr(peerDeviceId).c_str(), isSupport);
std::lock_guard<std::mutex> decisionLock(connectDecisionMutex_);
peerConnectDecision_[peerDeviceId] = isSupport;
connectDecisionCond_.notify_all();
}
int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
{
@ -229,13 +237,41 @@ void DSchedContinueManager::HandleContinueMissionWithBundleName(const DSchedCont
auto newContinue = std::make_shared<DSchedContinue>(subType, direction, callback, info);
newContinue->Init();
continues_.insert(std::make_pair(info, newContinue));
SetTimeOut(info, CONTINUE_TIMEOUT);
newContinue->OnContinueMission(wantParams);
}
WaitAllConnectDecision(direction, info, CONTINUE_TIMEOUT);
HILOGI("end, subType: %{public}d dirction: %{public}d, continue info: %{public}s",
subType, direction, info.toString().c_str());
}
void DSchedContinueManager::WaitAllConnectDecision(int32_t direction, const DSchedContinueInfo &info, int32_t timeout)
{
#ifdef DMSFWK_ALL_CONNECT_MGR
std::string peerDeviceId = direction == CONTINUE_SOURCE ? info.sinkDeviceId_ : info.sourceDeviceId_;
{
std::unique_lock<std::mutex> decisionLock(connectDecisionMutex_);
connectDecisionCond_.wait_for(decisionLock, std::chrono::seconds(CONNECT_DECISION_WAIT_S),
[this, peerDeviceId]() {
return peerConnectDecision_.find(peerDeviceId) != peerConnectDecision_.end() &&
peerConnectDecision_.at(peerDeviceId).load();
});
if (peerConnectDecision_.find(peerDeviceId) == peerConnectDecision_.end()) {
HILOGE("Not find peerDeviceId %{public}s in peerConnectDecision.", GetAnonymStr(peerDeviceId).c_str());
return;
}
if (!peerConnectDecision_.at(peerDeviceId).load()) {
HILOGE("All connect manager refuse bind to PeerDeviceId %{public}s.", GetAnonymStr(peerDeviceId).c_str());
peerConnectDecision_.erase(peerDeviceId);
SetTimeOut(info, 0);
return;
}
peerConnectDecision_.erase(peerDeviceId);
}
#endif
SetTimeOut(info, CONTINUE_TIMEOUT);
}
void DSchedContinueManager::SetTimeOut(const DSchedContinueInfo &info, int32_t timeout)
{
auto func = [this, info]() {
@ -244,13 +280,17 @@ void DSchedContinueManager::SetTimeOut(const DSchedContinueInfo &info, int32_t t
return;
}
HILOGE("continue timeout! info: %{public}s", info.toString().c_str());
continues_[info]->OnContinueEnd(CONTINUE_ABILITY_TIMEOUT_ERR);
auto dsContinue = continues_[info];
if (dsContinue != nullptr) {
dsContinue->OnContinueEnd(CONTINUE_ABILITY_TIMEOUT_ERR);
}
};
if (eventHandler_ == nullptr) {
HILOGE("eventHandler_ is nullptr");
return;
}
eventHandler_->PostTask(func, info.ToStringIgnoreMissionId(), timeout);
timeout > 0 ? eventHandler_->PostTask(func, info.ToStringIgnoreMissionId(), timeout) :
eventHandler_->PostTask(func);
}
int32_t DSchedContinueManager::StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId,
@ -298,7 +338,7 @@ std::shared_ptr<DSchedContinue> DSchedContinueManager::GetDSchedContinueByWant(
HILOGE("continue info doesn't match an existing continuation.");
return nullptr;
}
if (missionId == continues_[info]->GetContinueInfo().missionId_) {
if (continues_[info] != nullptr && missionId == continues_[info]->GetContinueInfo().missionId_) {
return continues_[info];
}
}
@ -454,6 +494,10 @@ void DSchedContinueManager::OnDataRecv(int32_t sessionId, std::shared_ptr<DSched
void DSchedContinueManager::HandleDataRecv(int32_t sessionId, std::shared_ptr<DSchedDataBuffer> dataBuffer)
{
HILOGI("start, sessionId: %{public}d.", sessionId);
if (dataBuffer == nullptr) {
HILOGE("dataBuffer is null.");
return;
}
uint8_t *data = dataBuffer->Data();
std::string jsonStr(reinterpret_cast<const char *>(data), dataBuffer->Capacity());
cJSON *rootValue = cJSON_Parse(jsonStr.c_str());
@ -571,8 +615,13 @@ int32_t DSchedContinueManager::GetContinueInfo(std::string &srcDeviceId, std::st
HILOGW("No continuation in progress.");
return ERR_OK;
}
dstDeviceId = continues_.begin()->second->GetContinueInfo().sinkDeviceId_;
srcDeviceId = continues_.begin()->second->GetContinueInfo().sourceDeviceId_;
auto dsContinue = continues_.begin()->second;
if (dsContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
dstDeviceId = dsContinue->GetContinueInfo().sinkDeviceId_;
srcDeviceId = dsContinue->GetContinueInfo().sourceDeviceId_;
return ERR_OK;
}

View File

@ -60,9 +60,8 @@ DSchedContinueStateType DSchedContinueDataState::GetStateType()
int32_t DSchedContinueDataState::DoContinueDataTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueDataState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<DSchedContinueDataCmd>();
@ -76,9 +75,8 @@ int32_t DSchedContinueDataState::DoContinueDataTask(std::shared_ptr<DSchedContin
int32_t DSchedContinueDataState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueDataState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -60,9 +60,8 @@ DSchedContinueStateType DSchedContinueSinkEndState::GetStateType()
int32_t DSchedContinueSinkEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -62,9 +62,8 @@ DSchedContinueStateType DSchedContinueSinkStartState::GetStateType()
int32_t DSchedContinueSinkStartState::DoContinuePullReqTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<DistributedWantParams>();
@ -78,9 +77,8 @@ int32_t DSchedContinueSinkStartState::DoContinuePullReqTask(std::shared_ptr<DSch
int32_t DSchedContinueSinkStartState::DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
return dContinue->ExecuteContinueReply();
@ -89,9 +87,8 @@ int32_t DSchedContinueSinkStartState::DoContinueAbilityTask(std::shared_ptr<DSch
int32_t DSchedContinueSinkStartState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -61,9 +61,8 @@ DSchedContinueStateType DSchedContinueSinkWaitEndState::GetStateType()
int32_t DSchedContinueSinkWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkWaitEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();
@ -77,9 +76,8 @@ int32_t DSchedContinueSinkWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSc
int32_t DSchedContinueSinkWaitEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSinkWaitEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -61,9 +61,8 @@ DSchedContinueStateType DSchedContinueAbilityState::GetStateType()
int32_t DSchedContinueAbilityState::DoContinueSendTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueAbilityState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<ContinueAbilityData>();
@ -77,9 +76,8 @@ int32_t DSchedContinueAbilityState::DoContinueSendTask(std::shared_ptr<DSchedCon
int32_t DSchedContinueAbilityState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueAbilityState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -59,9 +59,8 @@ DSchedContinueStateType DSchedContinueEndState::GetStateType()
int32_t DSchedContinueEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -62,9 +62,8 @@ DSchedContinueStateType DSchedContinueSourceStartState::GetStateType()
int32_t DSchedContinueSourceStartState::DoContinuePushReqTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSourceStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<DistributedWantParams>();
@ -78,9 +77,8 @@ int32_t DSchedContinueSourceStartState::DoContinuePushReqTask(std::shared_ptr<DS
int32_t DSchedContinueSourceStartState::DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSourceStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();
@ -94,9 +92,8 @@ int32_t DSchedContinueSourceStartState::DoContinueAbilityTask(std::shared_ptr<DS
int32_t DSchedContinueSourceStartState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueSourceStartState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -61,9 +61,8 @@ DSchedContinueStateType DSchedContinueWaitEndState::GetStateType()
int32_t DSchedContinueWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueWaitEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();
@ -77,9 +76,8 @@ int32_t DSchedContinueWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSchedC
int32_t DSchedContinueWaitEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
const AppExecFwk::InnerEvent::Pointer &event)
{
auto stateMachine = stateMachine_.lock();
if (stateMachine == nullptr) {
HILOGE("DSchedContinueWaitEndState stateMachine is null");
if (dContinue == nullptr) {
HILOGE("dContinue is null");
return INVALID_PARAMETERS_ERR;
}
auto syncContinueData = event->GetSharedObject<int32_t>();

View File

@ -16,7 +16,6 @@
#include "datashare_manager.h"
#include "distributed_sched_utils.h"
#include "dsched_continue_manager.h"
#include "dtbschedmgr_log.h"
#include "mission/dms_continue_recv_manager.h"
#include "mission/dms_continue_send_manager.h"

View File

@ -417,7 +417,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, bool value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<bool>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IBoolean);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IBoolean));
if (ao != nullptr) {
for (std::size_t i = 0; i < size; i++) {
ao->Set(i, AAFwk::Boolean::Box(value[i]));
@ -465,7 +465,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, AAFwk::byte v
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<AAFwk::byte>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IByte);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IByte));
if (ao == nullptr) {
return *this;
}
@ -514,7 +514,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, AAFwk::zchar
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<AAFwk::zchar>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IChar);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IChar));
if (ao == nullptr) {
return *this;
}
@ -563,7 +563,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, int value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<int>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IInteger);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IInteger));
if (ao == nullptr) {
return *this;
}
@ -612,7 +612,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, double value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<double>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IDouble);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IDouble));
if (ao == nullptr) {
return *this;
}
@ -661,7 +661,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, float value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<float>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IFloat);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IFloat));
if (ao == nullptr) {
return *this;
}
@ -736,7 +736,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, long value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<long>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_ILong);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_ILong));
if (ao == nullptr) {
return *this;
}
@ -791,7 +791,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, short value)
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<short>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IShort);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IShort));
if (ao == nullptr) {
return *this;
}
@ -840,7 +840,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::st
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<std::string>& value)
{
std::size_t size = value.size();
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IString);
sptr<AAFwk::IArray> ao(new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IString));
if (ao == nullptr) {
return *this;
}
@ -1097,6 +1097,9 @@ void DistributedWant::RemoveParam(const std::string& key)
void DistributedWant::ClearWant(DistributedWant* want)
{
if (want == nullptr) {
return;
}
want->SetType("");
want->SetAction("");
want->SetFlags(0);

View File

@ -1110,6 +1110,9 @@ bool DistributedWantParams::ReadFromParcelWantParamWrapper(Parcel& parcel, const
bool DistributedWantParams::ReadFromParcelFD(Parcel& parcel, const std::string& key)
{
auto messageParcel = static_cast<MessageParcel*>(&parcel);
if (messageParcel == nullptr) {
return false;
}
auto fd = messageParcel->ReadFileDescriptor();
DistributedWantParams wp;
wp.SetParam(TYPE_PROPERTY, AAFwk::String::Box(FD));
@ -1122,6 +1125,9 @@ bool DistributedWantParams::ReadFromParcelFD(Parcel& parcel, const std::string&
bool DistributedWantParams::ReadFromParcelRemoteObject(Parcel& parcel, const std::string& key)
{
auto messageParcel = static_cast<MessageParcel*>(&parcel);
if (messageParcel == nullptr) {
return false;
}
auto remoteObject = messageParcel->ReadRemoteObject();
DistributedWantParams wp;
wp.SetParam(TYPE_PROPERTY, AAFwk::String::Box(REMOTE_OBJECT));

View File

@ -68,13 +68,13 @@ std::string DistributedWantParamWrapper::ToString()
sptr<IDistributedWantParams> DistributedWantParamWrapper::Box(const DistributedWantParams& value)
{
sptr<IDistributedWantParams> object = new (std::nothrow)DistributedWantParamWrapper(value);
sptr<IDistributedWantParams> object(new (std::nothrow)DistributedWantParamWrapper(value));
return object;
}
sptr<IDistributedWantParams> DistributedWantParamWrapper::Box(DistributedWantParams&& value)
{
sptr<IDistributedWantParams> object = new (std::nothrow) DistributedWantParamWrapper(std::move(value));
sptr<IDistributedWantParams> object(new (std::nothrow) DistributedWantParamWrapper(std::move(value)));
return object;
}
@ -170,7 +170,7 @@ sptr<IDistributedWantParams> DistributedWantParamWrapper::Parse(const std::strin
strKey = "";
}
}
sptr<IDistributedWantParams> iwantParams = new (std::nothrow) DistributedWantParamWrapper(wantParams);
sptr<IDistributedWantParams> iwantParams(new (std::nothrow) DistributedWantParamWrapper(wantParams));
if (iwantParams == nullptr) {
return nullptr;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -16,7 +16,6 @@
#include "distributed_sched_adapter.h"
#include "datetime_ex.h"
#include "device_manager.h"
#include "dfx/dms_hisysevent_report.h"
#include "distributed_sched_service.h"
#include "distributed_sched_utils.h"
@ -38,7 +37,6 @@ using namespace std;
using namespace AAFwk;
using namespace AccountSA;
using namespace AppExecFwk;
using namespace DistributedHardware;
using DstbMissionChangeListener = DistributedMissionChangeListener;
namespace {
// set a non-zero value on need later
@ -286,16 +284,11 @@ bool DistributedSchedAdapter::CheckAccessToGroup(const std::string& groupId, con
int32_t ret = hichainGmInstance_->checkAccessToGroup(ANY_OS_ACCOUNT, targetBundleName.c_str(),
groupId.c_str());
HILOGI("[PerformanceTest] checkAccessToGroup spend %{public}" PRId64 " ms", GetTickCount() - begin);
if (ret == ERR_OK) {
HILOGI("hichain checkAccessToGroup success");
return true;
}
HILOGI("hichain checkAccessToGroup fail, ret %{public}d, will try DM CheckRelatedDevice.", ret);
if (!DeviceManager::GetInstance().CheckRelatedDevice(groupId, targetBundleName)) {
HILOGE("DM CheckRelatedDevice failed");
if (ret != ERR_OK) {
HILOGE("hichain checkAccessToGroup fail, ret %{public}d.", ret);
return false;
}
HILOGD("hichain checkAccessToGroup success");
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -22,6 +22,7 @@
#include "device_security_defines.h"
#include "device_security_info.h"
#include "ipc_skeleton.h"
#include "ohos_account_kits.h"
#include "os_account_manager.h"
#include "adapter/dnetwork_adapter.h"
@ -29,6 +30,7 @@
#include "caller_info.h"
#include "distributed_sched_adapter.h"
#include "distributed_sched_utils.h"
#include "dtbschedmgr_device_info_storage.h"
#include "dtbschedmgr_log.h"
#include "json_util.h"
@ -134,7 +136,7 @@ int32_t DistributedSchedPermission::CheckStartPermission(const AAFwk::Want& want
HILOGE("CheckStartControlPermission denied or failed! the callee component do not have permission");
return DMS_START_CONTROL_PERMISSION_DENIED;
}
HILOGI("CheckDistributedPermission success!!");
HILOGI("CheckDistributedPermission success!");
return ERR_OK;
}
@ -150,33 +152,110 @@ int32_t DistributedSchedPermission::GetAccountInfo(const std::string& remoteNetw
HILOGE("udid is empty");
return ERR_NULL_OBJECT;
}
if (!GetOsAccountData(accountInfo)) {
HILOGE("Get Os accountId and userId fail.");
return INVALID_PARAMETERS_ERR;
}
#ifdef DMSFWK_SAME_ACCOUNT
if (!DeviceManager::GetInstance().IsSameAccount(remoteNetworkId)) {
HILOGE("different account");
return INVALID_PARAMETERS_ERR;
if (CheckDstSameAccount(remoteNetworkId, accountInfo, callerInfo)) {
return ERR_OK;
}
return ERR_OK;
#endif
HILOGI("check same account by DM fail, will try check access Group by hichain");
#endif // DMSFWK_SAME_ACCOUNT
if (!GetRelatedGroups(udid, callerInfo.bundleNames, accountInfo) &&
!CheckAclList(udid, callerInfo.bundleNames)) {
HILOGE("GetRelatedGroups failed");
return INVALID_PARAMETERS_ERR;
if (GetRelatedGroups(udid, callerInfo.bundleNames, accountInfo)) {
return ERR_OK;
}
return ERR_OK;
HILOGI("Check access Group by hichain fail, will try check different account ACL by DM.");
if (CheckAclList(remoteNetworkId, accountInfo, callerInfo)) {
return ERR_OK;
}
HILOGE("Check different account ACL by DM fail.");
return INVALID_PARAMETERS_ERR;
}
bool DistributedSchedPermission::CheckAclList(const std::string& udid,
const std::vector<std::string>& bundleNames)
bool DistributedSchedPermission::GetOsAccountData(AccountInfo& dmsAccountInfo)
{
for (const auto& bundleName : bundleNames) {
if (DeviceManager::GetInstance().CheckRelatedDevice(udid, bundleName)) {
HILOGI("DM CheckRelatedDevice success");
return true;
}
#ifdef OS_ACCOUNT_PART
std::vector<int32_t> ids;
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
if (ret != ERR_OK || ids.empty()) {
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
return false;
}
dmsAccountInfo.userId = ids[0];
AccountSA::OhosAccountInfo osAccountInfo;
ret = AccountSA::OhosAccountKits::GetInstance().GetOhosAccountInfo(osAccountInfo);
if (ret != 0 || osAccountInfo.uid_ == "") {
HILOGE("Get accountId from Ohos account info fail, ret: %{public}d.", ret);
return false;
}
dmsAccountInfo.activeAccountId = osAccountInfo.uid_;
HILOGI("Get caller dmsAccountInfo OK, accountId %{public}s, userId %{public}s.",
GetAnonymStr(dmsAccountInfo.activeAccountId).c_str(), GetAnonymInt32(dmsAccountInfo.userId).c_str());
#endif
return true;
}
bool DistributedSchedPermission::CheckDstSameAccount(const std::string& dstNetworkId,
const AccountInfo& dmsAccountInfo, const CallerInfo& callerInfo)
{
#ifdef DMSFWK_SAME_ACCOUNT
DmAccessCaller dmSrcCaller = {
.accountId = dmsAccountInfo.activeAccountId,
.networkId = callerInfo.sourceDeviceId,
.userId = dmsAccountInfo.userId,
.tokenId = 0,
};
DmAccessCallee dmDstCallee = {
.networkId = dstNetworkId,
.peerId = "",
};
for (const auto& bundleName : callerInfo.bundleNames) {
dmSrcCaller.pkgName = bundleName;
HILOGI("dmSrcCaller networkId %{public}s, accountId %{public}s, userId %{public}s, pkgName %{public}s; "
"dmDstCallee networkId %{public}s.", GetAnonymStr(dmSrcCaller.networkId).c_str(),
GetAnonymStr(dmSrcCaller.accountId).c_str(), GetAnonymInt32(dmSrcCaller.userId).c_str(),
dmSrcCaller.pkgName.c_str(), GetAnonymStr(dmDstCallee.networkId).c_str());
if (!DeviceManager::GetInstance().CheckIsSameAccount(dmSrcCaller, dmDstCallee)) {
continue;
}
return true;
}
return false;
#else // DMSFWK_SAME_ACCOUNT
HILOGI("Not support remote same account check.");
return false;
#endif // DMSFWK_SAME_ACCOUNT
}
bool DistributedSchedPermission::CheckAclList(const std::string& dstNetworkId,
const AccountInfo& dmsAccountInfo, const CallerInfo& callerInfo)
{
DmAccessCaller dmSrcCaller = {
.accountId = dmsAccountInfo.activeAccountId,
.networkId = callerInfo.sourceDeviceId,
.userId = dmsAccountInfo.userId,
.tokenId = 0,
};
DmAccessCallee dmDstCallee = {
.networkId = dstNetworkId,
.peerId = "",
};
for (const auto& bundleName : callerInfo.bundleNames) {
dmSrcCaller.pkgName = bundleName;
HILOGI("dmSrcCaller networkId %{public}s, accountId %{public}s, userId %{public}s, pkgName %{public}s; "
"dmDstCallee networkId %{public}s.", GetAnonymStr(dmSrcCaller.networkId).c_str(),
GetAnonymStr(dmSrcCaller.accountId).c_str(), GetAnonymInt32(dmSrcCaller.userId).c_str(),
dmSrcCaller.pkgName.c_str(), GetAnonymStr(dmDstCallee.networkId).c_str());
if (!DeviceManager::GetInstance().CheckAccessControl(dmSrcCaller, dmDstCallee)) {
continue;
}
return true;
}
HILOGE("DM CheckRelatedDevice failed");
return false;
}
@ -408,19 +487,45 @@ bool DistributedSchedPermission::CheckAccountAccessPermission(const CallerInfo&
const AccountInfo& accountInfo, const std::string& targetBundleName)
{
std::string udid = DnetworkAdapter::GetInstance()->GetUdidByNetworkId(callerInfo.sourceDeviceId);
#ifdef DMSFWK_SAME_ACCOUNT
if (!DeviceManager::GetInstance().IsSameAccount(callerInfo.sourceDeviceId)) {
HILOGE("check same account permission in DM failed");
std::string dstNetworkId;
if (!DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(dstNetworkId)) {
HILOGE("GetLocalDeviceId failed");
return false;
}
return true;
DmAccessCaller dmSrcCaller = {
.accountId = accountInfo.activeAccountId,
.pkgName = targetBundleName,
.networkId = callerInfo.sourceDeviceId,
.userId = accountInfo.userId,
.tokenId = 0,
};
DmAccessCallee dmDstCallee = {
.networkId = dstNetworkId,
.peerId = "",
};
HILOGI("dmSrcCaller netWorkId %{public}s, accountId %{public}s, userId %{public}s, pkgName %{public}s; "
"dmDstCallee networkId %{public}s.", GetAnonymStr(dmSrcCaller.networkId).c_str(),
GetAnonymStr(dmSrcCaller.accountId).c_str(), GetAnonymInt32(dmSrcCaller.userId).c_str(),
dmSrcCaller.pkgName.c_str(), GetAnonymStr(dmDstCallee.networkId).c_str());
#ifdef DMSFWK_SAME_ACCOUNT
if (DeviceManager::GetInstance().CheckIsSameAccount(dmSrcCaller, dmDstCallee)) {
return true;
}
HILOGI("check same account by DM fail, will try check access Group by hichain");
#endif
if (!DistributedSchedAdapter::GetInstance().CheckAccessToGroup(udid, targetBundleName)) {
HILOGE("check different account permission failed");
return false;
if (DistributedSchedAdapter::GetInstance().CheckAccessToGroup(udid, targetBundleName)) {
return true;
}
return true;
HILOGI("Check access Group by hichain fail, will try check different account ACL by DM.");
if (DeviceManager::GetInstance().CheckAccessControl(dmSrcCaller, dmDstCallee)) {
return true;
}
HILOGE("Check different account ACL by DM fail.");
return false;
}
bool DistributedSchedPermission::CheckComponentAccessPermission(const AppExecFwk::AbilityInfo& targetAbility,

View File

@ -16,6 +16,7 @@
#include "distributed_sched_proxy.h"
#include "dfx/dms_hitrace_constants.h"
#include "distributed_want.h"
#include "dms_constant.h"
#include "dtbschedmgr_log.h"
#include "ipc_types.h"
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
@ -89,6 +90,8 @@ int32_t DistributedSchedProxy::StartAbilityFromRemote(const OHOS::AAFwk::Want& w
PARCEL_WRITE_HELPER(data, String, callerInfo.callerAppId);
nlohmann::json extraInfoJson;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = callerInfo.accessToken;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = accountInfo.activeAccountId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = accountInfo.userId;
if (callerInfo.extraInfoJson.find(DMS_VERSION_ID) != callerInfo.extraInfoJson.end()) {
extraInfoJson[DMS_VERSION_ID] = callerInfo.extraInfoJson[DMS_VERSION_ID];
}
@ -121,7 +124,11 @@ int32_t DistributedSchedProxy::SendResultFromRemote(OHOS::AAFwk::Want& want, int
PARCEL_WRITE_HELPER(data, StringVector, accountInfo.groupIdList);
PARCEL_WRITE_HELPER(data, String, callerInfo.callerAppId);
PARCEL_WRITE_HELPER(data, Int32, resultCode);
std::string extraInfo = callerInfo.extraInfoJson.dump();
nlohmann::json extraInfoJson;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = accountInfo.activeAccountId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = accountInfo.userId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX] = callerInfo.extraInfoJson.dump();
std::string extraInfo = extraInfoJson.dump();
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;
PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast<uint32_t>(IDSchedInterfaceCode::SEND_RESULT_FROM_REMOTE),
@ -342,6 +349,8 @@ int32_t DistributedSchedProxy::ConnectAbilityFromRemote(const OHOS::AAFwk::Want&
PARCEL_WRITE_HELPER(data, String, callerInfo.callerAppId);
nlohmann::json extraInfoJson;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = callerInfo.accessToken;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = accountInfo.activeAccountId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = accountInfo.userId;
if (callerInfo.extraInfoJson.find(DMS_VERSION_ID) != callerInfo.extraInfoJson.end()) {
extraInfoJson[DMS_VERSION_ID] = callerInfo.extraInfoJson[DMS_VERSION_ID];
}
@ -820,6 +829,8 @@ int32_t DistributedSchedProxy::StartAbilityByCallFromRemote(const OHOS::AAFwk::W
PARCEL_WRITE_HELPER(data, String, callerInfo.callerAppId);
nlohmann::json extraInfoJson;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = callerInfo.accessToken;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = accountInfo.activeAccountId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = accountInfo.userId;
if (callerInfo.extraInfoJson.find(DMS_VERSION_ID) != callerInfo.extraInfoJson.end()) {
extraInfoJson[DMS_VERSION_ID] = callerInfo.extraInfoJson[DMS_VERSION_ID];
}
@ -1118,6 +1129,8 @@ int32_t DistributedSchedProxy::StopExtensionAbilityFromRemote(const OHOS::AAFwk:
PARCEL_WRITE_HELPER(data, String, callerInfo.callerAppId);
nlohmann::json extraInfoJson;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = callerInfo.accessToken;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = accountInfo.activeAccountId;
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = accountInfo.userId;
std::string extraInfo = extraInfoJson.dump();
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;

View File

@ -82,6 +82,7 @@ using namespace AAFwk;
using namespace AccountSA;
using namespace AppExecFwk;
using namespace Constants;
using namespace DistributedHardware;
namespace {
const std::string TAG = "DistributedSchedService";
@ -110,6 +111,8 @@ const std::string DSCHED_EVENT_KEY = "IDSchedEventListener";
const std::string DMSDURATION_SAVETIME = "ohos.dschedule.SaveDataTime";
const std::string DMS_CONTINUE_SESSION_ID = "ohos.dms.continueSessionId";
const std::string DMS_PERSISTENT_ID = "ohos.dms.persistentId";
const std::string PKG_NAME = "DBinderBus_Dms_" + std::to_string(getprocpid());
const std::string BOOT_COMPLETED_EVENT = "usual.event.BOOT_COMPLETED";
constexpr int32_t DEFAULT_DMS_MISSION_ID = -1;
constexpr int32_t DEFAULT_DMS_CONNECT_TOKEN = -1;
constexpr int32_t BIND_CONNECT_RETRY_TIMES = 3;
@ -144,8 +147,9 @@ DistributedSchedService::DistributedSchedService() : SystemAbility(DISTRIBUTED_S
{
}
void DistributedSchedService::OnStart()
void DistributedSchedService::OnStart(const SystemAbilityOnDemandReason &startReason)
{
HILOGI("OnStart reason %{public}s, reasonId_:%{public}d", startReason.GetName().c_str(), startReason.GetId());
#ifdef DMS_SERVICE_DISABLE
HILOGI("DMS service disabled, exiting.");
_exit(0);
@ -181,11 +185,12 @@ void DistributedSchedService::OnStart()
HILOGI("OnStart dms service success.");
Publish(this);
HandleBootStart(startReason);
}
void DistributedSchedService::OnStop()
void DistributedSchedService::OnStop(const SystemAbilityOnDemandReason &stopReason)
{
HILOGI("OnStop dms service enter.");
HILOGI("OnStart reason %{public}s, reasonId_:%{public}d", stopReason.GetName().c_str(), stopReason.GetId());
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
DMSContinueSendMgr::GetInstance().UnInit();
DMSContinueRecvMgr::GetInstance().UnInit();
@ -195,7 +200,36 @@ void DistributedSchedService::OnStop()
dlclose(dllHandle_);
dllHandle_ = nullptr;
#endif
HILOGD("begin");
HILOGI("OnStop dms service end");
}
void DistributedSchedService::OnActive(const SystemAbilityOnDemandReason &activeReason)
{
HILOGI("OnStart reason %{public}s, reasonId_:%{public}d", activeReason.GetName().c_str(), activeReason.GetId());
OnStart(activeReason);
}
void DistributedSchedService::HandleBootStart(const SystemAbilityOnDemandReason &startReason)
{
std::vector<DistributedHardware::DmDeviceInfo> dmDeviceInfoList;
int32_t errCode = DeviceManager::GetInstance().GetTrustedDeviceList(PKG_NAME, "", dmDeviceInfoList);
if (errCode != ERR_OK) {
HILOGE("Get device manager trusted device list fail, errCode %{public}d", errCode);
}
if (startReason.GetName() == BOOT_COMPLETED_EVENT && dmDeviceInfoList.empty()) {
HILOGI("UnloadSystemAbility dms");
auto samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (samgrProxy == nullptr) {
HILOGE("get samgr failed");
return;
}
int32_t ret = samgrProxy->UnloadSystemAbility(DISTRIBUTED_SCHED_SA_ID);
if (ret != ERR_OK) {
HILOGE("remove system ability failed");
return;
}
HILOGI("UnloadSystemAbility dms ok");
}
}
int32_t DistributedSchedService::Dump(int32_t fd, const std::vector<std::u16string>& args)
@ -405,7 +439,7 @@ int32_t DistributedSchedService::StartRemoteAbilityAdapter(const OHOS::AAFwk::Wa
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.StartRemoteAbilityAdapter == nullptr) {
HILOGE("Dms interactive start remote ability adapter handle is null.");
HILOGE("Dms interactive start remote ability adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -421,7 +455,7 @@ int32_t DistributedSchedService::ConnectRemoteAbilityAdapter(const OHOS::AAFwk::
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.ConnectRemoteAbilityAdapter == nullptr) {
HILOGE("Dms interactive connect remote ability adapter handle is null.");
HILOGE("Dms interactive connect remote ability adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -437,7 +471,7 @@ int32_t DistributedSchedService::DisconnectRemoteAbilityAdapter(const sptr<IRemo
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.DisconnectRemoteAbilityAdapter == nullptr) {
HILOGE("Dms interactive disconnect remote ability adapter handle is null.");
HILOGE("Dms interactive disconnect remote ability adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -452,7 +486,7 @@ int32_t DistributedSchedService::StartAbilityFromRemoteAdapter(MessageParcel& da
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.StartAbilityFromRemoteAdapter == nullptr) {
HILOGE("Dms interactive start ability from remote adapter handle is null.");
HILOGE("Dms interactive start ability from remote adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -467,7 +501,7 @@ int32_t DistributedSchedService::StopAbilityFromRemoteAdapter(MessageParcel& dat
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.StopAbilityFromRemoteAdapter == nullptr) {
HILOGE("Dms interactive stop ability from remote adapter handle is null.");
HILOGE("Dms interactive stop ability from remote adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -482,7 +516,7 @@ int32_t DistributedSchedService::ConnectAbilityFromRemoteAdapter(MessageParcel&
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.ConnectAbilityFromRemoteAdapter == nullptr) {
HILOGE("Dms interactive connect ability from remote adapter handle is null.");
HILOGE("Dms interactive connect ability from remote adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -497,7 +531,7 @@ int32_t DistributedSchedService::DisconnectAbilityFromRemoteAdapter(MessageParce
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.DisconnectAbilityFromRemoteAdapter == nullptr) {
HILOGE("Dms interactive disconnect ability from remote adapter handle is null.");
HILOGE("Dms interactive disconnect ability from remote adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -513,7 +547,7 @@ int32_t DistributedSchedService::NotifyAbilityLifecycleChangedFromRemoteAdapter(
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.NotifyAbilityLifecycleChangedFromRemoteAdapter == nullptr) {
HILOGE("Dms interactive disconnect ability from remote adapter handle is null.");
HILOGE("Dms interactive disconnect ability from remote adapter handle is null.");
return INVALID_PARAMETERS_ERR;
}
@ -528,7 +562,7 @@ void DistributedSchedService::OnDeviceOnlineEx(const OHOS::DistributedHardware::
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.OnDeviceOnlineEx == nullptr) {
HILOGE("Dms interactive on device online extention handle is null.");
HILOGE("Dms interactive on device online extention handle is null.");
return;
}
@ -539,7 +573,7 @@ void DistributedSchedService::OnDeviceOfflineEx(const OHOS::DistributedHardware:
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.OnDeviceOfflineEx == nullptr) {
HILOGE("Dms interactive on device online extention handle is null.");
HILOGE("Dms interactive on device online extention handle is null.");
return;
}
@ -550,7 +584,7 @@ void DistributedSchedService::OnDeviceInfoChangedEx(const OHOS::DistributedHardw
{
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
if (dmsAdapetr_.OnDeviceInfoChangedEx == nullptr) {
HILOGE("Dms interactive on device online extention handle is null.");
HILOGE("Dms interactive on device online extention handle is null.");
return;
}
@ -3054,7 +3088,7 @@ int32_t DistributedSchedService::StartFreeInstallFromRemote(const FreeInstallInf
return err;
}
sptr<DmsFreeInstallCallback> callback = new DmsFreeInstallCallback(taskId, info);
sptr<DmsFreeInstallCallback> callback(new DmsFreeInstallCallback(taskId, info));
err = AAFwk::AbilityManagerClient::GetInstance()->FreeInstallAbilityFromRemote(
info.want, callback, activeAccountId, info.requestCode);
if (err != ERR_OK) {
@ -3115,7 +3149,7 @@ int32_t DistributedSchedService::StartAbility(const OHOS::AAFwk::Want& want, int
}
if (want.GetBoolParam(Want::PARAM_RESV_FOR_RESULT, false)) {
HILOGI("StartAbilityForResult start, flag is %{public}d", want.GetFlags());
sptr<IRemoteObject> dmsTokenCallback = new DmsTokenCallback();
sptr<IRemoteObject> dmsTokenCallback(new DmsTokenCallback());
err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, dmsTokenCallback, requestCode,
activeAccountId);
} else {
@ -3465,7 +3499,7 @@ int32_t DistributedSchedService::StopExtensionAbilityFromRemote(const OHOS::AAFw
}
Want want = remoteWant;
want.RemoveParam(DMS_SRC_NETWORK_ID);
sptr<IRemoteObject> callerToken = new DmsTokenCallback();
sptr<IRemoteObject> callerToken(new DmsTokenCallback());
int32_t activeAccountId = -1;
ErrCode err = QueryOsAccount(activeAccountId);

View File

@ -32,6 +32,7 @@
#include "distributed_sched_service.h"
#include "distributed_sched_types.h"
#include "distributed_sched_utils.h"
#include "dms_constant.h"
#include "dms_version_manager.h"
#include "dsched_continue_manager.h"
#include "dsched_transport_softbus_adapter.h"
@ -320,7 +321,7 @@ int32_t DistributedSchedStub::GetStartAbilityFromRemoteExParam(MessageParcel& da
if (!extraInfo.empty()) {
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
HILOGD("parse extra info");
}
}
@ -351,7 +352,7 @@ int32_t DistributedSchedStub::GetConnectAbilityFromRemoteExParam(MessageParcel&
}
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
HILOGD("parse extra info");
}
return ERR_OK;
@ -412,7 +413,8 @@ int32_t DistributedSchedStub::StopAbilityFromRemoteInner(MessageParcel& data, Me
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
void DistributedSchedStub::SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo)
void DistributedSchedStub::SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo,
AccountInfo& accountInfo)
{
if (extraInfoJson.find(EXTRO_INFO_JSON_KEY_ACCESS_TOKEN) != extraInfoJson.end() &&
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN].is_number_unsigned()) {
@ -431,6 +433,38 @@ void DistributedSchedStub::SaveExtraInfo(const nlohmann::json& extraInfoJson, Ca
std::string uidBundleName = extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME];
callerInfo.extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME] = uidBundleName;
}
if (extraInfoJson.find(Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID) != extraInfoJson.end() &&
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID].is_string()) {
accountInfo.activeAccountId = extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID];
}
if (extraInfoJson.find(Constants::EXTRO_INFO_JSON_KEY_USERID_ID) != extraInfoJson.end() &&
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID].is_number()) {
accountInfo.userId = extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID];
}
HILOGD("save dms version");
}
void DistributedSchedStub::SaveSendResultExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo,
AccountInfo& accountInfo)
{
if (extraInfoJson.find(Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID) != extraInfoJson.end() &&
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID].is_string()) {
accountInfo.activeAccountId = extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID];
}
if (extraInfoJson.find(Constants::EXTRO_INFO_JSON_KEY_USERID_ID) != extraInfoJson.end() &&
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID].is_number()) {
accountInfo.userId = extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID];
}
if (extraInfoJson.find(Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX) != extraInfoJson.end() &&
extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX].is_string()) {
std::string callerExJsonStr = extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX];
if (callerExJsonStr.empty()) {
HILOGD("caller extra info json string is empty!");
}
callerInfo.extraInfoJson = nlohmann::json::parse(callerExJsonStr, nullptr, false);
}
HILOGD("save dms version");
}
@ -466,7 +500,12 @@ int32_t DistributedSchedStub::SendResultFromRemoteInner(MessageParcel& data, Mes
if (extraInfo.empty()) {
HILOGD("extra info is empty!");
}
callerInfo.extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
if (!extraInfoJson.is_discarded()) {
SaveSendResultExtraInfo(extraInfoJson, callerInfo, accountInfo);
HILOGD("parse extra info");
}
int32_t result = SendResultFromRemote(*want, requestCode, callerInfo, accountInfo, resultCode);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_HELPER(reply, Int32, result);
@ -1286,7 +1325,7 @@ int32_t DistributedSchedStub::StartAbilityByCallFromRemoteInner(MessageParcel& d
}
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
HILOGD("parse extra info");
}
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
@ -1453,12 +1492,13 @@ int32_t DistributedSchedStub::ReadDataForFreeInstall(MessageParcel& data, Caller
return ERR_NONE;
}
int32_t DistributedSchedStub::CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo)
int32_t DistributedSchedStub::CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo,
AccountInfo& accountInfo)
{
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
int32_t requestCode = DEFAULT_REQUEST_CODE;
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
if (extraInfoJson.find(EXTRO_INFO_JSON_KEY_REQUEST_CODE) != extraInfoJson.end() &&
extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE].is_number_integer()) {
requestCode = extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE];
@ -1496,7 +1536,7 @@ int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& dat
if (extraInfo.empty()) {
HILOGD("extra info is empty!");
}
int32_t requestCode = CreateJsonObject(extraInfo, callerInfo);
int32_t requestCode = CreateJsonObject(extraInfo, callerInfo, accountInfo);
FreeInstallInfo info = {
.want = *want, .requestCode = requestCode, .callerInfo = callerInfo, .accountInfo = accountInfo};
info.want.RemoveParam(PARAM_FREEINSTALL_APPID);

View File

@ -305,7 +305,7 @@ bool DmsBmStorage::DealGetBundleName(const std::string &networkId, const uint16_
HILOGI("get bundleName failed.");
return false;
}
HILOGE("end.");
HILOGI("end.");
return true;
}
@ -357,8 +357,12 @@ bool DmsBmStorage::CheckSyncData(const std::string &networkId)
HILOGE("can not get udid or uuid by networkId");
return false;
}
HILOGE("uuid: %{public}s", GetAnonymStr(uuid).c_str());
HILOGI("uuid: %{public}s", GetAnonymStr(uuid).c_str());
std::vector<Entry> newEntries;
if (kvStorePtr_ == nullptr) {
HILOGE("kvstore is null");
return false;
}
Status status = kvStorePtr_->GetDeviceEntries(uuid, newEntries);
if (newEntries.empty() || status != Status::SUCCESS) {
HILOGE("CheckSyncData fail: %{public}d", status);
@ -402,6 +406,10 @@ void DmsBmStorage::GetEntries(const std::string &networkId, const Key &allEntryK
std::promise<OHOS::DistributedKv::Status> &resultStatusSignal, std::vector<Entry> &allEntries)
{
HILOGI("called.");
if (kvStorePtr_ == nullptr) {
HILOGE("kvstore is null");
return;
}
kvStorePtr_->GetEntries(allEntryKeyPrefix, networkId,
[&resultStatusSignal, &allEntries](Status innerStatus, std::vector<Entry> innerAllEntries) {
HILOGI("GetEntries, result = %{public}d", innerStatus);
@ -529,7 +537,7 @@ bool DmsBmStorage::GetLastBundleNameId(uint16_t &bundleNameId)
Value value;
Status status = kvStorePtr_->Get(publicKey, value);
if (status != Status::SUCCESS) {
HILOGE("This information not be found in the database,Get error: %{public}d", status);
HILOGW("This information not be found in the database, Get error: %{public}d", status);
return false;
}
PublicRecordsInfo publicRecordsInfo;

View File

@ -59,7 +59,7 @@ bool PublicRecordsInfo::Marshalling(Parcel &parcel) const
PublicRecordsInfo *PublicRecordsInfo::Unmarshalling(Parcel &parcel)
{
PublicRecordsInfo *info = new (std::nothrow) PublicRecordsInfo();
if (info && !info->ReadFromParcel(parcel)) {
if (info != nullptr && !info->ReadFromParcel(parcel)) {
APP_LOGW("read from parcel failed");
delete info;
info = nullptr;
@ -152,7 +152,7 @@ bool DmsAbilityInfo::Marshalling(Parcel &parcel) const
DmsAbilityInfo *DmsAbilityInfo::Unmarshalling(Parcel &parcel)
{
DmsAbilityInfo *info = new (std::nothrow) DmsAbilityInfo();
if (info && !info->ReadFromParcel(parcel)) {
if (info != nullptr && !info->ReadFromParcel(parcel)) {
APP_LOGW("read from parcel failed");
delete info;
info = nullptr;
@ -270,7 +270,7 @@ bool DmsBundleInfo::Marshalling(Parcel &parcel) const
DmsBundleInfo *DmsBundleInfo::Unmarshalling(Parcel &parcel)
{
DmsBundleInfo *info = new (std::nothrow) DmsBundleInfo();
if (info && !info->ReadFromParcel(parcel)) {
if (info != nullptr && !info->ReadFromParcel(parcel)) {
delete info;
info = nullptr;
}

View File

@ -383,6 +383,10 @@ int32_t DistributedSchedMissionManager::StartSyncRemoteMissions(const std::strin
int32_t DistributedSchedMissionManager::StartSyncRemoteMissions(const std::string& dstDevId,
const sptr<IDistributedSched>& remoteDms)
{
if (remoteDms == nullptr) {
HILOGE("remoteDms is null");
return INVALID_PARAMETERS_ERR;
}
std::vector<DstbMissionInfo> missionInfos;
CallerInfo callerInfo;
if (!GenerateCallerInfo(callerInfo)) {
@ -523,7 +527,7 @@ int32_t DistributedSchedMissionManager::StartSyncMissionsFromRemote(const Caller
InitAllSnapshots(missionInfoSet);
}
};
if (!missionHandler_->PostTask(func)) {
if (missionHandler_ != nullptr && !missionHandler_->PostTask(func)) {
HILOGE("post RegisterMissionListener and InitAllSnapshots Task failed");
}
return result;
@ -542,7 +546,7 @@ void DistributedSchedMissionManager::StopSyncMissionsFromRemote(const std::strin
isRegMissionChange_ = false;
}
};
if (!missionHandler_->PostTask(func)) {
if (missionHandler_ != nullptr && !missionHandler_->PostTask(func)) {
HILOGE("post UnRegisterMissionListener Task failed");
}
}
@ -618,6 +622,10 @@ void DistributedSchedMissionManager::EnqueueCachedSnapshotInfo(const std::string
std::string keyInfo = GenerateKeyInfo(deviceId, missionId);
auto iter = cachedSnapshotInfos_.find(keyInfo);
if (iter != cachedSnapshotInfos_.end()) {
if (iter->second == nullptr) {
HILOGE("snapshotInfo is null");
return;
}
if (snapshot->GetCreatedTime() < iter->second->GetCreatedTime()) {
return;
}
@ -627,6 +635,10 @@ void DistributedSchedMissionManager::EnqueueCachedSnapshotInfo(const std::string
int64_t oldest = -1;
auto iterOldest = cachedSnapshotInfos_.end();
for (auto iterItem = cachedSnapshotInfos_.begin(); iterItem != cachedSnapshotInfos_.end(); ++iterItem) {
if (iterItem->second == nullptr) {
HILOGE("snapshotInfo is null");
continue;
}
if (oldest == -1 || iterItem->second->GetLastAccessTime() < oldest) {
oldest = iterItem->second->GetLastAccessTime();
iterOldest = iterItem;
@ -650,6 +662,10 @@ std::unique_ptr<Snapshot> DistributedSchedMissionManager::DequeueCachedSnapshotI
auto iter = cachedSnapshotInfos_.find(GenerateKeyInfo(deviceId, missionId));
if (iter != cachedSnapshotInfos_.end()) {
std::unique_ptr<Snapshot> snapshot = std::move(iter->second);
if (snapshot == nullptr) {
HILOGE("snapshot is null");
return nullptr;
}
snapshot->UpdateLastAccessTime(GetTickCount());
iter->second = nullptr;
cachedSnapshotInfos_.erase(iter);
@ -778,6 +794,10 @@ void DistributedSchedMissionManager::NotifyLocalMissionsChanged()
HILOGI("NotifyMissionsChangedToRemote result = %{public}d", result);
}
};
if (missionChangeHandler_ == nullptr) {
HILOGE("missionChangeHandler_ is null");
return;
}
if (!missionChangeHandler_->PostTask(func)) {
HILOGE("postTask failed");
}
@ -792,6 +812,10 @@ void DistributedSchedMissionManager::NotifyMissionSnapshotCreated(int32_t missio
HILOGE("mission snapshot changed failed, missionId=%{public}d, errCode=%{public}d", missionId, errCode);
}
};
if (missionChangeHandler_ == nullptr) {
HILOGE("missionChangeHandler_ is null");
return;
}
if (!missionChangeHandler_->PostTask(func, GET_FOREGROUND_SNAPSHOT_DELAY_TIME)) {
HILOGE("post MissionSnapshotChanged delay Task failed");
}
@ -806,6 +830,10 @@ void DistributedSchedMissionManager::NotifyMissionSnapshotChanged(int32_t missio
HILOGE("mission snapshot changed failed, missionId=%{public}d, errCode=%{public}d", missionId, errCode);
}
};
if (missionChangeHandler_ == nullptr) {
HILOGE("missionChangeHandler_ is null");
return;
}
if (!missionChangeHandler_->PostTask(func)) {
HILOGE("post MissionSnapshotChanged Task failed");
}
@ -820,6 +848,10 @@ void DistributedSchedMissionManager::NotifyMissionSnapshotDestroyed(int32_t miss
HILOGE("mission snapshot removed failed, missionId=%{public}d, errCode=%{public}d", missionId, errCode);
}
};
if (missionChangeHandler_ == nullptr) {
HILOGE("missionChangeHandler_ is null");
return;
}
if (!missionChangeHandler_->PostTask(func)) {
HILOGE("post MissionSnapshotDestroyed Task failed");
}
@ -964,7 +996,9 @@ void DistributedSchedMissionManager::OnMissionListenerDied(const sptr<IRemoteObj
++iterItem;
continue;
}
remote->RemoveDeathRecipient(listenerDeath_);
if (remote != nullptr) {
remote->RemoveDeathRecipient(listenerDeath_);
}
listenerInfo.Erase(remote);
if (listenerInfo.Empty()) {
if (listenerInfo.called) {
@ -988,7 +1022,7 @@ void DistributedSchedMissionManager::OnRemoteDmsDied(const sptr<IRemoteObject>&
{
std::lock_guard<std::mutex> autoLock(remoteDmsLock_);
for (auto iter = remoteDmsMap_.begin(); iter != remoteDmsMap_.end(); ++iter) {
if (iter->second->AsObject() == remote) {
if (iter->second->AsObject() == remote && iter->second->AsObject() != nullptr) {
iter->second->AsObject()->RemoveDeathRecipient(remoteDmsRecipient_);
devId = iter->first;
remoteDmsMap_.erase(iter);

View File

@ -72,7 +72,7 @@ void DMSContinueRecvMgr::Init()
void DMSContinueRecvMgr::UnInit()
{
HILOGI("UnInit start");
if (eventHandler_ != nullptr) {
if (eventHandler_ != nullptr && eventHandler_->GetEventRunner() != nullptr) {
eventHandler_->GetEventRunner()->Stop();
eventThread_.join();
eventHandler_ = nullptr;
@ -191,7 +191,11 @@ void DMSContinueRecvMgr::StartEvent()
eventHandler_ = std::make_shared<OHOS::AppExecFwk::EventHandler>(runner);
}
eventCon_.notify_one();
runner->Run();
if (runner != nullptr) {
runner->Run();
} else {
HILOGE("runner is null");
}
HILOGI("StartEvent end");
}

View File

@ -29,7 +29,6 @@
#include "parcel_helper.h"
#include "softbus_adapter/softbus_adapter.h"
#include "switch_status_dependency.h"
#include "dsched_continue_manager.h"
#include "mission/dms_continue_recv_manager.h"
#include "mission/wifi_state_adapter.h"
@ -83,7 +82,7 @@ void DMSContinueSendMgr::UnInit()
{
HILOGI("UnInit start");
MMIAdapter::GetInstance().UnInit();
if (eventHandler_ != nullptr) {
if (eventHandler_ != nullptr && eventHandler_->GetEventRunner() != nullptr) {
eventHandler_->GetEventRunner()->Stop();
eventThread_.join();
eventHandler_ = nullptr;
@ -96,14 +95,20 @@ void DMSContinueSendMgr::UnInit()
int32_t DMSContinueSendMgr::GetCurrentMissionId()
{
HILOGI("GetCurrentMission begin");
auto abilityMgr = AAFwk::AbilityManagerClient::GetInstance();
if (abilityMgr == nullptr) {
HILOGE("abilityMgr is nullptr");
return INVALID_PARAMETERS_ERR;
}
sptr<IRemoteObject> token;
int ret = AAFwk::AbilityManagerClient::GetInstance()->GetTopAbility(token);
int ret = abilityMgr->GetTopAbility(token);
if (ret != ERR_OK || token == nullptr) {
HILOGE("GetTopAbility failed, ret: %{public}d", ret);
return INVALID_MISSION_ID;
}
int32_t missionId = INVALID_MISSION_ID;
AAFwk::AbilityManagerClient::GetInstance()->GetMissionIdByToken(token, missionId);
abilityMgr->GetMissionIdByToken(token, missionId);
return missionId;
}
@ -142,7 +147,7 @@ void DMSContinueSendMgr::NotifyMissionFocused(const int32_t missionId, FocusedRe
return;
}
auto feedfunc = [this, missionId, reason]() {
if (reason == FocusedReason::NORMAL) {
if (reason == FocusedReason::NORMAL && screenOffHandler_ != nullptr) {
screenOffHandler_->ClearScreenOffInfo();
}
DealFocusedBusiness(missionId);
@ -190,7 +195,7 @@ int32_t DMSContinueSendMgr::GetMissionIdByBundleName(const std::string& bundleNa
return ERR_OK;
}
HILOGW("get iterItem failed from focusedMission_, try screenOffHandler_");
if (bundleName == screenOffHandler_->GetBundleName()) {
if (screenOffHandler_ != nullptr && bundleName == screenOffHandler_->GetBundleName()) {
missionId = screenOffHandler_->GetMissionId();
HILOGI("get missionId end, missionId: %{public}d", missionId);
return ERR_OK;
@ -209,7 +214,11 @@ void DMSContinueSendMgr::StartEvent()
eventHandler_ = std::make_shared<OHOS::AppExecFwk::EventHandler>(runner);
}
eventCon_.notify_one();
runner->Run();
if (runner != nullptr) {
runner->Run();
} else {
HILOGE("runner is null");
}
HILOGI("StartEvent end");
}
@ -260,10 +269,16 @@ int32_t DMSContinueSendMgr::DealFocusedBusiness(const int32_t missionId)
{
HILOGI("DealFocusedBusiness start, missionId: %{public}d", missionId);
AAFwk::MissionInfo info;
int32_t ret = AAFwk::AbilityManagerClient::GetInstance()->GetMissionInfo("", missionId, info);
if (ret != ERR_OK) {
HILOGE("get missionInfo failed, missionId: %{public}d, ret: %{public}d", missionId, ret);
return ret;
auto abilityMgr = AAFwk::AbilityManagerClient::GetInstance();
if (abilityMgr != nullptr) {
int32_t ret = abilityMgr->GetMissionInfo("", missionId, info);
if (ret != ERR_OK) {
HILOGE("get missionInfo failed, missionId: %{public}d, ret: %{public}d", missionId, ret);
return ret;
}
} else {
HILOGE("abilityMgr is null");
return INVALID_PARAMETERS_ERR;
}
bool isMissionContinuable = info.continuable;
{
@ -295,7 +310,7 @@ int32_t DMSContinueSendMgr::DealFocusedBusiness(const int32_t missionId)
AddMMIListener();
#endif
if (!SwitchStatusDependency::GetInstance().IsContinueSwitchOn()) { return DMS_PERMISSION_DENIED;}
ret = FocusedBusinessSendEvent(bundleName, abilityName);
int32_t ret = FocusedBusinessSendEvent(bundleName, abilityName);
HILOGI("DealFocusedBusiness end");
return ret;
}
@ -327,8 +342,14 @@ int32_t DMSContinueSendMgr::FocusedBusinessSendEvent(std::string bundleName, con
int32_t DMSContinueSendMgr::CheckContinueState(const int32_t missionId)
{
auto abilityMgr = AAFwk::AbilityManagerClient::GetInstance();
if (abilityMgr == nullptr) {
HILOGE("abilityMgr is null");
return INVALID_PARAMETERS_ERR;
}
AAFwk::MissionInfo info;
int32_t ret = AAFwk::AbilityManagerClient::GetInstance()->GetMissionInfo("", missionId, info);
int32_t ret = abilityMgr->GetMissionInfo("", missionId, info);
if (ret != ERR_OK) {
HILOGE("get missionInfo failed, missionId: %{public}d, ret: %{public}d", missionId, ret);
return ERR_OK;
@ -390,7 +411,7 @@ int32_t DMSContinueSendMgr::DealUnfocusedBusiness(const int32_t missionId, Unfoc
focusedMissionAbility_.erase(missionId);
}
if (reason == UnfocusedReason::NORMAL) {
if (reason == UnfocusedReason::NORMAL && screenOffHandler_ != nullptr) {
screenOffHandler_->SetScreenOffInfo(missionId, bundleName, bundleNameId, abilityName);
}
HILOGI("DealUnfocusedBusiness end");
@ -399,6 +420,10 @@ int32_t DMSContinueSendMgr::DealUnfocusedBusiness(const int32_t missionId, Unfoc
int32_t DMSContinueSendMgr::SendScreenOffEvent(uint8_t type)
{
if (screenOffHandler_ == nullptr) {
HILOGE("screenOffHandler_ is nullptr");
return INVALID_PARAMETERS_ERR;
}
int32_t missionId = screenOffHandler_->GetMissionId();
std::string bundleName = screenOffHandler_->GetBundleName();
uint16_t bundleNameId = screenOffHandler_->GetAccessTokenId();
@ -455,7 +480,7 @@ int32_t DMSContinueSendMgr::GetAbilityNameByMissionId(const int32_t missionId, s
return ERR_OK;
}
HILOGW("get iterItem failed from focusedMissionAbility_, try screenOffHandler_");
if (missionId == screenOffHandler_->GetMissionId()) {
if (screenOffHandler_ != nullptr && missionId == screenOffHandler_->GetMissionId()) {
abilityName = screenOffHandler_->GetAbilityName();
HILOGI("get missionId end, abilityName: %{public}s", abilityName.c_str());
return ERR_OK;
@ -606,7 +631,9 @@ void DMSContinueSendMgr::OnDeviceScreenOff()
}
int32_t missionId = info_.currentMissionId;
auto feedfunc = [this, missionId]() {
screenOffHandler_->OnDeviceScreenOff(missionId);
if (screenOffHandler_ != nullptr) {
screenOffHandler_->OnDeviceScreenOff(missionId);
}
};
if (eventHandler_ == nullptr) {
HILOGE("eventHandler_ is nullptr");
@ -619,7 +646,9 @@ void DMSContinueSendMgr::OnDeviceScreenOn()
{
HILOGI("OnDeviceScreenOn called");
auto feedfunc = [this]() {
screenOffHandler_->OnDeviceScreenOn();
if (screenOffHandler_ != nullptr) {
screenOffHandler_->OnDeviceScreenOn();
}
};
if (eventHandler_ == nullptr) {
HILOGE("eventHandler_ is nullptr");
@ -709,7 +738,7 @@ int32_t DMSContinueSendMgr::GetAccessTokenIdSendEvent(std::string bundleName,
return ret;
}
if (screenOffHandler_->IsDeviceScreenOn()) {
if (screenOffHandler_ != nullptr && screenOffHandler_->IsDeviceScreenOn()) {
ret = SendSoftbusEvent(bundleNameId, continueTypeId, DMS_UNFOCUSED_TYPE);
bool res = (reason != UnfocusedReason::TIMEOUT)
? DmsRadar::GetInstance().NormalUnfocusedSendEventRes("SendSoftbusEvent", ret)
@ -759,14 +788,14 @@ int32_t DMSContinueSendMgr::SetStateSendEvent(const uint16_t bundleNameId, const
void DMSContinueSendMgr::DeleteAliveMissionInfo(const int32_t missionId)
{
HILOGI("called");
HILOGD("called");
std::lock_guard<std::mutex> aliveMissionMapLock(eventMutex_);
aliveMission_.erase(missionId);
}
int32_t DMSContinueSendMgr::GetAliveMissionInfo(const int32_t missionId, AliveMissionInfo& missionInfo)
{
HILOGI("start, missionId: %{public}d", missionId);
HILOGD("start, missionId: %{public}d", missionId);
std::lock_guard<std::mutex> aliveMissionMapLock(eventMutex_);
auto iterItem = aliveMission_.find(missionId);
if (iterItem != aliveMission_.end()) {

View File

@ -59,6 +59,9 @@ int32_t SnapshotConverter::ConvertToSnapshot(AAFwk::MissionSnapshot& missionSnap
int32_t SnapshotConverter::ConvertToSnapshot(AAFwk::MissionSnapshot& missionSnapshot,
std::unique_ptr<Snapshot>& snapshot)
{
if (snapshot == nullptr) {
return INVALID_PARAMETERS_ERR;
}
snapshot->version_ = DMS_VERSION;
snapshot->orientation_ = 0;
std::unique_ptr<Rect> contentInsets = std::make_unique<Rect>(0, 0, 0, 0);
@ -92,8 +95,10 @@ int32_t SnapshotConverter::ConvertToSnapshot(AAFwk::MissionSnapshot& missionSnap
int32_t SnapshotConverter::ConvertToMissionSnapshot(Snapshot& snapshot,
std::unique_ptr<AAFwk::MissionSnapshot>& missionSnapshot)
{
missionSnapshot->snapshot = snapshot.pixelMap_;
if (missionSnapshot != nullptr) {
missionSnapshot->snapshot = snapshot.pixelMap_;
}
return ERR_OK;
}
}
}
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -0,0 +1,289 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dsched_all_connect_manager.h"
#include <dlfcn.h>
#include "distributed_sched_utils.h"
#include "dsched_continue_manager.h"
#include "dsched_transport_softbus_adapter.h"
#include "dtbschedmgr_log.h"
namespace OHOS {
namespace DistributedSchedule {
namespace {
const std::string TAG = "DSchedAllConnectManager";
constexpr int32_t CONNECT_DECISION_WAIT_S = 60;
}
IMPLEMENT_SINGLE_INSTANCE(DSchedAllConnectManager);
ServiceCollaborationManager_HardwareRequestInfo DSchedAllConnectManager::locReqInfo_ = {
.hardWareType = ServiceCollaborationManagerHardwareType::SCM_DISPLAY,
.canShare = true,
};
ServiceCollaborationManager_HardwareRequestInfo DSchedAllConnectManager::rmtReqInfo_ = {
.hardWareType = ServiceCollaborationManagerHardwareType::SCM_DISPLAY,
.canShare = true,
};
ServiceCollaborationManager_CommunicationRequestInfo DSchedAllConnectManager::communicationRequest_ = {
.minBandwidth = DSCHED_QOS_TYPE_MIN_BW,
.maxLatency = DSCHED_QOS_TYPE_MAX_LATENCY,
.minLatency = DSCHED_QOS_TYPE_MIN_LATENCY,
.maxWaitTime = 0,
.dataType = "DATA_TYPE_FILE",
};
std::queue<std::string> DSchedAllConnectManager::peerConnectCbQueue_;
int32_t DSchedAllConnectManager::InitAllConnectManager()
{
HILOGI("Init bind manager.");
int32_t ret = GetServiceCollaborationManagerProxy();
if (ret != ERR_OK) {
HILOGE("GetServiceCollaborationManagerProxy fail, ret %{public}d.", ret);
return ret;
}
ret = RegistLifecycleCallback();
if (ret != ERR_OK) {
HILOGE("Regist lifecycle callback fail, ret %{public}d.", ret);
return ret;
}
return ERR_OK;
}
int32_t DSchedAllConnectManager::UninitAllConnectManager()
{
HILOGI("Uninit bind manager enter.");
int32_t ret = UnregistLifecycleCallback();
if (ret != ERR_OK) {
HILOGE("Unregist lifecycle callback fail, ret %{public}d.", ret);
}
dlclose(dllHandle_);
dllHandle_ = nullptr;
allConnectMgrApi_ = {
.ServiceCollaborationManager_PublishServiceState = nullptr,
.ServiceCollaborationManager_ApplyAdvancedResource = nullptr,
.ServiceCollaborationManager_RegisterLifecycleCallback = nullptr,
.ServiceCollaborationManager_UnRegisterLifecycleCallback = nullptr,
};
return ERR_OK;
}
int32_t DSchedAllConnectManager::GetServiceCollaborationManagerProxy()
{
HILOGI("Get service collaboration manager proxy for all connect.");
std::lock_guard<std::mutex> autoLock(allConnectMgrLock_);
#if (defined(__aarch64__) || defined(__x86_64__))
std::string resolvedPath = "/system/lib64/libcfwk_allconnect_client.z.so";
#else
std::string resolvedPath = "/system/lib/libcfwk_allconnect_client.z.so";
#endif
char path[PATH_MAX + 1] = {0};
if (resolvedPath.empty() || resolvedPath.length() > PATH_MAX || realpath(resolvedPath.c_str(), path) == nullptr) {
HILOGE("Check all connect so real path failed, resolvedPath [%{public}s].", resolvedPath.c_str());
return INVALID_PARAMETERS_ERR;
}
int32_t (*ServiceCollaborationManagerExport)(ServiceCollaborationManager_API *exportapi) = nullptr;
dllHandle_ = dlopen(resolvedPath.c_str(), RTLD_LAZY);
if (dllHandle_ == nullptr) {
HILOGE("Open dms interactive adapter shared object fail, resolvedPath [%{public}s].", resolvedPath.c_str());
return NOT_FIND_SERVICE_REGISTRY;
}
int32_t ret = ERR_OK;
do {
ServiceCollaborationManagerExport =
reinterpret_cast<int32_t (*)(ServiceCollaborationManager_API *exportapi)>(
dlsym(dllHandle_, "ServiceCollaborationManager_Export"));
if (ServiceCollaborationManagerExport == nullptr) {
HILOGE("Link the ServiceCollaborationManagerExport symbol in dms interactive adapter fail.");
ret = NOT_FIND_SERVICE_REGISTRY;
break;
}
int32_t ret = ServiceCollaborationManagerExport(&allConnectMgrApi_);
if (ret != ERR_OK) {
HILOGE("Init remote dms interactive adapter proxy fail, ret %{public}d.", ret);
ret = INVALID_PARAMETERS_ERR;
break;
}
HILOGI("Init remote dms interactive adapter proxy success.");
ret = ERR_OK;
} while (false);
if (ret != ERR_OK) {
HILOGE("Get remote dms interactive adapter proxy fail, dlclose handle.");
dlclose(dllHandle_);
dllHandle_ = nullptr;
}
return ret;
}
int32_t DSchedAllConnectManager::RegistLifecycleCallback()
{
std::lock_guard<std::mutex> autoLock(allConnectMgrLock_);
HILOGI("Regist lifecycle callback.");
if (allConnectMgrApi_.ServiceCollaborationManager_RegisterLifecycleCallback == nullptr) {
HILOGE("Dms all connect manager RegisterLifecycleCallback api is null.");
return INVALID_PARAMETERS_ERR;
}
ServiceCollaborationManager_Callback bindMgrRegLfCB = {
.OnStop = &DSchedAllConnectManager::OnStop,
.ApplyResult = &DSchedAllConnectManager::ApplyResult,
};
int32_t ret = allConnectMgrApi_.ServiceCollaborationManager_RegisterLifecycleCallback(
DMS_BIND_MGR_SRV_NAME, &bindMgrRegLfCB);
if (ret != ERR_OK) {
HILOGE("Dms all connect manager regist lifecycle callback fail, ret %{public}d.", ret);
}
return ret;
}
int32_t DSchedAllConnectManager::UnregistLifecycleCallback()
{
std::lock_guard<std::mutex> autoLock(allConnectMgrLock_);
HILOGI("Unregist lifecycle callback.");
if (allConnectMgrApi_.ServiceCollaborationManager_UnRegisterLifecycleCallback == nullptr) {
HILOGE("Dms all connect manager UnRegisterLifecycleCallback api is null.");
return INVALID_PARAMETERS_ERR;
}
int32_t ret = allConnectMgrApi_.ServiceCollaborationManager_UnRegisterLifecycleCallback(
DMS_BIND_MGR_SRV_NAME);
if (ret != ERR_OK) {
HILOGE("Dms all connect manager unregist lifecycle callback fail, ret %{public}d.", ret);
}
return ret;
}
int32_t DSchedAllConnectManager::PublishServiceState(const std::string &peerNetworkId, const std::string &extraInfo,
ServiceCollaborationManagerBussinessStatus state)
{
std::lock_guard<std::mutex> autoLock(allConnectMgrLock_);
HILOGI("Publish service state enter, peerNetworkId %{public}s, extraInfo %{public}s, state %{public}d.",
GetAnonymStr(peerNetworkId).c_str(), extraInfo.c_str(), state);
if (allConnectMgrApi_.ServiceCollaborationManager_PublishServiceState == nullptr) {
HILOGE("Dms all connect manager PublishServiceState api is null.");
return INVALID_PARAMETERS_ERR;
}
int32_t ret = allConnectMgrApi_.ServiceCollaborationManager_PublishServiceState(peerNetworkId.c_str(),
DMS_BIND_MGR_SRV_NAME, extraInfo.c_str(), state);
if (ret != ERR_OK) {
HILOGE("Dms all connect manager publish service state fail, ret %{public}d.", ret);
}
return ret;
}
int32_t DSchedAllConnectManager::ApplyAdvanceResource(const std::string &peerNetworkId,
ServiceCollaborationManager_ResourceRequestInfoSets reqInfoSets)
{
int32_t ret = ERR_OK;
{
std::lock_guard<std::mutex> autoLock(allConnectMgrLock_);
HILOGI("Apply advance resource enter, peerNetworkId %{public}s.", GetAnonymStr(peerNetworkId).c_str());
if (allConnectMgrApi_.ServiceCollaborationManager_ApplyAdvancedResource == nullptr) {
HILOGE("Dms all connect manager ApplyAdvancedResource api is null.");
return ERR_OK;
}
peerConnectCbQueue_.push(peerNetworkId);
ServiceCollaborationManager_Callback applyScmCbApi = {
.OnStop = &DSchedAllConnectManager::OnStop,
.ApplyResult = &DSchedAllConnectManager::ApplyResult,
};
ret = allConnectMgrApi_.ServiceCollaborationManager_ApplyAdvancedResource(peerNetworkId.c_str(),
DMS_BIND_MGR_SRV_NAME, &reqInfoSets, &applyScmCbApi);
if (ret != ERR_OK) {
HILOGE("Dms all connect manager apply advanced resource fail, ret %{public}d.", ret);
return ret;
}
}
ret = WaitAllConnectApplyCb(peerNetworkId);
if (ret != ERR_OK) {
HILOGE("Wait all connect manager apply callback fail, ret %{public}d.", ret);
}
return ret;
}
int32_t DSchedAllConnectManager::WaitAllConnectApplyCb(const std::string &peerNetworkId)
{
std::unique_lock<std::mutex> decisionLock(connectDecisionMutex_);
connectDecisionCond_.wait_for(decisionLock, std::chrono::seconds(CONNECT_DECISION_WAIT_S),
[this, peerNetworkId]() {
return peerConnectDecision_.find(peerNetworkId) != peerConnectDecision_.end();
});
if (peerConnectDecision_.find(peerNetworkId) == peerConnectDecision_.end()) {
HILOGE("Not find peerNetworkId %{public}s in peerConnectDecision.", GetAnonymStr(peerNetworkId).c_str());
return CONTINUE_ABILITY_TIMEOUT_ERR;
}
int32_t ret = peerConnectDecision_.at(peerNetworkId).load() ? ERR_OK : DMS_CONNECT_APPLY_REJECT_FAILED;
HILOGI("Wait all connect apply decision callback end, peerNetworkId %{public}s, isSupport %{public}d.",
GetAnonymStr(peerNetworkId).c_str(), peerConnectDecision_.at(peerNetworkId).load());
peerConnectDecision_.erase(peerNetworkId);
return ret;
}
void DSchedAllConnectManager::NotifyAllConnectDecision(const std::string &peerNetworkId, bool isSupport)
{
HILOGI("Notify all connect decision, peerNetworkId %{public}s, isSupport %{public}d.",
GetAnonymStr(peerNetworkId).c_str(), isSupport);
std::lock_guard<std::mutex> decisionLock(connectDecisionMutex_);
peerConnectDecision_[peerNetworkId] = isSupport;
connectDecisionCond_.notify_all();
}
void DSchedAllConnectManager::GetResourceRequest(ServiceCollaborationManager_ResourceRequestInfoSets &reqInfoSets)
{
reqInfoSets.remoteHardwareListSize = 1;
reqInfoSets.remoteHardwareList = &rmtReqInfo_;
reqInfoSets.localHardwareListSize = 1;
reqInfoSets.localHardwareList = &locReqInfo_;
reqInfoSets.communicationRequest = &communicationRequest_;
}
int32_t DSchedAllConnectManager::OnStop(const char *peerNetworkId)
{
HILOGI("OnStop, when other task prepare to seize bind, disconnect DMS bind with peerNetworkId %{public}s.",
GetAnonymStr(peerNetworkId).c_str());
DSchedTransportSoftbusAdapter::GetInstance().DisconnectDevice(peerNetworkId);
return ERR_OK;
}
int32_t DSchedAllConnectManager::ApplyResult(int32_t errorcode, int32_t result, const char *reason)
{
HILOGI("Apply result start, errorcode %{public}d, result %{public}s, reason %{public}s.",
errorcode, result == ServiceCollaborationManagerResultCode::PASS ? "PASS" : "REJECT", reason);
bool isSupport = result == ServiceCollaborationManagerResultCode::PASS ? true : false;
if (peerConnectCbQueue_.empty()) {
HILOGE("Apply result start, peerConnectCbQueue is empty.");
return ERR_OK;
}
std::string peerNetworkId = peerConnectCbQueue_.front();
DSchedContinueManager::GetInstance().NotifyAllConnectDecision(peerNetworkId, isSupport);
DSchedAllConnectManager::GetInstance().NotifyAllConnectDecision(peerNetworkId, isSupport);
peerConnectCbQueue_.pop();
return ERR_OK;
}
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -58,6 +58,10 @@ int32_t SoftbusAdapter::StopSoftbusEvent()
static void EventListenerReceived(const EventNotify *eventNotify)
{
HILOGD("called.");
if (eventNotify == nullptr) {
HILOGE("eventNotify is null");
return;
}
std::string networkId(eventNotify->senderNetworkId);
SoftbusAdapter::GetInstance().OnBroadCastRecv(networkId, eventNotify->data, eventNotify->dataLen);
}

View File

@ -76,6 +76,10 @@ bool DSchedSoftbusSession::OnDisconnect()
int32_t DSchedSoftbusSession::OnBytesReceived(std::shared_ptr<DSchedDataBuffer> buffer)
{
HILOGD("called");
if (buffer == nullptr) {
HILOGE("buffer is null");
return INVALID_PARAMETERS_ERR;
}
PackRecvData(buffer);
return ERR_OK;
}
@ -83,6 +87,10 @@ int32_t DSchedSoftbusSession::OnBytesReceived(std::shared_ptr<DSchedDataBuffer>
int32_t DSchedSoftbusSession::SendData(std::shared_ptr<DSchedDataBuffer> buffer, int32_t dataType)
{
HILOGD("called");
if (buffer == nullptr) {
HILOGE("buffer is null");
return INVALID_PARAMETERS_ERR;
}
UnPackSendData(buffer, dataType);
return ERR_OK;
}

View File

@ -16,6 +16,7 @@
#include "dsched_transport_softbus_adapter.h"
#include "distributed_sched_utils.h"
#include "dsched_all_connect_manager.h"
#include "dtbschedmgr_device_info_storage.h"
#include "dtbschedmgr_log.h"
#include "softbus_bus_center.h"
@ -83,6 +84,13 @@ int32_t DSchedTransportSoftbusAdapter::InitChannel()
HILOGE("service listen failed, ret: %{public}d", ret);
return ret;
}
#ifdef DMSFWK_ALL_CONNECT_MGR
ret = DSchedAllConnectManager::GetInstance().InitAllConnectManager();
if (ret != ERR_OK) {
HILOGE("Init all connect manager fail, ret: %{public}d.", ret);
}
#endif
HILOGI("end");
return ERR_OK;
}
@ -106,10 +114,13 @@ int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDevi
HILOGI("try to connect peer: %{public}s.", GetAnonymStr(peerDeviceId).c_str());
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
if (!sessions_.empty()) {
for (auto iter = sessions_.begin(); iter != sessions_.end(); iter++) {
if (iter->second != nullptr && peerDeviceId == iter->second->GetPeerDeviceId()) {
HILOGI("peer device already connected");
if (sessions_.empty()) {
return INVALID_SESSION_ID;
}
for (auto iter = sessions_.begin(); iter != sessions_.end(); iter++) {
if (iter->second != nullptr && peerDeviceId == iter->second->GetPeerDeviceId()) {
HILOGI("peer device already connected");
if (sessions_[iter->first] != nullptr) {
sessions_[iter->first]->OnConnect();
return iter->first;
}
@ -117,13 +128,43 @@ int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDevi
}
}
int32_t sessionId = CreateClientSocket(peerDeviceId);
int32_t ret = ERR_OK;
#ifdef DMSFWK_ALL_CONNECT_MGR
ServiceCollaborationManager_ResourceRequestInfoSets reqInfoSets;
DSchedAllConnectManager::GetInstance().GetResourceRequest(reqInfoSets);
ret = DSchedAllConnectManager::GetInstance().ApplyAdvanceResource(peerDeviceId, reqInfoSets);
if (ret != ERR_OK) {
HILOGE("Apply advance resource fail, ret: %{public}d.", ret);
return INVALID_SESSION_ID;
}
#endif
int32_t sessionId = INVALID_SESSION_ID;
ret = AddNewPeerSession(peerDeviceId, sessionId);
if (ret != ERR_OK || sessionId <= 0) {
HILOGE("Add new peer connect session fail, ret: %{public}d, sessionId: %{public}d.", ret, sessionId);
}
return sessionId;
}
int32_t DSchedTransportSoftbusAdapter::AddNewPeerSession(const std::string &peerDeviceId, int32_t &sessionId)
{
int32_t ret = ERR_OK;
#ifdef DMSFWK_ALL_CONNECT_MGR
ret = DSchedAllConnectManager::GetInstance().PublishServiceState(peerDeviceId, "", SCM_PREPARE);
if (ret != ERR_OK) {
HILOGE("Publish connect idle state fail, peerDeviceId: %{public}s, socket sessionId: %{public}d.",
GetAnonymStr(peerDeviceId).c_str(), sessionId);
}
#endif
sessionId = CreateClientSocket(peerDeviceId);
if (sessionId <= 0) {
HILOGE("create socket failed, ret: %{public}d", sessionId);
return sessionId;
HILOGE("create socket failed, sessionId: %{public}d.", sessionId);
return REMOTE_DEVICE_BIND_ABILITY_ERR;
}
int32_t ret = SetFirstCallerTokenID(callingTokenId_);
ret = SetFirstCallerTokenID(callingTokenId_);
HILOGD("SetFirstCallerTokenID callingTokenId: %{public}d, ret: %{public}d", callingTokenId_, ret);
callingTokenId_ = 0;
@ -133,13 +174,16 @@ int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDevi
if (ret != ERR_OK) {
HILOGE("client bind failed, ret: %{public}d", ret);
Shutdown(sessionId);
return INVALID_SESSION_ID;
sessionId = INVALID_SESSION_ID;
return REMOTE_DEVICE_BIND_ABILITY_ERR;
}
std::string localDeviceId;
if (!DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(localDeviceId)) {
HILOGE("GetLocalDeviceId failed");
Shutdown(sessionId);
return INVALID_SESSION_ID;
sessionId = INVALID_SESSION_ID;
return GET_LOCAL_DEVICE_ERR;
}
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
@ -147,7 +191,14 @@ int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDevi
auto session = std::make_shared<DSchedSoftbusSession>(info);
sessions_[sessionId] = session;
}
return sessionId;
#ifdef DMSFWK_ALL_CONNECT_MGR
ret = DSchedAllConnectManager::GetInstance().PublishServiceState(peerDeviceId, "", SCM_CONNECTED);
if (ret != ERR_OK) {
HILOGE("Publish connect idle state fail, peerDeviceId: %{public}s, socket sessionId: %{public}d.",
GetAnonymStr(peerDeviceId).c_str(), sessionId);
}
#endif
return ERR_OK;
}
int32_t DSchedTransportSoftbusAdapter::CreateClientSocket(const std::string &peerDeviceId)
@ -194,7 +245,7 @@ void DSchedTransportSoftbusAdapter::DisconnectDevice(const std::string &peerDevi
break;
}
}
if (sessionId != 0 && sessions_[sessionId]->OnDisconnect()) {
if (sessionId != 0 && sessions_[sessionId] != nullptr && sessions_[sessionId]->OnDisconnect()) {
HILOGI("peer %{public}s shutdown, socket sessionId: %{public}d.",
GetAnonymStr(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
Shutdown(sessionId);
@ -219,17 +270,28 @@ bool DSchedTransportSoftbusAdapter::GetSessionIdByDeviceId(const std::string &pe
void DSchedTransportSoftbusAdapter::OnShutdown(int32_t sessionId, bool isSelfcalled)
{
std::string peerDeviceId;
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
if (sessions_.empty() || sessions_.count(sessionId) == 0) {
if (sessions_.empty() || sessions_.count(sessionId) == 0 || sessions_[sessionId] == nullptr) {
HILOGE("error, invalid sessionId %{public}d", sessionId);
return;
}
HILOGI("peer %{public}s shutdown, socket sessionId: %{public}d.",
GetAnonymStr(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
peerDeviceId = sessions_[sessionId]->GetPeerDeviceId();
HILOGI("peerDeviceId: %{public}s shutdown, socket sessionId: %{public}d.",
GetAnonymStr(peerDeviceId).c_str(), sessionId);
Shutdown(sessionId);
sessions_.erase(sessionId);
}
#ifdef DMSFWK_ALL_CONNECT_MGR
int32_t ret = DSchedAllConnectManager::GetInstance().PublishServiceState(peerDeviceId, "", SCM_IDLE);
if (ret != ERR_OK) {
HILOGE("Publish connect idle state fail, peerDeviceId: %{public}s, socket sessionId: %{public}d.",
GetAnonymStr(peerDeviceId).c_str(), sessionId);
}
#endif
NotifyListenersSessionShutdown(sessionId, isSelfcalled);
}
@ -255,8 +317,10 @@ int32_t DSchedTransportSoftbusAdapter::ReleaseChannel()
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
for (auto iter = sessions_.begin(); iter != sessions_.end(); iter++) {
HILOGI("shutdown client: %{public}s, socket sessionId: %{public}d.",
GetAnonymStr(iter->second->GetPeerDeviceId()).c_str(), iter->first);
if (iter->second != nullptr) {
HILOGI("shutdown client: %{public}s, socket sessionId: %{public}d.",
GetAnonymStr(iter->second->GetPeerDeviceId()).c_str(), iter->first);
}
Shutdown(iter->first);
}
sessions_.clear();
@ -264,6 +328,13 @@ int32_t DSchedTransportSoftbusAdapter::ReleaseChannel()
HILOGI("shutdown server, socket session id: %{public}d", serverSocket_);
Shutdown(serverSocket_);
serverSocket_ = 0;
#ifdef DMSFWK_ALL_CONNECT_MGR
int32_t ret = DSchedAllConnectManager::GetInstance().UninitAllConnectManager();
if (ret != ERR_OK) {
HILOGE("Uninit all connect manager fail, ret: %{public}d.", ret);
}
#endif
return ERR_OK;
}
@ -271,7 +342,7 @@ int32_t DSchedTransportSoftbusAdapter::SendData(int32_t sessionId, int32_t dataT
std::shared_ptr<DSchedDataBuffer> dataBuffer)
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
if (!sessions_.count(sessionId)) {
if (!sessions_.count(sessionId) || sessions_[sessionId] == nullptr) {
HILOGE("error, invalid session id %{public}d", sessionId);
return INVALID_SESSION_ID;
}
@ -281,7 +352,12 @@ int32_t DSchedTransportSoftbusAdapter::SendData(int32_t sessionId, int32_t dataT
int32_t DSchedTransportSoftbusAdapter::SendBytesBySoftbus(int32_t sessionId,
std::shared_ptr<DSchedDataBuffer> dataBuffer)
{
return SendBytes(sessionId, dataBuffer->Data(), dataBuffer->Size());
if (dataBuffer != nullptr) {
return SendBytes(sessionId, dataBuffer->Data(), dataBuffer->Size());
} else {
HILOGE("dataBuffer is nullptr");
return INVALID_PARAMETERS_ERR;
}
}
void DSchedTransportSoftbusAdapter::OnBytes(int32_t sessionId, const void *data, uint32_t dataLen)
@ -293,7 +369,7 @@ void DSchedTransportSoftbusAdapter::OnBytes(int32_t sessionId, const void *data,
HILOGD("start, sessionId: %{public}d", sessionId);
{
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
if (!sessions_.count(sessionId)) {
if (!sessions_.count(sessionId) || sessions_[sessionId] == nullptr) {
HILOGE("invalid session id %{public}d", sessionId);
return;
}

View File

@ -58,6 +58,7 @@ HWTEST_F(AppStateObserverTest, OnAbilityStateChanged_001, TestSize.Level3)
{
DTEST_LOG << "AppStateObserverTest OnAbilityStateChanged_001 begin" << std::endl;
ASSERT_NE(appStateObserver_, nullptr);
AppExecFwk::AppStateData appStateData;
appStateObserver_->OnForegroundApplicationChanged(appStateData);
@ -83,6 +84,7 @@ HWTEST_F(AppStateObserverTest, OnAbilityStateChanged_001, TestSize.Level3)
HWTEST_F(AppStateObserverTest, OnAbilityStateChanged_002, TestSize.Level3)
{
DTEST_LOG << "AppStateObserverTest OnAbilityStateChanged_001 begin" << std::endl;
ASSERT_NE(appStateObserver_, nullptr);
AppExecFwk::AbilityStateData abilityStateData;
abilityStateData.abilityState = FOREGROUND;
appStateObserver_->OnAbilityStateChanged(abilityStateData);
@ -102,6 +104,7 @@ HWTEST_F(AppStateObserverTest, OnAbilityStateChanged_002, TestSize.Level3)
HWTEST_F(AppStateObserverTest, OnAbilityStateChanged_003, TestSize.Level3)
{
DTEST_LOG << "AppStateObserverTest OnAbilityStateChanged_001 begin" << std::endl;
ASSERT_NE(appStateObserver_, nullptr);
AppExecFwk::AbilityStateData abilityStateData;
abilityStateData.abilityState = BACKGROUND;
appStateObserver_->OnAbilityStateChanged(abilityStateData);

View File

@ -315,6 +315,7 @@ HWTEST_F(BundleManagerInternalTest, BundleManagerCallBackTest_001, TestSize.Leve
int32_t missionId = 0;
int32_t versionCode = 10000;
auto callback = new DmsBundleManagerCallbackStub();
ASSERT_NE(callback, nullptr);
int32_t ret = callback->OnQueryInstallationFinished(resultCode, missionId, versionCode);
EXPECT_TRUE(CONTINUE_REMOTE_UNINSTALLED_CANNOT_FREEINSTALL == ret);
DTEST_LOG << "BundleManagerCallBackTest BundleManagerCallBackTest_001 end "<< std::endl;
@ -332,6 +333,7 @@ HWTEST_F(BundleManagerInternalTest, BundleManagerCallBackTest_002, TestSize.Leve
int32_t missionId = 0;
int32_t versionCode = 10000;
auto callback = new DmsBundleManagerCallbackStub();
ASSERT_NE(callback, nullptr);
int32_t ret = callback->OnQueryInstallationFinished(resultCode, missionId, versionCode);
EXPECT_TRUE(ERR_OK != ret);
DTEST_LOG << "BundleManagerCallBackTest BundleManagerCallBackTest_002 end "<< std::endl;
@ -349,6 +351,7 @@ HWTEST_F(BundleManagerInternalTest, BundleManagerCallBackTest_003, TestSize.Leve
MessageParcel reply;
MessageOption option;
auto callback = new DmsBundleManagerCallbackStub();
ASSERT_NE(callback, nullptr);
int32_t ret = callback->OnRemoteRequest(-1, data, reply, option);
EXPECT_TRUE(ERR_OK != ret);
DTEST_LOG << "BundleManagerCallBackTest BundleManagerCallBackTest_003 end "<< std::endl;
@ -366,6 +369,7 @@ HWTEST_F(BundleManagerInternalTest, BundleManagerCallBackTest_004, TestSize.Leve
MessageParcel reply;
MessageOption option;
auto callback = new DmsBundleManagerCallbackStub();
ASSERT_NE(callback, nullptr);
data.WriteInterfaceToken(callback->GetDescriptor());
int32_t ret = callback->OnRemoteRequest(-1, data, reply, option);
EXPECT_TRUE(ERR_OK != ret);
@ -384,6 +388,7 @@ HWTEST_F(BundleManagerInternalTest, BundleManagerCallBackTest_005, TestSize.Leve
MessageParcel reply;
MessageOption option;
auto callback = new DmsBundleManagerCallbackStub();
ASSERT_NE(callback, nullptr);
data.WriteInterfaceToken(callback->GetDescriptor());
int32_t ret = callback->OnRemoteRequest(1, data, reply, option);
EXPECT_TRUE(ERR_OK != ret);

View File

@ -213,6 +213,8 @@ void DSchedContinueAbilityStateTest::SetUp()
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
std::shared_ptr<DSchedContinueStateMachine> stateMachine =
std::make_shared<DSchedContinueStateMachine>(dContinue);
ASSERT_NE(dContinue, nullptr);
ASSERT_NE(stateMachine, nullptr);
abilityStateTest_ = std::make_shared<DSchedContinueAbilityState>(stateMachine);
DTEST_LOG << "DSchedContinueAbilityStateTest::SetUp" << std::endl;
usleep(WAITTIME);
@ -400,7 +402,9 @@ std::shared_ptr<DSchedContinue> DSchedContinueStateMachineTest::CreateObject()
HWTEST_F(DSchedContinueDataStateTest, SinkExecuteTest001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueDataStateTest SinkExecuteTest001 begin" << std::endl;
ASSERT_NE(dataStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -420,7 +424,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkExecuteTest001, TestSize.Level3)
HWTEST_F(DSchedContinueDataStateTest, SinkExecuteTest002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueDataStateTest SinkExecuteTest002 begin" << std::endl;
ASSERT_NE(dataStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_DATA_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -440,6 +446,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkExecuteTest002, TestSize.Level3)
HWTEST_F(DSchedContinueDataStateTest, SinkGetStateType001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueDataStateTest SinkGetStateType001 begin" << std::endl;
ASSERT_NE(dataStateTest_, nullptr);
int32_t ret = dataStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_DATA_STATE);
DTEST_LOG << "DSchedContinueDataStateTest SinkGetStateType001 end" << std::endl;
@ -453,7 +460,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkGetStateType001, TestSize.Level3)
HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueDataTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueDataTask001 begin" << std::endl;
ASSERT_NE(dataStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -473,7 +482,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueDataTask001, TestSize.Level3
HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueEndTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueEndTask001 begin" << std::endl;
ASSERT_NE(dataStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -493,7 +504,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueEndTask001, TestSize.Level3)
HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkExecute001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkEndStateTest SinkExecuteTest001 begin" << std::endl;
ASSERT_NE(sinkEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -513,7 +526,9 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkExecute001, TestSize.Level3)
HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkExecute002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkEndStateTest SinkExecuteTest001 begin" << std::endl;
ASSERT_NE(sinkEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_END_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -533,6 +548,7 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkExecute002, TestSize.Level3)
HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkGetStateType001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkEndStateTest TestSinkGetStateType001 begin" << std::endl;
ASSERT_NE(sinkEndStateTest_, nullptr);
int32_t ret = sinkEndStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SINK_END_STATE);
DTEST_LOG << "DSchedContinueSinkEndStateTest TestSinkGetStateType001 end" << std::endl;
@ -546,7 +562,9 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkGetStateType001, TestSize.Level
HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkDoContinueEndTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkEndStateTest TestSinkDoContinueEndTask001 begin" << std::endl;
ASSERT_NE(sinkEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -566,7 +584,9 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkDoContinueEndTask001, TestSize.
HWTEST_F(DSchedContinueSinkStartStateTest, SinkExecuteTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkExecuteTest_001 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -586,7 +606,9 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkExecuteTest_001, TestSize.Level3)
HWTEST_F(DSchedContinueSinkStartStateTest, SinkExecuteTest_002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkExecuteTest_002 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_REQ_PULL_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -606,6 +628,7 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkExecuteTest_002, TestSize.Level3)
HWTEST_F(DSchedContinueSinkStartStateTest, SinkGetStateTypeTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkGetStateTypeTest_001 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
int32_t ret = sinkStartStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SINK_START_STATE);
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkGetStateTypeTest_001 end" << std::endl;
@ -619,7 +642,9 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkGetStateTypeTest_001, TestSize.Le
HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinuePullReqTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkDoContinuePullReqTaskTest_001 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -640,7 +665,9 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinuePullReqTaskTest_001, Te
HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueAbilityTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkDoContinueAbilityTaskTest_001 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -661,7 +688,9 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueAbilityTaskTest_001, Te
HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueEndTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkStartStateTest SinkDoContinueEndTaskTest_001 begin" << std::endl;
ASSERT_NE(sinkStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -682,7 +711,9 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueEndTaskTest_001, TestSi
HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkExecute001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkExecute001 begin" << std::endl;
ASSERT_NE(sinkWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -702,7 +733,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkExecute001, TestSize.Level3)
HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkExecute002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkExecute002 begin" << std::endl;
ASSERT_NE(sinkWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_COMPLETE_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -722,6 +755,7 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkExecute002, TestSize.Level3)
HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkGetStateType001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkGetStateType001 begin" << std::endl;
ASSERT_NE(sinkWaitEndTest_, nullptr);
int32_t ret = sinkWaitEndTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SINK_WAIT_END_STATE);
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkGetStateType001 end" << std::endl;
@ -736,7 +770,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkGetStateType001, TestSize.Level
HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoNotifyCompleteTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoNotifyCompleteTask001 begin" << std::endl;
ASSERT_NE(sinkWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -757,7 +793,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoNotifyCompleteTask001, TestSi
HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoContinueEndTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoContinueEndTask001 begin" << std::endl;
ASSERT_NE(sinkWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -778,7 +816,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoContinueEndTask001, TestSize.
HWTEST_F(DSchedContinueAbilityStateTest, SrcExecuteTest001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueAbilityStateTest SrcExecuteTest001 begin" << std::endl;
ASSERT_NE(abilityStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -798,7 +838,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcExecuteTest001, TestSize.Level3)
HWTEST_F(DSchedContinueAbilityStateTest, SrcExecuteTest002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueAbilityStateTest SrcExecuteTest002 begin" << std::endl;
ASSERT_NE(abilityStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSHCED_CONTINUE_SEND_DATA_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -818,6 +860,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcExecuteTest002, TestSize.Level3)
HWTEST_F(DSchedContinueAbilityStateTest, SrcGetStateType001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueAbilityStateTest SrcGetStateType001 begin" << std::endl;
ASSERT_NE(abilityStateTest_, nullptr);
int32_t ret = abilityStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_ABILITY_STATE);
DTEST_LOG << "DSchedContinueAbilityStateTest SrcGetStateType001 end" << std::endl;
@ -831,7 +874,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcGetStateType001, TestSize.Level3)
HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueSendTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueSendTask001 begin" << std::endl;
ASSERT_NE(abilityStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -851,7 +896,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueSendTask001, TestSize.Leve
HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueEndTask001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueEndTask001 begin" << std::endl;
ASSERT_NE(abilityStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -871,7 +918,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueEndTask001, TestSize.Level
HWTEST_F(DSchedContinueEndStateTest, SrcExecuteTest001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueEndStateTest SrcExecuteTest001 begin" << std::endl;
ASSERT_NE(srcEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -891,7 +940,9 @@ HWTEST_F(DSchedContinueEndStateTest, SrcExecuteTest001, TestSize.Level3)
HWTEST_F(DSchedContinueEndStateTest, SrcExecuteTest002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueEndStateTest SrcExecuteTest002 begin" << std::endl;
ASSERT_NE(srcEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_END_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -911,6 +962,7 @@ HWTEST_F(DSchedContinueEndStateTest, SrcExecuteTest002, TestSize.Level3)
HWTEST_F(DSchedContinueEndStateTest, SrcGetStateTypeTest001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueEndStateTest SrcGetStateTypeTest001 begin" << std::endl;
ASSERT_NE(srcEndStateTest_, nullptr);
int32_t ret = srcEndStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SOURCE_END_STATE);
DTEST_LOG << "DSchedContinueEndStateTest SrcGetStateTypeTest001 end" << std::endl;
@ -924,7 +976,9 @@ HWTEST_F(DSchedContinueEndStateTest, SrcGetStateTypeTest001, TestSize.Level3)
HWTEST_F(DSchedContinueEndStateTest, SrcDoContinueEndTaskTest001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueEndStateTest SrcDoContinueEndTaskTest001 begin" << std::endl;
ASSERT_NE(srcEndStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -944,7 +998,9 @@ HWTEST_F(DSchedContinueEndStateTest, SrcDoContinueEndTaskTest001, TestSize.Level
HWTEST_F(DSchedContinueSourceStartStateTest, SrcExecuteTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcExecuteTest_001 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -964,7 +1020,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcExecuteTest_001, TestSize.Level3
HWTEST_F(DSchedContinueSourceStartStateTest, SrcExecuteTest_002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcExecuteTest_002 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSHCED_CONTINUE_REQ_PUSH_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -984,6 +1042,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcExecuteTest_002, TestSize.Level3
HWTEST_F(DSchedContinueSourceStartStateTest, SrcGetStateTypeTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcGetStateTypeTest_001 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
int32_t ret = srcStartStateTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SOURCE_START_STATE);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcGetStateTypeTest_001 end" << std::endl;
@ -997,7 +1056,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcGetStateTypeTest_001, TestSize.L
HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinuePushReqTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinuePushReqTaskTest_001 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1018,7 +1079,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinuePushReqTaskTest_001, T
HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueAbilityTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueAbilityTaskTest_001 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1039,7 +1102,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueAbilityTaskTest_001, T
HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueEndTaskTest_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueEndTaskTest_001 begin" << std::endl;
ASSERT_NE(srcStartStateTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1060,7 +1125,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueEndTaskTest_001, TestS
HWTEST_F(DSchedContinueWaitEndStateTest, SrcExecute_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcExecute_001 begin" << std::endl;
ASSERT_NE(srcWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1080,7 +1147,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcExecute_001, TestSize.Level3)
HWTEST_F(DSchedContinueWaitEndStateTest, SrcExecute_002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcExecute_002 begin" << std::endl;
ASSERT_NE(srcWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(DSCHED_CONTINUE_COMPLETE_EVENT);
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1100,6 +1169,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcExecute_002, TestSize.Level3)
HWTEST_F(DSchedContinueWaitEndStateTest, SrcGetStateType_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcGetStateType_001 begin" << std::endl;
ASSERT_NE(srcWaitEndTest_, nullptr);
int32_t ret = srcWaitEndTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SOURCE_WAIT_END_STATE);
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcGetStateType_001 end" << std::endl;
@ -1113,7 +1183,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcGetStateType_001, TestSize.Level3)
HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoNotifyCompleteTask_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoNotifyCompleteTask_001 begin" << std::endl;
ASSERT_NE(srcWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1134,7 +1206,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoNotifyCompleteTask_001, TestSize.L
HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoContinueEndTask_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoContinueEndTask_001 begin" << std::endl;
ASSERT_NE(srcWaitEndTest_, nullptr);
AppExecFwk::InnerEvent *event = new AppExecFwk::InnerEvent();
ASSERT_NE(event, nullptr);
event->innerEventId_ = static_cast<uint32_t>(-1);;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1156,6 +1230,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoContinueEndTask_001, TestSize.Leve
HWTEST_F(DSchedContinueStateMachineTest, Execute_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueStateMachineTest Execute_001 begin" << std::endl;
ASSERT_NE(stateMachineTest_, nullptr);
AppExecFwk::InnerEvent *event = nullptr;
auto destructor = [](AppExecFwk::InnerEvent *event) {
if (event != nullptr) {
@ -1176,6 +1251,7 @@ HWTEST_F(DSchedContinueStateMachineTest, Execute_001, TestSize.Level3)
HWTEST_F(DSchedContinueStateMachineTest, UpdateState_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueStateMachineTest UpdateState_001 begin" << std::endl;
ASSERT_NE(stateMachineTest_, nullptr);
DSchedContinueStateType stateType = DSCHED_CONTINUE_SOURCE_START_STATE;
stateMachineTest_->UpdateState(stateType);
EXPECT_NE(stateMachineTest_->currentState_, nullptr);
@ -1190,6 +1266,7 @@ HWTEST_F(DSchedContinueStateMachineTest, UpdateState_001, TestSize.Level3)
HWTEST_F(DSchedContinueStateMachineTest, UpdateState_002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueStateMachineTest UpdateState_002 begin" << std::endl;
ASSERT_NE(stateMachineTest_, nullptr);
DSchedContinueStateType stateType = DSCHED_CONTINUE_ABILITY_STATE;
stateMachineTest_->currentState_ = stateMachineTest_->CreateState(stateType);
stateMachineTest_->UpdateState(stateType);
@ -1205,6 +1282,7 @@ HWTEST_F(DSchedContinueStateMachineTest, UpdateState_002, TestSize.Level3)
HWTEST_F(DSchedContinueStateMachineTest, CreateState_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueStateMachineTest CreateState_001 begin" << std::endl;
ASSERT_NE(stateMachineTest_, nullptr);
std::shared_ptr<DSchedContinueState> state = stateMachineTest_->CreateState(DSCHED_CONTINUE_SOURCE_START_STATE);
EXPECT_TRUE(state != nullptr);
@ -1242,6 +1320,7 @@ HWTEST_F(DSchedContinueStateMachineTest, CreateState_001, TestSize.Level3)
HWTEST_F(DSchedContinueStateMachineTest, GetStateType_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueStateMachineTest GetStateType_001 begin" << std::endl;
ASSERT_NE(stateMachineTest_, nullptr);
stateMachineTest_->currentState_ = nullptr;
DSchedContinueStateType ret = stateMachineTest_->GetStateType();
EXPECT_EQ(ret, DSCHED_CONTINUE_SOURCE_START_STATE);

View File

@ -68,6 +68,7 @@ void DistributedOperationBaseTest::TearDown(void)
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAbilityName_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "enter";
GTEST_LOG_(INFO) << "DmsFwk_DistributedOperation_GetAbilityName_0100 start";
@ -85,10 +86,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAbilityNam
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAbilityName_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
operationbuilder_->WithAbilityName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetAbilityName().c_str());
}
@ -99,9 +101,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAbilityNam
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetBundleName_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "value";
operationbuilder_->WithBundleName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetBundleName().c_str());
}
@ -112,9 +116,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetBundleName
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetBundleName_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
operationbuilder_->WithBundleName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetBundleName().c_str());
}
@ -125,9 +131,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetBundleName
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetDeviceId_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "value";
operationbuilder_->WithDeviceId(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetDeviceId().c_str());
}
@ -138,9 +146,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetDeviceId_0
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetDeviceId_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
operationbuilder_->WithDeviceId(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetDeviceId().c_str());
}
@ -151,9 +161,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetDeviceId_0
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAction_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "value";
operationbuilder_->WithAction(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
}
@ -164,9 +176,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAction_010
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAction_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
operationbuilder_->WithAction(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
}
@ -177,11 +191,12 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetAction_020
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetEntities_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::vector<std::string> value;
value.push_back("string1");
operationbuilder_->WithEntities(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
std::vector<std::string> revValue = operation->GetEntities();
if (value.size() > 0 && revValue.size() > 0) {
@ -198,9 +213,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetEntities_0
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetEntities_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::vector<std::string> value;
operationbuilder_->WithEntities(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(true, operation->GetEntities().size() == 0);
}
@ -211,9 +228,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetEntities_0
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetFlags_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
unsigned int value = 1;
operationbuilder_->WithFlags(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(value, operation->GetFlags());
}
@ -224,9 +243,11 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetFlags_0100
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetFlags_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
unsigned int value = 0;
operationbuilder_->WithFlags(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(value, operation->GetFlags());
}
@ -237,11 +258,12 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetFlags_0200
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetUri_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "scheme://authority/path1/path2/path3?id = 1&name = mingming&old#fragment";
OHOS::Uri uri(value);
operationbuilder_->WithUri(uri);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(uri, operation->GetUri());
}
@ -252,10 +274,12 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetUri_0100,
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetUri_0200, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
OHOS::Uri uri(value);
operationbuilder_->WithUri(uri);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(uri, operation->GetUri());
}
@ -266,6 +290,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_GetUri_0200,
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_build_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "value";
OHOS::Uri uri(value);
std::vector<std::string> columns;
@ -278,7 +303,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_build_0100, F
operationbuilder_->WithAbilityName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
EXPECT_EQ(uri, operation->GetUri());
EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
@ -301,6 +326,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_build_0100, F
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Marshalling_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "value";
OHOS::Uri uri(value);
std::vector<std::string> columns;
@ -313,6 +339,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Marshalling_0
operationbuilder_->WithAbilityName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
Parcel in;
operation->Marshalling(in);
@ -331,6 +358,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Marshalling_0
*/
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0100, Function | MediumTest | Level3)
{
ASSERT_NE(operationbuilder_, nullptr);
DistributedOperation operation_;
std::string value = "value";
OHOS::Uri uri(value);
@ -344,6 +372,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0100
operationbuilder_->WithAbilityName(value);
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
ASSERT_NE(operation, nullptr);
operation_ = *(operation.get());
EXPECT_EQ(true, operation_ == *(operation.get()));
@ -358,6 +387,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0100
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_AddEntity_0100, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_AddEntity_0100 begin" << std::endl;
ASSERT_NE(distributedOperation_, nullptr);
std::string entity = "test";
distributedOperation_->entities_.emplace_back(entity);
distributedOperation_->AddEntity(entity);
@ -375,6 +405,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_AddEntity_010
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_RemoveEntity_0100, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0100 begin" << std::endl;
ASSERT_NE(distributedOperation_, nullptr);
std::string entity = "test";
distributedOperation_->entities_.clear();
distributedOperation_->RemoveEntity(entity);
@ -392,6 +423,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_RemoveEntity_
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_RemoveEntity_0200, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0200 begin" << std::endl;
ASSERT_NE(distributedOperation_, nullptr);
std::string entity = "test";
distributedOperation_->entities_.emplace_back(entity);
std::string entity1 = "test1";
@ -560,6 +592,7 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_1000
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Marshalling_0200, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Marshalling_0200 begin" << std::endl;
ASSERT_NE(operationbuilder_, nullptr);
std::string value = "";
OHOS::Uri uri(value);
std::vector<std::string> columns;

View File

@ -81,6 +81,7 @@ void DistributedWantParamsBaseTest::TearDown(void)
*/
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0100, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamsIn_, nullptr);
std::string keyStr = "12345667";
std::string valueStr = "sdasdfdsffdgfdg";
wantParamsIn_->SetParam(keyStr, String::Box(valueStr));
@ -99,6 +100,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0100, F
*/
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0200, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamsIn_, nullptr);
std::string keyStr = "12345667";
bool valueBool = true;
wantParamsIn_->SetParam(keyStr, Boolean::Box(valueBool));
@ -118,6 +120,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0200, F
*/
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0300, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamsIn_, nullptr);
std::string keyStr = "12345667";
int valueInteger = 12345;
wantParamsIn_->SetParam(keyStr, Integer::Box(valueInteger));
@ -140,6 +143,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0300, F
*/
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0400, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamsIn_, nullptr);
std::string keyStr = "12345667";
long valueLong = 1234567;
wantParamsIn_->SetParam(keyStr, Long::Box(valueLong));
@ -158,6 +162,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0400, F
*/
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Parcelable_0700, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamsIn_, nullptr);
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(2, AAFwk::g_IID_IString);
std::string valueStr0 = "TestValue0";
ao->Set(0, String::Box(valueStr0));
@ -1062,6 +1067,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_CompareInterface_1
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_remove_0100, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_remove_0100 begin" << std::endl;
ASSERT_NE(distributedWantParams_, nullptr);
distributedWantParams_->params_["hello"] = String::Box("World");
distributedWantParams_->Remove("hello");
distributedWantParams_->params_.clear();
@ -1078,6 +1084,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_remove_0100, Funct
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_IsEmpty_0100, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_IsEmpty_0100 begin" << std::endl;
ASSERT_NE(distributedWantParams_, nullptr);
distributedWantParams_->params_.clear();
EXPECT_TRUE(distributedWantParams_->IsEmpty());
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_IsEmpty_0100 end" << std::endl;
@ -1092,6 +1099,7 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_IsEmpty_0100, Func
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_DoMarshalling_0100, Function | MediumTest | Level3)
{
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_DoMarshalling_0100 begin" << std::endl;
ASSERT_NE(distributedWantParams_, nullptr);
DistributedUnsupportedData data;
distributedWantParams_->cachedUnsupportedData_.emplace_back(std::move(data));
Parcel tempParcel;

View File

@ -70,6 +70,7 @@ void DistributedWantParamWrapperBaseTest::TearDown(void)
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_0100, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
DistributedWantParams wantParams;
ErrCode result = wantParamWrapperPtr_->GetValue(wantParams);
@ -85,6 +86,7 @@ HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_010
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_0200, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
DistributedWantParams wantParams;
ErrCode result = wantParamWrapperPtr_->GetValue(wantParams);
@ -103,6 +105,7 @@ HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_020
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_0300, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
DistributedWantParams wantParams;
wantParams.SetParam(STRING_WANT_PARAMS_KEY_01, String::Box(STRING_WANT_PARAMS_VALUE_01));
DistributedWantParamWrapper wantParamWrapper(wantParams);
@ -119,6 +122,7 @@ HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_030
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_0400, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
DistributedWantParams wantParams;
DistributedWantParamWrapper wantParamWrapper(wantParams);
@ -284,6 +288,7 @@ HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_140
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_1500, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
auto wantParamsString = wantParamWrapperPtr_->ToString();
EXPECT_EQ(wantParamsString, STRING_WANT_PARAMS_STRING_01);
@ -328,6 +333,7 @@ HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_170
*/
HWTEST_F(DistributedWantParamWrapperBaseTest, Distributed_Want_Param_Wrapper_1800, Function | MediumTest | Level3)
{
ASSERT_NE(wantParamWrapperPtr_, nullptr);
auto wantParamsString = wantParamWrapperPtr_->ToString();
EXPECT_EQ(wantParamsString, STRING_WANT_PARAMS_STRING_01);

View File

@ -263,6 +263,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedSchedule_DistributedWant_Convert_01
HWTEST_F(DistributedWantBaseTest, DistributedSchedule_Distributedwant_Convert_0200, Function | MediumTest | Level3)
{
std::shared_ptr<DistributedWant> dwant = std::make_shared<DistributedWant>();
ASSERT_NE(dwant, nullptr);
std::string description = "liuuy";
dwant->SetType(description);
dwant->SetFlags(16);
@ -319,6 +320,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedSchedule_Distributedwant_Convert_02
HWTEST_F(DistributedWantBaseTest, DistributedSchedule_Distributedwant_Convert_0201, Function | MediumTest | Level3)
{
std::shared_ptr<DistributedWant> dwant = std::make_shared<DistributedWant>();
ASSERT_NE(dwant, nullptr);
std::vector<bool> bv;
bv.emplace_back(true);
bv.emplace_back(false);
@ -2079,6 +2081,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_ParseUri_ToUri_1401, F
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Flags_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
int flags = 3;
int returnsflags;
int description = 8;
@ -2100,6 +2103,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Flags_0100, Function |
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_MakeMainAbility_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
ElementName elementName;
std::string action("action.system.home");
@ -2128,6 +2132,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_MakeMainAbility_0100,
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_ClearWant_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
DistributedWant want;
ElementName elementName;
std::string empty = "";
@ -2148,6 +2153,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_ClearWant_0100, Functi
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_replaceParams_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
DistributedWantParams wantParams;
std::string keyStr = "123";
std::string valueStr = "123";
@ -2164,6 +2170,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_replaceParams_0100, Fu
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_setElement_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string valueStr1 = "xxxxx";
std::string valueStr2 = "uaid";
std::string valueStr3 = "uaygfi";
@ -2201,6 +2208,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_setElement_0100, Funct
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Action_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setValue;
want_->SetAction(setValue);
EXPECT_EQ(setValue, want_->GetAction());
@ -2213,6 +2221,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Action_0200, Function
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Action_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setValue("action.system.com");
want_->SetAction(setValue);
EXPECT_STREQ(setValue.c_str(), want_->GetAction().c_str());
@ -2310,6 +2319,7 @@ void DistributedWantBoolArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantBoolArrayParamTest, DistributedScheduleWant_BoolArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<bool> setValue = std::get<2>(GetParam());
@ -2366,6 +2376,7 @@ void DistributedWantCharArrayParamTest::TearDown(void)
HWTEST_P(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_CharArray_0100,
Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<zchar> setValue = std::get<2>(GetParam());
@ -2389,6 +2400,7 @@ INSTANTIATE_TEST_SUITE_P(WantCharArrayParamTestCaseP, DistributedWantCharArrayPa
HWTEST_F(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_CharArray_0200,
Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<zchar> defaultValue;
std::string getKey("aa");
EXPECT_EQ(defaultValue, want_->GetCharArrayParam(getKey));
@ -2402,6 +2414,7 @@ HWTEST_F(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_C
HWTEST_F(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_CharArray_0300,
Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("ff");
std::vector<zchar> firstValue({U'', U''});
std::vector<zchar> secondValue({U'', U''});
@ -2424,6 +2437,7 @@ HWTEST_F(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_C
HWTEST_F(DistributedWantCharArrayParamTest, DistributedScheduleWant_Parameters_CharArray_0400,
Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
std::vector<zchar> firstValue({U'', U''});
std::vector<zchar> secondValue({U'', U''});
@ -2476,6 +2490,7 @@ void DistributedWantCharParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
zchar setValue = std::get<2>(GetParam());
@ -2496,6 +2511,7 @@ INSTANTIATE_TEST_SUITE_P(WantParametersCharTestCaseP, DistributedWantCharParamTe
*/
HWTEST_F(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
zchar defaultValue = U'';
std::string getKey("aa");
EXPECT_EQ(defaultValue, want_->GetCharParam(getKey, defaultValue));
@ -2508,6 +2524,7 @@ HWTEST_F(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0
*/
HWTEST_F(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("jj");
zchar firstValue = U'';
zchar secondValue = U'';
@ -2530,6 +2547,7 @@ HWTEST_F(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0
*/
HWTEST_F(DistributedWantCharParamTest, DistributedScheduleWant_Parameters_Char_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
zchar firstValue = U'';
zchar secondValue = U'';
@ -2584,6 +2602,7 @@ void DistributedWantDoubleArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<double> setValue = std::get<2>(GetParam());
@ -2606,6 +2625,7 @@ INSTANTIATE_TEST_SUITE_P(WantDoubleArrayParamTestCaseP, DistributedWantDoubleArr
*/
HWTEST_F(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<double> defaultValue;
std::string key = "aa";
EXPECT_EQ(defaultValue, want_->GetDoubleArrayParam(key));
@ -2618,6 +2638,7 @@ HWTEST_F(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArra
*/
HWTEST_F(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<double> defaultValue;
std::string setKey1 = "cc";
std::string setKey2 = "aa";
@ -2640,6 +2661,7 @@ HWTEST_F(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArra
*/
HWTEST_F(DistributedWantDoubleArrayParamTest, DistributedScheduleWant_DoubleArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<double> defaultValue;
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
@ -2696,6 +2718,7 @@ void DistributedWantFloatArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<float> setValue = std::get<2>(GetParam());
@ -2718,6 +2741,7 @@ INSTANTIATE_TEST_SUITE_P(WantFloatArrayParamTestCaseP, DistributedWantFloatArray
*/
HWTEST_F(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<float> defaultValue;
std::string key = "aa";
EXPECT_EQ(defaultValue, want_->GetFloatArrayParam(key));
@ -2730,6 +2754,7 @@ HWTEST_F(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_
*/
HWTEST_F(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<float> defaultValue;
std::string setKey1 = "hh";
std::string setKey2 = "aa";
@ -2751,6 +2776,7 @@ HWTEST_F(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_
*/
HWTEST_F(DistributedWantFloatArrayParamTest, DistributedScheduleWant_FloatArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<float> defaultValue;
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
@ -2806,6 +2832,7 @@ void DistributedWantLongArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<long> setValue = std::get<2>(GetParam());
@ -2828,6 +2855,7 @@ INSTANTIATE_TEST_SUITE_P(WantLongArrayParamTestCaseP, DistributedWantLongArrayPa
*/
HWTEST_F(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<long> defaultValue;
std::string key = "aa";
EXPECT_EQ(defaultValue, want_->GetLongArrayParam(key));
@ -2840,6 +2868,7 @@ HWTEST_F(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_02
*/
HWTEST_F(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<long> defaultValue;
std::string setKey1 = "bb";
std::string setKey2 = "aa";
@ -2861,6 +2890,7 @@ HWTEST_F(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_03
*/
HWTEST_F(DistributedWantLongArrayParamTest, DistributedScheduleWant_LongArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<long> defaultValue;
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
@ -2915,6 +2945,7 @@ void DistributedWantShortArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<short> setValue = std::get<2>(GetParam());
@ -2937,6 +2968,7 @@ INSTANTIATE_TEST_SUITE_P(WantShortArrayParamTestCaseP, DistributedWantShortArray
*/
HWTEST_F(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<short> defaultValue;
std::string getKey("aa");
EXPECT_EQ(defaultValue, want_->GetShortArrayParam(getKey));
@ -2949,6 +2981,7 @@ HWTEST_F(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_
*/
HWTEST_F(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("hh");
std::vector<short> firstValue({1, 4, -9});
std::vector<short> secondValue({1, 8, -9});
@ -2970,6 +3003,7 @@ HWTEST_F(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_
*/
HWTEST_F(DistributedWantShortArrayParamTest, DistributedScheduleWant_ShortArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
std::vector<short> firstValue({-1, -2});
std::vector<short> secondValue({-1, -2, -1, -2, 0});
@ -3021,6 +3055,7 @@ void DistributedWantShortParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantShortParamTest, DistributedScheduleWant_Short_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
short setValue = std::get<2>(GetParam());
@ -3052,6 +3087,7 @@ HWTEST_F(DistributedWantShortParamTest, DistributedScheduleWant_Short_0200, Func
*/
HWTEST_F(DistributedWantShortParamTest, DistributedScheduleWant_Short_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("bb");
short firstValue = 1;
short secondValue = 2;
@ -3074,6 +3110,7 @@ HWTEST_F(DistributedWantShortParamTest, DistributedScheduleWant_Short_0300, Func
*/
HWTEST_F(DistributedWantShortParamTest, DistributedScheduleWant_Short_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
short firstValue = -1;
short secondValue = 0;
@ -3127,6 +3164,7 @@ void DistributedWantStringArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<std::string> setValue = std::get<2>(GetParam());
@ -3149,6 +3187,7 @@ INSTANTIATE_TEST_SUITE_P(WantStringArrayParamTestCaseP, DistributedWantStringArr
*/
HWTEST_F(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<std::string> defaultValue;
std::string key = "aa";
std::vector<std::string> resultValue = want_->GetStringArrayParam(key);
@ -3162,6 +3201,7 @@ HWTEST_F(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArra
*/
HWTEST_F(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<std::string> defaultValue;
std::vector<std::string> setValue1 = {"aaa", "2132"};
std::vector<std::string> setValue2 = {"1*中_aR", "dbdb"};
@ -3185,6 +3225,7 @@ HWTEST_F(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArra
*/
HWTEST_F(DistributedWantStringArrayParamTest, DistributedScheduleWant_StringArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<std::string> defaultValue;
std::vector<std::string> setValue = {"aaa", "2132"};
std::string key1 = "%1uH3";
@ -3239,6 +3280,7 @@ void DistributedWantStringParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantStringParamTest, DistributedScheduleWant_String_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::string setValue = std::get<2>(GetParam());
@ -3259,6 +3301,7 @@ INSTANTIATE_TEST_SUITE_P(WantStringParamTestCaseP, DistributedWantStringParamTes
*/
HWTEST_F(DistributedWantStringParamTest, DistributedScheduleWant_String_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string defaultStrValue;
std::string key = "aa";
EXPECT_EQ(defaultStrValue, want_->GetStringParam(key));
@ -3271,6 +3314,7 @@ HWTEST_F(DistributedWantStringParamTest, DistributedScheduleWant_String_0200, Fu
*/
HWTEST_F(DistributedWantStringParamTest, DistributedScheduleWant_String_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string defaultStrValue;
std::string setValue1 = "aaa";
std::string setValue2 = "1*中_aR";
@ -3291,6 +3335,7 @@ HWTEST_F(DistributedWantStringParamTest, DistributedScheduleWant_String_0300, Fu
*/
HWTEST_F(DistributedWantStringParamTest, DistributedScheduleWant_String_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string key1 = "%1uH3";
std::string defaultStrValue;
std::string setValue1 = "aaa";
@ -3341,6 +3386,7 @@ void DistributedWantLongParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
long setValue = std::get<2>(GetParam());
@ -3361,6 +3407,7 @@ INSTANTIATE_TEST_SUITE_P(WantLongParamTestCaseP, DistributedWantLongParamTest,
*/
HWTEST_F(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
long defaultValue = 100;
std::string key = "aa";
EXPECT_EQ(defaultValue, want_->GetLongParam(key, defaultValue));
@ -3373,6 +3420,7 @@ HWTEST_F(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0200, F
*/
HWTEST_F(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "dd";
std::string setKey2 = "aa";
long setValue1 = 1;
@ -3395,6 +3443,7 @@ HWTEST_F(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0300, F
*/
HWTEST_F(DistributedWantLongParamTest, DistributedScheduleWant_LongParam_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
long setValue1 = -1;
@ -3449,6 +3498,7 @@ void DistributedWantIntParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantIntParamTest, DistributedScheduleWant_IntParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
int setValue = std::get<2>(GetParam());
@ -3481,6 +3531,7 @@ HWTEST_F(DistributedWantIntParamTest, DistributedScheduleWant_IntParam_0200, Fun
*/
HWTEST_F(DistributedWantIntParamTest, DistributedScheduleWant_IntParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("bb");
int firstValue = 1;
int secondValue = 2;
@ -3503,6 +3554,7 @@ HWTEST_F(DistributedWantIntParamTest, DistributedScheduleWant_IntParam_0300, Fun
*/
HWTEST_F(DistributedWantIntParamTest, DistributedScheduleWant_IntParam_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
int firstValue = -1;
int secondValue = 0;
@ -3557,6 +3609,7 @@ void DistributedWantIntArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<int> setValue = std::get<2>(GetParam());
@ -3579,6 +3632,7 @@ INSTANTIATE_TEST_SUITE_P(WantIntArrayParamTestCaseP, DistributedWantIntArrayPara
*/
HWTEST_F(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<int> defaultValue;
std::string getKey("aa");
EXPECT_EQ(defaultValue, want_->GetIntArrayParam(getKey));
@ -3591,6 +3645,7 @@ HWTEST_F(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam
*/
HWTEST_F(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("cc");
std::vector<int> firstValue({1, 4, -9});
std::vector<int> secondValue({1, 8, -9});
@ -3612,6 +3667,7 @@ HWTEST_F(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam
*/
HWTEST_F(DistributedWantIntArrayParamTest, DistributedScheduleWant_IntArrayParam_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
std::vector<int> firstValue({-1, -2});
std::vector<int> secondValue({-1, -2, -1, -2, 0});
@ -3666,6 +3722,7 @@ void DistributedWantFloatParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantFloatParamTest, DistributedScheduleWant_FloatParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
float setValue = std::get<2>(GetParam());
@ -3698,6 +3755,7 @@ HWTEST_F(DistributedWantFloatParamTest, DistributedScheduleWant_FloatParam_0200,
*/
HWTEST_F(DistributedWantFloatParamTest, DistributedScheduleWant_FloatParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "ee";
std::string setKey2 = "aa";
float setValue1 = 1.1;
@ -3720,6 +3778,7 @@ HWTEST_F(DistributedWantFloatParamTest, DistributedScheduleWant_FloatParam_0300,
*/
HWTEST_F(DistributedWantFloatParamTest, DistributedScheduleWant_FloatParam_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
float setValue1 = -1.1;
@ -3774,6 +3833,7 @@ void DistributedWantDoubleParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantDoubleParamTest, DistributedScheduleWant_DoubleParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
double setValue = std::get<2>(GetParam());
@ -3795,6 +3855,7 @@ INSTANTIATE_TEST_SUITE_P(WantDoubleParamTestCaseP, DistributedWantDoubleParamTes
*/
HWTEST_F(DistributedWantDoubleParamTest, DistributedScheduleWant_DoubleParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
double defaultValue = 100.1;
std::string key = "aa";
EXPECT_EQ(defaultValue, want_->GetDoubleParam(key, defaultValue));
@ -3807,6 +3868,7 @@ HWTEST_F(DistributedWantDoubleParamTest, DistributedScheduleWant_DoubleParam_030
*/
HWTEST_F(DistributedWantDoubleParamTest, DistributedScheduleWant_DoubleParam_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "ff";
std::string setKey2 = "aa";
double setValue1 = 1.1;
@ -3829,6 +3891,7 @@ HWTEST_F(DistributedWantDoubleParamTest, DistributedScheduleWant_DoubleParam_040
*/
HWTEST_F(DistributedWantDoubleParamTest, DistributedScheduleWant_ByteArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey1 = "%1uH3";
std::string setKey2 = "aa";
double setValue1 = -1.1;
@ -3884,6 +3947,7 @@ void DistributedWantByteArrayParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
std::vector<byte> setValue = std::get<2>(GetParam());
@ -3905,6 +3969,7 @@ INSTANTIATE_TEST_SUITE_P(WantByteArrayParamTestCaseP, DistributedWantByteArrayPa
*/
HWTEST_F(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<byte> defaultValue;
std::string getKey("aa");
EXPECT_EQ(defaultValue, want_->GetByteArrayParam(getKey));
@ -3917,6 +3982,7 @@ HWTEST_F(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_02
*/
HWTEST_F(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string emptyStr("gg");
std::vector<byte> firstValue({'a', '2'});
std::vector<byte> secondValue({'1', 'd'});
@ -3938,6 +4004,7 @@ HWTEST_F(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_03
*/
HWTEST_F(DistributedWantByteArrayParamTest, DistributedScheduleWant_ByteArray_0400, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("%1uH3");
std::vector<byte> firstValue({'a', '2'});
std::vector<byte> secondValue({'w', '$'});
@ -3990,6 +4057,7 @@ void DistributedWantBoolParamTest::TearDown(void)
*/
HWTEST_P(DistributedWantBoolParamTest, DistributedScheduleWant_BoolParam_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string setKey = std::get<0>(GetParam());
std::string getKey = std::get<1>(GetParam());
bool setValue = std::get<2>(GetParam());
@ -4015,6 +4083,7 @@ INSTANTIATE_TEST_SUITE_P(WantBoolParamTestCaseP, DistributedWantBoolParamTest,
*/
HWTEST_F(DistributedWantBoolParamTest, DistributedScheduleWant_BoolParam_0200, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string firstKey("_中文ddPEJKJ#(&*~#^%");
std::string secondKey("key33");
want_->SetParam(firstKey, true);
@ -4030,6 +4099,7 @@ HWTEST_F(DistributedWantBoolParamTest, DistributedScheduleWant_BoolParam_0200, F
*/
HWTEST_F(DistributedWantBoolParamTest, DistributedScheduleWant_BoolParam_0300, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string keyStr("_中文ddPEJKJ#(&*~#^%");
for (int i = 0; i < 20; i++) {
want_->SetParam(keyStr, true);
@ -4071,6 +4141,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Want_0100, Function |
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Entity_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::string entity1 = "entity.system.entity1";
want_->AddEntity(entity1);
@ -4108,6 +4179,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_Entity_0100, Function
*/
HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_HasParameter_0100, Function | MediumTest | Level3)
{
ASSERT_NE(want_, nullptr);
std::vector<std::string> vector;
std::string key = "system.want.test.key";
std::string key2 = "system.want.test.key2";
@ -4204,6 +4276,7 @@ HWTEST_F(DistributedWantBaseTest, DistributedScheduleWant_ToString_0100, Functio
HWTEST_F(DistributedWantBaseTest, array_test_001, TestSize.Level3)
{
sptr<Array> arrayObj(new Array(9, g_IID_IInteger));
ASSERT_NE(arrayObj, nullptr);
long size = 0;
arrayObj->GetLength(size);
EXPECT_EQ(size, 9);
@ -4223,6 +4296,7 @@ HWTEST_F(DistributedWantBaseTest, array_test_001, TestSize.Level3)
HWTEST_F(DistributedWantBaseTest, array_test_002, TestSize.Level3)
{
sptr<Array> arrayObj(new Array(19, g_IID_IInteger));
ASSERT_NE(arrayObj, nullptr);
arrayObj->Set(0, Integer::Box(23));
sptr<IInterface> valueObj = nullptr;
arrayObj->Get(0, valueObj);
@ -4243,6 +4317,7 @@ HWTEST_F(DistributedWantBaseTest, array_test_002, TestSize.Level3)
HWTEST_F(DistributedWantBaseTest, array_test_003, TestSize.Level3)
{
sptr<Array> arrayObj(new Array(5, g_IID_IInteger));
ASSERT_NE(arrayObj, nullptr);
arrayObj->Set(0, Integer::Box(2));
arrayObj->Set(1, Integer::Box(3));
arrayObj->Set(2, Integer::Box(5));
@ -4263,6 +4338,7 @@ HWTEST_F(DistributedWantBaseTest, array_test_004, TestSize.Level3)
{
sptr<IArray> arrayObj = Array::Parse("I5{2,3,5,7,11}");
sptr<IInterface> valueObj = nullptr;
ASSERT_NE(arrayObj, nullptr);
arrayObj->Get(0, valueObj);
EXPECT_EQ(Integer::Unbox(IInteger::Query(valueObj)), 2);
arrayObj->Get(1, valueObj);
@ -4288,6 +4364,9 @@ HWTEST_F(DistributedWantBaseTest, array_test_005, TestSize.Level3)
sptr<IArray> arrayObj1 = Array::Parse("I5{2,3,5,7,11}");
sptr<IArray> arrayObj2 = Array::Parse("I5{2,3,7,7,11}");
sptr<IArray> arrayObj3 = Array::Parse("I5{2,3,5,7,11}");
ASSERT_NE(arrayObj1, nullptr);
ASSERT_NE(arrayObj2, nullptr);
ASSERT_NE(arrayObj3, nullptr);
EXPECT_FALSE(Object::Equals(*(arrayObj1.GetRefPtr()), *(arrayObj2.GetRefPtr())));
EXPECT_TRUE(Object::Equals(*(arrayObj1.GetRefPtr()), *(arrayObj3.GetRefPtr())));
}

View File

@ -55,6 +55,7 @@ void DistributedSchedAdapterTest::SetUp()
HWTEST_F(DistributedSchedAdapterTest, Init_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest Init_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->Init();
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
DTEST_LOG << "DistributedSchedAdapterTest Init_001 end" << std::endl;
@ -69,6 +70,7 @@ HWTEST_F(DistributedSchedAdapterTest, Init_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ConnectAbility_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ConnectAbility_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const OHOS::AAFwk::Want want;
const sptr<IRemoteObject> connect = nullptr;
const sptr<IRemoteObject> callerToken = nullptr;
@ -86,6 +88,7 @@ HWTEST_F(DistributedSchedAdapterTest, ConnectAbility_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DisconnectAbility_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DisconnectAbility_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
int32_t result = distributedSchedAdapter_->DisconnectAbility(connect);
EXPECT_NE(result, ERR_OK);
@ -101,6 +104,7 @@ HWTEST_F(DistributedSchedAdapterTest, DisconnectAbility_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOnline_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "";
distributedSchedAdapter_->dmsAdapterHandler_ = nullptr;
distributedSchedAdapter_->DeviceOnline(deviceId);
@ -117,6 +121,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOnline_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "";
distributedSchedAdapter_->DeviceOnline(deviceId);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -132,6 +137,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_002, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOnline_003 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "mockDeviceId";
distributedSchedAdapter_->DeviceOnline(deviceId);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -147,6 +153,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOnline_003, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOffline_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "";
distributedSchedAdapter_->dmsAdapterHandler_ = nullptr;
distributedSchedAdapter_->DeviceOffline(deviceId);
@ -163,6 +170,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOffline_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "";
distributedSchedAdapter_->DeviceOffline(deviceId);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -178,6 +186,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_002, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest DeviceOffline_003 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const std::string deviceId = "mockDeviceId";
distributedSchedAdapter_->DeviceOffline(deviceId);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -193,6 +202,7 @@ HWTEST_F(DistributedSchedAdapterTest, DeviceOffline_003, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessConnectDied_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
distributedSchedAdapter_->dmsAdapterHandler_ = nullptr;
distributedSchedAdapter_->ProcessConnectDied(connect);
@ -209,6 +219,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessConnectDied_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
distributedSchedAdapter_->ProcessConnectDied(connect);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -224,6 +235,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_002, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessConnectDied_003 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect(new MockRemoteStub());
distributedSchedAdapter_->ProcessConnectDied(connect);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -239,6 +251,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessConnectDied_003, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessCalleeDied_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCalleeDied_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
distributedSchedAdapter_->dmsAdapterHandler_ = nullptr;
distributedSchedAdapter_->ProcessCalleeDied(connect);
@ -255,6 +268,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCalleeDied_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessCalleeDied_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCalleeDied_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
distributedSchedAdapter_->ProcessCalleeDied(connect);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -271,6 +285,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCalleeDied_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCalleeDied_003 begin" << std::endl;
const sptr<IRemoteObject> connect(new MockRemoteStub());
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->ProcessCalleeDied(connect);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
DTEST_LOG << "DistributedSchedAdapterTest ProcessCalleeDied_003 end" << std::endl;
@ -286,6 +301,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCallerDied_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCallerDied_001 begin" << std::endl;
const sptr<IRemoteObject> connect = nullptr;
ASSERT_NE(distributedSchedAdapter_, nullptr);
int32_t deviceType = 0;
distributedSchedAdapter_->dmsAdapterHandler_ = nullptr;
distributedSchedAdapter_->ProcessCallerDied(connect, deviceType);
@ -302,6 +318,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCallerDied_001, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, ProcessCallerDied_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCallerDied_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<IRemoteObject> connect = nullptr;
int32_t deviceType = 0;
distributedSchedAdapter_->ProcessCallerDied(connect, deviceType);
@ -319,6 +336,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCallerDied_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedAdapterTest ProcessCallerDied_003 begin" << std::endl;
const sptr<IRemoteObject> connect(new MockRemoteStub());
ASSERT_NE(distributedSchedAdapter_, nullptr);
int32_t deviceType = 0;
distributedSchedAdapter_->ProcessCallerDied(connect, deviceType);
EXPECT_NE(distributedSchedAdapter_->dmsAdapterHandler_, nullptr);
@ -334,6 +352,7 @@ HWTEST_F(DistributedSchedAdapterTest, ProcessCallerDied_003, TestSize.Level3)
HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedAdapterTest GetLocalMissionInfos_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
int32_t numMissions = -1;
std::vector<DstbMissionInfo> missionInfos;
int32_t result = distributedSchedAdapter_->GetLocalMissionInfos(numMissions, missionInfos);
@ -350,6 +369,7 @@ HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_001, TestSize.Level4)
HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedAdapterTest GetLocalMissionInfos_002 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
int32_t numMissions = 0;
std::vector<DstbMissionInfo> missionInfos;
int32_t result = distributedSchedAdapter_->GetLocalMissionInfos(numMissions, missionInfos);
@ -366,6 +386,7 @@ HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_002, TestSize.Level4)
HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_003, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedAdapterTest GetLocalMissionInfos_003 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
int32_t numMissions = 10;
std::vector<DstbMissionInfo> missionInfos;
int32_t result = distributedSchedAdapter_->GetLocalMissionInfos(numMissions, missionInfos);
@ -382,6 +403,7 @@ HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionInfos_003, TestSize.Level4)
HWTEST_F(DistributedSchedAdapterTest, RegisterMissionListener_001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedAdapterTest RegisterMissionListener_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
const sptr<DistributedMissionChangeListener> listener = nullptr;
int32_t result = distributedSchedAdapter_->RegisterMissionListener(listener);
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
@ -398,6 +420,7 @@ HWTEST_F(DistributedSchedAdapterTest, RegisterMissionListener_002, TestSize.Leve
{
DTEST_LOG << "DistributedSchedAdapterTest RegisterMissionListener_002 begin" << std::endl;
const sptr<IRemoteObject> connect(new MockRemoteStub());
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->ProcessCallResult(connect, nullptr);
const sptr<DistributedMissionChangeListener> listener(new DistributedMissionChangeListener());
int32_t result = distributedSchedAdapter_->RegisterMissionListener(listener);
@ -415,6 +438,7 @@ HWTEST_F(DistributedSchedAdapterTest, UnRegisterMissionListener_001, TestSize.Le
{
DTEST_LOG << "DistributedSchedAdapterTest UnRegisterMissionListener_001 begin" << std::endl;
const sptr<IRemoteObject> connect(new MockRemoteStub());
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->ProcessCallResult(nullptr, connect);
const sptr<DistributedMissionChangeListener> listener = nullptr;
int32_t result = distributedSchedAdapter_->UnRegisterMissionListener(listener);
@ -432,6 +456,7 @@ HWTEST_F(DistributedSchedAdapterTest, UnRegisterMissionListener_002, TestSize.Le
{
DTEST_LOG << "DistributedSchedAdapterTest UnRegisterMissionListener_002 begin" << std::endl;
const sptr<IRemoteObject> connect(new MockRemoteStub());
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->ProcessCallResult(connect, connect);
const sptr<DistributedMissionChangeListener> listener(new DistributedMissionChangeListener());
int32_t result = distributedSchedAdapter_->UnRegisterMissionListener(listener);
@ -448,6 +473,7 @@ HWTEST_F(DistributedSchedAdapterTest, UnRegisterMissionListener_002, TestSize.Le
HWTEST_F(DistributedSchedAdapterTest, GetLocalMissionSnapshotInfo_001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedAdapterTest GetLocalMissionSnapshotInfo_001 begin" << std::endl;
ASSERT_NE(distributedSchedAdapter_, nullptr);
distributedSchedAdapter_->ProcessCallResult(nullptr, nullptr);
const std::string networkId = "invalidNetworkId";
int32_t missionId = 0;

View File

@ -1482,7 +1482,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub001, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub001 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect);
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;
@ -1507,7 +1509,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub002, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub002 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;
@ -1532,7 +1536,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub003, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub003 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect);
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;
@ -1556,7 +1562,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub004, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub004 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;
@ -1580,7 +1588,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub005, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub005 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -1602,7 +1612,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub006, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub006 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -1624,7 +1636,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub007, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub007 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;
@ -1649,7 +1663,9 @@ HWTEST_F(DistributedSchedConnectTest, AbilityConnectionWrapperStub008, TestSize.
{
DTEST_LOG << "DistributedSchedServiceTest AbilityConnectionWrapperStub008 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
ASSERT_NE(connect, nullptr);
sptr<AbilityConnectionWrapperStub> connectStub = new AbilityConnectionWrapperStub(connect, "localDeviceId");
ASSERT_NE(connectStub, nullptr);
MessageParcel data;
if (!data.WriteInterfaceToken(CONNECTION_CALLBACK_INTERFACE_TOKEN)) {
return;

View File

@ -77,11 +77,19 @@ void DSchedContinuationTest::DeviceInitCallBack::OnRemoteDied()
sptr<IRemoteObject> DSchedContinuationTest::GetDSchedService() const
{
sptr<IRemoteObject> dsched = new MockDistributedSched();
if (dsched == nullptr) {
DTEST_LOG << "GetDSchedService dsched is null" << std::endl;
return nullptr;
}
return dsched;
}
int32_t DSchedContinuationTest::PushAbilityToken()
{
if (dschedContinuation_ == nullptr) {
DTEST_LOG << "dschedContinuation_ is null" << std::endl;
return -1;
}
FuncContinuationCallback continuationCallback = [this] (int32_t missionId) {
timeoutFlag_ = true;
};
@ -96,6 +104,10 @@ std::shared_ptr<Want> DSchedContinuationTest::MockWant(const std::string& bundle
{
ElementName element("", bundleName, ability);
std::shared_ptr<Want> spWant = std::make_shared<Want>();
if (spWant == nullptr) {
DTEST_LOG << "spWant is null" << std::endl;
return nullptr;
}
spWant->SetElement(element);
spWant->SetFlags(flags);
return spWant;
@ -121,6 +133,14 @@ void DSchedContinuationTest::MockOnStart()
std::make_shared<DSchedContinuation>();
DistributedSchedService::GetInstance().dmsCallbackTask_ =
std::make_shared<DmsCallbackTask>();
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DTEST_LOG << "MockOnStart dschedContinuation_ is nullptr" << std::endl;
return;
}
if (DistributedSchedService::GetInstance().dmsCallbackTask_ == nullptr) {
DTEST_LOG << "MockOnStart dmsCallbackTask_ is nullptr" << std::endl;
return;
}
DistributedSchedService::GetInstance().dschedContinuation_->Init(continuationCallback);
DistributedSchedService::GetInstance().dmsCallbackTask_->Init(freeCallback);
}
@ -141,6 +161,7 @@ sptr<IDistributedSched> DSchedContinuationTest::GetDms()
proxy_ = iface_cast<IDistributedSched>(distributedObject);
if (proxy_ == nullptr) {
DTEST_LOG << "DSchedContinuationTest DistributedSched is nullptr" << std::endl;
return nullptr;
} else {
DTEST_LOG << "DSchedContinuationTest DistributedSched is not nullptr" << std::endl;
}
@ -154,6 +175,10 @@ int32_t DSchedContinuationTest::StartContinuation(int32_t missionId, int32_t fla
std::string devId = "devId";
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, flags);
int callerUid = 0;
if (spWant == nullptr) {
DTEST_LOG << "StartContinuation spWant is nullptr" << std::endl;
return -1;
}
return DistributedSchedService::GetInstance().StartContinuation(*spWant, missionId, callerUid, 0, 0);
}
@ -164,6 +189,10 @@ int32_t DSchedContinuationTest::StartRemoteFreeInstall(int32_t flags, const sptr
std::string devId = "devId";
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, flags);
int callerUid = 0;
if (spWant == nullptr) {
DTEST_LOG << "StartRemoteFreeInstall spWant is nullptr" << std::endl;
return -1;
}
return DistributedSchedService::GetInstance().StartRemoteFreeInstall(*spWant, callerUid, 0, 0, callback);
}
@ -212,6 +241,7 @@ HWTEST_F(DSchedContinuationTest, StartContinuation_003, TestSize.Level1)
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
}
ASSERT_NE(DistributedSchedService::GetInstance().dschedContinuation_, nullptr);
std::string bundleName = "bundleName";
std::string abilityName = "abilityName";
int32_t flags = Want::FLAG_ABILITY_CONTINUATION;
@ -240,6 +270,7 @@ HWTEST_F(DSchedContinuationTest, StartContinuation_004, TestSize.Level1)
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
}
ASSERT_NE(DistributedSchedService::GetInstance().dschedContinuation_, nullptr);
std::string bundleName = "bundleName";
std::string abilityName = "abilityName";
int32_t flags = Want::FLAG_ABILITY_CONTINUATION;
@ -345,6 +376,7 @@ HWTEST_F(DSchedContinuationTest, SetWantForContinuation_001, TestSize.Level1)
std::string abilityName = "abilityName";
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, 0);
int32_t missionId = 0;
ASSERT_NE(spWant, nullptr);
int32_t ret = DistributedSchedService::GetInstance().SetWantForContinuation(*spWant, missionId);
EXPECT_TRUE(INVALID_PARAMETERS_ERR == ret);
DTEST_LOG << "DSchedContinuationTest SetWantForContinuation_001 end" << std::endl;
@ -367,6 +399,7 @@ HWTEST_F(DSchedContinuationTest, SetWantForContinuation_002, TestSize.Level1)
std::string abilityName = "bmsThirdBundle";
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, 0);
int32_t missionId = 0;
ASSERT_NE(spWant, nullptr);
int32_t ret = DistributedSchedService::GetInstance().SetWantForContinuation(*spWant, missionId);
EXPECT_TRUE(ERR_OK == ret);
DTEST_LOG << "DSchedContinuationTest SetWantForContinuation_002 end" << std::endl;
@ -414,6 +447,7 @@ HWTEST_F(DSchedContinuationTest, ContinueLocalMission_002, TestSize.Level1)
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
return;
}
ASSERT_NE(DistributedSchedService::GetInstance().dschedContinuation_, nullptr);
DistributedSchedService::GetInstance().dschedContinuation_->PushCallback(missionId, callback, deviceId, false);
int32_t ret = DistributedSchedService::GetInstance().ContinueLocalMission(
deviceId, missionId, callback, wantParams);
@ -482,6 +516,7 @@ HWTEST_F(DSchedContinuationTest, ContinueLocalMission_005, TestSize.Level1)
return;
}
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
ASSERT_NE(DistributedSchedService::GetInstance().dschedContinuation_, nullptr);
DistributedSchedService::GetInstance().dschedContinuation_->PushCallback(missionId, callback, deviceId, false);
int32_t ret = DistributedSchedService::GetInstance().ContinueAbilityWithTimeout(deviceId, missionId, callback);
EXPECT_EQ(CONTINUE_ALREADY_IN_PROGRESS, ret);
@ -569,6 +604,8 @@ HWTEST_F(DSchedContinuationTest, PushAbilityToken_001, TestSize.Level1)
* @tc.steps: step1. input invalid abilityToken.
* @tc.expected: step1. return false.
*/
ASSERT_NE(dschedContinuation_, nullptr);
auto sessionId = dschedContinuation_->GenerateSessionId();
bool ret = dschedContinuation_->PushAbilityToken(sessionId, nullptr);
EXPECT_TRUE(!ret);
@ -587,6 +624,7 @@ HWTEST_F(DSchedContinuationTest, PushAbilityToken_002, TestSize.Level1)
* @tc.steps: step1. input invalid sessionId.
* @tc.expected: step1. return false.
*/
ASSERT_NE(dschedContinuation_, nullptr);
bool ret = dschedContinuation_->PushAbilityToken(-1, GetDSchedService());
EXPECT_TRUE(!ret);
DTEST_LOG << "DSchedContinuationTest PushAbilityToken_002 end" << std::endl;
@ -604,6 +642,7 @@ HWTEST_F(DSchedContinuationTest, PushAbilityToken_003, TestSize.Level1)
* @tc.steps: step1. input valid abilityToken and valid sessionId.
* @tc.expected: step1. return false.
*/
ASSERT_NE(dschedContinuation_, nullptr);
auto sessionId = dschedContinuation_->GenerateSessionId();
bool ret = dschedContinuation_->PushAbilityToken(sessionId, GetDSchedService());
EXPECT_TRUE(!ret);
@ -622,6 +661,7 @@ HWTEST_F(DSchedContinuationTest, PushAbilityToken_004, TestSize.Level1)
* @tc.steps: step1. input valid params and init.
* @tc.expected: step1. return true.
*/
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
auto sessionId = dschedContinuation_->GenerateSessionId();
bool ret = dschedContinuation_->PushAbilityToken(sessionId, GetDSchedService());
@ -638,6 +678,7 @@ HWTEST_F(DSchedContinuationTest, PushAbilityToken_004, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PushAbilityToken_005, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PushAbilityToken_005 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
auto sessionId = 1;
bool ret = dschedContinuation_->PushAbilityToken(sessionId, GetDSchedService());
@ -658,6 +699,7 @@ HWTEST_F(DSchedContinuationTest, PopAbilityToken_001, TestSize.Level1)
* @tc.steps: step1. input invalid sessionId.
* @tc.expected: step1. return false.
*/
ASSERT_NE(dschedContinuation_, nullptr);
sptr<IRemoteObject> abilityToken = dschedContinuation_->PopAbilityToken(-1);
EXPECT_TRUE(abilityToken == nullptr);
DTEST_LOG << "DSchedContinuationTest PopAbilityToken_001 end" << std::endl;
@ -675,6 +717,7 @@ HWTEST_F(DSchedContinuationTest, PopAbilityToken_002, TestSize.Level1)
* @tc.steps: step1. pop not exist sessionId.
* @tc.expected: step1. return false.
*/
ASSERT_NE(dschedContinuation_, nullptr);
int32_t sessionId = dschedContinuation_->GenerateSessionId() + 1;
sptr<IRemoteObject> abilityToken = dschedContinuation_->PopAbilityToken(sessionId);
EXPECT_TRUE(abilityToken == nullptr);
@ -693,6 +736,7 @@ HWTEST_F(DSchedContinuationTest, PopAbilityToken_003, TestSize.Level1)
* @tc.steps: step1. pop exist sessionId.
* @tc.expected: step1. return true.
*/
ASSERT_NE(dschedContinuation_, nullptr);
int32_t sessionId = PushAbilityToken();
sptr<IRemoteObject> abilityToken = dschedContinuation_->PopAbilityToken(sessionId);
EXPECT_TRUE(abilityToken != nullptr);
@ -715,6 +759,7 @@ HWTEST_F(DSchedContinuationTest, PopAbilityToken_003, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PopAbilityToken_004, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PopAbilityToken_004 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->continuationHandler_ = nullptr;
int32_t sessionId = PushAbilityToken();
@ -732,6 +777,7 @@ HWTEST_F(DSchedContinuationTest, PopAbilityToken_004, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, GenerateSessionId_001, TestSize.Level4)
{
DTEST_LOG << "DSchedContinuationTest GenerateSessionId_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t sessionId = dschedContinuation_->currSessionId_;
dschedContinuation_->currSessionId_ = -100;
dschedContinuation_->GenerateSessionId();
@ -749,6 +795,7 @@ HWTEST_F(DSchedContinuationTest, GenerateSessionId_001, TestSize.Level4)
HWTEST_F(DSchedContinuationTest, SetTimeOut_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest SetTimeOut_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -767,6 +814,7 @@ HWTEST_F(DSchedContinuationTest, SetTimeOut_001, TestSize.Level3)
HWTEST_F(DSchedContinuationTest, RemoveTimeOut_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest RemoveTimeOut_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -785,6 +833,7 @@ HWTEST_F(DSchedContinuationTest, RemoveTimeOut_001, TestSize.Level3)
HWTEST_F(DSchedContinuationTest, GetTargetDevice_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest GetTargetDevice_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -804,6 +853,7 @@ HWTEST_F(DSchedContinuationTest, GetTargetDevice_001, TestSize.Level3)
HWTEST_F(DSchedContinuationTest, PushCallback_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest PushCallback_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -824,6 +874,7 @@ HWTEST_F(DSchedContinuationTest, PushCallback_001, TestSize.Level3)
HWTEST_F(DSchedContinuationTest, PushCallback_002, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest PushCallback_002 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -845,6 +896,7 @@ HWTEST_F(DSchedContinuationTest, PushCallback_002, TestSize.Level3)
HWTEST_F(DSchedContinuationTest, PushCallback_003, TestSize.Level3)
{
DTEST_LOG << "DSchedContinuationTest PushCallback_003 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
dschedContinuation_->Init(nullptr);
int32_t missionId = 0;
@ -1262,6 +1314,7 @@ HWTEST_F(DSchedContinuationTest, NotifyCompleteFreeInstallFromRemote_002, TestSi
HWTEST_F(DSchedContinuationTest, IsFreeInstall_001, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest IsFreeInstall_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
bool result = dschedContinuation_->IsFreeInstall(missionId);
EXPECT_EQ(result, false);
@ -1277,6 +1330,7 @@ HWTEST_F(DSchedContinuationTest, IsFreeInstall_001, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, IsFreeInstall_002, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest IsFreeInstall_002 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = 1;
dschedContinuation_->freeInstall_[missionId] = true;
bool result = dschedContinuation_->IsFreeInstall(missionId);
@ -1293,6 +1347,7 @@ HWTEST_F(DSchedContinuationTest, IsFreeInstall_002, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, IsFreeInstall_003, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest IsFreeInstall_003 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = 1;
dschedContinuation_->freeInstall_[missionId] = false;
bool result = dschedContinuation_->IsFreeInstall(missionId);
@ -1309,6 +1364,7 @@ HWTEST_F(DSchedContinuationTest, IsFreeInstall_003, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PopCallback_001, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PopCallback_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
dschedContinuation_->callbackMap_.erase(missionId);
sptr<IRemoteObject> result = dschedContinuation_->PopCallback(missionId);
@ -1325,6 +1381,7 @@ HWTEST_F(DSchedContinuationTest, PopCallback_001, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PopCallback_002, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PopCallback_002 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
dschedContinuation_->callbackMap_[missionId] = GetDSchedService();
dschedContinuation_->continuationDevices_.erase(missionId);
@ -1342,6 +1399,7 @@ HWTEST_F(DSchedContinuationTest, PopCallback_002, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PopCallback_003, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PopCallback_003 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
dschedContinuation_->callbackMap_[missionId] = GetDSchedService();
dschedContinuation_->continuationDevices_[missionId] = "mockDevices";
@ -1360,6 +1418,7 @@ HWTEST_F(DSchedContinuationTest, PopCallback_003, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, PopCallback_004, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest PopCallback_004 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
dschedContinuation_->callbackMap_[missionId] = GetDSchedService();
dschedContinuation_->continuationDevices_[missionId] = "mockDevices";
@ -1378,6 +1437,7 @@ HWTEST_F(DSchedContinuationTest, PopCallback_004, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, NotifyMissionCenterResult_001, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest NotifyMissionCenterResult_001 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
int32_t resultCode = 0;
dschedContinuation_->callbackMap_[missionId] = nullptr;
@ -1395,6 +1455,7 @@ HWTEST_F(DSchedContinuationTest, NotifyMissionCenterResult_001, TestSize.Level1)
HWTEST_F(DSchedContinuationTest, NotifyMissionCenterResult_002, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest NotifyMissionCenterResult_002 start" << std::endl;
ASSERT_NE(dschedContinuation_, nullptr);
int32_t missionId = -1;
int32_t resultCode = 0;
dschedContinuation_->callbackMap_[missionId] = GetDSchedService();

View File

@ -958,6 +958,7 @@ HWTEST_F(DistributedSchedPermissionTest, CheckBackgroundPermission_006, TestSize
HWTEST_F(DistributedSchedPermissionTest, CheckBackgroundPermission_007, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedPermissionTest CheckBackgroundPermission_007 begin" << std::endl;
ASSERT_NE(DnetworkAdapter::GetInstance(), nullptr);
std::string udid = DnetworkAdapter::GetInstance()->GetUdidByNetworkId(deviceId_);
std::string deviceId = udid;
AccessTokenKit::DeleteRemoteToken(deviceId, 0x20100000);
@ -1134,6 +1135,7 @@ HWTEST_F(DistributedSchedPermissionTest, CheckTargetAbilityVisible_003, TestSize
HWTEST_F(DistributedSchedPermissionTest, CheckTargetAbilityVisible_004, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedPermissionTest CheckTargetAbilityVisible_004 begin" << std::endl;
ASSERT_NE(DnetworkAdapter::GetInstance(), nullptr);
std::string udid = DnetworkAdapter::GetInstance()->GetUdidByNetworkId(deviceId_);
std::string deviceId = udid;
AccessTokenKit::DeleteRemoteToken(deviceId, 0x20100000);
@ -1188,6 +1190,7 @@ HWTEST_F(DistributedSchedPermissionTest, CheckTargetAbilityVisible_004, TestSize
HWTEST_F(DistributedSchedPermissionTest, CheckTargetAbilityVisible_005, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedPermissionTest CheckTargetAbilityVisible_005 begin" << std::endl;
ASSERT_NE(DnetworkAdapter::GetInstance(), nullptr);
std::string udid = DnetworkAdapter::GetInstance()->GetUdidByNetworkId(deviceId_);
std::string deviceId = udid;
AccessTokenKit::DeleteRemoteToken(deviceId, 0x20100000);

View File

@ -120,6 +120,7 @@ void DistributedSchedStubTest::FreeInstallInfoMarshalling(const CallerInfo& call
HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -139,6 +140,7 @@ HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -158,6 +160,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -203,6 +206,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -231,6 +235,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_004, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_004 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -264,6 +269,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_004, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -318,6 +324,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_001, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -360,6 +367,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_002, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -398,6 +406,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_003, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -441,6 +450,7 @@ HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_001, TestSize.Level
HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -495,6 +505,7 @@ HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_002, TestSize.Level
HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -512,6 +523,7 @@ HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -564,6 +576,7 @@ HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_002, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, ContinueMissionOfBundleNameInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ContinueMissionOfBundleNameInner_003 start" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -591,6 +604,7 @@ HWTEST_F(DistributedSchedStubTest, ContinueMissionOfBundleNameInner_003, TestSiz
HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
MessageParcel data;
MessageParcel reply;
@ -611,6 +625,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
MessageParcel data;
MessageParcel reply;
@ -644,6 +659,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
MessageParcel data;
MessageParcel reply;
@ -673,6 +689,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
MessageParcel data;
MessageParcel reply;
@ -693,6 +710,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize
HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
MessageParcel data;
MessageParcel reply;
@ -722,6 +740,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_002, TestSize
HWTEST_F(DistributedSchedStubTest, NotifyContinuationResultFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyContinuationResultFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -744,6 +763,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyContinuationResultFromRemoteInner_001,
HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -764,6 +784,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level
HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -795,6 +816,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level
HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -822,6 +844,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level
HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -842,6 +865,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Le
HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -867,6 +891,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Le
HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -892,6 +917,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_003, TestSize.Le
HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -935,6 +961,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_001, TestSize.L
HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -976,6 +1003,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_002, TestSize.L
HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -996,6 +1024,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteInner_001, TestSiz
HWTEST_F(DistributedSchedStubTest, NotifyProcessDiedFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyProcessDiedFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1019,6 +1048,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyProcessDiedFromRemoteInner_001, TestSiz
HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
MessageParcel data;
MessageParcel reply;
@ -1039,6 +1069,7 @@ HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
MessageParcel data;
MessageParcel reply;
@ -1062,6 +1093,7 @@ HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
MessageParcel data;
MessageParcel reply;
@ -1082,6 +1114,7 @@ HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSi
HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
MessageParcel data;
MessageParcel reply;
@ -1116,6 +1149,7 @@ HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSi
HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
MessageParcel data;
MessageParcel reply;
@ -1136,6 +1170,7 @@ HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Le
HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
MessageParcel data;
MessageParcel reply;
@ -1170,6 +1205,8 @@ HWTEST_F(DistributedSchedStubTest, RegisterOnListenerInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1206,6 +1243,7 @@ HWTEST_F(DistributedSchedStubTest, RegisterOnListenerInner_002, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
MessageParcel data;
MessageParcel reply;
@ -1226,6 +1264,7 @@ HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize.
HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
MessageParcel data;
MessageParcel reply;
@ -1258,6 +1297,7 @@ HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_002, TestSize.
HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1274,6 +1314,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_001, TestSiz
HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
DistributedSchedUtil::MockManageMissions();
MessageParcel data;
MessageParcel reply;
@ -1295,6 +1336,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_002, TestSiz
HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
MessageParcel data;
MessageParcel reply;
@ -1315,6 +1357,7 @@ HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
MessageParcel data;
MessageParcel reply;
@ -1340,6 +1383,7 @@ HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_002, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1356,6 +1400,7 @@ HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_001, TestSize
HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
CallerInfo callerInfo;
@ -1376,6 +1421,7 @@ HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_002, TestSize
HWTEST_F(DistributedSchedStubTest, NotifyMissionsChangedFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyMissionsChangedFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1394,6 +1440,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyMissionsChangedFromRemoteInner_001, Tes
HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
MessageParcel data;
MessageParcel reply;
@ -1414,6 +1461,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Le
HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
MessageParcel data;
MessageParcel reply;
@ -1443,6 +1491,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_002, TestSize.Le
HWTEST_F(DistributedSchedStubTest, SetMissionContinueStateInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest SetMissionContinueStateInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1464,6 +1513,7 @@ HWTEST_F(DistributedSchedStubTest, SetMissionContinueStateInner_001, TestSize.Le
HWTEST_F(DistributedSchedStubTest, CallerInfoUnmarshalling_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest CallerInfoUnmarshalling_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
int32_t uid = 0;
data.WriteInt32(uid);
@ -1493,6 +1543,7 @@ HWTEST_F(DistributedSchedStubTest, CallerInfoUnmarshalling_001, TestSize.Level3)
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
MessageParcel data;
MessageParcel reply;
@ -1513,6 +1564,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.L
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
MessageParcel data;
MessageParcel reply;
@ -1546,6 +1598,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.L
HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
MessageParcel data;
MessageParcel reply;
@ -1575,6 +1628,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.L
HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -1595,6 +1649,7 @@ HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level
HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
MessageParcel data;
MessageParcel reply;
@ -1623,6 +1678,7 @@ HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_002, TestSize.Level
HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1668,6 +1724,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_001, TestSi
HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1705,6 +1762,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_002, TestSi
HWTEST_F(DistributedSchedStubTest, ReleaseAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest ReleaseAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1737,6 +1795,7 @@ HWTEST_F(DistributedSchedStubTest, ReleaseAbilityFromRemoteInner_001, TestSize.L
HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
MessageParcel data;
MessageParcel reply;
@ -1757,6 +1816,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level
HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
MessageParcel data;
MessageParcel reply;
@ -1785,6 +1845,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_002, TestSize.Level
HWTEST_F(DistributedSchedStubTest, StartShareFormFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartShareFormFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1810,6 +1871,7 @@ HWTEST_F(DistributedSchedStubTest, StartShareFormFromRemoteInner_001, TestSize.L
HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
MessageParcel data;
MessageParcel reply;
@ -1830,6 +1892,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
MessageParcel data;
MessageParcel reply;
@ -1871,6 +1934,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
MessageParcel data;
MessageParcel reply;
@ -1900,6 +1964,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_003, TestSize.Lev
HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -1916,6 +1981,7 @@ HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_001, TestSize
HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_002, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -1934,6 +2000,7 @@ HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_002, TestSize
HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_003, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_003 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -1960,6 +2027,7 @@ HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_003, TestSize
HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_004, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_004 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -1986,6 +2054,7 @@ HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_004, TestSize
HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_005, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_005 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
Want want;
@ -2012,6 +2081,7 @@ HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_005, TestSize
HWTEST_F(DistributedSchedStubTest, NotifyCompleteFreeInstallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedStubTest NotifyCompleteFreeInstallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -2035,6 +2105,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyCompleteFreeInstallFromRemoteInner_001,
HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_001, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
const char* processName = "testCase";
const char* permissionState[] = {
"ohos.permission.ACCESS_SERVICE_DM"
@ -2076,6 +2147,7 @@ HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_001, TestSize
HWTEST_F(DistributedSchedStubTest, StopExtensionAbilityFromRemoteInner_001, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedStubTest StopExtensionAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
Want want;
want.SetElementName("test.test.test", "Ability");
int32_t callerUid = 0;
@ -2127,6 +2199,7 @@ HWTEST_F(DistributedSchedStubTest, StopExtensionAbilityFromRemoteInner_001, Test
HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_001, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
int32_t abilityState = 0;
@ -2150,20 +2223,22 @@ HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_001, TestSi
HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_002, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
nlohmann::json extraInfoJson;
CallerInfo callerInfo;
distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo);
IDistributedSched::AccountInfo accountInfo;
distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
nlohmann::json extraInfoJson1;
extraInfoJson[DMS_VERSION_ID] = "4";
CallerInfo callerInfo1;
distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1);
distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1, accountInfo);
nlohmann::json extraInfoJson2;
extraInfoJson[DMS_VERSION_ID] = 4;
CallerInfo callerInfo2;
distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2);
distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2, accountInfo);
MessageParcel data;
MessageParcel reply;
@ -2186,20 +2261,22 @@ HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_002, TestSi
HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_002, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_002 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
nlohmann::json extraInfoJson;
CallerInfo callerInfo;
distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo);
IDistributedSched::AccountInfo accountInfo;
distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
nlohmann::json extraInfoJson1;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
CallerInfo callerInfo1;
distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1);
distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1, accountInfo);
nlohmann::json extraInfoJson2;
extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = "4";
CallerInfo callerInfo2;
distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2);
distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2, accountInfo);
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY);
MessageParcel data;

View File

@ -72,6 +72,7 @@ void DistributedSchedUidTest::SetUp()
HWTEST_F(DistributedSchedUidTest, StartAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StartAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -88,6 +89,7 @@ HWTEST_F(DistributedSchedUidTest, StartAbilityFromRemoteInner_001, TestSize.Leve
HWTEST_F(DistributedSchedUidTest, SendResultFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest SendResultFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -104,6 +106,7 @@ HWTEST_F(DistributedSchedUidTest, SendResultFromRemoteInner_001, TestSize.Level3
HWTEST_F(DistributedSchedUidTest, NotifyContinuationResultFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest NotifyContinuationResultFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -120,6 +123,7 @@ HWTEST_F(DistributedSchedUidTest, NotifyContinuationResultFromRemoteInner_001, T
HWTEST_F(DistributedSchedUidTest, ConnectAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest ConnectAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -136,6 +140,7 @@ HWTEST_F(DistributedSchedUidTest, ConnectAbilityFromRemoteInner_001, TestSize.Le
HWTEST_F(DistributedSchedUidTest, DisconnectAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest DisconnectAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -152,6 +157,7 @@ HWTEST_F(DistributedSchedUidTest, DisconnectAbilityFromRemoteInner_001, TestSize
HWTEST_F(DistributedSchedUidTest, NotifyProcessDiedFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest NotifyProcessDiedFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -169,6 +175,7 @@ HWTEST_F(DistributedSchedUidTest, NotifyProcessDiedFromRemoteInner_001, TestSize
HWTEST_F(DistributedSchedUidTest, StartSyncMissionsFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StartSyncMissionsFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -185,6 +192,7 @@ HWTEST_F(DistributedSchedUidTest, StartSyncMissionsFromRemoteInner_001, TestSize
HWTEST_F(DistributedSchedUidTest, StopSyncMissionsFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StopSyncMissionsFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -201,6 +209,7 @@ HWTEST_F(DistributedSchedUidTest, StopSyncMissionsFromRemoteInner_001, TestSize.
HWTEST_F(DistributedSchedUidTest, NotifyMissionsChangedFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest NotifyMissionsChangedFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -218,6 +227,7 @@ HWTEST_F(DistributedSchedUidTest, NotifyMissionsChangedFromRemoteInner_001, Test
HWTEST_F(DistributedSchedUidTest, StartAbilityByCallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StartAbilityByCallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -234,6 +244,7 @@ HWTEST_F(DistributedSchedUidTest, StartAbilityByCallFromRemoteInner_001, TestSiz
HWTEST_F(DistributedSchedUidTest, ReleaseAbilityFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest ReleaseAbilityFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -251,6 +262,7 @@ HWTEST_F(DistributedSchedUidTest, ReleaseAbilityFromRemoteInner_001, TestSize.Le
HWTEST_F(DistributedSchedUidTest, StartShareFormFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StartShareFormFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -268,6 +280,7 @@ HWTEST_F(DistributedSchedUidTest, StartShareFormFromRemoteInner_001, TestSize.Le
HWTEST_F(DistributedSchedUidTest, GetDistributedComponentListInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest GetDistributedComponentListInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -284,6 +297,7 @@ HWTEST_F(DistributedSchedUidTest, GetDistributedComponentListInner_001, TestSize
HWTEST_F(DistributedSchedUidTest, StartFreeInstallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest StartFreeInstallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;
@ -300,6 +314,7 @@ HWTEST_F(DistributedSchedUidTest, StartFreeInstallFromRemoteInner_001, TestSize.
HWTEST_F(DistributedSchedUidTest, NotifyCompleteFreeInstallFromRemoteInner_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedUidTest NotifyCompleteFreeInstallFromRemoteInner_001 begin" << std::endl;
ASSERT_NE(distributedSchedStub_, nullptr);
MessageParcel data;
MessageParcel reply;

View File

@ -58,6 +58,7 @@ void DmsFreeInstallCallbackTest::SetUp()
HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_001, TestSize.Level3)
{
DTEST_LOG << "DmsFreeInstallCallbackTest DmsFreeInstallCallbackTest_001 begin" << std::endl;
ASSERT_NE(dmsFreeInstallCallbackStub_, nullptr);
int32_t code = 0;
MessageParcel data;
MessageParcel reply;
@ -77,6 +78,7 @@ HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_001, TestSize.Le
HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_002, TestSize.Level4)
{
DTEST_LOG << "DmsFreeInstallCallbackTest DmsFreeInstallCallbackTest_002 begin" << std::endl;
ASSERT_NE(dmsFreeInstallCallbackStub_, nullptr);
int32_t code = -1;
MessageParcel data;
MessageParcel reply;
@ -96,6 +98,7 @@ HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_002, TestSize.Le
HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_003, TestSize.Level3)
{
DTEST_LOG << "DmsFreeInstallCallbackTest DmsFreeInstallCallbackTest_003 begin" << std::endl;
ASSERT_NE(dmsFreeInstallCallbackStub_, nullptr);
int32_t code = 0;
MessageParcel data;
MessageParcel reply;
@ -115,6 +118,7 @@ HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_003, TestSize.Le
HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_004, TestSize.Level3)
{
DTEST_LOG << "DmsFreeInstallCallbackTest DmsFreeInstallCallbackTest_004 begin" << std::endl;
ASSERT_NE(dmsFreeInstallCallbackStub_, nullptr);
int32_t code = 0;
MessageParcel data;
MessageParcel reply;
@ -137,6 +141,7 @@ HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_004, TestSize.Le
HWTEST_F(DmsFreeInstallCallbackTest, DmsFreeInstallCallbackTest_005, TestSize.Level3)
{
DTEST_LOG << "DmsFreeInstallCallbackTest DmsFreeInstallCallbackTest_005 begin" << std::endl;
ASSERT_NE(dmsFreeInstallCallbackProxy_, nullptr);
AAFwk::Want want;
int32_t requestCode = -1;
int32_t resultCode = -1;

View File

@ -62,6 +62,7 @@ void DmsTokenCallbackTest::SetUp()
HWTEST_F(DmsTokenCallbackTest, SendResultTest_001, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest SendResultTest_001 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
AAFwk::Want want;
int32_t callerUid = 0;
int32_t requestCode = 0;
@ -82,6 +83,7 @@ HWTEST_F(DmsTokenCallbackTest, SendResultTest_001, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, SendResultTest_002, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest SendResultTest_002 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
AAFwk::Want want;
int32_t callerUid = 0;
int32_t requestCode = 0;
@ -101,6 +103,7 @@ HWTEST_F(DmsTokenCallbackTest, SendResultTest_002, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, SendResultTest_003, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest SendResultTest_003 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
AAFwk::Want want;
string localDeviceId;
dmsTokenCallback_->GetLocalDeviceId(localDeviceId);
@ -123,6 +126,7 @@ HWTEST_F(DmsTokenCallbackTest, SendResultTest_003, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, SendResultTest_004, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest SendResultTest_004 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
AAFwk::Want want;
int32_t callerUid = 0;
int32_t requestCode = 0;
@ -143,6 +147,7 @@ HWTEST_F(DmsTokenCallbackTest, SendResultTest_004, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, SendResultTest_005, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest SendResultTest_005 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
AAFwk::Want want;
string remoteDeviceId = "remoteDeviceId";
want.SetParam("dmsSrcNetworkId", remoteDeviceId);
@ -164,6 +169,7 @@ HWTEST_F(DmsTokenCallbackTest, SendResultTest_005, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_001, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest CheckDeviceIdTest_001 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
std::string localDeviceId;
std::string remoteDeviceId;
bool result = dmsTokenCallback_->CheckDeviceId(localDeviceId, remoteDeviceId);
@ -180,6 +186,7 @@ HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_001, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_002, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest CheckDeviceIdTest_002 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
std::string localDeviceId = "1";
std::string remoteDeviceId = "1";
bool result = dmsTokenCallback_->CheckDeviceId(localDeviceId, remoteDeviceId);
@ -196,6 +203,7 @@ HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_002, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_003, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest CheckDeviceIdTest_003 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
std::string localDeviceId = "1";
std::string remoteDeviceId = "2";
bool result = dmsTokenCallback_->CheckDeviceId(localDeviceId, remoteDeviceId);
@ -212,6 +220,7 @@ HWTEST_F(DmsTokenCallbackTest, CheckDeviceIdTest_003, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, GetRemoteDmsTest_001, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest GetRemoteDmsTest_001 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
std::string remoteDeviceId;
sptr<IDistributedSched> result = dmsTokenCallback_->GetRemoteDms(remoteDeviceId);
EXPECT_EQ(result, nullptr);
@ -227,6 +236,7 @@ HWTEST_F(DmsTokenCallbackTest, GetRemoteDmsTest_001, TestSize.Level3)
HWTEST_F(DmsTokenCallbackTest, GetRemoteDmsTest_002, TestSize.Level3)
{
DTEST_LOG << "DmsTokenCallbackTest GetRemoteDmsTest_002 begin" << std::endl;
ASSERT_NE(dmsTokenCallback_, nullptr);
std::string remoteDeviceId = "1";
sptr<IDistributedSched> result = dmsTokenCallback_->GetRemoteDms(remoteDeviceId);
EXPECT_EQ(result, nullptr);

View File

@ -356,6 +356,7 @@ HWTEST_F(DtbschedmgrDeviceInfoStorageTest, GetNetworkIdByUuidTest_001, TestSize.
*/
wptr<IRemoteObject> remote = nullptr;
sptr<DnetServiceDeathRecipient> dnetServiceDeathRecipient(new DnetServiceDeathRecipient());
ASSERT_NE(dnetServiceDeathRecipient, nullptr);
dnetServiceDeathRecipient->OnRemoteDied(remote);
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest GetNetworkIdByUuidTest_001 end" << std::endl;
}

View File

@ -76,6 +76,7 @@ std::shared_ptr<DmsBmStorage> DistributedBmStorageTest::GetDmsBmStorage()
HWTEST_F(DistributedBmStorageTest, SaveStorageDistributeInfo_001, TestSize.Level0)
{
DTEST_LOG << "DistributedBmStorageTest SaveStorageDistributeInfo_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -94,6 +95,7 @@ HWTEST_F(DistributedBmStorageTest, SaveStorageDistributeInfo_001, TestSize.Level
HWTEST_F(DistributedBmStorageTest, DeleteStorageDistributeInfoTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest DeleteStorageDistributeInfoTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -112,6 +114,7 @@ HWTEST_F(DistributedBmStorageTest, DeleteStorageDistributeInfoTest_001, TestSize
HWTEST_F(DistributedBmStorageTest, GetStorageDistributeInfo_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetStorageDistributeInfo_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -131,6 +134,7 @@ HWTEST_F(DistributedBmStorageTest, GetStorageDistributeInfo_001, TestSize.Level1
HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -150,6 +154,7 @@ HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_001, TestSize.Le
HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_002, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_002 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -170,6 +175,7 @@ HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_002, TestSize.Le
HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_003, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_003 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -190,6 +196,7 @@ HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_003, TestSize.Le
HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_001, TestSize.Level0)
{
DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -209,6 +216,7 @@ HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_001, TestSize.Level0)
HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_002, TestSize.Level0)
{
DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_002 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -228,6 +236,7 @@ HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_002, TestSize.Level0)
HWTEST_F(DistributedBmStorageTest, UpdateDistributedDataTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest UpdateDistributedDataTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -244,6 +253,7 @@ HWTEST_F(DistributedBmStorageTest, UpdateDistributedDataTest_001, TestSize.Level
HWTEST_F(DistributedBmStorageTest, CloudSyncTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest CloudSyncTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -260,6 +270,7 @@ HWTEST_F(DistributedBmStorageTest, CloudSyncTest_001, TestSize.Level1)
HWTEST_F(DistributedBmStorageTest, GetBundleMgrTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetBundleMgrTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -277,6 +288,7 @@ HWTEST_F(DistributedBmStorageTest, GetBundleMgrTest_001, TestSize.Level1)
HWTEST_F(DistributedBmStorageTest, GetContinueTypeTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetContinueTypeTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -297,6 +309,7 @@ HWTEST_F(DistributedBmStorageTest, GetContinueTypeTest_001, TestSize.Level1)
HWTEST_F(DistributedBmStorageTest, GetAbilityNameTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetAbilityNameTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -317,6 +330,7 @@ HWTEST_F(DistributedBmStorageTest, GetAbilityNameTest_001, TestSize.Level1)
HWTEST_F(DistributedBmStorageTest, GetContinueTypeIdTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetContinueTypeIdTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -337,6 +351,7 @@ HWTEST_F(DistributedBmStorageTest, GetContinueTypeIdTest_001, TestSize.Level1)
HWTEST_F(DistributedBmStorageTest, GetContinueEventInfoTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest GetContinueEventInfoTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -359,6 +374,7 @@ HWTEST_F(DistributedBmStorageTest, GetContinueEventInfoTest_001, TestSize.Level1
HWTEST_F(DistributedBmStorageTest, DmsPutBatchTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest DmsPutBatchTest_001 start" << std::endl;
ASSERT_NE(dmsBmStorage_, nullptr);
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
@ -367,5 +383,22 @@ HWTEST_F(DistributedBmStorageTest, DmsPutBatchTest_001, TestSize.Level1)
}
DTEST_LOG << "DistributedBmStorageTest DmsPutBatchTest_001 end" << std::endl;
}
/**
* @tc.name: UpdatePublicRecordsTest_001
* @tc.desc: test delete DistributedBmStorage
* @tc.type: FUNC
*/
HWTEST_F(DistributedBmStorageTest, UpdatePublicRecordsTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedBmStorageTest UpdatePublicRecordsTest_001 start" << std::endl;
auto distributedDataStorage = GetDmsBmStorage();
EXPECT_NE(distributedDataStorage, nullptr);
if (distributedDataStorage != nullptr) {
std::vector<DmsBundleInfo> dmsBundleInfos;
dmsBmStorage_->GetInstance()->UpdatePublicRecords("");
}
DTEST_LOG << "DistributedBmStorageTest UpdatePublicRecordsTest_001 end" << std::endl;
}
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -92,6 +92,7 @@ std::string DistributedDataStorageTest::GetLocalDeviceId() const
HWTEST_F(DistributedDataStorageTest, InitTest_001, TestSize.Level0)
{
DTEST_LOG << "DistributedDataStorageTest InitTest_001 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
bool ret = distributedDataStorage_->Init();
EXPECT_EQ(true, ret);
this_thread::sleep_for(1s);
@ -107,6 +108,7 @@ HWTEST_F(DistributedDataStorageTest, InitTest_001, TestSize.Level0)
HWTEST_F(DistributedDataStorageTest, InsertTest_001, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest InsertTest_001 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -125,6 +127,7 @@ HWTEST_F(DistributedDataStorageTest, InsertTest_001, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, InsertTest_002, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest InsertTest_002 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId;
@ -143,6 +146,7 @@ HWTEST_F(DistributedDataStorageTest, InsertTest_002, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, InsertTest_003, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest InsertTest_003 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -161,6 +165,7 @@ HWTEST_F(DistributedDataStorageTest, InsertTest_003, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, DeleteTest_001, TestSize.Level0)
{
DTEST_LOG << "DistributedDataStorageTest DeleteTest_001 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -178,6 +183,7 @@ HWTEST_F(DistributedDataStorageTest, DeleteTest_001, TestSize.Level0)
HWTEST_F(DistributedDataStorageTest, DeleteTest_002, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest DeleteTest_002 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -197,6 +203,7 @@ HWTEST_F(DistributedDataStorageTest, DeleteTest_002, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, DeleteTest_003, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest DeleteTest_003 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string networkId;
@ -215,6 +222,7 @@ HWTEST_F(DistributedDataStorageTest, DeleteTest_003, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, DeleteTest_004, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest DeleteTest_004 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string networkId = GetLocalDeviceId();
@ -233,6 +241,7 @@ HWTEST_F(DistributedDataStorageTest, DeleteTest_004, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_001, TestSize.Level0)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_001 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -251,6 +260,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_001, TestSize.Level0)
HWTEST_F(DistributedDataStorageTest, QueryTest_002, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_002 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -271,6 +281,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_002, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_003, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_003 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -292,6 +303,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_003, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_004, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_004 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -316,6 +328,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_004, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_005, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_005 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();
@ -340,6 +353,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_005, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_006, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_006 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId;
@ -358,6 +372,7 @@ HWTEST_F(DistributedDataStorageTest, QueryTest_006, TestSize.Level1)
HWTEST_F(DistributedDataStorageTest, QueryTest_007, TestSize.Level1)
{
DTEST_LOG << "DistributedDataStorageTest QueryTest_007 start" << std::endl;
ASSERT_NE(distributedDataStorage_, nullptr);
distributedDataStorage_->Init();
this_thread::sleep_for(1s);
std::string deviceId = GetLocalDeviceId();

View File

@ -111,6 +111,7 @@ void DSchedTransportSoftbusAdapterTest::SetUp()
HWTEST_F(DSchedDataBufferTest, Size_001, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest Size_001 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
size_t ret = dataBufferTest_->Size();
EXPECT_EQ(ret, SIZE_2);
DTEST_LOG << "DSchedDataBufferTest Size_001 end" << std::endl;
@ -124,6 +125,7 @@ HWTEST_F(DSchedDataBufferTest, Size_001, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, Offset_001, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest Offset_001 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
dataBufferTest_->rangeOffset_ = SIZE_2;
size_t ret = dataBufferTest_->Offset();
EXPECT_EQ(ret, SIZE_2);
@ -138,6 +140,7 @@ HWTEST_F(DSchedDataBufferTest, Offset_001, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, Capacity_001, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest Capacity_001 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
size_t ret = dataBufferTest_->Capacity();
EXPECT_EQ(ret, SIZE_2);
DTEST_LOG << "DSchedDataBufferTest Capacity_001 end" << std::endl;
@ -151,6 +154,7 @@ HWTEST_F(DSchedDataBufferTest, Capacity_001, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, Data_001, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest Data_001 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
uint8_t *ret = dataBufferTest_->Data();
EXPECT_NE(ret, nullptr);
DTEST_LOG << "DSchedDataBufferTest Data_001 end" << std::endl;
@ -164,6 +168,7 @@ HWTEST_F(DSchedDataBufferTest, Data_001, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, Data_002, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest Data_002 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
dataBufferTest_->data_ = nullptr;
uint8_t *ret = dataBufferTest_->Data();
EXPECT_EQ(ret, nullptr);
@ -178,6 +183,7 @@ HWTEST_F(DSchedDataBufferTest, Data_002, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, SetRange_001, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest SetRange_001 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
int32_t ret = dataBufferTest_->SetRange(OFFSET_2, SIZE_1);
EXPECT_EQ(ret, -1);
DTEST_LOG << "DSchedDataBufferTest SetRange_001 end" << std::endl;
@ -191,6 +197,7 @@ HWTEST_F(DSchedDataBufferTest, SetRange_001, TestSize.Level3)
HWTEST_F(DSchedDataBufferTest, SetRange_002, TestSize.Level3)
{
DTEST_LOG << "DSchedDataBufferTest SetRange_002 begin" << std::endl;
ASSERT_NE(dataBufferTest_, nullptr);
int32_t ret = dataBufferTest_->SetRange(OFFSET_1, SIZE_2);
EXPECT_EQ(ret, -1);
DTEST_LOG << "DSchedDataBufferTest SetRange_002 end" << std::endl;
@ -205,6 +212,7 @@ HWTEST_F(DSchedSoftbusSessionTest, OnDisconnect_001, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest OnDisconnect_001 begin" << std::endl;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
ASSERT_NE(softbusSessionTest_, nullptr);
softbusSessionTest_->OnConnect();
softbusSessionTest_->refCount_ = 0;
@ -228,6 +236,8 @@ HWTEST_F(DSchedSoftbusSessionTest, OnBytesReceived_001, TestSize.Level3)
DTEST_LOG << "DSchedSoftbusSessionTest OnBytesReceived_001 begin" << std::endl;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
ASSERT_NE(softbusSessionTest_, nullptr);
ASSERT_NE(buffer, nullptr);
int32_t ret = softbusSessionTest_->OnBytesReceived(buffer);
EXPECT_EQ(ret, ERR_OK);
softbusSessionTest_ = nullptr;
@ -244,6 +254,8 @@ HWTEST_F(DSchedSoftbusSessionTest, SendData_001, TestSize.Level3)
DTEST_LOG << "DSchedSoftbusSessionTest SendData_001 begin" << std::endl;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
ASSERT_NE(softbusSessionTest_, nullptr);
ASSERT_NE(buffer, nullptr);
int32_t dataType = COUNT;
int32_t ret = softbusSessionTest_->SendData(buffer, dataType);
EXPECT_EQ(ret, ERR_OK);
@ -261,6 +273,7 @@ HWTEST_F(DSchedSoftbusSessionTest, GetPeerDeviceId_001, TestSize.Level3)
DTEST_LOG << "DSchedSoftbusSessionTest GetPeerDeviceId_001 begin" << std::endl;
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
ASSERT_NE(softbusSessionTest_, nullptr);
std::string str = softbusSessionTest_->GetPeerDeviceId();
EXPECT_EQ(str, PEERDEVICEID);
softbusSessionTest_ = nullptr;
@ -275,6 +288,7 @@ HWTEST_F(DSchedSoftbusSessionTest, GetPeerDeviceId_001, TestSize.Level3)
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_001, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_001 begin" << std::endl;
ASSERT_NE(softbusSessionTest_, nullptr);
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
DSchedSoftbusSession::SessionDataHeader headerPara;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
@ -298,6 +312,7 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_001, TestSize.Level3)
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_002, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_002 begin" << std::endl;
ASSERT_NE(softbusSessionTest_, nullptr);
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
@ -324,6 +339,7 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_002, TestSize.Level3)
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_003, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_003 begin" << std::endl;
ASSERT_NE(softbusSessionTest_, nullptr);
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
@ -346,6 +362,7 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_003, TestSize.Level3)
HWTEST_F(DSchedSoftbusSessionTest, UnPackSendData_001, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest UnPackSendData_001 begin" << std::endl;
ASSERT_NE(softbusSessionTest_, nullptr);
int32_t dataType = 0;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
@ -363,6 +380,7 @@ HWTEST_F(DSchedSoftbusSessionTest, UnPackSendData_001, TestSize.Level3)
HWTEST_F(DSchedSoftbusSessionTest, UnPackStartEndData_001, TestSize.Level3)
{
DTEST_LOG << "DSchedSoftbusSessionTest UnPackStartEndData_001 begin" << std::endl;
ASSERT_NE(softbusSessionTest_, nullptr);
int32_t dataType = 0;
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
@ -410,6 +428,7 @@ HWTEST_F(DSchedTransportSoftbusAdapterTest, GetSessionIdByDeviceId_001, TestSize
DTEST_LOG << "DSchedTransportSoftbusAdapterTest GetSessionIdByDeviceId_001 begin" << std::endl;
int32_t sessionId = 0;
std::shared_ptr<DSchedDataBuffer> dataBuffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
ASSERT_NE(dataBuffer, nullptr);
uint32_t dataType = 0;
std::shared_ptr<IDataListener> listener = nullptr;
DSchedTransportSoftbusAdapter::GetInstance().OnDataReady(sessionId, dataBuffer, dataType);