| 27 | |
| 28 | |
| 29 | void TestConfig::Process() { |
| 30 | phxqueue::plugin::ConfigFactory::SetConfigFactoryCreateFunc( |
| 31 | []()->unique_ptr<phxqueue::plugin::ConfigFactory> { |
| 32 | return unique_ptr<phxqueue::plugin::ConfigFactory>( |
| 33 | new plugin::ConfigFactory("./etc/globalconfig.conf")); |
| 34 | }); |
| 35 | |
| 36 | const int topic_id{1000}; |
| 37 | |
| 38 | // test topic_config |
| 39 | { |
| 40 | shared_ptr<const phxqueue::config::TopicConfig> topic_config; |
| 41 | assert(phxqueue::comm::RetCode::RET_OK == |
| 42 | phxqueue::config::GlobalConfig::GetThreadInstance()-> |
| 43 | GetTopicConfigByTopicID(topic_id, topic_config)); |
| 44 | assert(topic_config != nullptr); |
| 45 | |
| 46 | TestTopicConfig(topic_config.get()); |
| 47 | } |
| 48 | |
| 49 | // test consumer_config |
| 50 | { |
| 51 | shared_ptr<const phxqueue::config::ConsumerConfig> consumer_config; |
| 52 | assert(phxqueue::comm::RetCode::RET_OK == |
| 53 | phxqueue::config::GlobalConfig::GetThreadInstance()-> |
| 54 | GetConsumerConfig(topic_id, consumer_config)); |
| 55 | assert(consumer_config); |
| 56 | |
| 57 | TestConsumerConfig(consumer_config.get()); |
| 58 | } |
| 59 | |
| 60 | // test store_config |
| 61 | { |
| 62 | shared_ptr<const phxqueue::config::StoreConfig> store_config; |
| 63 | assert(phxqueue::comm::RetCode::RET_OK == |
| 64 | phxqueue::config::GlobalConfig::GetThreadInstance()-> |
| 65 | GetStoreConfig(topic_id, store_config)); |
| 66 | assert(store_config != nullptr); |
| 67 | |
| 68 | TestStoreConfig(store_config.get()); |
| 69 | } |
| 70 | |
| 71 | // test scheduler_config |
| 72 | { |
| 73 | shared_ptr<const phxqueue::config::SchedulerConfig> scheduler_config; |
| 74 | assert(phxqueue::comm::RetCode::RET_OK == |
| 75 | phxqueue::config::GlobalConfig::GetThreadInstance()-> |
| 76 | GetSchedulerConfig(topic_id, scheduler_config)); |
| 77 | assert(scheduler_config != nullptr); |
| 78 | |
| 79 | TestSchedulerConfig(scheduler_config.get()); |
| 80 | } |
| 81 | |
| 82 | // test lock_config |
| 83 | { |
| 84 | shared_ptr<const phxqueue::config::LockConfig> lock_config; |
| 85 | assert(phxqueue::comm::RetCode::RET_OK == |
| 86 | phxqueue::config::GlobalConfig::GetThreadInstance()-> |
no test coverage detected