rippled
GRPCTestClientBase.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2020 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLED_GRPCTESTCLIENTBASE_H
21 #define RIPPLED_GRPCTESTCLIENTBASE_H
22 
23 #include <org/xrpl/rpc/v1/xrp_ledger.grpc.pb.h>
24 #include <test/jtx/envconfig.h>
25 
26 namespace ripple {
27 namespace test {
28 
30 {
31  explicit GRPCTestClientBase(std::string const& port)
32  : stub_(org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub(
33  grpc::CreateChannel(
34  beast::IP::Endpoint(
35  boost::asio::ip::make_address(getEnvLocalhostAddr()),
36  std::stoi(port))
37  .to_string(),
38  grpc::InsecureChannelCredentials())))
39  {
40  }
41 
42  grpc::Status status;
43  grpc::ClientContext context;
45 };
46 
47 } // namespace test
48 } // namespace ripple
49 #endif // RIPPLED_GRPCTESTCLIENTBASE_H
std::string
STL class.
ripple::test::GRPCTestClientBase::stub_
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > stub_
Definition: GRPCTestClientBase.h:44
boost
Definition: IPAddress.h:103
ripple::test::GRPCTestClientBase::status
grpc::Status status
Definition: GRPCTestClientBase.h:42
ripple::test::GRPCTestClientBase
Definition: GRPCTestClientBase.h:29
ripple::test::GRPCTestClientBase::GRPCTestClientBase
GRPCTestClientBase(std::string const &port)
Definition: GRPCTestClientBase.h:31
ripple::test::getEnvLocalhostAddr
const char * getEnvLocalhostAddr()
Definition: envconfig.h:31
ripple::test::GRPCTestClientBase::context
grpc::ClientContext context
Definition: GRPCTestClientBase.h:43
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
std
STL namespace.
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub >
beast
Definition: base_uint.h:641