use of com.hedera.services.context.primitives.StateView in project hedera-services by hashgraph.
the class GetMerkleTopicInfoResourceUsageTest method setup.
@BeforeEach
void setup() {
topics = mock(MerkleMap.class);
final var children = new MutableStateChildren();
children.setTopics(topics);
view = new StateView(null, null, children, null);
subject = new GetTopicInfoResourceUsage();
}
use of com.hedera.services.context.primitives.StateView in project hedera-services by hashgraph.
the class TopicResourceUsageTestBase method setup.
void setup() throws Throwable {
topics = mock(MerkleMap.class);
nodeProps = mock(NodeLocalProperties.class);
final MutableStateChildren children = new MutableStateChildren();
children.setTopics(topics);
view = new StateView(null, null, children, null);
}
use of com.hedera.services.context.primitives.StateView 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);
}
use of com.hedera.services.context.primitives.StateView 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);
}
use of com.hedera.services.context.primitives.StateView in project hedera-services by hashgraph.
the class GetAccountInfoAnswerTest method identifiesFailInvalid.
@Test
void identifiesFailInvalid() throws Throwable {
// setup:
Query query = validQuery(ANSWER_ONLY, fee, target);
// and:
StateView view = mock(StateView.class);
given(view.infoForAccount(any(), any())).willReturn(Optional.empty());
// when:
Response response = subject.responseGiven(query, view, OK, fee);
// then:
assertTrue(response.hasCryptoGetInfo());
assertEquals(FAIL_INVALID, response.getCryptoGetInfo().getHeader().getNodeTransactionPrecheckCode());
assertEquals(ANSWER_ONLY, response.getCryptoGetInfo().getHeader().getResponseType());
}
Aggregations