mirror of
https://gitee.com/openharmony/distributeddatamgr_datamgr_service
synced 2024-11-23 14:59:46 +00:00
Remove useless test code
Signed-off-by: wangkun <wangkun217@huawei.com>
This commit is contained in:
parent
a7a6f2f729
commit
2a723f6859
@ -219,22 +219,3 @@ HWTEST_F(CommunicationProviderImplTest, CommunicationProvider017, TestSize.Level
|
||||
delete dataListener17;
|
||||
sleep(1); // avoid thread dnet thread died, then will have pthread;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CommunicationProvider018
|
||||
* @tc.desc: test isPeerAvailable
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000CCPQ2 AR000CQS3C AR000CQS3D SR000CQS3B AR000CQSAI
|
||||
* @tc.author: hongbo
|
||||
*/
|
||||
HWTEST_F(CommunicationProviderImplTest, CommunicationProvider018, TestSize.Level1)
|
||||
{
|
||||
struct PipeInfo appId;
|
||||
appId.pipeId = "appIda";
|
||||
appId.userId = "groupIds";
|
||||
struct DeviceId di;
|
||||
di.deviceId = "mydeviceid0";
|
||||
bool ret = CommunicationProvider::GetInstance().IsSameStartedOnPeer(appId, di);
|
||||
EXPECT_EQ(true, ret);
|
||||
sleep(1); // avoid thread dnet thread died, then will have pthread;
|
||||
}
|
||||
|
@ -193,59 +193,3 @@ HWTEST_F(KvStoreBackupTest, KvStoreBackupTest003, TestSize.Level1)
|
||||
kvStorePtr->ReleaseKvStoreSnapshot(std::move(kvStoreSnapshotPtr));
|
||||
kvDataService.CloseKvStore(appId, storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: KvStoreBackupTest004
|
||||
* @tc.desc: kvstore backup delete test
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000DR9J0 AR000DR9JN
|
||||
* @tc.author: guodaoxin
|
||||
*/
|
||||
HWTEST_F(KvStoreBackupTest, KvStoreBackupTest004, TestSize.Level1)
|
||||
{
|
||||
Options options = { .createIfMissing = true, .encrypt = false, .autoSync = true, .backup = true,
|
||||
.kvStoreType = KvStoreType::SINGLE_VERSION, .dataOwnership = true };
|
||||
AppId appId = { "backup4" };
|
||||
StoreId storeId = { "store4" };
|
||||
|
||||
KvStoreDataService kvDataService;
|
||||
kvDataService.DeleteKvStore(appId, storeId);
|
||||
sptr<ISingleKvStore> kvStorePtr;
|
||||
Status status = kvDataService.GetSingleKvStore(options, appId, storeId,
|
||||
[&](sptr<ISingleKvStore> kvStore) { kvStorePtr = std::move(kvStore);});
|
||||
|
||||
EXPECT_EQ(status, Status::SUCCESS) << "KvStoreBackupTest004 set backup true failed";
|
||||
|
||||
Key key1("test1_key");
|
||||
Value value1("test1_value");
|
||||
kvStorePtr->Put(key1, value1);
|
||||
Key key2("test2_key");
|
||||
Value value2("test2_value");
|
||||
kvStorePtr->Put(key2, value2);
|
||||
|
||||
auto backupHandler = std::make_unique<BackupHandler>();
|
||||
auto trueAppId = KvStoreUtils::GetAppIdByBundleName(appId.appId);
|
||||
|
||||
MetaData metaData{0};
|
||||
metaData.kvStoreMetaData.deviceAccountId = "0";
|
||||
metaData.kvStoreMetaData.userId = AccountDelegate::GetInstance()->GetCurrentHarmonyAccountId();
|
||||
metaData.kvStoreMetaData.appId = trueAppId;
|
||||
metaData.kvStoreMetaData.storeId = storeId.storeId;
|
||||
metaData.kvStoreMetaData.isBackup = false;
|
||||
metaData.kvStoreType = KvStoreType::SINGLE_VERSION;
|
||||
|
||||
backupHandler->SingleKvStoreBackup(metaData);
|
||||
|
||||
auto backupFileName = BackupHandler::GetHashedBackupName(Constant::Concatenate({ AccountDelegate::GetInstance()->GetCurrentHarmonyAccountId(),
|
||||
"_", trueAppId, "_", storeId.storeId }));
|
||||
auto pathType = KvStoreAppManager::ConvertPathType(appId.appId, metaData.kvStoreMetaData.securityLevel);
|
||||
auto backFilePath = Constant::Concatenate({BackupHandler::GetBackupPath("0", pathType), "/", backupFileName});
|
||||
bool ret = BackupHandler::FileExists(backFilePath);
|
||||
EXPECT_EQ(true, ret) << "KvStoreBackupTest004 backup file failed";
|
||||
|
||||
kvDataService.CloseKvStore(appId, storeId);
|
||||
kvDataService.DeleteKvStore(appId, storeId);
|
||||
|
||||
ret = BackupHandler::FileExists(backFilePath);
|
||||
EXPECT_EQ(false, ret) << "KvStoreBackupTest004 delete backup file failed";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user