mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-10-07 05:43:40 +00:00
分布式DP用例维护
Signed-off-by: bWX1145125 <bianjianliang1@huawei.com>
This commit is contained in:
parent
09ea3d3b53
commit
77166ab443
@ -47,15 +47,15 @@ using namespace std;
|
||||
|
||||
void AddPermission(void)
|
||||
{
|
||||
const int32_t PERMS_NUM = 2;
|
||||
const char *perms[PERMS_NUM] = {
|
||||
const int32_t permsNum = 2;
|
||||
const char *perms[permsNum] = {
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.DISTRIBUTED_SOFTBUS_CENTER"
|
||||
};
|
||||
uint64_t tokenId;
|
||||
NativeTokenInfoParams infoInstance = {
|
||||
.dcapsNum = 0,
|
||||
.permsNum = PERMS_NUM,
|
||||
.permsNum = permsNum,
|
||||
.aclsNum = 0,
|
||||
.dcaps = nullptr,
|
||||
.perms = perms,
|
||||
@ -146,8 +146,10 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0300, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0400, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
ServiceProfile serviceProfile;
|
||||
serviceProfile.SetDeviceId("deviceId");
|
||||
serviceProfile.SetDeviceId(deviceId);
|
||||
serviceProfile.SetServiceName("serviceName");
|
||||
serviceProfile.SetServiceType("serviceType");
|
||||
|
||||
@ -180,19 +182,21 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0500, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0600, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
ServiceProfile serviceProfile1;
|
||||
serviceProfile1.SetDeviceId("deviceId1");
|
||||
serviceProfile1.SetDeviceId(deviceId);
|
||||
serviceProfile1.SetServiceName("serviceName");
|
||||
serviceProfile1.SetServiceType("serviceType");
|
||||
|
||||
ServiceProfile serviceProfile2;
|
||||
serviceProfile2.SetDeviceId("deviceId1");
|
||||
serviceProfile2.SetDeviceId(deviceId);
|
||||
serviceProfile2.SetServiceName("serviceName");
|
||||
serviceProfile2.SetServiceType("serviceType");
|
||||
|
||||
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile1);
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile2);
|
||||
EXPECT_EQ(ret, DP_CACHE_EXIST);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,14 +207,16 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0600, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0700, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
ServiceProfile serviceProfile10;
|
||||
serviceProfile10.SetDeviceId("deviceId10");
|
||||
serviceProfile10.SetDeviceId(deviceId);
|
||||
serviceProfile10.SetServiceName("serviceName10");
|
||||
serviceProfile10.SetServiceType("serviceType10");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_ = nullptr;
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile10);
|
||||
EXPECT_EQ(ret, DP_INVALID_PARAMS);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
}
|
||||
|
||||
@ -222,14 +228,16 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0700, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0800, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
ServiceProfile serviceProfile11;
|
||||
serviceProfile11.SetDeviceId("deviceId11");
|
||||
serviceProfile11.SetDeviceId(deviceId);
|
||||
serviceProfile11.SetServiceName("serviceName11");
|
||||
serviceProfile11.SetServiceType("serviceType11");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile11);
|
||||
EXPECT_EQ(ret, DP_PUT_KV_DB_FAIL);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
}
|
||||
|
||||
@ -241,15 +249,17 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0800, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0900, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
vector<ServiceProfile> serviceProfiles;
|
||||
ServiceProfile serviceProfile1;
|
||||
serviceProfile1.SetDeviceId("deviceId2");
|
||||
serviceProfile1.SetDeviceId(deviceId);
|
||||
serviceProfile1.SetServiceName("serviceName2");
|
||||
serviceProfile1.SetServiceType("serviceType2");
|
||||
serviceProfiles.push_back(serviceProfile1);
|
||||
|
||||
ServiceProfile serviceProfile2;
|
||||
serviceProfile2.SetDeviceId("deviceId3");
|
||||
serviceProfile2.SetDeviceId(deviceId);
|
||||
serviceProfile2.SetServiceName("serviceName3");
|
||||
serviceProfile2.SetServiceType("serviceType3");
|
||||
serviceProfiles.push_back(serviceProfile2);
|
||||
@ -266,6 +276,8 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_0900, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1000, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
vector<ServiceProfile> serviceProfiles;
|
||||
ServiceProfile serviceProfile1;
|
||||
serviceProfile1.SetDeviceId("");
|
||||
@ -274,7 +286,7 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1000, TestSize.Level1)
|
||||
serviceProfiles.push_back(serviceProfile1);
|
||||
|
||||
ServiceProfile serviceProfile4;
|
||||
serviceProfile4.SetDeviceId("deviceId4");
|
||||
serviceProfile4.SetDeviceId(deviceId);
|
||||
serviceProfile4.SetServiceName("serviceName4");
|
||||
serviceProfile4.SetServiceType("serviceType4");
|
||||
serviceProfiles.push_back(serviceProfile4);
|
||||
@ -291,8 +303,10 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1000, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1100, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
CharacteristicProfile charProfile;
|
||||
charProfile.SetDeviceId("deviceId");
|
||||
charProfile.SetDeviceId(deviceId);
|
||||
charProfile.SetServiceName("serviceName");
|
||||
charProfile.SetCharacteristicKey("characteristicKey");
|
||||
charProfile.SetCharacteristicValue("characteristicValue");
|
||||
@ -327,21 +341,23 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1200, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1300, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
CharacteristicProfile charProfile1;
|
||||
charProfile1.SetDeviceId("deviceId1");
|
||||
charProfile1.SetDeviceId(deviceId);
|
||||
charProfile1.SetServiceName("serviceName");
|
||||
charProfile1.SetCharacteristicKey("characteristicKey");
|
||||
charProfile1.SetCharacteristicValue("characteristicValue");
|
||||
|
||||
CharacteristicProfile charProfile2;
|
||||
charProfile2.SetDeviceId("deviceId1");
|
||||
charProfile2.SetDeviceId(deviceId);
|
||||
charProfile2.SetServiceName("serviceName");
|
||||
charProfile2.SetCharacteristicKey("characteristicKey");
|
||||
charProfile2.SetCharacteristicValue("characteristicValue");
|
||||
|
||||
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile1);
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile2);
|
||||
EXPECT_EQ(ret, DP_CACHE_EXIST);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -372,15 +388,17 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1400, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1500, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
CharacteristicProfile charProfile11;
|
||||
charProfile11.SetDeviceId("deviceId11");
|
||||
charProfile11.SetDeviceId(deviceId);
|
||||
charProfile11.SetServiceName("serviceName11");
|
||||
charProfile11.SetCharacteristicKey("characteristicKey11");
|
||||
charProfile11.SetCharacteristicValue("characteristicValue11");
|
||||
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
int32_t ret = DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile11);
|
||||
EXPECT_EQ(ret, DP_PUT_KV_DB_FAIL);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
DeviceProfileManager::GetInstance().Init();
|
||||
}
|
||||
|
||||
@ -392,16 +410,18 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1500, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1600, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
vector<CharacteristicProfile> charProfiles;
|
||||
CharacteristicProfile charProfile1;
|
||||
charProfile1.SetDeviceId("deviceId2");
|
||||
charProfile1.SetDeviceId(deviceId);
|
||||
charProfile1.SetServiceName("serviceName2");
|
||||
charProfile1.SetCharacteristicKey("characteristicKey2");
|
||||
charProfile1.SetCharacteristicValue("characteristicValue2");
|
||||
charProfiles.push_back(charProfile1);
|
||||
|
||||
CharacteristicProfile charProfile2;
|
||||
charProfile2.SetDeviceId("deviceId3");
|
||||
charProfile2.SetDeviceId(deviceId);
|
||||
charProfile2.SetServiceName("serviceName3");
|
||||
charProfile2.SetCharacteristicKey("characteristicKey3");
|
||||
charProfile2.SetCharacteristicValue("characteristicValue3");
|
||||
@ -419,6 +439,8 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1600, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1700, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
vector<CharacteristicProfile> charProfiles;
|
||||
CharacteristicProfile charProfile1;
|
||||
charProfile1.SetDeviceId("");
|
||||
@ -428,7 +450,7 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_1700, TestSize.Level1)
|
||||
charProfiles.push_back(charProfile1);
|
||||
|
||||
CharacteristicProfile charProfile4;
|
||||
charProfile4.SetDeviceId("deviceId4");
|
||||
charProfile4.SetDeviceId(deviceId);
|
||||
charProfile4.SetServiceName("serviceName4");
|
||||
charProfile4.SetCharacteristicKey("characteristicKey4");
|
||||
charProfile4.SetCharacteristicValue("characteristicValue4");
|
||||
@ -705,13 +727,14 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_2900, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3000, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
ServiceProfile serviceProfile6;
|
||||
serviceProfile6.SetDeviceId("deviceId6");
|
||||
serviceProfile6.SetDeviceId(deviceId);
|
||||
serviceProfile6.SetServiceName("serviceName6");
|
||||
serviceProfile6.SetServiceType("serviceType6");
|
||||
DeviceProfileManager::GetInstance().PutServiceProfile(serviceProfile6);
|
||||
|
||||
string deviceId = "deviceId6";
|
||||
string serviceName = "serviceName6";
|
||||
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
|
||||
EXPECT_EQ(ret, DP_SUCCESS);
|
||||
@ -760,7 +783,8 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3200, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3300, TestSize.Level1)
|
||||
{
|
||||
string deviceId = "deviceId15";
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
string serviceName = "serviceName15";
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
int32_t ret = DeviceProfileManager::GetInstance().DeleteServiceProfile(deviceId, serviceName);
|
||||
@ -776,14 +800,15 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3300, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3400, TestSize.Level1)
|
||||
{
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
CharacteristicProfile charProfile6;
|
||||
charProfile6.SetDeviceId("deviceId6");
|
||||
charProfile6.SetDeviceId(deviceId);
|
||||
charProfile6.SetServiceName("serviceName6");
|
||||
charProfile6.SetCharacteristicKey("characteristicKey6");
|
||||
charProfile6.SetCharacteristicValue("characteristicValue6");
|
||||
DeviceProfileManager::GetInstance().PutCharacteristicProfile(charProfile6);
|
||||
|
||||
string deviceId = "deviceId6";
|
||||
string serviceName = "serviceName6";
|
||||
string characteristicKey = "characteristicKey6";
|
||||
int32_t ret = DeviceProfileManager::GetInstance().DeleteCharacteristicProfile(deviceId, serviceName,
|
||||
@ -840,7 +865,8 @@ HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3600, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(DeviceProfileManagerTest, SUB_DH_DDp_Dcts_3700, TestSize.Level1)
|
||||
{
|
||||
string deviceId = "deviceId15";
|
||||
string deviceId = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
|
||||
string serviceName = "serviceName15";
|
||||
string characteristicKey = "characteristicKey15";
|
||||
DeviceProfileManager::GetInstance().deviceProfileStore_->UnInit();
|
||||
|
Loading…
Reference in New Issue
Block a user