2#include <test/jtx/JSONRPCClient.h>
3#include <test/jtx/WSClient.h>
5#include <xrpld/core/ConfigSections.h>
7#include <xrpl/beast/unit_test.h>
8#include <xrpl/protocol/jss.h>
19 testcase <<
"Overload " << (useWS ?
"WS" :
"HTTP") <<
" RPC client";
22 cfg->loadFromString(
"[" SECTION_SIGNING_SUPPORT
"]\ntrue");
28 env.fund(
XRP(10000), alice, bob);
35 tx[jss::tx_json] =
pay(alice, bob,
XRP(1));
41 bool warned =
false, booted =
false;
42 for (
int i = 0; i < 500 && !booted; ++i)
44 auto jv = client->invoke(
"sign", tx);
50 else if (!(jv.isMember(jss::status) &&
51 (jv[jss::status] ==
"success")))
56 fail(
"", __FILE__, __LINE__);
59 if (jv.isMember(jss::warning))
60 warned = jv[jss::warning] == jss::load;
62 BEAST_EXPECT(warned && booted);
testcase_t testcase
Memberspace for declaring test cases.
void fail(String const &reason, char const *file, int line)
Record a failure.
void testOverload(bool useWS)
void run() override
Runs the suite.
Immutable cryptographic account descriptor.
A transaction testing environment.
Set the expected result code for a JTx The test will fail if the code doesn't match.
@ objectValue
object value (collection of name/value pairs).
std::unique_ptr< Config > no_admin(std::unique_ptr< Config >)
adjust config so no admin ports are enabled
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
XRP_t const XRP
Converts to XRP Issue or STAmount.
std::unique_ptr< WSClient > makeWSClient(Config const &cfg, bool v2, unsigned rpc_version, std::unordered_map< std::string, std::string > const &headers)
Returns a client operating through WebSockets/S.
std::unique_ptr< AbstractClient > makeJSONRPCClient(Config const &cfg, unsigned rpc_version)
Returns a client using JSON-RPC over HTTP/S.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.