| 31 | |
| 32 | |
| 33 | void TestAdd(store::Store &store) { |
| 34 | NLVerb("begin"); |
| 35 | |
| 36 | comm::RetCode ret; |
| 37 | |
| 38 | const int topic_id = 1000; |
| 39 | const int store_id = 1; |
| 40 | const int queue_id = 0; |
| 41 | const int pub_id = 1; |
| 42 | const int handle_id = 1; |
| 43 | const uint64_t uin = 123; |
| 44 | const string buffer = "123"; |
| 45 | const int buffer_type = 0; |
| 46 | const uint64_t sub_ids = 3; |
| 47 | |
| 48 | comm::proto::AddRequest req; |
| 49 | comm::proto::AddResponse resp; |
| 50 | req.set_topic_id(topic_id); |
| 51 | req.set_store_id(store_id); |
| 52 | req.set_queue_id(queue_id); |
| 53 | |
| 54 | auto &&item = req.add_items(); |
| 55 | auto &&meta = item->mutable_meta(); |
| 56 | meta->set_topic_id(topic_id); |
| 57 | meta->set_handle_id(handle_id); |
| 58 | meta->set_uin(uin); |
| 59 | item->set_buffer(buffer); |
| 60 | item->set_buffer_type(buffer_type); |
| 61 | item->set_sub_ids(sub_ids); |
| 62 | item->set_pub_id(pub_id); |
| 63 | item->set_atime(time(nullptr)); |
| 64 | |
| 65 | if (comm::RetCode::RET_OK != (ret = store.Add(req, resp))) { |
| 66 | NLErr("Store Add ret %d", as_integer(ret)); |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | NLVerb("cursor_id %" PRIu64, (uint64_t)resp.cursor_id()); |
| 71 | } |
| 72 | |
| 73 | void StoreRun(const int vpid) { |
| 74 | comm::RetCode ret; |
no test coverage detected