Search in sources :

Example 1 with EXPIRY

use of com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.EXPIRY in project hedera-services by hashgraph.

the class FileCreateTransitionLogicTest method happyPathFlows.

@Test
void happyPathFlows() {
    // setup:
    InOrder inOrder = inOrder(hfs, txnCtx, sigImpactHistorian);
    givenTxnCtxCreating(EnumSet.allOf(ValidProperty.class));
    // and:
    given(hfs.create(any(), any(), any())).willReturn(created);
    // when:
    subject.doStateTransition();
    // then:
    inOrder.verify(txnCtx).activePayer();
    inOrder.verify(hfs).create(argThat(bytes -> Arrays.equals(contents, bytes)), argThat(info -> info.getWacl().toString().equals(hederaWacl.toString()) && info.getExpiry() == expiry && memo.equals(info.getMemo())), argThat(genesis::equals));
    inOrder.verify(txnCtx).setCreated(created);
    inOrder.verify(txnCtx).setStatus(SUCCESS);
    inOrder.verify(sigImpactHistorian).markEntityChanged(created.getFileNum());
}
Also used : StateView(com.hedera.services.context.primitives.StateView) BeforeEach(org.junit.jupiter.api.BeforeEach) OK(com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK) Arrays(java.util.Arrays) HFileMeta(com.hedera.services.files.HFileMeta) TieredHederaFs(com.hedera.services.files.TieredHederaFs) BDDMockito.inOrder(org.mockito.BDDMockito.inOrder) Duration(com.hederahashgraph.api.proto.java.Duration) TransactionContext(com.hedera.services.context.TransactionContext) BDDMockito.any(org.mockito.BDDMockito.any) BDDMockito.verify(org.mockito.BDDMockito.verify) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) BDDMockito.given(org.mockito.BDDMockito.given) CONTENTS(com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.CONTENTS) EXPIRY(com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.EXPIRY) KEY(com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.KEY) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PlatformTxnAccessor(com.hedera.services.utils.PlatformTxnAccessor) AccountID(com.hederahashgraph.api.proto.java.AccountID) EnumSet(java.util.EnumSet) TxnHandlingScenario(com.hedera.test.factories.scenarios.TxnHandlingScenario) FileID(com.hederahashgraph.api.proto.java.FileID) FileCreateTransactionBody(com.hederahashgraph.api.proto.java.FileCreateTransactionBody) InOrder(org.mockito.InOrder) BDDMockito.willThrow(org.mockito.BDDMockito.willThrow) INVALID_ZERO_BYTE_IN_STRING(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_ZERO_BYTE_IN_STRING) SigImpactHistorian(com.hedera.services.ledger.SigImpactHistorian) TransactionID(com.hederahashgraph.api.proto.java.TransactionID) FAIL_INVALID(com.hederahashgraph.api.proto.java.ResponseCodeEnum.FAIL_INVALID) HederaFs(com.hedera.services.files.HederaFs) Instant(java.time.Instant) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) OptionValidator(com.hedera.services.txns.validation.OptionValidator) IdUtils(com.hedera.test.utils.IdUtils) ByteString(com.google.protobuf.ByteString) Test(org.junit.jupiter.api.Test) MiscUtils(com.hedera.services.utils.MiscUtils) INVALID_FILE_WACL(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_FILE_WACL) Key(com.hederahashgraph.api.proto.java.Key) JKey(com.hedera.services.legacy.core.jproto.JKey) AUTORENEW_DURATION_NOT_IN_RANGE(com.hederahashgraph.api.proto.java.ResponseCodeEnum.AUTORENEW_DURATION_NOT_IN_RANGE) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) BDDMockito.argThat(org.mockito.BDDMockito.argThat) BDDMockito.mock(org.mockito.BDDMockito.mock) KeyTree(com.hedera.test.factories.keys.KeyTree) INVALID_EXPIRATION_TIME(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_EXPIRATION_TIME) InOrder(org.mockito.InOrder) Test(org.junit.jupiter.api.Test)

Aggregations

ByteString (com.google.protobuf.ByteString)1 TransactionContext (com.hedera.services.context.TransactionContext)1 StateView (com.hedera.services.context.primitives.StateView)1 HFileMeta (com.hedera.services.files.HFileMeta)1 HederaFs (com.hedera.services.files.HederaFs)1 TieredHederaFs (com.hedera.services.files.TieredHederaFs)1 SigImpactHistorian (com.hedera.services.ledger.SigImpactHistorian)1 JKey (com.hedera.services.legacy.core.jproto.JKey)1 CONTENTS (com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.CONTENTS)1 EXPIRY (com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.EXPIRY)1 KEY (com.hedera.services.txns.file.FileCreateTransitionLogicTest.ValidProperty.KEY)1 OptionValidator (com.hedera.services.txns.validation.OptionValidator)1 MiscUtils (com.hedera.services.utils.MiscUtils)1 PlatformTxnAccessor (com.hedera.services.utils.PlatformTxnAccessor)1 KeyTree (com.hedera.test.factories.keys.KeyTree)1 TxnHandlingScenario (com.hedera.test.factories.scenarios.TxnHandlingScenario)1 IdUtils (com.hedera.test.utils.IdUtils)1 AccountID (com.hederahashgraph.api.proto.java.AccountID)1 Duration (com.hederahashgraph.api.proto.java.Duration)1 FileCreateTransactionBody (com.hederahashgraph.api.proto.java.FileCreateTransactionBody)1