use of io.nem.symbol.sdk.model.transaction.Transaction in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getMultipleTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMultipleTransactions(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
Account account = config().getDefaultAccount();
List<TransactionType> transactionTypes = Arrays.asList(TransactionType.TRANSFER, TransactionType.AGGREGATE_COMPLETE, TransactionType.NAMESPACE_METADATA);
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).signerPublicKey(account.getPublicAccount().getPublicKey()).transactionTypes(transactionTypes))).getData();
Assertions.assertFalse(transactions.isEmpty());
transactions.forEach(t -> Assertions.assertTrue(transactionTypes.contains(t.getType())));
}
use of io.nem.symbol.sdk.model.transaction.Transaction in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleTransaction(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
TransactionPaginationStreamer streamer = new TransactionPaginationStreamer(transactionRepository);
List<Transaction> list = get(streamer.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED)).take(5).toList().toObservable());
Assertions.assertFalse(list.isEmpty());
list.forEach(s -> {
String hash = s.getTransactionInfo().get().getHash().get();
BigInteger height = s.getTransactionInfo().get().getHeight();
MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleTransaction(height, hash));
Assertions.assertFalse(merkleProofInfo.getMerklePath().isEmpty());
});
}
use of io.nem.symbol.sdk.model.transaction.Transaction in project nem2-sdk-java by nemtech.
the class ListenerIntegrationTest method shouldReturnUnconfirmedAddedTransactionViaListener.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void shouldReturnUnconfirmedAddedTransactionViaListener(RepositoryType type) {
Listener listener = getListener(type);
SignedTransaction signedTransaction = this.announceStandaloneTransferTransaction(type, this.getRecipient());
Transaction transaction = get(listener.unconfirmedAdded(this.account.getAddress(), signedTransaction.getHash()).take(1));
assertEquals(signedTransaction.getHash(), transaction.getTransactionInfo().get().getHash().get());
}
use of io.nem.symbol.sdk.model.transaction.Transaction in project nem2-sdk-java by nemtech.
the class ListenerIntegrationTest method shouldReturnConfirmedTransactionAddressRecipientViaListener.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void shouldReturnConfirmedTransactionAddressRecipientViaListener(RepositoryType type) {
Listener listener = getListener(type);
SignedTransaction signedTransaction = this.announceStandaloneTransferTransaction(type, this.getRecipient());
Observable<Transaction> confirmed = listener.confirmed(this.getRecipient(), signedTransaction.getHash());
Transaction transaction = get(confirmed.take(1));
assertEquals(signedTransaction.getHash(), transaction.getTransactionInfo().get().getHash().get());
}
use of io.nem.symbol.sdk.model.transaction.Transaction in project nem2-sdk-java by nemtech.
the class BlockServiceIntegrationTest method isValidTransactionInBlock.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isValidTransactionInBlock(RepositoryType type) {
BigInteger height = BigInteger.ONE;
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).height(height).pageNumber(1))).getData();
BlockService service = new BlockServiceImpl(repositoryFactory);
transactions.forEach(t -> {
String hash = t.getTransactionInfo().get().getHash().get();
Assertions.assertNotNull(hash);
Boolean valid = get(service.isValidTransactionInBlock(height, hash));
Assertions.assertTrue(valid);
});
}
Aggregations