Search in sources :

Example 1 with PlatformTxnAccessor

use of com.hedera.services.utils.PlatformTxnAccessor in project hedera-services by hashgraph.

the class PrecheckUtilsTest method transferWithoutTargetNodeIsNotQueryPayment.

@Test
void transferWithoutTargetNodeIsNotQueryPayment() throws Throwable {
    given(nodeInfo.selfAccount()).willReturn(node);
    final var txn = new PlatformTxnAccessor(from(newSignedCryptoTransfer().transfers(tinyBarsFromTo("0.0.1024", "0.0.2048", 1_000L)).get())).getTxn();
    assertFalse(subject.test(txn));
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) Test(org.junit.jupiter.api.Test)

Example 2 with PlatformTxnAccessor

use of com.hedera.services.utils.PlatformTxnAccessor 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 3 with PlatformTxnAccessor

use of com.hedera.services.utils.PlatformTxnAccessor in project hedera-services by hashgraph.

the class PrecheckUtilsTest method queryPaymentsMustBeCryptoTransfers.

@Test
void queryPaymentsMustBeCryptoTransfers() throws Throwable {
    final var txn = new PlatformTxnAccessor(from(newSignedCryptoUpdate("0.0.2").get())).getTxn();
    assertFalse(subject.test(txn));
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) Test(org.junit.jupiter.api.Test)

Example 4 with PlatformTxnAccessor

use of com.hedera.services.utils.PlatformTxnAccessor in project hedera-services by hashgraph.

the class PrecheckUtilsTest method queryPaymentTransfersToTargetNode.

@Test
void queryPaymentTransfersToTargetNode() throws Throwable {
    given(nodeInfo.selfAccount()).willReturn(node);
    final var txn = new PlatformTxnAccessor(from(newSignedCryptoTransfer().transfers(tinyBarsFromTo(nodeId, "0.0.2048", 1_000L)).get())).getTxn();
    assertFalse(subject.test(txn));
}
Also used : PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) Test(org.junit.jupiter.api.Test)

Example 5 with PlatformTxnAccessor

use of com.hedera.services.utils.PlatformTxnAccessor in project hedera-services by hashgraph.

the class HederaToPlatformSigOpsTest method setup.

@BeforeEach
private void setup() throws Throwable {
    allSigBytes = mock(PubKeyToSigBytes.class);
    keyOrdering = mock(SigRequirements.class);
    platformTxn = new PlatformTxnAccessor(PlatformTxnFactory.from(newSignedSystemDelete().get()));
}
Also used : SigRequirements(com.hedera.services.sigs.order.SigRequirements) PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) PubKeyToSigBytes(com.hedera.services.sigs.sourcing.PubKeyToSigBytes) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PlatformTxnAccessor (com.hedera.services.utils.PlatformTxnAccessor)6 Test (org.junit.jupiter.api.Test)4 BeforeEach (org.junit.jupiter.api.BeforeEach)3 SigRequirements (com.hedera.services.sigs.order.SigRequirements)2 PubKeyToSigBytes (com.hedera.services.sigs.sourcing.PubKeyToSigBytes)2 MockAccountNumbers (com.hedera.services.config.MockAccountNumbers)1 TransactionContext (com.hedera.services.context.TransactionContext)1 GlobalDynamicProperties (com.hedera.services.context.properties.GlobalDynamicProperties)1 HFileMeta (com.hedera.services.files.HFileMeta)1 JContractIDKey (com.hedera.services.legacy.core.jproto.JContractIDKey)1 JKey (com.hedera.services.legacy.core.jproto.JKey)1 KeyPrefixMismatchException (com.hedera.services.legacy.exception.KeyPrefixMismatchException)1 HederaToPlatformSigOps.expandIn (com.hedera.services.sigs.HederaToPlatformSigOps.expandIn)1 PlatformSigFactory (com.hedera.services.sigs.factories.PlatformSigFactory)1 ReusableBodySigningFactory (com.hedera.services.sigs.factories.ReusableBodySigningFactory)1 CODE_ORDER_RESULT_FACTORY (com.hedera.services.sigs.order.CodeOrderResultFactory.CODE_ORDER_RESULT_FACTORY)1 SigningOrderResult (com.hedera.services.sigs.order.SigningOrderResult)1 KeyType (com.hedera.services.sigs.sourcing.KeyType)1 SigObserver (com.hedera.services.sigs.sourcing.SigObserver)1 SyncVerifier (com.hedera.services.sigs.verification.SyncVerifier)1