Search in sources :

Example 16 with HapiSpecOperation

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

the class UtilVerbs method updateSpecialFile.

public static HapiSpecOperation updateSpecialFile(final String payer, final String fileName, final ByteString contents, final int bytesPerOp, final int appendsPerBurst) {
    return withOpContext((spec, opLog) -> {
        final var bytesToUpload = contents.size();
        final var bytesToAppend = bytesToUpload - bytesPerOp;
        final var appendsRequired = bytesToAppend / bytesPerOp + Math.min(1, bytesToAppend % bytesPerOp);
        COMMON_MESSAGES.info("Beginning update for " + fileName + " (" + appendsRequired + " appends required)");
        final var numBursts = appendsRequired / appendsPerBurst + Math.min(1, appendsRequired % appendsPerBurst);
        int position = Math.min(bytesPerOp, bytesToUpload);
        final var updateSubOp = fileUpdate(fileName).fee(ONE_HUNDRED_HBARS).contents(contents.substring(0, position)).alertingPre(fid -> COMMON_MESSAGES.info("Submitting initial update for file 0.0." + fid.getFileNum())).alertingPost(code -> COMMON_MESSAGES.info("Finished initial update with " + code)).noLogging().payingWith(payer).signedBy(payer);
        allRunFor(spec, updateSubOp);
        final AtomicInteger burstNo = new AtomicInteger(1);
        while (position < bytesToUpload) {
            final var totalBytesLeft = bytesToUpload - position;
            final var appendsLeft = totalBytesLeft / bytesPerOp + Math.min(1, totalBytesLeft % bytesPerOp);
            final var appendsHere = new AtomicInteger(Math.min(appendsPerBurst, appendsLeft));
            boolean isFirstAppend = true;
            final List<HapiSpecOperation> theBurst = new ArrayList<>();
            final CountDownLatch burstLatch = new CountDownLatch(1);
            final AtomicReference<Instant> burstStart = new AtomicReference<>();
            while (appendsHere.getAndDecrement() >= 0) {
                final var bytesLeft = bytesToUpload - position;
                final var bytesThisAppend = Math.min(bytesLeft, bytesPerOp);
                final var newPosition = position + bytesThisAppend;
                final var appendSubOp = fileAppend(fileName).content(contents.substring(position, newPosition).toByteArray()).fee(ONE_HUNDRED_HBARS).noLogging().payingWith(payer).signedBy(payer).deferStatusResolution();
                if (isFirstAppend) {
                    final var fixedBurstNo = burstNo.get();
                    final var fixedAppendsHere = appendsHere.get() + 1;
                    appendSubOp.alertingPre(fid -> {
                        burstStart.set(Instant.now());
                        COMMON_MESSAGES.info("Starting burst " + fixedBurstNo + "/" + numBursts + " (" + fixedAppendsHere + " ops)");
                    });
                    isFirstAppend = false;
                }
                if (appendsHere.get() < 0) {
                    final var fixedBurstNo = burstNo.get();
                    appendSubOp.alertingPost(code -> {
                        final var burstSecs = Duration.between(burstStart.get(), Instant.now()).getSeconds();
                        COMMON_MESSAGES.info("Completed burst #" + fixedBurstNo + "/" + numBursts + " in " + burstSecs + "s with " + code);
                        burstLatch.countDown();
                    });
                }
                theBurst.add(appendSubOp);
                position = newPosition;
            }
            allRunFor(spec, theBurst);
            burstLatch.await();
            burstNo.getAndIncrement();
        }
    });
}
Also used : FeesJsonToGrpcBytes(com.hedera.services.bdd.suites.utils.sysfiles.serdes.FeesJsonToGrpcBytes) TxnUtils.asTransactionID(com.hedera.services.bdd.spec.transactions.TxnUtils.asTransactionID) COMMON_MESSAGES(com.hedera.services.yahcli.output.CommonMessages.COMMON_MESSAGES) PerfTestLoadSettings(com.hedera.services.bdd.suites.perf.PerfTestLoadSettings) HapiGetTxnRecord(com.hedera.services.bdd.spec.queries.meta.HapiGetTxnRecord) ParallelSpecOps(com.hedera.services.bdd.spec.utilops.grouping.ParallelSpecOps) VerifyGetLiveHashNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetLiveHashNotSupported) CryptoTransferSuite(com.hedera.services.bdd.suites.crypto.CryptoTransferSuite) RecordStreamVerification(com.hedera.services.bdd.spec.utilops.streams.RecordStreamVerification) Duration(java.time.Duration) Map(java.util.Map) HapiCryptoTransfer.tinyBarsFromTo(com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer.tinyBarsFromTo) HapiPropertySource.asAccount(com.hedera.services.bdd.spec.HapiPropertySource.asAccount) Set(java.util.Set) SpecKeyFromPem(com.hedera.services.bdd.spec.utilops.inventory.SpecKeyFromPem) TxnVerbs.submitMessageTo(com.hedera.services.bdd.spec.transactions.TxnVerbs.submitMessageTo) TransactionRecordAsserts.recordWith(com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) FREEZE_ONLY(com.hederahashgraph.api.proto.java.FreezeType.FREEZE_ONLY) CountDownLatch(java.util.concurrent.CountDownLatch) AccountAmount(com.hederahashgraph.api.proto.java.AccountAmount) Stream(java.util.stream.Stream) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) TxnVerbs.tokenDissociate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenDissociate) BUSY(com.hederahashgraph.api.proto.java.ResponseCodeEnum.BUSY) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) PLATFORM_TRANSACTION_NOT_CREATED(com.hederahashgraph.api.proto.java.ResponseCodeEnum.PLATFORM_TRANSACTION_NOT_CREATED) FeeSchedule(com.hederahashgraph.api.proto.java.FeeSchedule) SpecKeyFromMnemonic(com.hedera.services.bdd.spec.utilops.inventory.SpecKeyFromMnemonic) ByteArrayOutputStream(java.io.ByteArrayOutputStream) HapiFileCreate(com.hedera.services.bdd.spec.transactions.file.HapiFileCreate) SequentialID(com.hedera.services.bdd.spec.assertions.SequentialID) ObjIntConsumer(java.util.function.ObjIntConsumer) Supplier(java.util.function.Supplier) Setting(com.hederahashgraph.api.proto.java.Setting) ArrayList(java.util.ArrayList) NewSpecKey(com.hedera.services.bdd.spec.utilops.inventory.NewSpecKey) OptionalLong(java.util.OptionalLong) NodeLivenessTimeout(com.hedera.services.bdd.spec.utilops.pauses.NodeLivenessTimeout) StartThroughputObs(com.hedera.services.bdd.spec.utilops.throughput.StartThroughputObs) DUPLICATE_TRANSACTION(com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION) RecordSystemProperty(com.hedera.services.bdd.spec.utilops.inventory.RecordSystemProperty) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) AccountID(com.hederahashgraph.api.proto.java.AccountID) HapiPropertySource.asAccountString(com.hedera.services.bdd.spec.HapiPropertySource.asAccountString) Properties(java.util.Properties) SysFileSerde(com.hedera.services.bdd.suites.utils.sysfiles.serdes.SysFileSerde) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Files(java.nio.file.Files) ADDRESS_BOOK_CONTROL(com.hedera.services.bdd.suites.HapiApiSuite.ADDRESS_BOOK_CONTROL) IOException(java.io.IOException) HapiPropertySource(com.hedera.services.bdd.spec.HapiPropertySource) CustomSpecAssert.allRunFor(com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor) SpecKeyFromMutation(com.hedera.services.bdd.spec.utilops.inventory.SpecKeyFromMutation) SpecKeyFromLiteral(com.hedera.services.bdd.spec.utilops.inventory.SpecKeyFromLiteral) AtomicLong(java.util.concurrent.atomic.AtomicLong) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) TokenID(com.hederahashgraph.api.proto.java.TokenID) HapiMessageSubmit(com.hedera.services.bdd.spec.transactions.consensus.HapiMessageSubmit) Paths(java.nio.file.Paths) Utils.asAddress(com.hedera.services.bdd.suites.contract.Utils.asAddress) FinishThroughputObs(com.hedera.services.bdd.spec.utilops.throughput.FinishThroughputObs) ContractInfoAsserts.contractWith(com.hedera.services.bdd.spec.assertions.ContractInfoAsserts.contractWith) FREEZE_ABORT(com.hederahashgraph.api.proto.java.FreezeType.FREEZE_ABORT) System.arraycopy(java.lang.System.arraycopy) HapiSpecWaitUntil(com.hedera.services.bdd.spec.utilops.pauses.HapiSpecWaitUntil) EXCHANGE_RATE_CONTROL(com.hedera.services.bdd.suites.HapiApiSuite.EXCHANGE_RATE_CONTROL) TxnVerbs.cryptoTransfer(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer) VerifyGetFastRecordNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetFastRecordNotSupported) QueryVerbs.getContractInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getContractInfo) ContractID(com.hederahashgraph.api.proto.java.ContractID) QueryVerbs.getTxnRecord(com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord) TxnUtils.asId(com.hedera.services.bdd.spec.transactions.TxnUtils.asId) VerifyGetTokenNftInfosNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetTokenNftInfosNotSupported) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) VerifyGetAccountNftInfosNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetAccountNftInfosNotSupported) OpProvider(com.hedera.services.bdd.spec.infrastructure.OpProvider) ParseException(java.text.ParseException) HapiSpecSleep(com.hedera.services.bdd.spec.utilops.pauses.HapiSpecSleep) APP_PROPERTIES(com.hedera.services.bdd.suites.HapiApiSuite.APP_PROPERTIES) GENESIS(com.hedera.services.bdd.suites.HapiApiSuite.GENESIS) NewSpecKeyList(com.hedera.services.bdd.spec.utilops.inventory.NewSpecKeyList) CurrentAndNextFeeSchedule(com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule) UsableTxnId(com.hedera.services.bdd.spec.utilops.inventory.UsableTxnId) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ONE_HBAR(com.hedera.services.bdd.suites.HapiApiSuite.ONE_HBAR) ByteString(com.google.protobuf.ByteString) List(java.util.List) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) FREEZE_UPGRADE(com.hederahashgraph.api.proto.java.FreezeType.FREEZE_UPGRADE) Optional(java.util.Optional) PREPARE_UPGRADE(com.hederahashgraph.api.proto.java.FreezeType.PREPARE_UPGRADE) VerifyGetStakersNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetStakersNotSupported) HapiCryptoTransfer(com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer) HapiFileUpdate(com.hedera.services.bdd.spec.transactions.file.HapiFileUpdate) BYTES_4K(com.hedera.services.bdd.spec.transactions.TxnUtils.BYTES_4K) ONE_HUNDRED_HBARS(com.hedera.services.bdd.suites.HapiApiSuite.ONE_HUNDRED_HBARS) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) INSUFFICIENT_PAYER_BALANCE(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INSUFFICIENT_PAYER_BALANCE) HashMap(java.util.HashMap) TxnVerbs.fileUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileUpdate) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) Tuple(com.esaulpaugh.headlong.abi.Tuple) InBlockingOrder(com.hedera.services.bdd.spec.utilops.grouping.InBlockingOrder) TokenMovement.moving(com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) TxnVerbs.fileAppend(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileAppend) HCSChunkingRealisticPerfSuite(com.hedera.services.bdd.suites.perf.topic.HCSChunkingRealisticPerfSuite) VerifyGetBySolidityIdNotSupported(com.hedera.services.bdd.spec.utilops.checks.VerifyGetBySolidityIdNotSupported) QueryVerbs.getFileContents(com.hedera.services.bdd.spec.queries.QueryVerbs.getFileContents) SpecKeyFromFile(com.hedera.services.bdd.spec.utilops.inventory.SpecKeyFromFile) FEE_SCHEDULE_FILE_PART_UPLOADED(com.hederahashgraph.api.proto.java.ResponseCodeEnum.FEE_SCHEDULE_FILE_PART_UPLOADED) HapiFileAppend(com.hedera.services.bdd.spec.transactions.file.HapiFileAppend) HapiFreeze(com.hedera.services.bdd.spec.transactions.system.HapiFreeze) TELEMETRY_UPGRADE(com.hederahashgraph.api.proto.java.FreezeType.TELEMETRY_UPGRADE) FeeData(com.hederahashgraph.api.proto.java.FeeData) FileInputStream(java.io.FileInputStream) QueryVerbs.getAccountBalance(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance) Consumer(java.util.function.Consumer) AbstractMap(java.util.AbstractMap) FEE_SCHEDULE(com.hedera.services.bdd.suites.HapiApiSuite.FEE_SCHEDULE) Assertions(org.junit.jupiter.api.Assertions) TransactionRecordAsserts(com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts) Collections(java.util.Collections) InputStream(java.io.InputStream) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Instant(java.time.Instant) ArrayList(java.util.ArrayList) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 17 with HapiSpecOperation

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

