Inject Application (cont.)

This commit is contained in:
Vinnie Falco
2015-09-15 19:10:16 -04:00
committed by Edward Hennis
parent eed1a891a7
commit ffbcb96eff
98 changed files with 708 additions and 570 deletions

View File

@@ -318,7 +318,7 @@ public:
*/
template <class... Args>
void
require (Args const&... args) const
require (Args const&... args)
{
jtx::required(args...)(*this);
}

View File

@@ -68,7 +68,7 @@ public:
}
void
operator()(Env const&) const;
operator()(Env&) const;
};
} // jtx

View File

@@ -40,7 +40,7 @@ public:
}
void
operator()(Env const&, JTx& jtx) const;
operator()(Env&, JTx& jtx) const;
};
} // jtx

View File

@@ -58,7 +58,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -113,7 +113,7 @@ public:
}
void
operator()(Env const& env) const;
operator()(Env& env) const;
};
/** Match clear account flags */
@@ -132,7 +132,7 @@ public:
}
void
operator()(Env const& env) const;
operator()(Env& env) const;
};
} // jtx

View File

@@ -57,7 +57,7 @@ Env::Env (beast::unit_test::suite& test_)
KeyType::secp256k1,
generateSeed("masterpassphrase")))
, closed_ (std::make_shared<Ledger>(
create_genesis, config))
create_genesis, config, app().family()))
, cachedSLEs_ (std::chrono::seconds(5), stopwatch_)
, openLedger (closed_, config, cachedSLEs_, journal)
{
@@ -83,7 +83,8 @@ Env::close(NetClock::time_point const& closeTime)
clock.set(closeTime);
// VFALCO TODO Fix the Ledger constructor
auto next = std::make_shared<Ledger>(
open_ledger, *closed_);
open_ledger, *closed_,
app().timeKeeper().closeTime());
next->setClosed();
#if 0
// Build a SHAMap, put all the transactions

View File

