use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class MultisignIntegrationTest method shouldReturnCosignatureAddedViaListener2.
@Disabled
@ParameterizedTest
@EnumSource(RepositoryType.class)
void shouldReturnCosignatureAddedViaListener2(RepositoryType type) {
Listener listener = getListener(type);
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
TransactionRepository transactionRepository = repositoryFactory.createTransactionRepository();
SignedTransaction signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.getAddress());
Object finalObject = get(createHashLockTransactionAndAnnounce(type, signedAggregatedTx, cosignAccount1).flatMap(t -> {
System.out.println("hash lock finished");
TransactionServiceImpl transactionService = new TransactionServiceImpl(getRepositoryFactory(type));
return transactionService.announceAggregateBonded(listener, signedAggregatedTx).flatMap(a -> {
System.out.println("Aggregate bonded finished");
return repositoryFactory.createTransactionRepository().search(new TransactionSearchCriteria(TransactionGroup.PARTIAL).signerPublicKey(cosignAccount1.getPublicAccount().getPublicKey())).flatMap((page) -> {
List<Transaction> transactions = page.getData();
System.out.println("partialTransactions " + transactions.size());
AggregateTransaction transactionToCosign = (AggregateTransaction) transactions.get(0);
CosignatureTransaction cosignatureTransaction = CosignatureTransaction.create(transactionToCosign);
CosignatureSignedTransaction cosignatureSignedTransaction = cosignAccount2.signCosignatureTransaction(cosignatureTransaction);
return transactionRepository.announceAggregateBondedCosignature(cosignatureSignedTransaction).flatMap(r -> {
System.out.println("announceAggregateBondedCosignature " + r);
return listener.cosignatureAdded(cosignAccount1.getAddress());
});
});
});
}));
System.out.println(finalObject.getClass());
Assertions.assertNull(finalObject);
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class NamespaceMetadataServiceIntegrationTest method setAndUpdateNamespaceMetadata.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void setAndUpdateNamespaceMetadata(RepositoryType type) {
// TODO try target != signer
Account signerAccount = config().getDefaultAccount();
Account targetAccount = config().getDefaultAccount();
String namespaceName = "namespace-id-metadata-service-integration-test-" + Double.valueOf(Math.floor(Math.random() * 10000)).intValue();
NamespaceId targetNamespaceId = super.createRootNamespace(type, signerAccount, namespaceName);
BigInteger key = BigInteger.valueOf(RandomUtils.generateRandomInt(100000));
String originalMessage = "The original message";
String newMessage = "The new Message";
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
MetadataRepository metadataRepository = repositoryFactory.createMetadataRepository();
MetadataTransactionService service = new MetadataTransactionServiceImpl(repositoryFactory);
NamespaceMetadataTransaction originalTransaction = get(service.createNamespaceMetadataTransactionFactory(targetAccount.getAddress(), key, originalMessage, signerAccount.getAddress(), targetNamespaceId)).maxFee(maxFee).build();
announceAggregateAndValidate(type, originalTransaction, signerAccount);
assertMetadata(targetNamespaceId, key, originalMessage, metadataRepository, signerAccount);
NamespaceMetadataTransaction updateTransaction = get(service.createNamespaceMetadataTransactionFactory(targetAccount.getAddress(), key, newMessage, signerAccount.getAddress(), targetNamespaceId)).maxFee(maxFee).build();
announceAggregateAndValidate(type, updateTransaction, signerAccount);
assertMetadata(targetNamespaceId, key, newMessage, metadataRepository, signerAccount);
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class TestnetTester method main.
public static void main(String[] args) throws Exception {
String baseUrl = "http://api-01.us-west-2.0.10.0.x.symboldev.network:3000";
// String baseUrl = "http://api-01.us-west-1.0.10.0.x.symboldev.network:3000";
// String baseUrl = "http://api-01.ap-northeast-1.0.10.0.x.symboldev.network:3000";
RepositoryFactory repositoryFactory = new RepositoryFactoryOkHttpImpl(baseUrl);
sendVotingKey2(repositoryFactory);
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class MerkleLoaderIntegrationTest method metadatas.
public List<Arguments> metadatas() {
RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
MetadataRepository repository = repositoryFactory.createMetadataRepository();
return getArguments(repository, new MetadataSearchCriteria().order(ORDER_BY));
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class MerkleLoaderIntegrationTest method namespacesMerkles.
@ParameterizedTest
@MethodSource("namespaces")
void namespacesMerkles(NamespaceInfo state, RepositoryType repositoryType) {
RepositoryFactory repositoryFactory = getRepositoryFactory(repositoryType);
StateProofServiceImpl service = new StateProofServiceImpl(repositoryFactory);
StateMerkleProof<NamespaceInfo> proof = get(service.namespace(state));
Assertions.assertTrue(proof.isValid(), "Invalid proof " + proof.getState().getId().getIdAsHex());
}
Aggregations