use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO 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.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateMosaicCreationTransaction.
@Test
void shouldCreateAggregateMosaicCreationTransaction() {
TransactionInfoDTO aggregateMosaicCreationTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json");
Transaction aggregateMosaicCreationTransaction = map(aggregateMosaicCreationTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateMosaicCreationTransaction, aggregateMosaicCreationTransactionDTO);
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class ListenerVertxTest method subscribeOnHash.
@ParameterizedTest
@ValueSource(strings = { "CONFIRMED_ADDED", "AGGREGATE_BONDED_ADDED" })
public void subscribeOnHash(ListenerChannel channel) throws InterruptedException, ExecutionException, TimeoutException {
simulateWebSocketStartup();
TransactionInfoDTO transactionInfo = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json");
ObjectNode transactionInfoDtoJsonObject = jsonHelper.convert(transactionInfo, ObjectNode.class);
Address address = Address.createFromPublicKey(jsonHelper.getString(transactionInfoDtoJsonObject, "transaction", "signerPublicKey"), NETWORK_TYPE);
String channelName = channel.toString();
List<Transaction> transactions = new ArrayList<>();
List<Throwable> exceptions = new ArrayList<>();
BiFunction<Address, String, Observable<? extends Transaction>> subscriber = channel == ListenerChannel.CONFIRMED_ADDED ? listener::confirmedOrError : listener::aggregateBondedAddedOrError;
TransactionMetaDTO meta = jsonHelper.convert(transactionInfo.getMeta(), TransactionMetaDTO.class);
subscriber.apply(address, meta.getHash()).doOnError(exceptions::add).forEach(transactions::add);
handle(transactionInfoDtoJsonObject, channel.toString() + "/" + address.plain());
Assertions.assertEquals(1, transactions.size());
Assertions.assertEquals(0, exceptions.size());
Assertions.assertEquals(address, transactions.get(0).getSigner().get().getAddress());
Mockito.verify(webSocketMock).handler(Mockito.any());
Mockito.verify(webSocketMock).writeTextMessage(jsonHelper.print(new ListenerSubscribeMessage(this.wsId, channelName + "/" + address.plain())));
Mockito.verify(webSocketMock).writeTextMessage(jsonHelper.print(new ListenerSubscribeMessage(this.wsId, "status" + "/" + address.plain())));
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateStandaloneTransferTransaction.
@Test
void shouldCreateStandaloneTransferTransaction() {
TransactionInfoDTO transferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("standaloneTransferTransaction.json");
Transaction transferTransaction = map(transferTransactionDTO);
validateStandaloneTransaction(transferTransaction, transferTransactionDTO);
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateTransferTransaction.
@Test
void shouldCreateAggregateTransferTransaction() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateTransferTransaction.json");
Transaction aggregateTransferTransaction = map(aggregateTransferTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateTransferTransaction, aggregateTransferTransactionDTO);
}
Aggregations