Search in sources :

Example 1 with RegistryNotFound

use of com.hedera.services.bdd.spec.infrastructure.RegistryNotFound in project hedera-services by hashgraph.

the class HapiScheduleSign method opBodyDef.

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
    ScheduleSignTransactionBody opBody = spec.txns().<ScheduleSignTransactionBody, ScheduleSignTransactionBody.Builder>body(ScheduleSignTransactionBody.class, b -> {
        ScheduleID id;
        try {
            id = asScheduleId(schedule, spec);
            b.setScheduleID(id);
        } catch (RegistryNotFound e) {
            if (!ignoreMissing) {
                throw e;
            }
        }
    });
    return b -> b.setScheduleSign(opBody);
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) ScheduleID(com.hederahashgraph.api.proto.java.ScheduleID) TxnUtils.asScheduleId(com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId) ScheduleSign(com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) MoreObjects(com.google.common.base.MoreObjects) HapiScheduleCreate.correspondingScheduledTxnId(com.hedera.services.bdd.spec.transactions.schedule.HapiScheduleCreate.correspondingScheduledTxnId) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) Function(java.util.function.Function) ScheduleSignTransactionBody(com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) Key(com.hederahashgraph.api.proto.java.Key) List(java.util.List) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) TxnUtils.suFrom(com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom) FeeCalculator(com.hedera.services.bdd.spec.fees.FeeCalculator) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) ScheduleInfo(com.hederahashgraph.api.proto.java.ScheduleInfo) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) Collections(java.util.Collections) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) ScheduleSignTransactionBody(com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody) ScheduleID(com.hederahashgraph.api.proto.java.ScheduleID)

Example 2 with RegistryNotFound

use of com.hedera.services.bdd.spec.infrastructure.RegistryNotFound in project hedera-services by hashgraph.

the class ParallelSpecOps method submitOp.

@Override
protected boolean submitOp(HapiApiSpec spec) throws Throwable {
    Map<String, Throwable> subErrors = new HashMap<>();
    CompletableFuture future = CompletableFuture.allOf(Stream.of(subs).map(op -> CompletableFuture.runAsync(() -> op.execFor(spec).map(t -> subErrors.put(op.toString(), t)))).toArray(n -> new CompletableFuture[n]));
    future.join();
    if (subErrors.size() > 0) {
        String errMessages = subErrors.entrySet().stream().filter(e -> !(e.getValue() instanceof RegistryNotFound)).peek(e -> e.getValue().printStackTrace()).map(e -> e.getKey() + " :: " + e.getValue().getMessage()).collect(joining(", "));
        if (errMessages.length() > 0) {
            log.error("Problem(s) with sub-operation(s): {}", errMessages);
        }
    }
    return false;
}
Also used : Logger(org.apache.logging.log4j.Logger) Stream(java.util.stream.Stream) Map(java.util.Map) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) MoreObjects(com.google.common.base.MoreObjects) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) Collectors.joining(java.util.stream.Collectors.joining) UtilOp(com.hedera.services.bdd.spec.utilops.UtilOp) CompletableFuture(java.util.concurrent.CompletableFuture) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) HashMap(java.util.HashMap)

Aggregations

MoreObjects (com.google.common.base.MoreObjects)2 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)2 RegistryNotFound (com.hedera.services.bdd.spec.infrastructure.RegistryNotFound)2 HapiSpecOperation (com.hedera.services.bdd.spec.HapiSpecOperation)1 FeeCalculator (com.hedera.services.bdd.spec.fees.FeeCalculator)1 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)1 TxnUtils.asScheduleId (com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId)1 TxnUtils.suFrom (com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom)1 HapiScheduleCreate.correspondingScheduledTxnId (com.hedera.services.bdd.spec.transactions.schedule.HapiScheduleCreate.correspondingScheduledTxnId)1 UtilOp (com.hedera.services.bdd.spec.utilops.UtilOp)1 HapiApiSuite (com.hedera.services.bdd.suites.HapiApiSuite)1 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)1 ScheduleSign (com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign)1 Key (com.hederahashgraph.api.proto.java.Key)1 SUCCESS (com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS)1 ScheduleID (com.hederahashgraph.api.proto.java.ScheduleID)1 ScheduleInfo (com.hederahashgraph.api.proto.java.ScheduleInfo)1 ScheduleSignTransactionBody (com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody)1 Transaction (com.hederahashgraph.api.proto.java.Transaction)1 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)1