Rolf Badorek | ef2bf51 | 2019-08-20 11:17:15 +0300 | [diff] [blame] | 1 | /* |
| 2 | Copyright (c) 2018-2019 Nokia. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SHAREDDATALAYER_TST_HIREDISSYSTEMMOCK_HPP_ |
| 18 | #define SHAREDDATALAYER_TST_HIREDISSYSTEMMOCK_HPP_ |
| 19 | |
| 20 | #include <gmock/gmock.h> |
| 21 | #include "private/redis/hiredissystem.hpp" |
| 22 | |
| 23 | namespace shareddatalayer |
| 24 | { |
| 25 | namespace tst |
| 26 | { |
| 27 | class HiredisSystemMock: public redis::HiredisSystem |
| 28 | { |
| 29 | public: |
| 30 | MOCK_METHOD2(redisConnect, redisContext*(const char* ip, int port)); |
| 31 | |
| 32 | MOCK_METHOD4(redisCommandArgv, void*(redisContext* context, |
| 33 | int argc, |
| 34 | const char** argv, |
| 35 | const size_t* argvlen)); |
| 36 | |
| 37 | MOCK_METHOD1(freeReplyObject, void(void* reply)); |
| 38 | |
| 39 | MOCK_METHOD1(redisFree, void(redisContext* context)); |
| 40 | |
| 41 | MOCK_METHOD2(redisAsyncConnect, redisAsyncContext*(const char* ip, int port)); |
| 42 | |
| 43 | MOCK_METHOD2(redisAsyncSetConnectCallback, int(redisAsyncContext* ac, redisConnectCallback* fn)); |
| 44 | |
| 45 | MOCK_METHOD2(redisAsyncSetDisconnectCallback, int(redisAsyncContext* ac, redisDisconnectCallback* fn)); |
| 46 | |
| 47 | MOCK_METHOD6(redisAsyncCommandArgv, int(redisAsyncContext* ac, |
| 48 | redisCallbackFn* fn, |
| 49 | void* privdata, |
| 50 | int argc, |
| 51 | const char** argv, |
| 52 | const size_t* argvlen)); |
| 53 | |
| 54 | MOCK_METHOD1(redisAsyncHandleRead, void(redisAsyncContext* ac)); |
| 55 | |
| 56 | MOCK_METHOD1(redisAsyncHandleWrite, void(redisAsyncContext* ac)); |
| 57 | |
| 58 | MOCK_METHOD1(redisAsyncDisconnect, void(redisAsyncContext* ac)); |
| 59 | |
| 60 | MOCK_METHOD1(redisAsyncFree, void(redisAsyncContext* ac)); |
| 61 | }; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | #endif |