Search in sources :

Example 1 with AnswerFunctions

use of com.hedera.services.queries.answering.AnswerFunctions 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 AnswerFunctions

use of com.hedera.services.queries.answering.AnswerFunctions in project hedera-services by hashgraph.

the class GetAccountRecordsResourceUsageTest method setup.

@BeforeEach
private void setup() {
    aValue = MerkleAccountFactory.newAccount().get();
    aValue.records().offer(recordOne());
    aValue.records().offer(recordTwo());
    final MutableStateChildren children = new MutableStateChildren();
    children.setAccounts(accounts);
    view = new StateView(null, null, children, null);
    subject = new GetAccountRecordsResourceUsage(new AnswerFunctions(dynamicProperties), usageEstimator);
}
Also used : MutableStateChildren(com.hedera.services.context.MutableStateChildren) StateView(com.hedera.services.context.primitives.StateView) AnswerFunctions(com.hedera.services.queries.answering.AnswerFunctions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with AnswerFunctions

use of com.hedera.services.queries.answering.AnswerFunctions 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 4 with AnswerFunctions

use of com.hedera.services.queries.answering.AnswerFunctions in project hedera-services by hashgraph.

the class GetAccountRecordsAnswerTest method setup.

@BeforeEach
private void setup() throws Exception {
    payerAccount = MerkleAccountFactory.newAccount().accountKeys(COMPLEX_KEY_ACCOUNT_KT).proxy(asAccount("1.2.3")).senderThreshold(1_234L).receiverThreshold(4_321L).receiverSigRequired(true).balance(555L).autoRenewPeriod(1_000_000L).expirationTime(9_999_999L).get();
    payerAccount.records().offer(recordOne());
    payerAccount.records().offer(recordTwo());
    accounts = mock(MerkleMap.class);
    given(accounts.get(EntityNum.fromAccountId(asAccount(target)))).willReturn(payerAccount);
    final MutableStateChildren children = new MutableStateChildren();
    children.setAccounts(accounts);
    view = new StateView(null, null, children, null);
    optionValidator = mock(OptionValidator.class);
    subject = new GetAccountRecordsAnswer(new AnswerFunctions(dynamicProperties), optionValidator);
}
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) AnswerFunctions(com.hedera.services.queries.answering.AnswerFunctions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

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