use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtEpochLatest.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtEpochLatest(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
FinalizedBlock finalizedBlock = get(repositoryFactory.createChainRepository().getChainInfo()).getLatestFinalizedBlock();
FinalizationRepository repository = repositoryFactory.createFinalizationRepository();
FinalizationProof finalizationProof = get(repository.getFinalizationProofAtEpoch(finalizedBlock.getFinalizationEpoch()));
Assertions.assertEquals(finalizationProof.getFinalizationEpoch(), finalizationProof.getFinalizationEpoch());
Assertions.assertEquals(finalizationProof.getFinalizationPoint(), finalizationProof.getFinalizationPoint());
Assertions.assertEquals(finalizationProof.getHeight(), finalizationProof.getHeight());
Assertions.assertEquals(1, finalizationProof.getVersion());
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class ListenerIntegrationTest method shouldReturnCosignatureAddedViaListener.
@ParameterizedTest
@EnumSource(RepositoryType.class)
@Disabled
void shouldReturnCosignatureAddedViaListener(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();
AggregateTransaction announcedTransaction = get(transactionService.announceAggregateBonded(listener, signedTransaction));
assertEquals(signedTransaction.getHash(), announcedTransaction.getTransactionInfo().get().getHash().get());
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Collections.singletonList(TransactionType.AGGREGATE_BONDED)).signerPublicKey(this.cosignatoryAccount.getPublicAccount().getPublicKey()))).getData();
AggregateTransaction transactionToCosign = (AggregateTransaction) transactions.get(0);
this.announceCosignatureTransaction(transactionToCosign, type);
CosignatureSignedTransaction cosignatureSignedTransaction = get(listener.cosignatureAdded(this.cosignatoryAccount.getAddress()).take(1));
assertEquals(cosignatureSignedTransaction.getSigner(), this.cosignatoryAccount2.getPublicAccount());
}
use of io.nem.symbol.sdk.api.RepositoryFactory 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.RepositoryFactory in project nem2-sdk-java by nemtech.
the class AAASetupIntegrationTest method createMultisigAccountBondedUsingNemesis.
@Test
@Order(7)
void createMultisigAccountBondedUsingNemesis() {
Account multisig = config().getNemesisAccount8();
RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
MultisigAccountInfo info = helper().createMultisigAccountBonded(type, multisig, config().getNemesisAccount9(), config().getNemesisAccount10());
StateProofService service = new StateProofServiceImpl(repositoryFactory);
StateMerkleProof<MultisigAccountInfo> proof = get(service.multisig(info));
Assertions.assertTrue(proof.isValid());
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class AAASetupIntegrationTest method createMultisigAccountCompleteUsingNemesis.
@Test
@Order(6)
void createMultisigAccountCompleteUsingNemesis() {
Account multisig = config().getNemesisAccount8();
System.out.println(multisig.getAddress().plain());
RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
MultisigAccountInfo info = helper().createMultisigAccountComplete(type, multisig, config().getNemesisAccount9(), config().getNemesisAccount10());
StateProofService service = new StateProofServiceImpl(repositoryFactory);
StateMerkleProof<MultisigAccountInfo> proof = get(service.multisig(info));
Assertions.assertTrue(proof.isValid());
}
Aggregations