the class UtilVerbs method updateLargeFile.

public static HapiSpecOperation updateLargeFile(String payer, String fileName, ByteString byteString, boolean signOnlyWithPayer, OptionalLong tinyBarsToOffer, Consumer<HapiFileUpdate> updateCustomizer, ObjIntConsumer<HapiFileAppend> appendCustomizer) {
    return withOpContext((spec, ctxLog) -> {
        List<HapiSpecOperation> opsList = new ArrayList<>();
        int fileSize = byteString.size();
        int position = Math.min(BYTES_4K, fileSize);
        HapiFileUpdate updateSubOp = fileUpdate(fileName).contents(byteString.substring(0, position)).hasKnownStatusFrom(SUCCESS, FEE_SCHEDULE_FILE_PART_UPLOADED).noLogging().payingWith(payer);
        updateCustomizer.accept(updateSubOp);
        if (tinyBarsToOffer.isPresent()) {
            updateSubOp = updateSubOp.fee(tinyBarsToOffer.getAsLong());
        }
        if (signOnlyWithPayer) {
            updateSubOp = updateSubOp.signedBy(payer);
        }
        opsList.add(updateSubOp);
        final int bytesLeft = fileSize - position;
        final int totalAppendsRequired = bytesLeft / BYTES_4K + Math.min(1, bytesLeft % BYTES_4K);
        int numAppends = 0;
        while (position < fileSize) {
            int newPosition = Math.min(fileSize, position + BYTES_4K);
            var appendSubOp = fileAppend(fileName).content(byteString.substring(position, newPosition).toByteArray()).hasKnownStatusFrom(SUCCESS, FEE_SCHEDULE_FILE_PART_UPLOADED).noLogging().payingWith(payer);
            appendCustomizer.accept(appendSubOp, totalAppendsRequired - numAppends);
            if (tinyBarsToOffer.isPresent()) {
                appendSubOp = appendSubOp.fee(tinyBarsToOffer.getAsLong());
            }
            if (signOnlyWithPayer) {
                appendSubOp = appendSubOp.signedBy(payer);
            }
            opsList.add(appendSubOp);
            position = newPosition;
            numAppends++;
        }
        CustomSpecAssert.allRunFor(spec, opsList);
    });
}
Also used : ArrayList(java.util.ArrayList) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) HapiFileUpdate(com.hedera.services.bdd.spec.transactions.file.HapiFileUpdate)

