Search in sources :

Example 6 with HFileMeta

use of com.hedera.services.files.HFileMeta in project hedera-services by hashgraph.

the class TxnAwareRatesManagerTest method setup.

@BeforeEach
private void setup() {
    attr = new HFileMeta(false, new JContractIDKey(1, 2, 3), Instant.now().getEpochSecond());
    PlatformTxnAccessor accessor = mock(PlatformTxnAccessor.class);
    given(accessor.getSignedTxnWrapper()).willReturn(Transaction.getDefaultInstance());
    txnCtx = mock(TransactionContext.class);
    given(txnCtx.accessor()).willReturn(accessor);
    midnightRates = mock(ExchangeRates.class);
    postUpdateCb = mock(Consumer.class);
    intradayLimit = mock(BiPredicate.class);
    intradayLimitFactory = mock(IntFunction.class);
    given(intradayLimitFactory.apply(actualLimit)).willReturn(intradayLimit);
    properties = mock(GlobalDynamicProperties.class);
    given(properties.ratesIntradayChangeLimitPercent()).willReturn(actualLimit);
    subject = new TxnAwareRatesManager(new MockFileNumbers(), new MockAccountNumbers(), properties, txnCtx, () -> midnightRates, postUpdateCb, intradayLimitFactory);
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) Consumer(java.util.function.Consumer) TransactionContext(com.hedera.services.context.TransactionContext) IntFunction(java.util.function.IntFunction) HFileMeta(com.hedera.services.files.HFileMeta) ExchangeRates(com.hedera.services.state.submerkle.ExchangeRates) GlobalDynamicProperties(com.hedera.services.context.properties.GlobalDynamicProperties) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) MockAccountNumbers(com.hedera.services.config.MockAccountNumbers) BiPredicate(java.util.function.BiPredicate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with HFileMeta

use of com.hedera.services.files.HFileMeta in project hedera-services by hashgraph.

the class ValidatingCallbackInterceptorTest method setup.

@BeforeEach
private void setup() {
    attr = new HFileMeta(false, new JContractIDKey(1, 2, 3), Instant.now().getEpochSecond());
    validator = mock(Predicate.class);
    postUpdateCb = mock(Consumer.class);
    properties = mock(PropertySource.class);
    given(properties.getLongProperty(numProperty)).willReturn(actualNum);
    subject = new ValidatingCallbackInterceptor(applicablePriority, numProperty, properties, postUpdateCb, validator);
}
Also used : Consumer(java.util.function.Consumer) HFileMeta(com.hedera.services.files.HFileMeta) JContractIDKey(com.hedera.services.legacy.core.jproto.JContractIDKey) Predicate(java.util.function.Predicate) PropertySource(com.hedera.services.context.properties.PropertySource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with HFileMeta

use of com.hedera.services.files.HFileMeta in project hedera-services by hashgraph.

the class FileAppendTransitionLogicTest method setup.

@BeforeEach
private void setup() throws Throwable {
    wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
    attr = new HFileMeta(false, wacl, 2_000_000L);
    deletedAttr = new HFileMeta(true, wacl, 2_000_000L);
    immutableAttr = new HFileMeta(false, StateView.EMPTY_WACL, 2_000_000L);
    accessor = mock(PlatformTxnAccessor.class);
    txnCtx = mock(TransactionContext.class);
    networkCtx = mock(MerkleNetworkContext.class);
    hfs = mock(HederaFs.class);
    given(hfs.exists(target)).willReturn(true);
    given(hfs.exists(deleted)).willReturn(true);
    given(hfs.exists(special)).willReturn(true);
    given(hfs.exists(immutable)).willReturn(true);
    given(hfs.exists(missing)).willReturn(false);
    given(hfs.getattr(target)).willReturn(attr);
    given(hfs.getattr(deleted)).willReturn(deletedAttr);
    given(hfs.getattr(immutable)).willReturn(immutableAttr);
    subject = new FileAppendTransitionLogic(hfs, numbers, txnCtx, () -> networkCtx);
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) MerkleNetworkContext(com.hedera.services.state.merkle.MerkleNetworkContext) TransactionContext(com.hedera.services.context.TransactionContext) HFileMeta(com.hedera.services.files.HFileMeta) TieredHederaFs(com.hedera.services.files.TieredHederaFs) HederaFs(com.hedera.services.files.HederaFs) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with HFileMeta

use of com.hedera.services.files.HFileMeta in project hedera-services by hashgraph.

the class FileSysDelTransitionLogicTest method setup.

@BeforeEach
private void setup() throws Throwable {
    wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
    attr = new HFileMeta(false, wacl, oldExpiry);
    deletedAttr = new HFileMeta(true, wacl, oldExpiry);
    accessor = mock(PlatformTxnAccessor.class);
    txnCtx = mock(TransactionContext.class);
    sigImpactHistorian = mock(SigImpactHistorian.class);
    oldExpiries = mock(Map.class);
    hfs = mock(HederaFs.class);
    given(hfs.exists(tbd)).willReturn(true);
    given(hfs.exists(deleted)).willReturn(true);
    given(hfs.exists(missing)).willReturn(false);
    given(hfs.getattr(tbd)).willReturn(attr);
    given(hfs.getattr(deleted)).willReturn(deletedAttr);
    subject = new FileSysDelTransitionLogic(hfs, sigImpactHistorian, oldExpiries, txnCtx);
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) SigImpactHistorian(com.hedera.services.ledger.SigImpactHistorian) TransactionContext(com.hedera.services.context.TransactionContext) HFileMeta(com.hedera.services.files.HFileMeta) HederaFs(com.hedera.services.files.HederaFs) Map(java.util.Map) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with HFileMeta

use of com.hedera.services.files.HFileMeta in project hedera-services by hashgraph.

the class FileSysUndelTransitionLogicTest method setup.

@BeforeEach
private void setup() throws Throwable {
    wacl = TxnHandlingScenario.SIMPLE_NEW_WACL_KT.asJKey();
    attr = new HFileMeta(false, wacl, currExpiry);
    deletedAttr = new HFileMeta(true, wacl, currExpiry);
    accessor = mock(PlatformTxnAccessor.class);
    txnCtx = mock(TransactionContext.class);
    oldExpiries = mock(Map.class);
    sigImpactHistorian = mock(SigImpactHistorian.class);
    hfs = mock(HederaFs.class);
    given(hfs.exists(undeleted)).willReturn(true);
    given(hfs.exists(deleted)).willReturn(true);
    given(hfs.exists(missing)).willReturn(false);
    given(hfs.getattr(undeleted)).willReturn(attr);
    given(hfs.getattr(deleted)).willReturn(deletedAttr);
    subject = new FileSysUndelTransitionLogic(hfs, sigImpactHistorian, oldExpiries, txnCtx);
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) SigImpactHistorian(com.hedera.services.ledger.SigImpactHistorian) TransactionContext(com.hedera.services.context.TransactionContext) HFileMeta(com.hedera.services.files.HFileMeta) HederaFs(com.hedera.services.files.HederaFs) Map(java.util.Map) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HFileMeta (com.hedera.services.files.HFileMeta)14 BeforeEach (org.junit.jupiter.api.BeforeEach)11 TransactionContext (com.hedera.services.context.TransactionContext)7 HederaFs (com.hedera.services.files.HederaFs)6 PlatformTxnAccessor (com.hedera.services.utils.PlatformTxnAccessor)6 TieredHederaFs (com.hedera.services.files.TieredHederaFs)5 SigImpactHistorian (com.hedera.services.ledger.SigImpactHistorian)4 Map (java.util.Map)4 PropertySource (com.hedera.services.context.properties.PropertySource)3 JContractIDKey (com.hedera.services.legacy.core.jproto.JContractIDKey)3 Consumer (java.util.function.Consumer)3 GlobalDynamicProperties (com.hedera.services.context.properties.GlobalDynamicProperties)2 MerkleNetworkContext (com.hedera.services.state.merkle.MerkleNetworkContext)2 MerkleSpecialFiles (com.hedera.services.state.merkle.MerkleSpecialFiles)2 VirtualBlobKey (com.hedera.services.state.virtual.VirtualBlobKey)2 VirtualBlobValue (com.hedera.services.state.virtual.VirtualBlobValue)2 OptionValidator (com.hedera.services.txns.validation.OptionValidator)2 MerkleMap (com.swirlds.merkle.map.MerkleMap)2 MockAccountNumbers (com.hedera.services.config.MockAccountNumbers)1 NetworkInfo (com.hedera.services.config.NetworkInfo)1