use of com.hedera.services.txns.validation.OptionValidator 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);
}
use of com.hedera.services.txns.validation.OptionValidator in project hedera-services by hashgraph.
the class GetAccountBalanceAnswerTest method setup.
@BeforeEach
private void setup() {
deleted = mock(MerkleToken.class);
given(deleted.isDeleted()).willReturn(true);
given(deleted.decimals()).willReturn(123);
notDeleted = mock(MerkleToken.class);
given(notDeleted.isDeleted()).willReturn(false);
given(notDeleted.decimals()).willReturn(1).willReturn(2);
tokenRels = new MerkleMap<>();
tokenRels.put(fromAccountTokenRel(target, aToken), new MerkleTokenRelStatus(aBalance, true, true, true));
tokenRels.put(fromAccountTokenRel(target, bToken), new MerkleTokenRelStatus(bBalance, false, false, false));
tokenRels.put(fromAccountTokenRel(target, cToken), new MerkleTokenRelStatus(cBalance, false, false, true));
tokenRels.put(fromAccountTokenRel(target, dToken), new MerkleTokenRelStatus(dBalance, false, false, true));
accounts = mock(MerkleMap.class);
nodeProps = mock(NodeLocalProperties.class);
given(accounts.get(fromAccountId(asAccount(accountIdLit)))).willReturn(accountV);
given(accounts.get(fromContractId(asContract(contractIdLit)))).willReturn(contractV);
tokenStore = mock(TokenStore.class);
given(tokenStore.exists(aToken)).willReturn(true);
given(tokenStore.exists(bToken)).willReturn(true);
given(tokenStore.exists(cToken)).willReturn(true);
given(tokenStore.exists(dToken)).willReturn(false);
given(tokenStore.get(aToken)).willReturn(notDeleted);
given(tokenStore.get(bToken)).willReturn(notDeleted);
given(tokenStore.get(cToken)).willReturn(deleted);
scheduleStore = mock(ScheduleStore.class);
final MutableStateChildren children = new MutableStateChildren();
children.setAccounts(accounts);
children.setTokenAssociations(tokenRels);
view = new StateView(tokenStore, scheduleStore, children, null);
optionValidator = mock(OptionValidator.class);
aliasManager = mock(AliasManager.class);
subject = new GetAccountBalanceAnswer(aliasManager, optionValidator);
}
use of com.hedera.services.txns.validation.OptionValidator in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method setup.
@BeforeEach
private void setup() throws Exception {
adminKey = COMPLEX_KEY_ACCOUNT_KT.asKey();
submitKey = MISC_ACCOUNT_KT.asKey();
topics = mock(MerkleMap.class);
merkleTopic = TopicFactory.newTopic().adminKey(adminKey).submitKey(submitKey).memo(memo).expiry(expiry).deleted(false).autoRenewDuration(duration).autoRenewId(asAccount(id)).get();
merkleTopic.setRunningHash(hash);
merkleTopic.setSequenceNumber(seqNo);
given(topics.get(key)).willReturn(merkleTopic);
nodeProps = mock(NodeLocalProperties.class);
final MutableStateChildren children = new MutableStateChildren();
children.setTopics(topics);
networkInfo = mock(NetworkInfo.class);
given(networkInfo.ledgerId()).willReturn(ledgerId);
view = new StateView(null, null, children, networkInfo);
optionValidator = mock(OptionValidator.class);
subject = new GetTopicInfoAnswer(optionValidator);
}
use of com.hedera.services.txns.validation.OptionValidator 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);
}
Aggregations