Example 18 with HapiSpecOperation

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

the class UtilVerbs method contractListWithPropertiesInheritedFrom.

public static HapiSpecOperation contractListWithPropertiesInheritedFrom(final String contractList, final long expectedSize, final String parent) {
    return withOpContext((spec, ctxLog) -> {
        List<HapiSpecOperation> opsList = new ArrayList<HapiSpecOperation>();
        long contractListSize = spec.registry().getAmount(contractList + "Size");
        Assertions.assertEquals(expectedSize, contractListSize, contractList + " has bad size!");
        if (contractListSize > 1) {
            ContractID currentID = spec.registry().getContractId(contractList + "0");
            long nextIndex = 1;
            while (nextIndex < contractListSize) {
                ContractID nextID = spec.registry().getContractId(contractList + nextIndex);
                Assertions.assertEquals(currentID.getShardNum(), nextID.getShardNum());
                Assertions.assertEquals(currentID.getRealmNum(), nextID.getRealmNum());
                Assertions.assertTrue(currentID.getContractNum() < nextID.getContractNum());
                currentID = nextID;
                nextIndex++;
            }
        }
        for (long i = 0; i < contractListSize; i++) {
            HapiSpecOperation op = getContractInfo(contractList + i).has(contractWith().propertiesInheritedFrom(parent)).logged();
            opsList.add(op);
        }
        CustomSpecAssert.allRunFor(spec, opsList);
    });
}
Also used : ArrayList(java.util.ArrayList) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) ContractID(com.hederahashgraph.api.proto.java.ContractID)

