Search in sources :

Example 1 with NodeInfo

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);
}
Also used : TransactionContext(com.hedera.services.context.TransactionContext) NodeInfo(com.hedera.services.context.NodeInfo) HFileMeta(com.hedera.services.files.HFileMeta) MerkleMap(com.swirlds.merkle.map.MerkleMap) StateView(com.hedera.services.context.primitives.StateView) GlobalDynamicProperties(com.hedera.services.context.properties.GlobalDynamicProperties) PropertySource(com.hedera.services.context.properties.PropertySource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

NodeInfo (com.hedera.services.context.NodeInfo)1 TransactionContext (com.hedera.services.context.TransactionContext)1 StateView (com.hedera.services.context.primitives.StateView)1 GlobalDynamicProperties (com.hedera.services.context.properties.GlobalDynamicProperties)1 PropertySource (com.hedera.services.context.properties.PropertySource)1 HFileMeta (com.hedera.services.files.HFileMeta)1 MerkleMap (com.swirlds.merkle.map.MerkleMap)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1