use of io.nem.symbol.sdk.api.Listener in project nem2-sdk-java by nemtech.
the class ListenerIntegrationTest method shouldReturnAggregateBondedRemovedTransactionViaListener.
@ParameterizedTest
@EnumSource(RepositoryType.class)
@Disabled
void shouldReturnAggregateBondedRemovedTransactionViaListener(RepositoryType type) {
Listener listener = getListener(type);
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
TransactionService transactionService = new TransactionServiceImpl(repositoryFactory);
Pair<SignedTransaction, SignedTransaction> pair = this.createAggregateBondedTransaction(type);
System.out.println("Announcing HashLock transaction " + pair.getRight().getHash());
get(transactionService.announce(listener, pair.getRight()));
SignedTransaction signedTransaction = pair.getLeft();
System.out.println("Announcing Aggregate transaction " + signedTransaction.getHash());
get(transactionService.announceAggregateBonded(listener, signedTransaction).take(1));
String transactionHash = get(listener.aggregateBondedRemoved(this.account.getAddress()).take(1));
assertEquals(signedTransaction.getHash(), transactionHash);
}
use of io.nem.symbol.sdk.api.Listener in project nem2-sdk-java by nemtech.
the class ListenerStatusIntegrationTest method createListener.
private Listener createListener(RepositoryType type) throws InterruptedException, ExecutionException {
Listener listener = getRepositoryFactory(type).createListener();
CompletableFuture<Void> connected = listener.open();
connected.get();
assertTrue(connected.isDone());
return listener;
}
use of io.nem.symbol.sdk.api.Listener in project nem2-sdk-java by nemtech.
the class TransferTransactionIntegrationTest method listen.
private Listener listen(RepositoryType type, List<String> messages, boolean includeAliases, UnresolvedAddress... recipients) throws InterruptedException, ExecutionException {
Listener listener = getRepositoryFactory(type).createListener();
listener.open().get();
final HashSet<UnresolvedAddress> expected = new HashSet<>();
expected.add(recipientAlias);
expected.add(recipientAddress);
if (includeAliases) {
for (UnresolvedAddress recipient : recipients) {
listener.getAllAddressesAndAliases(recipient).subscribe(multiple -> {
Assertions.assertEquals(expected, multiple);
subscribeMultiple(messages, listener, multiple);
});
}
} else {
final Set<UnresolvedAddress> multiple = Arrays.stream(recipients).collect(Collectors.toSet());
subscribeMultiple(messages, listener, multiple);
}
return listener;
}
Aggregations