use of com.hedera.services.bdd.spec.utilops.UtilOp in project hedera-services by hashgraph.
the class HapiSpecOperation method execFor.
public Optional<Throwable> execFor(HapiApiSpec spec) {
pauseIfRequested();
configureProtoStructureFor(spec);
try {
boolean hasCompleteLifecycle = submitOp(spec);
if (!(this instanceof UtilOp)) {
spec.incrementNumLedgerOps();
}
if (shouldRegisterTxn) {
registerTxnSubmitted(spec);
}
if (hasCompleteLifecycle) {
assertExpectationsGiven(spec);
updateStateOf(spec);
}
} catch (Throwable t) {
if (unavailableNode && t.getMessage().startsWith("UNAVAILABLE")) {
log.info("Node {} is unavailable as expected!", HapiPropertySource.asAccountString(node.get()));
return Optional.empty();
}
if (verboseLoggingOn) {
log.warn(spec.logPrefix() + this + " failed - {}", t);
} else if (!loggingOff) {
log.warn(spec.logPrefix() + this + " failed {}!", t.getMessage());
}
return Optional.of(t);
}
if (unavailableNode) {
String message = String.format("Node %s is NOT unavailable as expected!!!", HapiPropertySource.asAccountString(node.get()));
log.error(message);
return Optional.of(new RuntimeException(message));
}
return Optional.empty();
}
Aggregations