use of com.hedera.mirror.importer.parser.CommonParserProperties in project hedera-mirror-node by hashgraph.
the class BatchInserterTest method throwsParserException.
@Test
void throwsParserException() throws SQLException, IOException {
// given
CopyManager copyManager = mock(CopyManager.class);
doThrow(SQLException.class).when(copyManager).copyIn(any(), (Reader) any(), anyInt());
PGConnection pgConnection = mock(PGConnection.class);
doReturn(copyManager).when(pgConnection).getCopyAPI();
DataSource dataSource = mock(DataSource.class);
Connection conn = mock(Connection.class);
doReturn(conn).when(dataSource).getConnection();
doReturn(pgConnection).when(conn).unwrap(any());
var cryptoTransferBatchInserter2 = new BatchInserter(CryptoTransfer.class, dataSource, new SimpleMeterRegistry(), new CommonParserProperties());
var cryptoTransfers = new HashSet<CryptoTransfer>();
cryptoTransfers.add(cryptoTransfer(1));
// when
assertThatThrownBy(() -> cryptoTransferBatchInserter2.persist(cryptoTransfers)).isInstanceOf(ParserException.class);
}
use of com.hedera.mirror.importer.parser.CommonParserProperties in project hedera-mirror-node by hashgraph.
the class TransactionSignatureTest method setup.
@BeforeEach
void setup() {
CommonParserProperties commonParserProperties = new CommonParserProperties();
EntityProperties entityProperties = new EntityProperties();
RecordParserProperties parserProperties = new RecordParserProperties();
entityRecordItemListener = new EntityRecordItemListener(commonParserProperties, entityProperties, addressBookService, nonFeeTransferExtractionStrategy, entityIdService, entityListener, transactionHandlerFactory, fileDataRepository, parserProperties, contractResultService);
defaultSignatureMap = getDefaultSignatureMap();
defaultTransactionSignatures = defaultSignatureMap.getSigPairList().stream().map(pair -> {
TransactionSignature transactionSignature = new TransactionSignature();
transactionSignature.setConsensusTimestamp(CONSENSUS_TIMESTAMP);
transactionSignature.setEntityId(ENTITY_ID);
transactionSignature.setPublicKeyPrefix(pair.getPubKeyPrefix().toByteArray());
transactionSignature.setSignature(pair.getEd25519().toByteArray());
transactionSignature.setType(SignaturePair.SignatureCase.ED25519.getNumber());
return transactionSignature;
}).collect(Collectors.toList());
transactionSignatures = entityProperties.getPersist().getTransactionSignatures();
doReturn(ENTITY_ID).when(transactionHandler).getEntity(any(RecordItem.class));
doReturn(transactionHandler).when(transactionHandlerFactory).get(any(TransactionType.class));
}
Aggregations