rippled
Loading...
Searching...
No Matches
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 <test/jtx/envconfig.h>
24
25#include <xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.grpc.pb.h>
26
27#include <grpcpp/grpcpp.h>
28
29namespace ripple {
30namespace test {
31
33{
34 explicit GRPCTestClientBase(std::string const& port)
35 : stub_(org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub(
36 grpc::CreateChannel(
37 beast::IP::Endpoint(
38 boost::asio::ip::make_address(getEnvLocalhostAddr()),
39 std::stoi(port))
40 .to_string(),
41 grpc::InsecureChannelCredentials())))
42 {
43 }
44
45 grpc::Status status;
46 grpc::ClientContext context;
48};
49
50} // namespace test
51} // namespace ripple
52#endif // RIPPLED_GRPCTESTCLIENTBASE_H
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition rpc.h:35
char const * getEnvLocalhostAddr()
Definition envconfig.h:36
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
STL namespace.
std::unique_ptr< org::xrpl::rpc::v1::XRPLedgerAPIService::Stub > stub_
GRPCTestClientBase(std::string const &port)