use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class TransactionSignatureTest method getRecordItem.
private RecordItem getRecordItem(TransactionType transactionType, ResponseCodeEnum responseCode, SignatureMap signatureMap) {
TransactionBody transactionBody = getTransactionBody(transactionType);
Transaction transaction = Transaction.newBuilder().setSignedTransactionBytes(SignedTransaction.newBuilder().setBodyBytes(transactionBody.toByteString()).setSigMap(signatureMap).build().toByteString()).build();
TransactionRecord transactionRecord = TransactionRecord.newBuilder().setConsensusTimestamp(Utility.instantToTimestamp(Instant.ofEpochSecond(0, CONSENSUS_TIMESTAMP))).setReceipt(TransactionReceipt.newBuilder().setStatus(responseCode).build()).build();
return new RecordItem(transaction, transactionRecord);
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class TransactionSignatureTest method transactionSignatureDefault.
@ParameterizedTest
@MethodSource("provideDefaultTransactionSignatures")
void transactionSignatureDefault(TransactionType transactionType) {
RecordItem recordItem = getRecordItem(transactionType, SUCCESS);
entityRecordItemListener.onItem(recordItem);
assertTransactionSignatures(defaultTransactionSignatures);
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class TransactionSignatureTest method transactionSignatureDisabled.
@ParameterizedTest
@EnumSource(value = TransactionType.class, names = "UNKNOWN", mode = EXCLUDE)
void transactionSignatureDisabled(TransactionType transactionType) {
transactionSignatures.clear();
transactionSignatures.addAll(EnumSet.complementOf(EnumSet.of(transactionType)));
RecordItem recordItem = getRecordItem(transactionType, SUCCESS);
entityRecordItemListener.onItem(recordItem);
assertTransactionSignatures(Collections.emptyList());
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class RecordFileParserTest method endDate.
@ParameterizedTest(name = "endDate with offset {0}ns")
@CsvSource({ "-1", "0", "1" })
void endDate(long offset) {
// given
RecordFile recordFile = (RecordFile) getStreamFile();
RecordItem firstItem = recordFile.getItems().blockFirst();
long end = recordFile.getConsensusStart() + offset;
DateRangeFilter filter = new DateRangeFilter(Instant.EPOCH, Instant.ofEpochSecond(0, end));
doReturn(filter).when(mirrorDateRangePropertiesProcessor).getDateRangeFilter(parserProperties.getStreamType());
// when
parser.parse(recordFile);
// then
verify(recordStreamFileListener).onStart();
if (offset >= 0) {
verify(recordItemListener).onItem(firstItem);
}
verify(recordStreamFileListener).onEnd(recordFile);
assertPostParseStreamFile(recordFile, true);
}
use of com.hedera.mirror.common.domain.transaction.RecordItem in project hedera-mirror-node by hashgraph.
the class RecordFileParserTest method startDate.
@ParameterizedTest(name = "startDate with offset {0}ns")
@CsvSource({ "-1", "0", "1" })
void startDate(long offset) {
// given
RecordFile recordFile = (RecordFile) getStreamFile();
RecordItem firstItem = recordFile.getItems().blockFirst();
long start = recordFile.getConsensusStart() + offset;
DateRangeFilter filter = new DateRangeFilter(Instant.ofEpochSecond(0, start), null);
doReturn(filter).when(mirrorDateRangePropertiesProcessor).getDateRangeFilter(parserProperties.getStreamType());
// when
parser.parse(recordFile);
// then
verify(recordStreamFileListener).onStart();
if (offset < 0) {
verify(recordItemListener).onItem(firstItem);
}
verify(recordStreamFileListener).onEnd(recordFile);
assertPostParseStreamFile(recordFile, true);
}
Aggregations