Example 19 with HapiSpecOperation

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

the class ProviderRun method submitOp.

@Override
protected boolean submitOp(HapiApiSpec spec) {
    int MAX_N = Runtime.getRuntime().availableProcessors();
    int MAX_OPS_PER_SEC = maxOpsPerSecSupplier.getAsInt();
    int MAX_PENDING_OPS = maxPendingOpsSupplier.getAsInt();
    int BACKOFF_SLEEP_SECS = backoffSleepSecsSupplier.getAsInt();
    long duration = durationSupplier.getAsLong();
    OpProvider provider = providerFn.apply(spec);
    allRunFor(spec, provider.suggestedInitializers().toArray(new HapiSpecOperation[0]));
    log.info("Finished initialization for provider run...");
    TimeUnit unit = unitSupplier.get();
    Stopwatch stopwatch = Stopwatch.createStarted();
    final var remainingOpsToSubmit = new AtomicInteger(totalOpsToSubmit.getAsInt());
    final boolean fixedOpSubmission = (remainingOpsToSubmit.get() < 0) ? false : true;
    int submittedSoFar = 0;
    long durationMs = unit.toMillis(duration);
    long logIncrementMs = durationMs / 100;
    long nextLogTargetMs = logIncrementMs;
    long lastDeltaLogged = -1;
    final var opsThisSecond = new AtomicInteger(0);
    final var submissionBoundaryMs = new AtomicLong(stopwatch.elapsed(MILLISECONDS) + 1_000);
    while (stopwatch.elapsed(unit) < duration) {
        long elapsedMs = stopwatch.elapsed(MILLISECONDS);
        if (elapsedMs > submissionBoundaryMs.get()) {
            submissionBoundaryMs.getAndAdd(1_000);
            opsThisSecond.set(0);
        }
        int numPending = spec.numPendingOps();
        if (elapsedMs > nextLogTargetMs) {
            nextLogTargetMs += logIncrementMs;
            long delta = duration - stopwatch.elapsed(unit);
            if (delta != lastDeltaLogged) {
                log.info(delta + " " + unit.toString().toLowerCase() + (fixedOpSubmission ? (" or " + remainingOpsToSubmit + " ops ") : "") + " left in test - " + submittedSoFar + " ops submitted so far (" + numPending + " pending).");
                log.info("Precheck txn status counts :: " + spec.precheckStatusCounts());
                log.info("Resolved txn status counts :: " + spec.finalizedStatusCounts());
                log.info("\n------------------------------\n");
                lastDeltaLogged = delta;
            }
        }
        if (fixedOpSubmission && remainingOpsToSubmit.get() <= 0) {
            if (numPending > 0) {
                continue;
            }
            log.info("Finished submission of total {} operations", totalOpsToSubmit.getAsInt());
            break;
        }
        if (numPending < MAX_PENDING_OPS) {
            HapiSpecOperation[] burst = IntStream.range(0, Math.min(MAX_N, fixedOpSubmission ? Math.min(remainingOpsToSubmit.get(), MAX_OPS_PER_SEC - opsThisSecond.get()) : MAX_OPS_PER_SEC - opsThisSecond.get())).mapToObj(ignore -> provider.get()).flatMap(Optional::stream).peek(op -> counts.get(op.type()).getAndIncrement()).toArray(HapiSpecOperation[]::new);
            if (burst.length > 0) {
                allRunFor(spec, inParallel(burst));
                submittedSoFar += burst.length;
                if (fixedOpSubmission) {
                    remainingOpsToSubmit.getAndAdd(-burst.length);
                }
                opsThisSecond.getAndAdd(burst.length);
            }
        } else {
            log.warn("Now " + numPending + " ops pending; backing off for " + BACKOFF_SLEEP_SECS + "s!");
            try {
                Thread.sleep(BACKOFF_SLEEP_SECS * 1_000L);
            } catch (InterruptedException ignore) {
            }
        }
    }
    Map<HederaFunctionality, Integer> finalCounts = counts.entrySet().stream().filter(entry -> entry.getValue().get() > 0).collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get()));
    log.info("Final breakdown of *provided* ops: " + finalCounts);
    log.info("Final breakdown of *resolved* statuses: " + spec.finalizedStatusCounts());
    return false;
}
Also used : IntStream(java.util.stream.IntStream) LongSupplier(java.util.function.LongSupplier) Stopwatch(com.google.common.base.Stopwatch) HashMap(java.util.HashMap) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Collectors(java.util.stream.Collectors) CustomSpecAssert.allRunFor(com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) Logger(org.apache.logging.log4j.Logger) Stream(java.util.stream.Stream) UtilVerbs.inParallel(com.hedera.services.bdd.spec.utilops.UtilVerbs.inParallel) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) Map(java.util.Map) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) Optional(java.util.Optional) OpProvider(com.hedera.services.bdd.spec.infrastructure.OpProvider) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) IntSupplier(java.util.function.IntSupplier) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) Optional(java.util.Optional) Stopwatch(com.google.common.base.Stopwatch) OpProvider(com.hedera.services.bdd.spec.infrastructure.OpProvider) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AtomicLong(java.util.concurrent.atomic.AtomicLong) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) TimeUnit(java.util.concurrent.TimeUnit) HashMap(java.util.HashMap) Map(java.util.Map)

