修改dmstdd

Signed-off-by: wangdantong <wangdantong@huawei.com>
Change-Id: I7a36bf261ece1a5ef22412e5667fa870c214f23d
This commit is contained in:
wangdantong 2023-03-28 10:40:49 +08:00
parent 84e5eb8da9
commit 4e3d2cae18
3 changed files with 328 additions and 605 deletions

View File

@ -896,6 +896,24 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility004, TestSize.Level
HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility005, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest DisconnectRemoteAbility005 start" << std::endl;
/**
* @tc.steps: step1. call RemoveCallerComponent
*/
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 end" << std::endl;
int32_t ret = DistributedSchedService::GetInstance().DisconnectRemoteAbility(nullptr, 0, 0);
EXPECT_NE(ret, ERR_OK);
DTEST_LOG << "DistributedSchedConnectTest DisconnectRemoteAbility005 end" << std::endl;
@ -910,6 +928,26 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility005, TestSize.Level
HWTEST_F(DistributedSchedConnectTest, DisconnectAbilityFromRemote001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote001 start" << std::endl;
/**
* @tc.steps: step1. call RemoveCallerComponent
*/
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 start" << std::endl;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
OHOS::AAFwk::Want want1;
want1.SetElementName(remoteDeviceId, "ohos.demo.bundleName1", "abilityName1");
OHOS::AAFwk::Want want2;
want2.SetElementName(remoteDeviceId, "ohos.demo.bundleName2", "abilityName2");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want1, connect, callerInfo);
DistributedSchedService::GetInstance().SaveCallerComponent(want2, connect, callerInfo);
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 end" << std::endl;
int32_t ret = DistributedSchedService::GetInstance().DisconnectAbilityFromRemote(nullptr, 0, "");
EXPECT_NE(ret, ERR_OK);
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote001 end" << std::endl;
@ -957,6 +995,22 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectAbilityFromRemote004, TestSize.L
{
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote004 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
/**
* @tc.steps: step1. call SaveCallerComponent
*/
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 end" << std::endl;
int32_t ret = DistributedSchedService::GetInstance().DisconnectAbilityFromRemote(
connect, 0, "123_remote_device_id");
EXPECT_EQ(ret, ERR_OK);
@ -1015,6 +1069,17 @@ HWTEST_F(DistributedSchedConnectTest, NotifyApp001, TestSize.Level3)
DTEST_LOG << "DistributedSchedConnectTest NotifyApp001 start" << std::endl;
AppExecFwk::ElementName element;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
/**
* @tc.steps: step1. call ProcessCalleeDied
*/
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 start" << std::endl;
sptr<IRemoteObject> callbackWrapper = new AbilityConnectionWrapperStubTest(connect);
CallerInfo callerInfo;
ConnectInfo connectInfo {callerInfo, callbackWrapper};
DistributedSchedService::GetInstance().calleeMap_.emplace(connect, connectInfo);
DistributedSchedService::GetInstance().ProcessCalleeDied(connect);
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 end" << std::endl;
int32_t ret = DistributedSchedService::GetInstance().NotifyApp(connect, element, 0);
EXPECT_EQ(ret, ERR_OK);
DTEST_LOG << "DistributedSchedConnectTest NotifyApp001 end" << std::endl;
@ -1030,6 +1095,13 @@ HWTEST_F(DistributedSchedConnectTest, NotifyApp002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest NotifyApp002 start" << std::endl;
AppExecFwk::ElementName element;
/**
* @tc.steps: step1. call ProcessCalleeDied
*/
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 start" << std::endl;
DistributedSchedService::GetInstance().ProcessCalleeDied(nullptr);
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 end" << std::endl;
int32_t ret = DistributedSchedService::GetInstance().NotifyApp(nullptr, element, 0);
EXPECT_NE(ret, ERR_OK);
DTEST_LOG << "DistributedSchedConnectTest NotifyApp002 end" << std::endl;
@ -1079,6 +1151,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectRemoteAbility001, TestS
if (proxy == nullptr) {
return;
}
/**
* @tc.steps: step1. call HandleLocalCallerDied
*/
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 end" << std::endl;
int32_t ret = proxy->DisconnectRemoteAbility(nullptr, 0, 0);
EXPECT_EQ(ret, ERR_NULL_OBJECT);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectRemoteAbility001 end" << std::endl;
@ -1098,6 +1179,23 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectRemoteAbility002, TestS
return;
}
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
/**
* @tc.steps: step1. call HandleLocalCallerDied
*/
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 end" << std::endl;
int32_t ret = proxy->DisconnectRemoteAbility(connect, 0, 0);
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectRemoteAbility002 end" << std::endl;
@ -1119,6 +1217,14 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectRemoteAbility001, TestSize
OHOS::AAFwk::Want want;
want.SetElementName("123_remote_device_id", "ohos.demo.bundleName", "abilityName");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
/**
* @tc.steps: step1. call GetUidLocked
*/
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 start" << std::endl;
std::list<ConnectAbilitySession> sessionsList;
DistributedSchedService::GetInstance().GetUidLocked(sessionsList);
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 end" << std::endl;
int32_t ret = proxy->ConnectRemoteAbility(want, connect, 0, 0, 0);
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallConnectRemoteAbility001 end" << std::endl;
@ -1139,6 +1245,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectRemoteAbility002, TestSize
}
OHOS::AAFwk::Want want;
want.SetElementName("123_remote_device_id", "ohos.demo.bundleName", "abilityName");
/**
* @tc.steps: step1. call DecreaseConnectLocked
*/
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 start" << std::endl;
int32_t uid = 1000;
AddConnectCount(uid);
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 end" << std::endl;
int32_t ret = proxy->ConnectRemoteAbility(want, nullptr, 0, 0, 0);
EXPECT_EQ(ret, ERR_NULL_OBJECT);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallConnectRemoteAbility002 end" << std::endl;
@ -1163,6 +1278,14 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectAbilityFromRemote001, Test
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
IDistributedSched::AccountInfo accountInfo;
/**
* @tc.steps: step1. call DecreaseConnectLocked
*/
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 start" << std::endl;
int32_t uid = -1;
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 end" << std::endl;
int32_t ret = proxy->ConnectAbilityFromRemote(want, abilityInfo,
connect, callerInfo, accountInfo);
EXPECT_EQ(ret, REQUEST_CODE_ERR);
@ -1187,6 +1310,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectAbilityFromRemote002, Test
AppExecFwk::AbilityInfo abilityInfo;
CallerInfo callerInfo;
IDistributedSched::AccountInfo accountInfo;
/**
* @tc.steps: step1. call CheckDistributedConnectLocked
*/
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 start" << std::endl;
int32_t uid = IPCSkeleton::GetCallingUid();
callerInfo.uid = uid;
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 end" << std::endl;
int32_t ret = proxy->ConnectAbilityFromRemote(want, abilityInfo,
nullptr, callerInfo, accountInfo);
EXPECT_EQ(ret, ERR_NULL_OBJECT);
@ -1207,6 +1339,17 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectAbilityFromRemote001, T
return;
}
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
/**
* @tc.steps: step1. call CheckDistributedConnectLocked
*/
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
int32_t uid = IPCSkeleton::GetCallingUid();
CallerInfo callerInfo;
callerInfo.uid = uid;
AddConnectCount(uid);
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 end" << std::endl;
int32_t ret = proxy->DisconnectAbilityFromRemote(connect, 0, "");
EXPECT_EQ(ret, REQUEST_CODE_ERR);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote001 end" << std::endl;
@ -1225,18 +1368,9 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectAbilityFromRemote002, T
if (proxy == nullptr) {
return;
}
int32_t ret = proxy->DisconnectAbilityFromRemote(nullptr, 0, "");
EXPECT_EQ(ret, ERR_NULL_OBJECT);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote002 end" << std::endl;
}
/**
* @tc.name: RemoteConnectAbilityMappingLocked001
* @tc.desc: call RemoteConnectAbilityMappingLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, RemoteConnectAbilityMappingLocked001, TestSize.Level4)
{
/**
* @tc.steps: step1. call RemoteConnectAbilityMappingLocked
*/
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
OHOS::AAFwk::Want want;
want.SetElementName("", "ohos.demo.bundleName", "abilityName");
@ -1248,77 +1382,10 @@ HWTEST_F(DistributedSchedConnectTest, RemoteConnectAbilityMappingLocked001, Test
DistributedSchedService::GetInstance().RemoteConnectAbilityMappingLocked(connect, localDeviceId,
remoteDeviceId, want.GetElement(), callerInfo, TargetComponent::HARMONY_COMPONENT);
DTEST_LOG << "DistributedSchedConnectTest RemoteConnectAbilityMappingLocked001 end" << std::endl;
}
/**
* @tc.name: CheckDistributedConnectLocked001
* @tc.desc: call CheckDistributedConnectLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, CheckDistributedConnectLocked001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
int32_t uid = IPCSkeleton::GetCallingUid();
CallerInfo callerInfo;
callerInfo.uid = uid;
AddConnectCount(uid);
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 end" << std::endl;
}
/**
* @tc.name: CheckDistributedConnectLocked002
* @tc.desc: call CheckDistributedConnectLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, CheckDistributedConnectLocked002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 start" << std::endl;
int32_t uid = IPCSkeleton::GetCallingUid();
CallerInfo callerInfo;
callerInfo.uid = uid;
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 end" << std::endl;
}
/**
* @tc.name: DecreaseConnectLocked001
* @tc.desc: call DecreaseConnectLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, DecreaseConnectLocked001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 start" << std::endl;
int32_t uid = -1;
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 end" << std::endl;
}
/**
* @tc.name: DecreaseConnectLocked002
* @tc.desc: call DecreaseConnectLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, DecreaseConnectLocked002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 start" << std::endl;
int32_t uid = 1000;
AddConnectCount(uid);
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 end" << std::endl;
}
/**
* @tc.name: GetUidLocked001
* @tc.desc: call GetUidLocked
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, GetUidLocked001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 start" << std::endl;
std::list<ConnectAbilitySession> sessionsList;
DistributedSchedService::GetInstance().GetUidLocked(sessionsList);
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 end" << std::endl;
int32_t ret = proxy->DisconnectAbilityFromRemote(nullptr, 0, "");
EXPECT_EQ(ret, ERR_NULL_OBJECT);
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote002 end" << std::endl;
}
/**
@ -1404,142 +1471,6 @@ HWTEST_F(DistributedSchedConnectTest, ProcessCallerDied003, TestSize.Level4)
DTEST_LOG << "DistributedSchedServiceTest ProcessCallerDied003 end" << std::endl;
}
/**
* @tc.name: HandleLocalCallerDied001
* @tc.desc: call HandleLocalCallerDied
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, HandleLocalCallerDied001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 end" << std::endl;
}
/**
* @tc.name: HandleLocalCallerDied002
* @tc.desc: call HandleLocalCallerDied
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, HandleLocalCallerDied002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 end" << std::endl;
}
/**
* @tc.name: ProcessCalleeDied001
* @tc.desc: call ProcessCalleeDied
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, ProcessCalleeDied001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 start" << std::endl;
DistributedSchedService::GetInstance().ProcessCalleeDied(nullptr);
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 end" << std::endl;
}
/**
* @tc.name: ProcessCalleeDied002
* @tc.desc: call ProcessCalleeDied
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, ProcessCalleeDied002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 start" << std::endl;
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
sptr<IRemoteObject> callbackWrapper = new AbilityConnectionWrapperStubTest(connect);
CallerInfo callerInfo;
ConnectInfo connectInfo {callerInfo, callbackWrapper};
DistributedSchedService::GetInstance().calleeMap_.emplace(connect, connectInfo);
DistributedSchedService::GetInstance().ProcessCalleeDied(connect);
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 end" << std::endl;
}
/**
* @tc.name: SaveCallerComponent001
* @tc.desc: call SaveCallerComponent
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, SaveCallerComponent001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 end" << std::endl;
}
/**
* @tc.name: SaveCallerComponent002
* @tc.desc: call SaveCallerComponent
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, SaveCallerComponent002, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 start" << std::endl;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
OHOS::AAFwk::Want want1;
want1.SetElementName(remoteDeviceId, "ohos.demo.bundleName1", "abilityName1");
OHOS::AAFwk::Want want2;
want2.SetElementName(remoteDeviceId, "ohos.demo.bundleName2", "abilityName2");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want1, connect, callerInfo);
DistributedSchedService::GetInstance().SaveCallerComponent(want2, connect, callerInfo);
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 end" << std::endl;
}
/**
* @tc.name: RemoveCallerComponent001
* @tc.desc: call RemoveCallerComponent
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedConnectTest, RemoveCallerComponent001, TestSize.Level4)
{
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 start" << std::endl;
OHOS::AAFwk::Want want;
std::string localDeviceId = "123_local_device_id";
std::string remoteDeviceId = "123_remote_device_id";
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
CallerInfo callerInfo;
callerInfo.uid = IPCSkeleton::GetCallingUid();
callerInfo.pid = IPCSkeleton::GetCallingPid();
callerInfo.sourceDeviceId = localDeviceId;
callerInfo.callerType = CALLER_TYPE_HARMONY;
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 end" << std::endl;
}
/**
* @tc.name: AbilityConnectionWrapperStub001
* @tc.desc: receive connect message

View File

@ -849,6 +849,17 @@ HWTEST_F(DistributedSchedServiceTest, StartShareFormFromRemote_002, TestSize.Lev
DTEST_LOG << "DistributedSchedServiceTest StartShareFormFromRemote_002 start" << std::endl;
std::string remoteDeviceId = "123456";
const OHOS::AppExecFwk::FormShareInfo formShareInfo {};
/**
* @tc.steps: step1. call GetContinuaitonDevice
*/
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 start" << std::endl;
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
}
int32_t missionId = MISSION_ID;
(void)DistributedSchedService::GetInstance().GetContinuaitonDevice(missionId);
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 end" << std::endl;
auto result = DistributedSchedService::GetInstance().StartShareFormFromRemote(remoteDeviceId, formShareInfo);
DTEST_LOG << "result:" << result << std::endl;
EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), result);
@ -906,19 +917,9 @@ HWTEST_F(DistributedSchedServiceTest, SendResultFromRemote_006, TestSize.Level1)
callerInfo.uid = 0;
callerInfo.sourceDeviceId = LOCAL_DEVICEID;
IDistributedSched::AccountInfo accountInfo;
int result = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
DTEST_LOG << "result:" << result << std::endl;
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result);
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_006 end" << std::endl;
}
/**
* @tc.name: RemoveContinuationTimeout_001
* @tc.desc: call RemoveContinuationTimeout
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceTest, RemoveContinuationTimeout_001, TestSize.Level1)
{
/**
* @tc.steps: step1. call RemoveContinuationTimeout
*/
DTEST_LOG << "DistributedSchedServiceTest RemoveContinuationTimeout_001 start" << std::endl;
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
@ -926,6 +927,11 @@ HWTEST_F(DistributedSchedServiceTest, RemoveContinuationTimeout_001, TestSize.Le
int32_t missionId = MISSION_ID;
DistributedSchedService::GetInstance().RemoveContinuationTimeout(missionId);
DTEST_LOG << "DistributedSchedServiceTest RemoveContinuationTimeout_001 end" << std::endl;
int result = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
DTEST_LOG << "result:" << result << std::endl;
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result);
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_006 end" << std::endl;
}
/**
@ -945,22 +951,6 @@ HWTEST_F(DistributedSchedServiceTest, SetContinuationTimeout_001, TestSize.Level
DTEST_LOG << "DistributedSchedServiceTest SetContinuationTimeout_001 end" << std::endl;
}
/**
* @tc.name: GetContinuaitonDevice_001
* @tc.desc: call GetContinuaitonDevice
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceTest, GetContinuaitonDevice_001, TestSize.Level1)
{
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 start" << std::endl;
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
}
int32_t missionId = MISSION_ID;
(void)DistributedSchedService::GetInstance().GetContinuaitonDevice(missionId);
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 end" << std::endl;
}
/**
* @tc.name: ContinueMission_001
* @tc.desc: call ContinueMission
@ -1220,6 +1210,15 @@ HWTEST_F(DistributedSchedServiceTest, StartContinuation_007, TestSize.Level3)
int32_t status = ERR_OK;
uint32_t accessToken = 0;
bool isSuccess = false;
/**
* @tc.steps: step1. call GetFormMgrProxy
*/
#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 start" << std::endl;
DistributedSchedService::GetInstance().GetFormMgrProxy();
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
#endif
int32_t ret = DistributedSchedService::GetInstance().StartContinuation(
want, missionId, callerUid, status, accessToken);
DistributedSchedService::GetInstance().NotifyCompleteContinuation(DEVICE_ID_NULL, SESSION_ID, isSuccess);
@ -1274,20 +1273,6 @@ HWTEST_F(DistributedSchedServiceTest, NotifyContinuationCallbackResult_002, Test
DTEST_LOG << "DSchedContinuationTest NotifyContinuationCallbackResult_002 end" << std::endl;
}
/**
* @tc.name: GetFormMgrProxy_001
* @tc.desc: call GetFormMgrProxy
* @tc.type: FUNC
*/
#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
HWTEST_F(DistributedSchedServiceTest, GetFormMgrProxy_001, TestSize.Level1)
{
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 start" << std::endl;
DistributedSchedService::GetInstance().GetFormMgrProxy();
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
}
#endif
/**
* @tc.name: StartAbilityFromRemote_007
* @tc.desc: test StartAbilityFromRemote
@ -1418,7 +1403,7 @@ HWTEST_F(DistributedSchedServiceTest, SendResultFromRemote_010, TestSize.Level3)
callerInfo.sourceDeviceId = localDeviceId;
IDistributedSched::AccountInfo accountInfo;
accountInfo.accountType = IDistributedSched::SAME_ACCOUNT_TYPE;
int ret = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
int32_t ret = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
EXPECT_NE(ret, ERR_OK);
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_010 end" << std::endl;
}

View File

@ -1044,19 +1044,6 @@ HWTEST_F(DMSMissionManagerTest, testFetchCachedRemoteMissions009, TestSize.Level
DTEST_LOG << "testFetchCachedRemoteMissions009 end" << std::endl;
}
/**
* @tc.name: testNotifyRemoteDied001
* @tc.desc: test notify remote died
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testNotifyRemoteDied001, TestSize.Level3)
{
DTEST_LOG << "testNotifyRemoteDied001 begin" << std::endl;
wptr<IRemoteObject> remote = nullptr;
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
DTEST_LOG << "testNotifyRemoteDied001 end" << std::endl;
}
/**
* @tc.name: testStopDataStorage001
* @tc.desc: test stop data storage
@ -1162,30 +1149,6 @@ HWTEST_F(DMSMissionManagerTest, testGetRemoteMissionSnapshotInfo001, TestSize.Le
DTEST_LOG << "testGetRemoteMissionSnapshotInfo001 end" << std::endl;
}
/**
* @tc.name: testDeviceOnlineNotify001
* @tc.desc: test device online notify
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeviceOnlineNotify001, TestSize.Level3)
{
DTEST_LOG << "testDeviceOnlineNotify001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify("");
DTEST_LOG << "testDeviceOnlineNotify001 end" << std::endl;
}
/**
* @tc.name: testDeviceOnlineNotify002
* @tc.desc: test device online notify
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeviceOnlineNotify002, TestSize.Level3)
{
DTEST_LOG << "testDeviceOnlineNotify002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify(DEVICE_ID);
DTEST_LOG << "testDeviceOnlineNotify002 end" << std::endl;
}
/**
* @tc.name: testDeviceOnlineNotify003
* @tc.desc: test device online notify
@ -1224,54 +1187,6 @@ HWTEST_F(DMSMissionManagerTest, testDeviceOfflineNotify002, TestSize.Level3)
DTEST_LOG << "testDeviceOfflineNotify002 end" << std::endl;
}
/**
* @tc.name: testDeleteDataStorage001
* @tc.desc: test delete data storage
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage001, TestSize.Level3)
{
DTEST_LOG << "testDeleteDataStorage001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", false);
DTEST_LOG << "testDeleteDataStorage001 end" << std::endl;
}
/**
* @tc.name: testDeleteDataStorage002
* @tc.desc: test delete data storage
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage002, TestSize.Level3)
{
DTEST_LOG << "testDeleteDataStorage002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, false);
DTEST_LOG << "testDeleteDataStorage002 end" << std::endl;
}
/**
* @tc.name: testDeleteDataStorage003
* @tc.desc: test delete data storage
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage003, TestSize.Level3)
{
DTEST_LOG << "testDeleteDataStorage003 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", true);
DTEST_LOG << "testDeleteDataStorage003 end" << std::endl;
}
/**
* @tc.name: testDeleteDataStorage004
* @tc.desc: test delete data storage
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage004, TestSize.Level3)
{
DTEST_LOG << "testDeleteDataStorage004 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, true);
DTEST_LOG << "testDeleteDataStorage004 end" << std::endl;
}
/**
* @tc.name: testNotifySnapshotChanged001
* @tc.desc: test notify snapshot changed
@ -1357,93 +1272,6 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncMissionsFromRemote002, TestSize.Leve
DTEST_LOG << "testStopSyncMissionsFromRemote002 end" << std::endl;
}
/**
* @tc.name: testEnqueueCachedSnapshotInfo001
* @tc.desc: enqueue cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo001, TestSize.Level3)
{
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, nullptr);
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 end" << std::endl;
}
/**
* @tc.name: testEnqueueCachedSnapshotInfo002
* @tc.desc: enqueue cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo002, TestSize.Level3)
{
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo(DEVICE_ID, 1, nullptr);
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 end" << std::endl;
}
/**
* @tc.name: testEnqueueCachedSnapshotInfo003
* @tc.desc: enqueue cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo003, TestSize.Level3)
{
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 begin" << std::endl;
unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, std::move(snapshot));
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 end" << std::endl;
}
/**
* @tc.name: testDequeueCachedSnapshotInfo001
* @tc.desc: enqueue cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo001, TestSize.Level3)
{
DTEST_LOG << "testDequeueCachedSnapshotInfo001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo("", 1);
DTEST_LOG << "testDequeueCachedSnapshotInfo001 end" << std::endl;
}
/**
* @tc.name: testDequeueCachedSnapshotInfo002
* @tc.desc: enqueue cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo002, TestSize.Level3)
{
DTEST_LOG << "testDequeueCachedSnapshotInfo002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo(DEVICE_ID, 1);
DTEST_LOG << "testDequeueCachedSnapshotInfo002 end" << std::endl;
}
/**
* @tc.name: testRebornMissionCache001
* @tc.desc: reborn mission cache
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache001, TestSize.Level3)
{
DTEST_LOG << "testRebornMissionCache001 begin" << std::endl;
std::vector<DstbMissionInfo> missionInfos;
DistributedSchedMissionManager::GetInstance().RebornMissionCache("", missionInfos);
DTEST_LOG << "testRebornMissionCache001 end" << std::endl;
}
/**
* @tc.name: testRebornMissionCache002
* @tc.desc: reborn mission cache
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache002, TestSize.Level3)
{
DTEST_LOG << "testRebornMissionCache002 begin" << std::endl;
std::vector<DstbMissionInfo> missionInfos;
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
DTEST_LOG << "testRebornMissionCache002 end" << std::endl;
}
/**
* @tc.name: testNotifyMissionsChangedFromRemote001
* @tc.desc: notify missions changed from remote
@ -1579,30 +1407,6 @@ HWTEST_F(DMSMissionManagerTest, testNotifyMissionsChangedToRemoteInner002, TestS
DTEST_LOG << "testNotifyMissionsChangedToRemoteInner002 end" << std::endl;
}
/**
* @tc.name: testFetchDeviceHandler001
* @tc.desc: fetch device handler
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testFetchDeviceHandler001, TestSize.Level3)
{
DTEST_LOG << "testFetchDeviceHandler001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler("");
DTEST_LOG << "testFetchDeviceHandler001 end" << std::endl;
}
/**
* @tc.name: testFetchDeviceHandler002
* @tc.desc: fetch device handler
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testFetchDeviceHandler002, TestSize.Level3)
{
DTEST_LOG << "testFetchDeviceHandler002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler(DEVICE_ID);
DTEST_LOG << "testFetchDeviceHandler002 end" << std::endl;
}
/**
* @tc.name: testOnRemoteDmsDied001
* @tc.desc: on remote dms died
@ -2009,52 +1813,6 @@ HWTEST_F(DMSMissionManagerTest, testRegisterMissionListener010, TestSize.Level3)
DTEST_LOG << "testRegisterMissionListener010 end" << std::endl;
}
/**
* @tc.name: testGetRemoteDms001
* @tc.desc: test GetRemoteDms
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testGetRemoteDms001, TestSize.Level1)
{
DTEST_LOG << "testGetRemoteDms001 begin" << std::endl;
sptr<IDistributedSched> proxy = GetDms();
if (proxy == nullptr) {
return;
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = proxy;
}
auto ret = DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
DTEST_LOG << "testGetRemoteDms001 end" << std::endl;
}
/**
* @tc.name: testGetRemoteDms002
* @tc.desc: test GetRemoteDms
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testGetRemoteDms002, TestSize.Level1)
{
DTEST_LOG << "testGetRemoteDms002 begin" << std::endl;
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = nullptr;
}
auto ret = DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
DTEST_LOG << "testGetRemoteDms002 end" << std::endl;
}
/**
* @tc.name: testIsDeviceIdValidated002
* @tc.desc: test IsDeviceIdValidated
@ -2168,23 +1926,6 @@ HWTEST_F(DMSMissionManagerTest, testGetMissionInfos009, TestSize.Level3)
DTEST_LOG << "testGetMissionInfos009 end" << std::endl;
}
/**
* @tc.name: testNotifyRemoteDied002
* @tc.desc: test notify remote died
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testNotifyRemoteDied002, TestSize.Level3)
{
DTEST_LOG << "testNotifyRemoteDied002 begin" << std::endl;
wptr<IRemoteObject> remote = new RemoteMissionListenerTest();
if (DistributedSchedMissionManager::GetInstance().distributedDataStorage_ == nullptr) {
DistributedSchedMissionManager::GetInstance().distributedDataStorage_ =
std::make_shared<DistributedDataStorage>();
}
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
DTEST_LOG << "testNotifyRemoteDied002 end" << std::endl;
}
/**
* @tc.name: testInitDataStorage003
* @tc.desc: test init data storage
@ -2510,6 +2251,14 @@ HWTEST_F(DMSMissionManagerTest, testStartSyncRemoteMissions016, TestSize.Level3)
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener006, TestSize.Level3)
{
DTEST_LOG << "testUnRegisterMissionListener006 begin" << std::endl;
/**
* @tc.steps: step1. test device online notify
*/
DTEST_LOG << "testDeviceOnlineNotify001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify("");
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify(DEVICE_ID);
DTEST_LOG << "testDeviceOnlineNotify001 end" << std::endl;
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
@ -2528,6 +2277,22 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener006, TestSize.Level
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener007, TestSize.Level3)
{
DTEST_LOG << "testUnRegisterMissionListener007 begin" << std::endl;
/**
* @tc.steps: step1. test delete data storage
*/
DTEST_LOG << "testDeleteDataStorage001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", false);
DTEST_LOG << "testDeleteDataStorage001 end" << std::endl;
DTEST_LOG << "testDeleteDataStorage002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, false);
DTEST_LOG << "testDeleteDataStorage002 end" << std::endl;
DTEST_LOG << "testDeleteDataStorage003 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", true);
DTEST_LOG << "testDeleteDataStorage003 end" << std::endl;
DTEST_LOG << "testDeleteDataStorage004 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, true);
DTEST_LOG << "testDeleteDataStorage004 end" << std::endl;
u16string deviceId = Str8ToStr16(DEVICE_ID);
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
@ -2547,6 +2312,36 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener007, TestSize.Level
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener008, TestSize.Level3)
{
DTEST_LOG << "testUnRegisterMissionListener008 begin" << std::endl;
/**
* @tc.steps: step1. enqueue cached snapshot info
*/
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, nullptr);
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 end" << std::endl;
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo(DEVICE_ID, 1, nullptr);
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 end" << std::endl;
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 begin" << std::endl;
unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, std::move(snapshot));
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 end" << std::endl;
DTEST_LOG << "testDequeueCachedSnapshotInfo001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo("", 1);
DTEST_LOG << "testDequeueCachedSnapshotInfo001 end" << std::endl;
DTEST_LOG << "testDequeueCachedSnapshotInfo002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo(DEVICE_ID, 1);
DTEST_LOG << "testDequeueCachedSnapshotInfo002 end" << std::endl;
/**
* @tc.steps: step2. reborn mission cache
*/
DTEST_LOG << "testRebornMissionCache001 begin" << std::endl;
std::vector<DstbMissionInfo> missionInfos;
DistributedSchedMissionManager::GetInstance().RebornMissionCache("", missionInfos);
DTEST_LOG << "testRebornMissionCache001 end" << std::endl;
DTEST_LOG << "testRebornMissionCache002 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
DTEST_LOG << "testRebornMissionCache002 end" << std::endl;
u16string deviceId = Str8ToStr16(DEVICE_ID);
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
{
@ -2572,6 +2367,14 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener008, TestSize.Level
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener009, TestSize.Level3)
{
DTEST_LOG << "testUnRegisterMissionListener009 begin" << std::endl;
/**
* @tc.steps: step1. fetch device handler
*/
DTEST_LOG << "testFetchDeviceHandler001 begin" << std::endl;
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler("");
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler(DEVICE_ID);
DTEST_LOG << "testFetchDeviceHandler001 end" << std::endl;
u16string deviceId = Str8ToStr16(DEVICE_ID);
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
sptr<IRemoteObject> nullListener = nullptr;
@ -2623,10 +2426,26 @@ HWTEST_F(DMSMissionManagerTest, testCleanMissionResources002, TestSize.Level3)
HWTEST_F(DMSMissionManagerTest, testStopSyncRemoteMissions013, TestSize.Level3)
{
DTEST_LOG << "testStopSyncRemoteMissions013 begin" << std::endl;
/**
* @tc.steps: step1. test GetRemoteDms
*/
DTEST_LOG << "testGetRemoteDms001 begin" << std::endl;
sptr<IDistributedSched> proxy = GetDms();
if (proxy == nullptr) {
return;
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = proxy;
}
DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
DTEST_LOG << "testGetRemoteDms001 end" << std::endl;
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
@ -2648,6 +2467,22 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncRemoteMissions013, TestSize.Level3)
HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote002, TestSize.Level3)
{
DTEST_LOG << "testStartSyncMissionsFromRemote002 begin" << std::endl;
/**
* @tc.steps: step1. test GetRemoteDms
*/
DTEST_LOG << "testGetRemoteDms002 begin" << std::endl;
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = nullptr;
}
DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
DTEST_LOG << "testGetRemoteDms002 end" << std::endl;
std::vector<DstbMissionInfo> missionInfos;
CallerInfo callerInfo;
auto runner = AppExecFwk::EventRunner::Create("MissionManagerHandler");
@ -2668,6 +2503,18 @@ HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote002, TestSize.Lev
HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote003, TestSize.Level3)
{
DTEST_LOG << "testStartSyncMissionsFromRemote003 begin" << std::endl;
/**
* @tc.steps: step1. test notify remote died
*/
DTEST_LOG << "testNotifyRemoteDied002 begin" << std::endl;
wptr<IRemoteObject> remote = new RemoteMissionListenerTest();
if (DistributedSchedMissionManager::GetInstance().distributedDataStorage_ == nullptr) {
DistributedSchedMissionManager::GetInstance().distributedDataStorage_ =
std::make_shared<DistributedDataStorage>();
}
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
DTEST_LOG << "testNotifyRemoteDied002 end" << std::endl;
std::vector<DstbMissionInfo> missionInfos;
CallerInfo callerInfo;
auto runner = AppExecFwk::EventRunner::Create("MissionManagerHandler");
@ -2704,6 +2551,32 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncMissionsFromRemote003, TestSize.Leve
HWTEST_F(DMSMissionManagerTest, testNeedSyncDevice003, TestSize.Level3)
{
DTEST_LOG << "testNeedSyncDevice003 begin" << std::endl;
/**
* @tc.steps: step1. delete cached snapshot info
*/
DTEST_LOG << "testDeleteCachedSnapshotInfo001 begin" << std::endl;
std::string uuid = "uuid for GetUuidByNetworkId";
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
}
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
}
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
std::string key = DistributedSchedMissionManager::GetInstance().GenerateKeyInfo(DEVICE_ID, 1);
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[key] = std::move(snapshot);
}
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
DTEST_LOG << "testDeleteCachedSnapshotInfo001 end" << std::endl;
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteSyncDeviceLock_);
DistributedSchedMissionManager::GetInstance().remoteSyncDeviceSet_.clear();
@ -2725,6 +2598,23 @@ HWTEST_F(DMSMissionManagerTest, testNeedSyncDevice003, TestSize.Level3)
HWTEST_F(DMSMissionManagerTest, testHasSyncListener002, TestSize.Level3)
{
DTEST_LOG << "testHasSyncListener002 begin" << std::endl;
/**
* @tc.steps: step1. reborn mission cache
*/
DTEST_LOG << "testRebornMissionCache003 begin" << std::endl;
std::string uuid = "uuid for GetUuidByNetworkId";
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
}
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
}
std::vector<DstbMissionInfo> missionInfos;
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
DTEST_LOG << "testRebornMissionCache003 end" << std::endl;
u16string deviceId = Str8ToStr16(DEVICE_ID);
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
{
@ -2829,67 +2719,6 @@ HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo003, TestSize.Level
DTEST_LOG << "testDequeueCachedSnapshotInfo003 end" << std::endl;
}
/**
* @tc.name: testDeleteCachedSnapshotInfo001
* @tc.desc: delete cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteCachedSnapshotInfo001, TestSize.Level3)
{
DTEST_LOG << "testDeleteCachedSnapshotInfo001 begin" << std::endl;
std::string uuid = "uuid for GetUuidByNetworkId";
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
}
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
}
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
std::string key = DistributedSchedMissionManager::GetInstance().GenerateKeyInfo(DEVICE_ID, 1);
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[key] = std::move(snapshot);
}
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
DTEST_LOG << "testDeleteCachedSnapshotInfo001 end" << std::endl;
}
/**
* @tc.name: testDeleteCachedSnapshotInfo002
* @tc.desc: delete cached snapshot info
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testDeleteCachedSnapshotInfo002, TestSize.Level3)
{
DTEST_LOG << "testDeleteCachedSnapshotInfo002 begin" << std::endl;
std::string uuid = "uuid for GetUuidByNetworkId";
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
}
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
}
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
}
{
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[uuid] = std::move(snapshot);
}
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
DTEST_LOG << "testDeleteCachedSnapshotInfo002 end" << std::endl;
}
/**
* @tc.name: testFetchCachedRemoteMissions010
* @tc.desc: test FetchCachedRemoteMissions
@ -2922,28 +2751,6 @@ HWTEST_F(DMSMissionManagerTest, testFetchCachedRemoteMissions010, TestSize.Level
DTEST_LOG << "testFetchCachedRemoteMissions010 end" << std::endl;
}
/**
* @tc.name: testRebornMissionCache003
* @tc.desc: reborn mission cache
* @tc.type: FUNC
*/
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache003, TestSize.Level3)
{
DTEST_LOG << "testRebornMissionCache003 begin" << std::endl;
std::string uuid = "uuid for GetUuidByNetworkId";
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
}
{
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
}
std::vector<DstbMissionInfo> missionInfos;
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
DTEST_LOG << "testRebornMissionCache003 end" << std::endl;
}
/**
* @tc.name: testNotifyMissionsChangedFromRemote003
* @tc.desc: notify missions changed from remote