rippled
WSClient_test.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2016 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 #include <test/jtx/WSClient.h>
21 #include <test/jtx.h>
22 #include <ripple/beast/unit_test.h>
23 
24 namespace ripple {
25 namespace test {
26 
27 class WSClient_test : public beast::unit_test::suite
28 {
29 public:
30  void run() override
31  {
32  using namespace jtx;
33  Env env(*this);
34  auto wsc = makeWSClient(env.app().config());
35  {
36  Json::Value jv;
37  jv["streams"] = Json::arrayValue;
38  jv["streams"].append("ledger");
39  }
40  env.fund(XRP(10000), "alice");
41  env.close();
42  auto jv = wsc->getMsg(std::chrono::seconds(1));
43  pass();
44  }
45 };
46 
47 BEAST_DEFINE_TESTSUITE(WSClient,test,ripple);
48 
49 } // test
50 } // ripple
ripple::test::jtx::XRP
const XRP_t XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:109
ripple::test::WSClient_test::run
void run() override
Definition: WSClient_test.cpp:30
ripple::test::WSClient_test
Definition: WSClient_test.cpp:27
ripple::test::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountDelete, app, ripple)
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:44
std::chrono::seconds
ripple::test::jtx::Env::app
Application & app()
Definition: Env.h:237
Json::Value::append
Value & append(const Value &value)
Append value to array at the end.
Definition: json_value.cpp:907
ripple::Application::config
virtual Config & config()=0
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::Env::close
void close(NetClock::time_point closeTime, boost::optional< std::chrono::milliseconds > consensusDelay=boost::none)
Close and advance the ledger.
Definition: Env.cpp:114
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:214
ripple::test::makeWSClient
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.
Definition: WSClient.cpp:307
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:117
Json::Value
Represents a JSON value.
Definition: json_value.h:141