use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileCreate.
@Test
void fileCreate() {
Transaction transaction = fileCreateTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertRowCountOnSuccess(FILE_ID), () -> assertTransactionAndRecord(transactionBody, record), () -> assertFileEntityAndData(transactionBody.getFileCreate(), record.getConsensusTimestamp()));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileCreateExpirationTimeOverflow.
@ParameterizedTest(name = "with {0} s and expected {1} ns")
@CsvSource({ "9223372036854775807, 9223372036854775807", "31556889864403199, 9223372036854775807", "-9223372036854775808, -9223372036854775808", "-1000000000000000000, -9223372036854775808" })
void fileCreateExpirationTimeOverflow(long seconds, long expectedNanosTimestamp) {
Transaction transaction = fileCreateTransaction(Timestamp.newBuilder().setSeconds(seconds).build());
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
var dbAccountEntity = getTransactionEntity(record.getConsensusTimestamp());
assertEquals(expectedNanosTimestamp, dbAccountEntity.getExpirationTimestamp());
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileDeleteToExisting.
@Test
void fileDeleteToExisting() {
// first create the file
Transaction fileCreateTransaction = fileCreateTransaction();
TransactionBody createTransactionBody = getTransactionBody(fileCreateTransaction);
TransactionRecord recordCreate = transactionRecord(createTransactionBody);
parseRecordItemAndCommit(new RecordItem(fileCreateTransaction, recordCreate));
// now update
Transaction transaction = fileDeleteTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
Entity dbFileEntity = getTransactionEntity(record.getConsensusTimestamp());
assertAll(() -> assertEquals(2, transactionRepository.count()), () -> assertEntities(EntityId.of(FILE_ID)), () -> assertEquals(0, contractResultRepository.count()), () -> assertEquals(6, cryptoTransferRepository.count()), () -> assertEquals(0, liveHashRepository.count()), () -> assertEquals(1, fileDataRepository.count()), () -> assertTransactionAndRecord(transactionBody, record), // Additional entity checks
() -> assertTrue(dbFileEntity.getDeleted()), () -> assertNotNull(dbFileEntity.getKey()), () -> assertNotNull(dbFileEntity.getExpirationTimestamp()), () -> assertNull(dbFileEntity.getAutoRenewPeriod()), () -> assertNull(dbFileEntity.getProxyAccountId()));
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileSystemDeleteInvalidTransaction.
@Test
void fileSystemDeleteInvalidTransaction() {
Transaction systemDeleteTransaction = systemDeleteTransaction();
TransactionBody transactionBody = getTransactionBody(systemDeleteTransaction);
TransactionRecord record = transactionRecord(transactionBody, ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE);
parseRecordItemAndCommit(new RecordItem(systemDeleteTransaction, record));
assertFailedFileTransaction(transactionBody, record);
}
use of com.hederahashgraph.api.proto.java.TransactionRecord in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerFileTest method fileCreateDoNotPersist.
@Test
void fileCreateDoNotPersist() {
entityProperties.getPersist().setFiles(false);
entityProperties.getPersist().setSystemFiles(false);
Transaction transaction = fileCreateTransaction();
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord record = transactionRecord(transactionBody);
parseRecordItemAndCommit(new RecordItem(transaction, record));
assertAll(() -> assertRowCountOnSuccessNoData(FILE_ID), () -> assertTransactionAndRecord(transactionBody, record));
}
Aggregations