use of io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse in project nem2-sdk-java by nemtech.
the class TransactionServiceTest method announce.
@Test
void announce() throws ExecutionException, InterruptedException {
TransferTransaction transferTransaction = TransferTransactionFactory.create(networkType, new Deadline(BigInteger.ONE), Address.generateRandom(networkType), Collections.emptyList()).build();
SignedTransaction signedTransaction = transferTransaction.signWith(account, "abc");
TransactionAnnounceResponse transactionAnnounceResponse = new TransactionAnnounceResponse("Some Message");
Mockito.when(transactionRepositoryMock.announce(Mockito.eq(signedTransaction))).thenReturn(Observable.just(transactionAnnounceResponse));
Mockito.when(listener.confirmedOrError(Mockito.eq(account.getAddress()), Mockito.eq(signedTransaction.getHash()))).thenReturn(Observable.just(transferTransaction));
Observable<Transaction> announcedTransaction = service.announce(listener, signedTransaction);
Assertions.assertEquals(transferTransaction, announcedTransaction.toFuture().get());
}
use of io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method announceAggregateBondedCosignature.
@Test
public void announceAggregateBondedCosignature() throws Exception {
Account signer = Account.generateNewAccount(networkType);
BigInteger version = AggregateTransactionCosignature.DEFAULT_VERSION;
CosignatureSignedTransaction signedTransaction = new CosignatureSignedTransaction(version, "aParentHash", "aSignature", signer.getPublicAccount());
AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
announceTransactionInfoDTO.setMessage("SomeMessage");
ArgumentCaptor<Object> parameter = mockRemoteCall(announceTransactionInfoDTO);
TransactionAnnounceResponse response = repository.announceAggregateBondedCosignature(signedTransaction).toFuture().get();
Assertions.assertNotNull(response);
Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
Cosignature cosignature = (Cosignature) parameter.getValue();
Assertions.assertEquals(signedTransaction.getParentHash(), cosignature.getParentHash());
Assertions.assertEquals(signedTransaction.getSignature(), cosignature.getSignature());
Assertions.assertEquals(signedTransaction.getSigner().getPublicKey().toHex(), cosignature.getSignerPublicKey());
Assertions.assertEquals(signedTransaction.getVersion(), cosignature.getVersion());
}
use of io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse in project nem2-sdk-java by nemtech.
the class TransactionRepositoryOkHttpImplTest method shouldAnnounceAggregateBonded.
@Test
public void shouldAnnounceAggregateBonded() throws Exception {
SignedTransaction signedTransaction = getSignedTransaction();
AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
announceTransactionInfoDTO.setMessage("SomeMessage");
mockRemoteCall(announceTransactionInfoDTO);
TransactionAnnounceResponse response = repository.announceAggregateBonded(signedTransaction).toFuture().get();
Assertions.assertNotNull(response);
Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
}
use of io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse in project nem2-sdk-java by nemtech.
the class TransactionRepositoryOkHttpImplTest method shouldAnnounce.
@Test
public void shouldAnnounce() throws Exception {
SignedTransaction signedTransaction = getSignedTransaction();
AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
announceTransactionInfoDTO.setMessage("SomeMessage");
mockRemoteCall(announceTransactionInfoDTO);
TransactionAnnounceResponse response = repository.announce(signedTransaction).toFuture().get();
Assertions.assertNotNull(response);
Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
}
use of io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse in project nem2-sdk-java by nemtech.
the class TransactionRepositoryOkHttpImplTest method announceAggregateBondedCosignature.
@Test
public void announceAggregateBondedCosignature() throws Exception {
Account signer = Account.generateNewAccount(networkType);
BigInteger version = AggregateTransactionCosignature.DEFAULT_VERSION;
CosignatureSignedTransaction signedTransaction = new CosignatureSignedTransaction(version, "aParentHash", "aSignature", signer.getPublicAccount());
AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
announceTransactionInfoDTO.setMessage("SomeMessage");
ArgumentCaptor<Object> parameter = mockRemoteCall(announceTransactionInfoDTO);
TransactionAnnounceResponse response = repository.announceAggregateBondedCosignature(signedTransaction).toFuture().get();
Assertions.assertNotNull(response);
Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
Cosignature cosignature = (Cosignature) parameter.getValue();
Assertions.assertEquals(signedTransaction.getParentHash(), cosignature.getParentHash());
Assertions.assertEquals(signedTransaction.getSignature(), cosignature.getSignature());
Assertions.assertEquals(signedTransaction.getSigner().getPublicKey().toHex(), cosignature.getSignerPublicKey());
}
Aggregations