Example 20 with HapiSpecOperation

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

the class CreateFilesBeforeReconnect method runCreateFiles.

private HapiApiSpec runCreateFiles() {
    PerfTestLoadSettings settings = new PerfTestLoadSettings(FILE_CREATION_RECONNECT_TPS, DEFAULT_MINS_FOR_RECONNECT_TESTS, DEFAULT_THREADS_FOR_RECONNECT_TESTS);
    Supplier<HapiSpecOperation[]> createBurst = () -> new HapiSpecOperation[] { generateFileCreateOperation() };
    return defaultHapiSpec("RunCreateFiles").given(logIt(ignore -> settings.toString())).when().then(defaultLoadTest(createBurst, settings));
}
Also used : UtilVerbs.logIt(com.hedera.services.bdd.spec.utilops.UtilVerbs.logIt) PerfTestLoadSettings(com.hedera.services.bdd.suites.perf.PerfTestLoadSettings) Supplier(java.util.function.Supplier) DEFAULT_THREADS_FOR_RECONNECT_TESTS(com.hedera.services.bdd.suites.reconnect.CreateAccountsBeforeReconnect.DEFAULT_THREADS_FOR_RECONNECT_TESTS) LoadTest.defaultLoadTest(com.hedera.services.bdd.spec.utilops.LoadTest.defaultLoadTest) UtilVerbs.noOp(com.hedera.services.bdd.spec.utilops.UtilVerbs.noOp) List(java.util.List) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) Logger(org.apache.logging.log4j.Logger) DUPLICATE_TRANSACTION(com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DEFAULT_MINS_FOR_RECONNECT_TESTS(com.hedera.services.bdd.suites.reconnect.CreateAccountsBeforeReconnect.DEFAULT_MINS_FOR_RECONNECT_TESTS) HapiApiSpec.defaultHapiSpec(com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) BUSY(com.hederahashgraph.api.proto.java.ResponseCodeEnum.BUSY) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) PLATFORM_TRANSACTION_NOT_CREATED(com.hederahashgraph.api.proto.java.ResponseCodeEnum.PLATFORM_TRANSACTION_NOT_CREATED) PerfTestLoadSettings(com.hedera.services.bdd.suites.perf.PerfTestLoadSettings) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation)

