Search in sources :

Example 1 with RecordCache

use of com.hedera.services.records.RecordCache in project hedera-services by hashgraph.

the class GetTxnRecordAnswerTest method setup.

@BeforeEach
private void setup() {
    recordCache = mock(RecordCache.class);
    accounts = mock(MerkleMap.class);
    nodeProps = mock(NodeLocalProperties.class);
    final MutableStateChildren children = new MutableStateChildren();
    children.setAccounts(accounts);
    view = new StateView(null, null, children, null);
    optionValidator = mock(OptionValidator.class);
    answerFunctions = mock(AnswerFunctions.class);
    subject = new GetTxnRecordAnswer(recordCache, optionValidator, answerFunctions);
}
Also used : MutableStateChildren(com.hedera.services.context.MutableStateChildren) OptionValidator(com.hedera.services.txns.validation.OptionValidator) MerkleMap(com.swirlds.merkle.map.MerkleMap) StateView(com.hedera.services.context.primitives.StateView) NodeLocalProperties(com.hedera.services.context.properties.NodeLocalProperties) RecordCache(com.hedera.services.records.RecordCache) AnswerFunctions(com.hedera.services.queries.answering.AnswerFunctions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with RecordCache

use of com.hedera.services.records.RecordCache in project hedera-services by hashgraph.

the class GetTxnRecordResourceUsageTest method setup.

@BeforeEach
private void setup() {
    desiredRecord = mock(TransactionRecord.class);
    usageEstimator = mock(CryptoFeeBuilder.class);
    recordCache = mock(RecordCache.class);
    final var children = new MutableStateChildren();
    view = new StateView(null, null, children, null);
    answerFunctions = mock(AnswerFunctions.class);
    given(answerFunctions.txnRecord(recordCache, satisfiableAnswerOnly)).willReturn(Optional.of(desiredRecord));
    given(answerFunctions.txnRecord(recordCache, satisfiableAnswerOnlyWithDups)).willReturn(Optional.of(desiredRecord));
    given(answerFunctions.txnRecord(recordCache, satisfiableCostAnswer)).willReturn(Optional.of(desiredRecord));
    given(answerFunctions.txnRecord(recordCache, unsatisfiable)).willReturn(Optional.empty());
    given(recordCache.getDuplicateRecords(targetTxnId)).willReturn(List.of(desiredRecord));
    subject = new GetTxnRecordResourceUsage(recordCache, answerFunctions, usageEstimator);
}
Also used : MutableStateChildren(com.hedera.services.context.MutableStateChildren) StateView(com.hedera.services.context.primitives.StateView) RecordCache(com.hedera.services.records.RecordCache) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) CryptoFeeBuilder(com.hederahashgraph.fee.CryptoFeeBuilder) AnswerFunctions(com.hedera.services.queries.answering.AnswerFunctions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with RecordCache

use of com.hedera.services.records.RecordCache in project hedera-services by hashgraph.

the class PlatformSubmissionManagerTest method setup.

@BeforeEach
void setup() throws InvalidProtocolBufferException {
    platform = mock(Platform.class);
    recordCache = mock(RecordCache.class);
    speedometers = mock(MiscSpeedometers.class);
    accessor = new SignedTxnAccessor(signedTxn);
    uncheckedAccessor = new SignedTxnAccessor(uncheckedSubTxn);
    invalidUncheckedAccessor = new SignedTxnAccessor(invalidUncheckedSubTxn);
    subject = new PlatformSubmissionManager(platform, recordCache, speedometers);
}
Also used : Platform(com.swirlds.common.Platform) MiscSpeedometers(com.hedera.services.stats.MiscSpeedometers) RecordCache(com.hedera.services.records.RecordCache) SignedTxnAccessor(com.hedera.services.utils.SignedTxnAccessor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

RecordCache (com.hedera.services.records.RecordCache)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 MutableStateChildren (com.hedera.services.context.MutableStateChildren)2 StateView (com.hedera.services.context.primitives.StateView)2 AnswerFunctions (com.hedera.services.queries.answering.AnswerFunctions)2 NodeLocalProperties (com.hedera.services.context.properties.NodeLocalProperties)1 MiscSpeedometers (com.hedera.services.stats.MiscSpeedometers)1 OptionValidator (com.hedera.services.txns.validation.OptionValidator)1 SignedTxnAccessor (com.hedera.services.utils.SignedTxnAccessor)1 TransactionRecord (com.hederahashgraph.api.proto.java.TransactionRecord)1 CryptoFeeBuilder (com.hederahashgraph.fee.CryptoFeeBuilder)1 Platform (com.swirlds.common.Platform)1 MerkleMap (com.swirlds.merkle.map.MerkleMap)1