From 2b7ddc636a538e10fcddde144d4596abb4f65f8b Mon Sep 17 00:00:00 2001 From: wenjinchao Date: Fri, 25 Jul 2025 18:14:05 +0800 Subject: [PATCH 1/2] fix ut Signed-off-by: wenjinchao Change-Id: I24954ba164084f587c976cd37eccfd941bed0cc9 --- .../service/test/udmf_run_time_store_test.cpp | 15 +++++++++++++-- .../service/test/udmf_service_impl_mock_test.cpp | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp index 1c92a86a6..4d3a57c42 100644 --- a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp +++ b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp @@ -93,6 +93,7 @@ public: const uint32_t MAX_VALUE_SIZE = 4 * 1024 * 1024; const std::string STORE_ID = "drag"; const std::string KEY_PREFIX = "TEST_"; + const std::string SUMMARY_KEY_PREFIX = "SUMMARY_KEY_PREFIX"; const std::string EMPTY_DEVICE_ID = ""; const std::string BUNDLE_NAME = "udmf_test"; static constexpr size_t tempUdataRecordSize = 1; @@ -643,9 +644,19 @@ HWTEST_F(UdmfRunTimeStoreTest, GetSummary, TestSize.Level1) bool result = store->Init(); EXPECT_TRUE(result); Summary summary; - UnifiedKey key(KEY_PREFIX); + summary.summary = { + { "general.file", 10 }, + { "general.png", 10 }, + { "general.html", 10 }, + { "general.jpeg", 10 }, + { "general.avi", 10}, + { "aabbcc", 10} + } + UnifiedKey key(SUMMARY_KEY_PREFIX); + auto status = store->PutSummary(key, summary); + EXPECT_EQ(status, E_OK); auto status = store->GetSummary(key, summary); - ASSERT_EQ(status, E_NOT_FOUND); + ASSERT_EQ(status, E_OK); } /** diff --git a/services/distributeddataservice/service/test/udmf_service_impl_mock_test.cpp b/services/distributeddataservice/service/test/udmf_service_impl_mock_test.cpp index 9c7e3c2db..9daa166f4 100644 --- a/services/distributeddataservice/service/test/udmf_service_impl_mock_test.cpp +++ b/services/distributeddataservice/service/test/udmf_service_impl_mock_test.cpp @@ -93,7 +93,7 @@ HWTEST_F(UdmfServiceImplMockTest, IsNeedMetaSyncTest001, TestSize.Level0) .WillOnce(Return(true)) .WillOnce(Return(true)); isNeedSync = udmfServiceImpl.IsNeedMetaSync(meta, devices); - EXPECT_EQ(isNeedSync, false); + EXPECT_EQ(isNeedSync, true); } /** -- Gitee From 28a7fb3bb51b6cd140e0bb79dede9cfa861e3985 Mon Sep 17 00:00:00 2001 From: wenjinchao Date: Fri, 25 Jul 2025 18:21:18 +0800 Subject: [PATCH 2/2] fix ut Signed-off-by: wenjinchao Change-Id: I14152b16563524ee7b1db96940ed355d8eab1d17 --- .../service/test/udmf_run_time_store_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp index 4d3a57c42..e583704c3 100644 --- a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp +++ b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp @@ -651,11 +651,11 @@ HWTEST_F(UdmfRunTimeStoreTest, GetSummary, TestSize.Level1) { "general.jpeg", 10 }, { "general.avi", 10}, { "aabbcc", 10} - } + }; UnifiedKey key(SUMMARY_KEY_PREFIX); auto status = store->PutSummary(key, summary); EXPECT_EQ(status, E_OK); - auto status = store->GetSummary(key, summary); + status = store->GetSummary(key, summary); ASSERT_EQ(status, E_OK); } -- Gitee