use of io.nem.symbol.sdk.api.TransactionSearchCriteria in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method unconfirmedTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void unconfirmedTransactions(RepositoryType type) {
Account testAccount = this.config().getDefaultAccount();
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
PublicAccount publicAccount = this.helper().getTestAccount(type).getLeft().getPublicAccount();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.UNCONFIRMED).signerPublicKey(publicAccount.getPublicKey()))).getData();
System.out.println(transactions.size());
transactions.forEach(transaction -> assertTransaction(transaction, testAccount.getAddress()));
}
use of io.nem.symbol.sdk.api.TransactionSearchCriteria in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getMosaicGlobalRegistration.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMosaicGlobalRegistration(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
Account account = config().getDefaultAccount();
TransactionType transactionType = TransactionType.MOSAIC_GLOBAL_RESTRICTION;
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Collections.singletonList(transactionType)).signerPublicKey(account.getPublicAccount().getPublicKey()).pageSize(10))).getData();
System.out.println(transactions.size());
Assertions.assertFalse(transactions.isEmpty());
transactions.forEach(t -> Assertions.assertEquals(transactionType, t.getType()));
}
use of io.nem.symbol.sdk.api.TransactionSearchCriteria in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method searchTransactionsPartial.
@Test
public void searchTransactionsPartial() throws Exception {
TransactionInfoDTO transferTransactionDTO = loadTransactionInfoDTO("standaloneTransferTransaction.json");
PublicAccount publicAccount = Account.generateNewAccount(networkType).getPublicAccount();
mockRemoteCall(toPage(transferTransactionDTO));
Page<Transaction> transactions = repository.search(new TransactionSearchCriteria(TransactionGroup.PARTIAL).signerPublicKey(publicAccount.getPublicKey())).toFuture().get();
Assertions.assertEquals(TransactionType.TRANSFER, transactions.getData().get(0).getType());
Assertions.assertEquals(TransactionGroup.PARTIAL, transactions.getData().get(0).getGroup().get());
Assertions.assertEquals(1, transactions.getData().size());
Assertions.assertEquals(1, transactions.getPageNumber());
Assertions.assertEquals(2, transactions.getPageSize());
}
use of io.nem.symbol.sdk.api.TransactionSearchCriteria in project nem2-sdk-java by nemtech.
the class TransactionRepositoryIntegrationTest method getBlockTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getBlockTransactions(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).height(BigInteger.ONE).pageNumber(1))).getData();
assertEquals(20, transactions.size());
List<Transaction> nextTransactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).height(BigInteger.ONE).pageNumber(2))).getData();
assertTrue(nextTransactions.size() > 0);
assertNotEquals(transactions.get(1).getTransactionInfo().get().getHash(), nextTransactions.get(0).getTransactionInfo().get().getHash());
}
use of io.nem.symbol.sdk.api.TransactionSearchCriteria in project nem2-sdk-java by nemtech.
the class TransactionSearchRepositoryIntegrationTest method searchEmbedded.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchEmbedded(RepositoryType type) {
TransactionRepository transactionRepository = getTransactionRepository(type);
TransactionPaginationStreamer streamer = new TransactionPaginationStreamer(transactionRepository);
TransactionGroup group = TransactionGroup.CONFIRMED;
TransactionSearchCriteria criteria = new TransactionSearchCriteria(group).embedded(true);
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());
}
Aggregations