Loading...
Searching...
No Matches
mock_net_channel.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include "gmock/gmock.h"
24
25namespace resdb {
26
27// A mock class for NetChannel.
28class MockNetChannel : public NetChannel {
29 public:
30 MockNetChannel(const std::string& ip, int port) : NetChannel(ip, port) {}
31
33 (const google::protobuf::Message&, Request::Type, bool),
34 (override));
35 MOCK_METHOD(int, SendRawMessage, (const google::protobuf::Message&),
36 (override));
37 MOCK_METHOD(int, SendRawMessageData, (const std::string&), (override));
38 MOCK_METHOD(int, RecvRawMessageStr, (std::string*), (override));
39 MOCK_METHOD(int, RecvRawMessage, (google::protobuf::Message*), (override));
40};
41
42} // namespace resdb
MOCK_METHOD(int, RecvRawMessage,(google::protobuf::Message *),(override))
MockNetChannel(const std::string &ip, int port)
MOCK_METHOD(int, SendRawMessage,(const google::protobuf::Message &),(override))
MOCK_METHOD(int, RecvRawMessageStr,(std::string *),(override))
MOCK_METHOD(int, SendRawMessageData,(const std::string &),(override))
MOCK_METHOD(int, SendRequest,(const google::protobuf::Message &, Request::Type, bool),(override))
virtual int SendRawMessage(const google::protobuf::Message &message)
virtual int RecvRawMessageStr(std::string *message)
virtual int SendRawMessageData(const std::string &message_str)
virtual int RecvRawMessage(google::protobuf::Message *message)
virtual int SendRequest(const google::protobuf::Message &message, Request::Type cmd, bool need_response=false)