@@ -25,7 +25,7 @@ namespace test {
namespace jtx {
void
balance::operator()(Env const& env) const
balance::operator()(Env& env) const
{
if (isXRP(value_.issue()))
{

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
delivermin::operator()(Env const& env, JTx& jt) const
delivermin::operator()(Env& env, JTx& jt) const
{
jt.jv[jss::DeliverMin] = amount_.getJson(0);
}

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
fee::operator()(Env const&, JTx& jt) const
fee::operator()(Env&, JTx& jt) const
{
if (! manual_)
return;

View File

@@ -40,7 +40,7 @@ fset (Account const& account,
}
void
flags::operator()(Env const& env) const
flags::operator()(Env& env) const
{
auto const sle = env.le(account_);
if (sle->isFieldPresent(sfFlags))
@@ -51,7 +51,7 @@ flags::operator()(Env const& env) const
}
void
nflags::operator()(Env const& env) const
nflags::operator()(Env& env) const
{
auto const sle = env.le(account_);
if (sle->isFieldPresent(sfFlags))

View File

@@ -42,7 +42,7 @@ json::json (Json::Value jv)
}
void
json::operator()(Env const&, JTx& jt) const
json::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
for (auto iter = jv_.begin();

View File

@@ -27,7 +27,7 @@ namespace test {
namespace jtx {
void
memo::operator()(Env const&, JTx& jt) const
memo::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -39,7 +39,7 @@ memo::operator()(Env const&, JTx& jt) const
}
void
memodata::operator()(Env const&, JTx& jt) const
memodata::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -49,7 +49,7 @@ memodata::operator()(Env const&, JTx& jt) const
}
void
memoformat::operator()(Env const&, JTx& jt) const
memoformat::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -59,7 +59,7 @@ memoformat::operator()(Env const&, JTx& jt) const
}
void
memotype::operator()(Env const&, JTx& jt) const
memotype::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -69,7 +69,7 @@ memotype::operator()(Env const&, JTx& jt) const
}
void
memondata::operator()(Env const&, JTx& jt) const
memondata::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -80,7 +80,7 @@ memondata::operator()(Env const&, JTx& jt) const
}
void
memonformat::operator()(Env const&, JTx& jt) const
memonformat::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];
@@ -91,7 +91,7 @@ memonformat::operator()(Env const&, JTx& jt) const
}
void
memontype::operator()(Env const&, JTx& jt) const
memontype::operator()(Env&, JTx& jt) const
{
auto& jv = jt.jv;
auto& ma = jv["Memos"];

View File

@@ -74,7 +74,7 @@ msig::msig (std::vector<msig::Reg> signers_)
}
void
msig::operator()(Env const& env, JTx& jt) const
msig::operator()(Env& env, JTx& jt) const
{
auto const mySigners = signers;
jt.signer = [mySigners, &env](Env&, JTx& jt)

View File

@@ -42,7 +42,7 @@ owned_count_of(ReadView const& view,
}
void
owned_count_helper(Env const& env,
owned_count_helper(Env& env,
AccountID const& id,
LedgerEntryType type,
std::uint32_t value)
@@ -54,7 +54,7 @@ owned_count_helper(Env const& env,
} // detail
void
owners::operator()(Env const& env) const
owners::operator()(Env& env) const
{
env.test.expect(env.le(
account_)->getFieldU32(sfOwnerCount) ==

View File

@@ -27,7 +27,7 @@ namespace test {
namespace jtx {
void
paths::operator()(Env const& env, JTx& jt) const
paths::operator()(Env& env, JTx& jt) const
{
auto& jv = jt.jv;
auto const from = env.lookup(
@@ -41,7 +41,7 @@ paths::operator()(Env const& env, JTx& jt) const
std::make_shared<RippleLineCache>(
env.open()), from, to,
in_, amount,
depth_, limit_, {}, fp);
depth_, limit_, {}, fp, env.app());
// VFALCO TODO API to allow caller to examine the STPathSet
// VFALCO isDefault should be renamed to empty()
if (found && ! found->isDefault())
@@ -80,7 +80,7 @@ path::append_one(BookSpec const& book)
}
void
path::operator()(Env const& env, JTx& jt) const
path::operator()(Env& env, JTx& jt) const
{
jt.jv["Paths"].append(jv_);
}

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
sendmax::operator()(Env const& env, JTx& jt) const
sendmax::operator()(Env& env, JTx& jt) const
{
jt.jv[jss::SendMax] = amount_.getJson(0);
}

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
seq::operator()(Env const&, JTx& jt) const
seq::operator()(Env&, JTx& jt) const
{
if (! manual_)
return;

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
sig::operator()(Env const&, JTx& jt) const
sig::operator()(Env&, JTx& jt) const
{
if (! manual_)
return;

View File

@@ -26,13 +26,13 @@ namespace test {
namespace jtx {
void
dtag::operator()(Env const&, JTx& jt) const
dtag::operator()(Env&, JTx& jt) const
{
jt.jv["DestinationTag"] = value_;
}
void
stag::operator()(Env const&, JTx& jt) const
stag::operator()(Env&, JTx& jt) const
{
jt.jv["SourceTag"] = value_;
}

View File

@@ -26,7 +26,7 @@ namespace test {
namespace jtx {
void
txflags::operator()(Env const&, JTx& jt) const
txflags::operator()(Env&, JTx& jt) const
{
jt[jss::Flags] =
v_ /*| tfUniversal*/;

View File

@@ -50,7 +50,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -50,7 +50,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memodata
@@ -65,7 +65,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memoformat
@@ -80,7 +80,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memotype
@@ -95,7 +95,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memondata
@@ -113,7 +113,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memonformat
@@ -131,7 +131,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
class memontype
@@ -149,7 +149,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -104,7 +104,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
private:
template <class AccountType>

View File

@@ -38,7 +38,7 @@ owned_count_of (ReadView const& view,
LedgerEntryType type);
void
owned_count_helper(Env const& env,
owned_count_helper(Env& env,
AccountID const& id,
LedgerEntryType type,
std::uint32_t value);
@@ -62,7 +62,7 @@ public:
}
void
operator()(Env const& env) const
operator()(Env& env) const
{
detail::owned_count_helper(
env, account_.id(), Type, value_);
@@ -84,7 +84,7 @@ public:
}
void
operator()(Env const& env) const;
operator()(Env& env) const;
};
/** Match the number of trust lines in the account's owner directory */

View File

@@ -46,7 +46,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
//------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ public:
path (T const& t, Args const&... args);
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
private:
Json::Value&

View File

@@ -43,7 +43,7 @@ struct prop
}
void
operator()(Env const& env, JTx& jt) const
operator()(Env& env, JTx& jt) const
{
jt.set(p_->clone());
}

View File

@@ -55,7 +55,7 @@ required (Args const&... args)
{
requires_t vec;
detail::require_args(vec, args...);
return [vec](Env const& env)
return [vec](Env& env)
{
for(auto const& f : vec)
f(env);
@@ -81,7 +81,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const
operator()(Env&, JTx& jt) const
{
jt.requires.emplace_back(cond_);
}

View File

@@ -29,7 +29,7 @@ namespace jtx {
class Env;
using require_t = std::function<void(Env const&)>;
using require_t = std::function<void(Env&)>;
using requires_t = std::vector<require_t>;
} // jtx

View File

@@ -40,7 +40,7 @@ public:
}
void
operator()(Env const&, JTx& jtx) const;
operator()(Env&, JTx& jtx) const;
};
} // jtx

View File

@@ -54,7 +54,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -55,7 +55,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -41,7 +41,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
/** Set the source tag on a JTx*/
@@ -58,7 +58,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx

View File

@@ -42,7 +42,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const
operator()(Env&, JTx& jt) const
{
jt.ter = v_;
}

View File

@@ -40,7 +40,7 @@ public:
}
void
operator()(Env const&, JTx& jt) const;
operator()(Env&, JTx& jt) const;
};
} // jtx