use of com.hedera.services.context.NodeInfo in project hedera-services by hashgraph.
the class ContextOptionValidatorTest method setup.
@BeforeEach
private void setup() throws Exception {
txnCtx = mock(TransactionContext.class);
given(txnCtx.consensusTime()).willReturn(now);
accounts = mock(MerkleMap.class);
given(accounts.get(EntityNum.fromAccountId(a))).willReturn(aV);
given(accounts.get(EntityNum.fromAccountId(deleted))).willReturn(deletedV);
given(accounts.get(fromContractId(contract))).willReturn(contractV);
given(accounts.get(fromContractId(deletedContract))).willReturn(deletedContractV);
dynamicProperties = mock(GlobalDynamicProperties.class);
given(dynamicProperties.maxMemoUtf8Bytes()).willReturn(100);
properties = mock(PropertySource.class);
given(properties.getLongProperty("entities.maxLifetime")).willReturn(maxLifetime);
topics = mock(MerkleMap.class);
deletedMerkleTopic = TopicFactory.newTopic().deleted(true).get();
expiredMerkleTopic = TopicFactory.newTopic().expiry(now.minusSeconds(555L).getEpochSecond()).get();
merkleTopic = TopicFactory.newTopic().memo("Hi, over here!").expiry(now.plusSeconds(555L).getEpochSecond()).get();
given(topics.get(EntityNum.fromTopicId(topicId))).willReturn(merkleTopic);
given(topics.get(EntityNum.fromTopicId(missingTopicId))).willReturn(null);
given(topics.get(EntityNum.fromTopicId(deletedTopicId))).willReturn(deletedMerkleTopic);
given(topics.get(EntityNum.fromTopicId(expiredTopicId))).willReturn(expiredMerkleTopic);
NodeInfo nodeInfo = mock(NodeInfo.class);
given(nodeInfo.selfAccount()).willReturn(thisNodeAccount);
wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
attr = new HFileMeta(false, wacl, expiry);
deletedAttr = new HFileMeta(true, wacl, expiry);
view = mock(StateView.class);
subject = new ContextOptionValidator(nodeInfo, properties, txnCtx, dynamicProperties);
}
Aggregations