use of io.nem.symbol.sdk.api.TransactionPaginationStreamer in project nem2-sdk-java by nemtech.
the class TransactionSearchRepositoryIntegrationTest method searchTransactionType.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchTransactionType(RepositoryType type) {
TransactionRepository transactionRepository = getTransactionRepository(type);
TransactionPaginationStreamer streamer = new TransactionPaginationStreamer(transactionRepository);
TransactionGroup group = TransactionGroup.CONFIRMED;
TransactionSearchCriteria criteria = new TransactionSearchCriteria(group).transactionTypes(Arrays.asList(TransactionType.TRANSFER));
List<Transaction> transactions = get(streamer.search(criteria).toList().toObservable());
transactions.forEach(b -> {
TransferTransaction transferTransaction = (TransferTransaction) b;
Message message = transferTransaction.getMessage().orElse(PlainMessage.create("No Message!!"));
Assertions.assertNotNull(message.getText());
});
Assertions.assertFalse(transactions.isEmpty());
}
use of io.nem.symbol.sdk.api.TransactionPaginationStreamer in project nem2-sdk-java by nemtech.
the class TransactionSearchRepositoryIntegrationTest method searchByTransactionFromHeight.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchByTransactionFromHeight(RepositoryType type) {
TransactionRepository transactionRepository = getTransactionRepository(type);
TransactionPaginationStreamer streamer = new TransactionPaginationStreamer(transactionRepository);
TransactionSearchCriteria toBlockOneTransactions = new TransactionSearchCriteria(TransactionGroup.CONFIRMED).fromHeight(BigInteger.valueOf(2)).embedded(true);
List<Transaction> transactions = get(streamer.search(toBlockOneTransactions).toList().toObservable());
transactions.forEach(b -> Assertions.assertTrue(b.getTransactionInfo().get().getHeight().compareTo(BigInteger.ONE) > 0));
Assertions.assertFalse(transactions.isEmpty());
}
use of io.nem.symbol.sdk.api.TransactionPaginationStreamer in project nem2-sdk-java by nemtech.
the class TransactionSearchRepositoryIntegrationTest method searchBySignerPublicKey.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchBySignerPublicKey(RepositoryType type) {
TransactionRepository transactionRepository = getTransactionRepository(type);
TransactionPaginationStreamer streamer = new TransactionPaginationStreamer(transactionRepository);
Transaction transaction1 = get(streamer.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED)).take(1));
TransactionSearchCriteria criteria = new TransactionSearchCriteria(TransactionGroup.CONFIRMED);
PublicKey expectedSignerPublicKey = transaction1.getSigner().get().getPublicKey();
criteria.setSignerPublicKey(expectedSignerPublicKey);
List<Transaction> transactions = get(streamer.search(criteria).toList().toObservable());
transactions.forEach(b -> Assertions.assertEquals(expectedSignerPublicKey, b.getSigner().get().getPublicKey()));
Assertions.assertFalse(transactions.isEmpty());
helper.assertById(transactionRepository, TransactionGroup.CONFIRMED, transactions);
}
Aggregations