Search in sources :

Example 1 with ConsensusScenario

use of com.hedera.services.bdd.suites.utils.validation.domain.ConsensusScenario in project hedera-services by hashgraph.

the class ValidationScenarios method consensusScenario.

private static HapiApiSpec consensusScenario() {
    try {
        ensureScenarios();
        if (scenarios.getConsensus() == null) {
            scenarios.setConsensus(new ConsensusScenario());
        }
        var consensus = scenarios.getConsensus();
        var expectedSeqNo = new AtomicLong(0);
        return customHapiSpec("ConsensusScenario").withProperties(Map.of("nodes", nodes(), "default.payer", primaryPayer(), "default.node", defaultNode(), "fees.useFixedOffer", "true", "fees.fixedOffer", "" + FEE_TO_OFFER, "startupAccounts.literal", payerKeystoreLiteral())).given(keyFromPem(() -> pemForAccount(targetNetwork().getScenarioPayer())).name(SCENARIO_PAYER_NAME).linkedTo(() -> String.format("0.0.%d", targetNetwork().getScenarioPayer())), ensureValidatedTopicExistence(PERSISTENT_TOPIC_NAME, pemForTopic(persistentTopicOrNegativeOne(consensus).getAsLong()), persistentTopicOrNegativeOne(consensus), consensus::setPersistent, expectedSeqNo)).when(flattened(submitMessageTo(PERSISTENT_TOPIC_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).message("The particular is pounded till it is man."), novelTopicIfDesired())).then(getTopicInfo(PERSISTENT_TOPIC_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).hasSeqNo(expectedSeqNo::get).logged());
    } catch (Exception e) {
        log.warn("Unable to initialize consensus scenario, skipping it!", e);
        errorsOccurred.set(true);
        return null;
    }
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) ConsensusScenario(com.hedera.services.bdd.suites.utils.validation.domain.ConsensusScenario) KeyStoreException(java.security.KeyStoreException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) IOException(java.io.IOException)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ConsensusScenario (com.hedera.services.bdd.suites.utils.validation.domain.ConsensusScenario)1 IOException (java.io.IOException)1 KeyStoreException (java.security.KeyStoreException)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1