RMQ - RabbitMQ C++ Library
rmqtestmocks_mockrabbitcontext.h
1// Copyright 2020-2023 Bloomberg Finance L.P.
2// SPDX-License-Identifier: Apache-2.0
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#ifndef INCLUDED_RMQTESTMOCKS_MOCKRABBITCONTEXT
17#define INCLUDED_RMQTESTMOCKS_MOCKRABBITCONTEXT
18
19#include <rmqa_rabbitcontext.h>
20#include <rmqp_rabbitcontext.h>
21
22#include <rmqa_vhost.h>
23#include <rmqp_connection.h>
24#include <rmqp_rabbitcontext.h>
25#include <rmqt_credentials.h>
26#include <rmqt_endpoint.h>
27#include <rmqt_future.h>
28#include <rmqt_vhostinfo.h>
29
30#include <gmock/gmock.h>
31
32#include <bslma_managedptr.h>
33
34#include <bsl_memory.h>
35#include <bsl_string.h>
36
37namespace BloombergLP {
38namespace rmqtestmocks {
39
42
44 public:
45 // CREATORS
47 ~MockRabbitContext() BSLS_KEYWORD_OVERRIDE;
48
49 bsl::shared_ptr<rmqa::RabbitContext> context();
50
51 MOCK_METHOD3(createVHostConnection,
52 bsl::shared_ptr<rmqp::Connection>(
53 const bsl::string& userDefinedName,
54 const bsl::shared_ptr<rmqt::Endpoint>& endpoint,
55 const bsl::shared_ptr<rmqt::Credentials>& credentials));
56
57 MOCK_METHOD2(
59 bsl::shared_ptr<rmqp::Connection>(const bsl::string& userDefinedName,
60 const rmqt::VHostInfo& vhostInfo));
61
62 private:
63 MockRabbitContext(const MockRabbitContext&) BSLS_KEYWORD_DELETED;
64 MockRabbitContext& operator=(const MockRabbitContext&) BSLS_KEYWORD_DELETED;
65
66}; // class RabbitContext
67
68} // namespace rmqtestmocks
69} // namespace BloombergLP
70
71#endif // ! INCLUDED_RMQTESTMOCKS_MOCKRABBITCONTEXT
Interface for spawning RabbitMQ connections.
Definition: rmqp_rabbitcontext.h:40
virtual bsl::shared_ptr< Connection > createVHostConnection(const bsl::string &userDefinedName, const bsl::shared_ptr< rmqt::Endpoint > &endpoint, const bsl::shared_ptr< rmqt::Credentials > &credentials)=0
Connect to a RabbitMQ broker.
Holds the VHost endpoint and credentials, used to connect.
Definition: rmqt_vhostinfo.h:28
Mocks rmqp::RabbitContext and/or rmqa::RabbitContext.
Definition: rmqtestmocks_mockrabbitcontext.h:43