1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifdef RELATIONAL_STORE 16 #include <gtest/gtest.h> 17 #include <iostream> 18 #include "cloud/cloud_storage_utils.h" 19 #include "cloud/cloud_db_constant.h" 20 #include "distributeddb_data_generate_unit_test.h" 21 #include "distributeddb_tools_unit_test.h" 22 #include "process_system_api_adapter_impl.h" 23 #include "relational_store_instance.h" 24 #include "relational_store_manager.h" 25 #include "runtime_config.h" 26 #include "sqlite_relational_store.h" 27 #include "sqlite_relational_utils.h" 28 #include "store_observer.h" 29 #include "time_helper.h" 30 #include "virtual_asset_loader.h" 31 #include "virtual_cloud_data_translate.h" 32 #include "virtual_cloud_db.h" 33 #include "mock_asset_loader.h" 34 #include "cloud_db_sync_utils_test.h" 35 36 using namespace testing::ext; 37 using namespace DistributedDB; 38 using namespace DistributedDBUnitTest; 39 using namespace std; 40 41 namespace { 42 string g_storeID = "Relational_Store_SYNC"; 43 const string g_tableName = "worker"; 44 const string DB_SUFFIX = ".db"; 45 const string CLOUD = "cloud"; 46 string g_testDir; 47 string g_storePath; 48 std::shared_ptr<VirtualCloudDb> g_virtualCloudDb; 49 std::shared_ptr<VirtualAssetLoader> g_virtualAssetLoader; 50 RelationalStoreObserverUnitTest *g_observer = nullptr; 51 RelationalStoreDelegate *g_delegate = nullptr; 52 TrackerSchema g_trackerSchema = { 53 .tableName = g_tableName, .extendColName = "name", .trackerColNames = {"age"} 54 }; 55 TrackerSchema g_trackerSchema2 = { 56 .tableName = g_tableName, .extendColName = "age", .trackerColNames = {"height"} 57 }; 58 TrackerSchema g_trackerSchema3 = { 59 .tableName = g_tableName, .extendColName = "", .trackerColNames = {} 60 }; 61 ChangeProperties g_onChangeProperties = { .isTrackedDataChange = true }; 62 ChangeProperties g_unChangeProperties = { .isTrackedDataChange = false }; 63 const std::vector<std::string> g_tables = {g_tableName}; 64 const std::string CREATE_LOCAL_TABLE_WITHOUT_PRIMARY_KEY_SQL = 65 "CREATE TABLE IF NOT EXISTS " + g_tableName + "(" \ 66 "name TEXT," \ 67 "height REAL ," \ 68 "married BOOLEAN ," \ 69 "photo BLOB NOT NULL," \ 70 "asset BLOB," \ 71 "age INT);"; 72 const std::vector<Field> g_cloudFiledWithoutPrimaryKey = { 73 {"name", TYPE_INDEX<std::string>, false, true}, {"height", TYPE_INDEX<double>}, 74 {"married", TYPE_INDEX<bool>}, {"photo", TYPE_INDEX<Bytes>, false, false}, 75 {"asset", TYPE_INDEX<Asset>}, {"age", TYPE_INDEX<int64_t>} 76 }; 77 InitExpectChangedData(ChangedDataType dataType,int64_t count,ChangeType changeType)78 void InitExpectChangedData(ChangedDataType dataType, int64_t count, ChangeType changeType) 79 { 80 ChangedData changedDataForTable; 81 changedDataForTable.tableName = g_tableName; 82 changedDataForTable.type = dataType; 83 changedDataForTable.field.push_back(std::string("rowid")); 84 for (int64_t i = 1; i <= count; ++i) { 85 changedDataForTable.primaryData[changeType].push_back({i}); 86 } 87 g_observer->SetExpectedResult(changedDataForTable); 88 } 89 InitExpectChangedDataByDetailsType(ChangedDataType dataType,int64_t count,ChangeType changeType,ChangeProperties properties,uint32_t detailsType)90 void InitExpectChangedDataByDetailsType(ChangedDataType dataType, int64_t count, ChangeType changeType, 91 ChangeProperties properties, uint32_t detailsType) 92 { 93 ChangedData changedDataForTable; 94 changedDataForTable.tableName = g_tableName; 95 if (detailsType & static_cast<uint32_t>(CallbackDetailsType::DEFAULT)) { 96 changedDataForTable.type = dataType; 97 changedDataForTable.field.push_back(std::string("rowid")); 98 for (int64_t i = 1; i <= count; ++i) { 99 changedDataForTable.primaryData[changeType].push_back({i}); 100 } 101 } 102 if (detailsType & static_cast<uint32_t>(CallbackDetailsType::BRIEF)) { 103 changedDataForTable.properties = properties; 104 } 105 g_observer->SetExpectedResult(changedDataForTable); 106 } 107 TestChangedDataInTrackerTable(const TrackerSchema & trackerSchema,uint32_t detailsType,std::vector<ChangeProperties> & expectProperties)108 void TestChangedDataInTrackerTable(const TrackerSchema &trackerSchema, uint32_t detailsType, 109 std::vector<ChangeProperties> &expectProperties) 110 { 111 EXPECT_EQ(expectProperties.size(), 3u); // 3 is the num to check change properties 112 /** 113 * @tc.steps:step1. set tracker table 114 * @tc.expected: step1. check the changeddata and return ok 115 */ 116 EXPECT_EQ(g_delegate->SetTrackerTable(trackerSchema), OK); 117 g_observer->SetCallbackDetailsType(detailsType); 118 int64_t cloudCount = 10; // 10 is random cloud count 119 int64_t paddingSize = 10; // 10 is padding size 120 int index = 0; 121 InitExpectChangedDataByDetailsType(ChangedDataType::DATA, cloudCount, ChangeType::OP_INSERT, 122 expectProperties[index++], detailsType); 123 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 124 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 125 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 126 g_observer->ClearChangedData(); 127 128 /** 129 * @tc.steps:step2. update cloud data 130 * @tc.expected: step2. check the changeddata and return ok 131 */ 132 InitExpectChangedDataByDetailsType(ChangedDataType::DATA, cloudCount, ChangeType::OP_UPDATE, 133 expectProperties[index++], detailsType); 134 CloudDBSyncUtilsTest::UpdateCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 135 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 136 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 137 g_observer->ClearChangedData(); 138 139 /** 140 * @tc.steps:step3. delete cloud data 141 * @tc.expected: step3. check the changeddata and return ok 142 */ 143 InitExpectChangedDataByDetailsType(ChangedDataType::DATA, cloudCount, ChangeType::OP_DELETE, 144 expectProperties[index++], detailsType); 145 CloudDBSyncUtilsTest::DeleteCloudTableRecordByGid(0, cloudCount, g_virtualCloudDb); 146 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 147 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 148 g_observer->ClearChangedData(); 149 } 150 151 class DistributedDBCloudTableWithoutPrimaryKeySyncTest : public testing::Test { 152 public: 153 static void SetUpTestCase(void); 154 static void TearDownTestCase(void); 155 void SetUp(); 156 void TearDown(); 157 protected: 158 sqlite3 *db = nullptr; 159 }; 160 SetUpTestCase(void)161 void DistributedDBCloudTableWithoutPrimaryKeySyncTest::SetUpTestCase(void) 162 { 163 DistributedDBToolsUnitTest::TestDirInit(g_testDir); 164 g_storePath = g_testDir + "/" + g_storeID + DB_SUFFIX; 165 LOGI("The test db is:%s", g_testDir.c_str()); 166 RuntimeConfig::SetCloudTranslate(std::make_shared<VirtualCloudDataTranslate>()); 167 } 168 TearDownTestCase(void)169 void DistributedDBCloudTableWithoutPrimaryKeySyncTest::TearDownTestCase(void) 170 {} 171 SetUp(void)172 void DistributedDBCloudTableWithoutPrimaryKeySyncTest::SetUp(void) 173 { 174 if (DistributedDBToolsUnitTest::RemoveTestDbFiles(g_testDir) != 0) { 175 LOGE("rm test db files error."); 176 } 177 DistributedDBToolsUnitTest::PrintTestCaseInfo(); 178 LOGD("Test dir is %s", g_testDir.c_str()); 179 db = RelationalTestUtils::CreateDataBase(g_storePath); 180 ASSERT_NE(db, nullptr); 181 CloudDBSyncUtilsTest::CreateUserDBAndTable(db, CREATE_LOCAL_TABLE_WITHOUT_PRIMARY_KEY_SQL); 182 CloudDBSyncUtilsTest::SetStorePath(g_storePath); 183 CloudDBSyncUtilsTest::InitSyncUtils(g_cloudFiledWithoutPrimaryKey, g_observer, g_virtualCloudDb, 184 g_virtualAssetLoader, g_delegate); 185 } 186 TearDown(void)187 void DistributedDBCloudTableWithoutPrimaryKeySyncTest::TearDown(void) 188 { 189 CloudDBSyncUtilsTest::CloseDb(g_observer, g_virtualCloudDb, g_delegate); 190 EXPECT_EQ(sqlite3_close_v2(db), SQLITE_OK); 191 if (DistributedDBToolsUnitTest::RemoveTestDbFiles(g_testDir) != 0) { 192 LOGE("rm test db files error."); 193 } 194 } 195 196 /* 197 * @tc.name: CloudSyncTest001 198 * @tc.desc: test data sync when cloud insert 199 * @tc.type: FUNC 200 * @tc.require: 201 * @tc.author: chenchaohao 202 */ 203 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest001, TestSize.Level0) 204 { 205 /** 206 * @tc.steps:step1. insert cloud data and merge 207 * @tc.expected: step1. check the changeddata and return ok 208 */ 209 int64_t cloudCount = 10; // 10 is random cloud count 210 int64_t paddingSize = 10; // 10 is padding size 211 InitExpectChangedData(ChangedDataType::DATA, cloudCount, ChangeType::OP_INSERT); 212 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 213 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 214 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 215 g_observer->ClearChangedData(); 216 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 217 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 218 } 219 220 /* 221 * @tc.name: CloudSyncTest002 222 * @tc.desc: test data sync when cloud update 223 * @tc.type: FUNC 224 * @tc.require: 225 * @tc.author: chenchaohao 226 */ 227 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest002, TestSize.Level0) 228 { 229 /** 230 * @tc.steps:step1. insert cloud data and merge 231 * @tc.expected: step1. check the changeddata and return ok 232 */ 233 int64_t cloudCount = 10; // 10 is random cloud count 234 int64_t paddingSize = 10; // 10 is padding size 235 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 236 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 237 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 238 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 239 240 /** 241 * @tc.steps:step2. update cloud data and merge 242 * @tc.expected: step2. check the changeddata and return ok 243 */ 244 InitExpectChangedData(ChangedDataType::DATA, cloudCount, ChangeType::OP_UPDATE); 245 CloudDBSyncUtilsTest::UpdateCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 246 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 247 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 248 g_observer->ClearChangedData(); 249 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 250 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 251 } 252 253 /* 254 * @tc.name: CloudSyncTest003 255 * @tc.desc: test data sync when cloud delete 256 * @tc.type: FUNC 257 * @tc.require: 258 * @tc.author: chenchaohao 259 */ 260 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest003, TestSize.Level0) 261 { 262 /** 263 * @tc.steps:step1. insert cloud data and merge 264 * @tc.expected: step1. check the changeddata and return ok 265 */ 266 int64_t cloudCount = 10; // 10 is random cloud count 267 int64_t paddingSize = 10; // 10 is padding size 268 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, true, g_virtualCloudDb); 269 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 270 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 271 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 272 273 /** 274 * @tc.steps:step2. delete cloud data and merge 275 * @tc.expected: step2. check the changeddata and return ok 276 */ 277 InitExpectChangedData(ChangedDataType::DATA, cloudCount, ChangeType::OP_DELETE); 278 CloudDBSyncUtilsTest::DeleteCloudTableRecordByGid(0, cloudCount, g_virtualCloudDb); 279 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 280 CloudDBSyncUtilsTest::CheckCloudTotalCount({0L}, g_virtualCloudDb); 281 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 282 g_observer->ClearChangedData(); 283 CloudDBSyncUtilsTest::CheckLocalRecordNum(db, g_tableName, 0); 284 } 285 286 /* 287 * @tc.name: CloudSyncTest004 288 * @tc.desc: test asset when cloud insert 289 * @tc.type: FUNC 290 * @tc.require: 291 * @tc.author: chenchaohao 292 */ 293 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest004, TestSize.Level0) 294 { 295 /** 296 * @tc.steps:step1. insert cloud asset and merge 297 * @tc.expected: step1. check the changeddata and return ok 298 */ 299 int64_t cloudCount = 10; // 10 is random cloud count 300 int64_t paddingSize = 10; // 10 is padding size 301 InitExpectChangedData(ChangedDataType::ASSET, cloudCount, ChangeType::OP_INSERT); 302 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, false, g_virtualCloudDb); 303 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 304 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 305 g_observer->ClearChangedData(); 306 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 307 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 308 } 309 310 /* 311 * @tc.name: CloudSyncTest005 312 * @tc.desc: test asset sync when cloud insert 313 * @tc.type: FUNC 314 * @tc.require: 315 * @tc.author: chenchaohao 316 */ 317 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest005, TestSize.Level0) 318 { 319 /** 320 * @tc.steps:step1. insert cloud asset and merge 321 * @tc.expected: step1. check the changeddata and return ok 322 */ 323 int64_t cloudCount = 10; // 10 is random cloud count 324 int64_t paddingSize = 10; // 10 is padding size 325 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, false, g_virtualCloudDb); 326 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 327 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 328 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 329 330 /** 331 * @tc.steps:step2. update cloud asset and merge 332 * @tc.expected: step2. check the changeddata and return ok 333 */ 334 InitExpectChangedData(ChangedDataType::ASSET, cloudCount, ChangeType::OP_UPDATE); 335 CloudDBSyncUtilsTest::UpdateCloudTableRecord(0, cloudCount, paddingSize, false, g_virtualCloudDb); 336 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 337 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 338 g_observer->ClearChangedData(); 339 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 340 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 341 } 342 343 /* 344 * @tc.name: CloudSyncTest006 345 * @tc.desc: test asset sync when cloud delete 346 * @tc.type: FUNC 347 * @tc.require: 348 * @tc.author: chenchaohao 349 */ 350 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest006, TestSize.Level0) 351 { 352 /** 353 * @tc.steps:step1. insert cloud asset and merge 354 * @tc.expected: step1. check the changeddata and return ok 355 */ 356 int64_t cloudCount = 10; // 10 is random cloud count 357 int64_t paddingSize = 10; // 10 is padding size 358 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, false, g_virtualCloudDb); 359 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 360 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 361 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 362 363 /** 364 * @tc.steps:step2. insert cloud asset and merge 365 * @tc.expected: step2. check the changeddata and return ok 366 */ 367 InitExpectChangedData(ChangedDataType::ASSET, cloudCount, ChangeType::OP_DELETE); 368 CloudDBSyncUtilsTest::DeleteCloudTableRecordByGid(0, cloudCount, g_virtualCloudDb); 369 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 370 CloudDBSyncUtilsTest::CheckCloudTotalCount({0L}, g_virtualCloudDb); 371 EXPECT_TRUE(g_observer->IsAllChangedDataEq()); 372 g_observer->ClearChangedData(); 373 CloudDBSyncUtilsTest::CheckLocalRecordNum(db, g_tableName, 0); 374 } 375 376 /* 377 * @tc.name: CloudSyncTest007 378 * @tc.desc: test sync when device delete 379 * @tc.type: FUNC 380 * @tc.require: 381 * @tc.author: chenchaohao 382 */ 383 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, CloudSyncTest007, TestSize.Level0) 384 { 385 /** 386 * @tc.steps:step1. insert cloud asset and merge 387 * @tc.expected: step1. check the changeddata and return ok 388 */ 389 int64_t cloudCount = 30; // 30 is random cloud count 390 int64_t paddingSize = 10; // 10 is padding size 391 CloudDBSyncUtilsTest::InsertCloudTableRecord(0, cloudCount, paddingSize, false, g_virtualCloudDb); 392 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 393 CloudDBSyncUtilsTest::CheckDownloadResult(db, {cloudCount}, CLOUD); 394 CloudDBSyncUtilsTest::CheckCloudTotalCount({cloudCount}, g_virtualCloudDb); 395 396 /** 397 * @tc.steps:step2. delete user data and update cloud data 398 * @tc.expected: step2. check sync reseult and return ok 399 */ 400 int64_t deviceBegin = 20; // 20 is device begin 401 int64_t deviceCount = 10; // 10 is device delete 402 CloudDBSyncUtilsTest::DeleteUserTableRecord(db, 0, deviceCount); 403 CloudDBSyncUtilsTest::DeleteUserTableRecord(db, deviceBegin, deviceCount); 404 CloudDBSyncUtilsTest::UpdateCloudTableRecord(0, deviceCount, paddingSize, false, g_virtualCloudDb); 405 CloudDBSyncUtilsTest::callSync(g_tables, SYNC_MODE_CLOUD_MERGE, DBStatus::OK, g_delegate); 406 CloudDBSyncUtilsTest::CheckLocalRecordNum(db, g_tableName, deviceBegin); 407 CloudDBSyncUtilsTest::CheckCloudTotalCount({deviceBegin}, g_virtualCloudDb); 408 } 409 410 /* 411 * @tc.name: ChangeTrackerDataTest001 412 * @tc.desc: test changed data on BRIEF type of sync 413 * @tc.type: FUNC 414 * @tc.require: 415 * @tc.author: bty 416 */ 417 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, ChangeTrackerDataTest001, TestSize.Level0) 418 { 419 std::vector<ChangeProperties> expectProperties = { 420 g_onChangeProperties, g_unChangeProperties, g_onChangeProperties 421 }; 422 TestChangedDataInTrackerTable(g_trackerSchema, static_cast<uint32_t>(CallbackDetailsType::BRIEF), 423 expectProperties); 424 } 425 426 /* 427 * @tc.name: ChangeTrackerDataTest002 428 * @tc.desc: test changed data on DETAILED type of sync 429 * @tc.type: FUNC 430 * @tc.require: 431 * @tc.author: bty 432 */ 433 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, ChangeTrackerDataTest002, TestSize.Level0) 434 { 435 std::vector<ChangeProperties> expectProperties = { 436 g_onChangeProperties, g_unChangeProperties, g_onChangeProperties 437 }; 438 TestChangedDataInTrackerTable(g_trackerSchema, static_cast<uint32_t>(CallbackDetailsType::DETAILED), 439 expectProperties); 440 } 441 442 /* 443 * @tc.name: ChangeTrackerDataTest003 444 * @tc.desc: test changed data on DEFAULT type of sync 445 * @tc.type: FUNC 446 * @tc.require: 447 * @tc.author: bty 448 */ 449 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, ChangeTrackerDataTest003, TestSize.Level0) 450 { 451 std::vector<ChangeProperties> expectProperties = { 452 g_unChangeProperties, g_unChangeProperties, g_unChangeProperties 453 }; 454 TestChangedDataInTrackerTable(g_trackerSchema, static_cast<uint32_t>(CallbackDetailsType::DEFAULT), 455 expectProperties); 456 } 457 458 /* 459 * @tc.name: ChangeTrackerDataTest004 460 * @tc.desc: test changed data on DETAILED type of sync 461 * @tc.type: FUNC 462 * @tc.require: 463 * @tc.author: bty 464 */ 465 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, ChangeTrackerDataTest004, TestSize.Level0) 466 { 467 std::vector<ChangeProperties> expectProperties = { 468 g_onChangeProperties, g_onChangeProperties, g_onChangeProperties 469 }; 470 TestChangedDataInTrackerTable(g_trackerSchema2, static_cast<uint32_t>(CallbackDetailsType::DETAILED), 471 expectProperties); 472 } 473 474 /* 475 * @tc.name: ChangeTrackerDataTest005 476 * @tc.desc: test changed data on unTracker table 477 * @tc.type: FUNC 478 * @tc.require: 479 * @tc.author: bty 480 */ 481 HWTEST_F(DistributedDBCloudTableWithoutPrimaryKeySyncTest, ChangeTrackerDataTest005, TestSize.Level0) 482 { 483 std::vector<ChangeProperties> expectProperties = { 484 g_unChangeProperties, g_unChangeProperties, g_unChangeProperties 485 }; 486 TestChangedDataInTrackerTable(g_trackerSchema3, static_cast<uint32_t>(CallbackDetailsType::DETAILED), 487 expectProperties); 488 } 489 } 490 #endif // RELATIONAL_STORE