| 340 | |
| 341 | |
| 342 | void TestConfig::TestLockConfig(const config::LockConfig *lock_config) { |
| 343 | const int expected_lock_id{1}; |
| 344 | comm::proto::Addr expected_addr; |
| 345 | expected_addr.set_ip("127.0.0.1"); |
| 346 | expected_addr.set_port(7100); |
| 347 | expected_addr.set_paxos_port(7101); |
| 348 | |
| 349 | // GetAllLock |
| 350 | { |
| 351 | vector<shared_ptr<const config::proto::Lock> > locks; |
| 352 | const int expected_nr_lock{1}; |
| 353 | |
| 354 | assert(comm::RetCode::RET_OK == lock_config->GetAllLock(locks)); |
| 355 | assert(expected_nr_lock == locks.size()); |
| 356 | } |
| 357 | |
| 358 | // GetAllLockID |
| 359 | { |
| 360 | set<int> lock_ids; |
| 361 | const int expected_nr_lock{1}; |
| 362 | |
| 363 | assert(comm::RetCode::RET_OK == lock_config->GetAllLockID(lock_ids)); |
| 364 | assert(expected_nr_lock == lock_ids.size()); |
| 365 | } |
| 366 | |
| 367 | // GetLockByLockID |
| 368 | { |
| 369 | |
| 370 | shared_ptr<const config::proto::Lock> lock; |
| 371 | assert(comm::RetCode::RET_OK == lock_config->GetLockByLockID(expected_lock_id, lock)); |
| 372 | assert(lock); |
| 373 | } |
| 374 | |
| 375 | // GetLockIDByAddr |
| 376 | { |
| 377 | int lock_id; |
| 378 | assert(comm::RetCode::RET_OK == lock_config->GetLockIDByAddr(expected_addr, lock_id)); |
| 379 | assert(expected_lock_id == lock_id); |
| 380 | } |
| 381 | |
| 382 | // GetLockByAddr |
| 383 | { |
| 384 | shared_ptr<const config::proto::Lock> lock; |
| 385 | assert(comm::RetCode::RET_OK == lock_config->GetLockByAddr(expected_addr, lock)); |
| 386 | assert(lock); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | |
| 391 | } // namespace test |
nothing calls this directly
no test coverage detected