use of com.hedera.services.bdd.spec.HapiApiSpec in project hedera-services by hashgraph.
the class SysDelSysUndelSpec method systemDeleteThenUndeleteRestoresContentsAndExpiry.
private HapiApiSpec systemDeleteThenUndeleteRestoresContentsAndExpiry() {
var now = Instant.now().getEpochSecond();
var lifetime = THREE_MONTHS_IN_SECONDS;
AtomicLong initExpiry = new AtomicLong();
return defaultHapiSpec("happyPathFlows").given(fileCreate("misc").lifetime(lifetime).contents(ORIG_FILE), UtilVerbs.withOpContext((spec, opLog) -> {
initExpiry.set(spec.registry().getTimestamp("misc").getSeconds());
})).when(systemFileDelete("misc").payingWith(SYSTEM_DELETE_ADMIN).fee(0L).updatingExpiry(now + lifetime - 1_000), getFileInfo("misc").nodePayment(1_234L).hasAnswerOnlyPrecheck(OK).hasDeleted(true), systemFileUndelete("misc").payingWith(SYSTEM_UNDELETE_ADMIN).fee(0L)).then(getFileContents("misc").hasContents(ignore -> ORIG_FILE), getFileInfo("misc").hasExpiry(initExpiry::get));
}
use of com.hedera.services.bdd.spec.HapiApiSpec in project hedera-services by hashgraph.
the class HapiTokenFreeze method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
var aId = TxnUtils.asId(account, spec);
var tId = TxnUtils.asTokenId(token, spec);
TokenFreezeAccountTransactionBody opBody = spec.txns().<TokenFreezeAccountTransactionBody, TokenFreezeAccountTransactionBody.Builder>body(TokenFreezeAccountTransactionBody.class, b -> {
b.setAccount(aId);
b.setToken(tId);
});
return b -> b.setTokenFreeze(opBody);
}
use of com.hedera.services.bdd.spec.HapiApiSpec in project hedera-services by hashgraph.
the class HapiTokenMint method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
var tId = TxnUtils.asTokenId(token, spec);
TokenMintTransactionBody opBody = spec.txns().<TokenMintTransactionBody, TokenMintTransactionBody.Builder>body(TokenMintTransactionBody.class, b -> {
b.setToken(tId);
b.setAmount(amount);
b.addAllMetadata(metadata);
});
return b -> b.setTokenMint(opBody);
}
use of com.hedera.services.bdd.spec.HapiApiSpec in project hedera-services by hashgraph.
the class HapiTokenPause method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(final HapiApiSpec spec) throws Throwable {
var tId = TxnUtils.asTokenId(token, spec);
TokenPauseTransactionBody opBody = spec.txns().<TokenPauseTransactionBody, TokenPauseTransactionBody.Builder>body(TokenPauseTransactionBody.class, b -> {
b.setToken(tId);
});
return b -> b.setTokenPause(opBody);
}
use of com.hedera.services.bdd.spec.HapiApiSpec in project hedera-services by hashgraph.
the class HapiTokenUnfreeze method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
var aId = TxnUtils.asId(account, spec);
var tId = TxnUtils.asTokenId(token, spec);
TokenUnfreezeAccountTransactionBody opBody = spec.txns().<TokenUnfreezeAccountTransactionBody, TokenUnfreezeAccountTransactionBody.Builder>body(TokenUnfreezeAccountTransactionBody.class, b -> {
b.setAccount(aId);
b.setToken(tId);
});
return b -> b.setTokenUnfreeze(opBody);
}
Aggregations