use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateNamespaceMetadataTransaction.
@Test
void shouldCreateAggregateNamespaceMetadataTransaction() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateNamespaceMetadataTransaction.json");
AggregateTransaction aggregateTransferTransaction = (AggregateTransaction) map(aggregateTransferTransactionDTO);
validateAggregateTransaction(aggregateTransferTransaction, aggregateTransferTransactionDTO);
NamespaceMetadataTransaction transaction = (NamespaceMetadataTransaction) aggregateTransferTransaction.getInnerTransactions().get(0);
Assertions.assertEquals("90E6FF7755A80B6AA935A5C31B6D3D0CFAF82E06BF2B9CC9", transaction.getTargetAddress().encoded(transaction.getNetworkType()));
Assertions.assertEquals(-1, transaction.getValueSizeDelta());
Assertions.assertEquals(new BigInteger("11529215046069664444"), transaction.getScopedMetadataKey());
Assertions.assertArrayEquals(StringEncoder.getBytes("This is the message for this account! 汉字89664"), transaction.getValue());
Assertions.assertEquals("0003070467832AAA", transaction.getTargetNamespaceId().getIdAsHex());
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAccountOperationRestriction.
@Test
public void shouldCreateAccountOperationRestriction() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("accountOperationRestrictionTransaction.json");
AccountOperationRestrictionTransaction transaction = (AccountOperationRestrictionTransaction) map(transactionInfoDTO);
validateStandaloneTransaction(transaction, transactionInfoDTO);
Assertions.assertEquals(AccountOperationRestrictionFlags.ALLOW_OUTGOING_TRANSACTION_TYPE, transaction.getRestrictionFlags());
Assertions.assertEquals(1, transaction.getRestrictionAdditions().size());
Assertions.assertEquals(TransactionType.MOSAIC_METADATA, transaction.getRestrictionAdditions().get(0));
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method shouldGetTransactionParial.
@Test
public void shouldGetTransactionParial() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json", TransactionInfoDTO.class);
String hash = jsonHelper.getString(transactionInfoDTO, "meta", "hash");
mockRemoteCall(transactionInfoDTO);
Transaction transaction = repository.getTransaction(TransactionGroup.PARTIAL, hash).toFuture().get();
Assertions.assertNotNull(transaction);
Assertions.assertEquals(hash, transaction.getTransactionInfo().get().getHash().get());
Assertions.assertEquals(TransactionGroup.PARTIAL, transaction.getGroup().get());
}
use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method searchTransactions.
@Test
public void searchTransactions() throws Exception {
TransactionInfoDTO transferTransactionDTO = loadTransactionInfoDTO("standaloneTransferTransaction.json");
PublicAccount publicAccount = Account.generateNewAccount(networkType).getPublicAccount();
mockRemoteCall(toPage(transferTransactionDTO));
Page<Transaction> transactions = repository.search(new TransactionSearchCriteria(TransactionGroup.UNCONFIRMED).signerPublicKey(publicAccount.getPublicKey())).toFuture().get();
Assertions.assertEquals(TransactionType.TRANSFER, transactions.getData().get(0).getType());
Assertions.assertEquals(TransactionGroup.UNCONFIRMED, 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 TransactionRepositoryVertxImplTest method searchTransactionsTransactionTypes.
@Test
public void searchTransactionsTransactionTypes() throws Exception {
TransactionInfoDTO transferTransactionDTO = loadTransactionInfoDTO("standaloneTransferTransaction.json");
mockRemoteCall(toPage(transferTransactionDTO));
TransactionSearchCriteria criteria = new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Arrays.asList(TransactionType.NAMESPACE_METADATA, TransactionType.AGGREGATE_COMPLETE));
Page<Transaction> transactions = repository.search(criteria).toFuture().get();
Assertions.assertEquals(TransactionType.TRANSFER, transactions.getData().get(0).getType());
Assertions.assertEquals(TransactionGroup.CONFIRMED, transactions.getData().get(0).getGroup().get());
Assertions.assertEquals(1, transactions.getData().size());
Assertions.assertEquals(1, transactions.getPageNumber());
Assertions.assertEquals(2, transactions.getPageSize());
}
Aggregations