Search in sources :

Example 1 with SysFilesUpScenario

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

the class ValidationScenarios method sysFilesUp.

private static HapiApiSpec sysFilesUp() {
    ensureScenarios();
    if (scenarios.getSysFilesUp() == null) {
        scenarios.setSysFilesUp(new SysFilesUpScenario());
    }
    var sys = scenarios.getSysFilesUp();
    long[] payers = sys.getUpdates().stream().mapToLong(UpdateAction::getPayer).toArray();
    try {
        return customHapiSpec("SysFilesUp").withProperties(Map.of("nodes", nodes(), "default.payer", primaryPayer(), "default.node", defaultNode(), "fees.useFixedOffer", "true", "fees.fixedOffer", "" + FEE_TO_OFFER, "startupAccounts.literal", payerKeystoreLiteral())).given(LongStream.of(payers).mapToObj(payer -> keyFromPem(() -> pemForAccount(payer)).name(String.format("payer%d", payer)).passphrase(passphraseFor(payer)).linkedTo(() -> String.format("0.0.%d", payer))).toArray(HapiSpecOperation[]::new)).when().then(sys.getUpdates().stream().map(action -> updateLargeFile(String.format("payer%d", action.getPayer()), String.format("0.0.%d", action.getNum()), appropriateContents(action.getNum()), true, OptionalLong.of(10_000_000_000L))).toArray(HapiSpecOperation[]::new));
    } catch (Exception e) {
        log.warn("Unable to initialize system file update scenario, skipping it!", e);
        errorsOccurred.set(true);
        return null;
    }
}
Also used : HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) SysFilesUpScenario(com.hedera.services.bdd.suites.utils.validation.domain.SysFilesUpScenario) KeyStoreException(java.security.KeyStoreException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) IOException(java.io.IOException)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 HapiSpecOperation (com.hedera.services.bdd.spec.HapiSpecOperation)1 SysFilesUpScenario (com.hedera.services.bdd.suites.utils.validation.domain.SysFilesUpScenario)1 IOException (java.io.IOException)1 KeyStoreException (java.security.KeyStoreException)1