Aggregations

HapiSpecOperation (com.hedera.services.bdd.spec.HapiSpecOperation)57 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)48 List (java.util.List)47 LogManager (org.apache.logging.log4j.LogManager)47 Logger (org.apache.logging.log4j.Logger)47 HapiApiSpec.defaultHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec)37 UtilVerbs.withOpContext (com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext)36 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)33 HapiApiSuite (com.hedera.services.bdd.suites.HapiApiSuite)29 Supplier (java.util.function.Supplier)29 TxnVerbs.cryptoCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate)28 UtilVerbs.logIt (com.hedera.services.bdd.spec.utilops.UtilVerbs.logIt)27 BUSY (com.hederahashgraph.api.proto.java.ResponseCodeEnum.BUSY)27 PLATFORM_TRANSACTION_NOT_CREATED (com.hederahashgraph.api.proto.java.ResponseCodeEnum.PLATFORM_TRANSACTION_NOT_CREATED)27 PerfTestLoadSettings (com.hedera.services.bdd.suites.perf.PerfTestLoadSettings)26 DUPLICATE_TRANSACTION (com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION)26 TxnVerbs.cryptoTransfer (com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer)24 SUCCESS (com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS)23 AtomicLong (java.util.concurrent.atomic.AtomicLong)21 TxnVerbs.fileCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate)20