use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class NamespaceRegistrationIntegrationTest method aggregateRootRegisterNamespaceTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void aggregateRootRegisterNamespaceTransaction(RepositoryType type) {
String namespaceName = "test-root-namespace-" + Double.valueOf(Math.floor(Math.random() * 10000)).intValue();
NamespaceRegistrationTransaction namespaceRegistrationTransaction = NamespaceRegistrationTransactionFactory.createRootNamespace(getNetworkType(), getDeadline(), namespaceName, helper().getDuration()).maxFee(maxFee).build();
announceAggregateAndValidate(type, namespaceRegistrationTransaction, this.account);
rootNamespaceId = namespaceRegistrationTransaction.getNamespaceId();
sleep(1000);
NamespaceInfo namespaceInfo = get(getRepositoryFactory(type).createNamespaceRepository().getNamespace(namespaceRegistrationTransaction.getNamespaceId()));
Assertions.assertEquals(this.account.getAddress(), namespaceInfo.getOwnerAddress());
Assertions.assertEquals(namespaceRegistrationTransaction.getNamespaceId(), namespaceInfo.getId());
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class NamespaceRegistrationIntegrationTest method standaloneRootRegisterNamespaceTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void standaloneRootRegisterNamespaceTransaction(RepositoryType type) {
String namespaceName = "test-root-namespace-" + Double.valueOf(Math.floor(Math.random() * 10000)).intValue();
NamespaceRegistrationTransaction namespaceRegistrationTransaction = NamespaceRegistrationTransactionFactory.createRootNamespace(getNetworkType(), getDeadline(), namespaceName, helper().getDuration()).maxFee(maxFee).build();
announceAndValidate(type, this.account, namespaceRegistrationTransaction);
rootNamespaceId = namespaceRegistrationTransaction.getNamespaceId();
sleep(1000);
NamespaceInfo namespaceInfo = get(getRepositoryFactory(type).createNamespaceRepository().getNamespace(namespaceRegistrationTransaction.getNamespaceId()));
Assertions.assertEquals(this.account.getAddress(), namespaceInfo.getOwnerAddress());
Assertions.assertEquals(namespaceRegistrationTransaction.getNamespaceId(), namespaceInfo.getId());
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class SecretLockSecretProofTransactionIntegrationTest method aggregateSecretLockTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void aggregateSecretLockTransaction(RepositoryType type) {
byte[] secretBytes = RandomUtils.generateRandomBytes(20);
byte[] result = Hashes.sha3_256(secretBytes);
String secret = ConvertUtils.toHex(result);
Address recipient = config().getTestAccount2().getAddress();
SecretLockTransaction transaction = SecretLockTransactionFactory.create(getNetworkType(), getDeadline(), getNetworkCurrency().createRelative(BigInteger.valueOf(10)), BigInteger.valueOf(100), LockHashAlgorithm.SHA3_256, secret, recipient).maxFee(maxFee).build();
announceAggregateAndValidate(type, transaction, account);
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class SecretLockSecretProofTransactionIntegrationTest method standaloneSecretProofTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void standaloneSecretProofTransaction(RepositoryType type) {
byte[] secretBytes = RandomUtils.generateRandomBytes(20);
byte[] result = Hashes.sha3_256(secretBytes);
String secret = ConvertUtils.toHex(result);
String proof = ConvertUtils.toHex(secretBytes);
Address recipient = config().getTestAccount2().getAddress();
SecretLockTransaction secretLockTransaction = SecretLockTransactionFactory.create(getNetworkType(), getDeadline(), getNetworkCurrency().createRelative(BigInteger.valueOf(10)), BigInteger.valueOf(100), LockHashAlgorithm.SHA3_256, secret, recipient).maxFee(maxFee).build();
announceAndValidate(type, account, secretLockTransaction);
SecretProofTransaction secretProofTransaction = SecretProofTransactionFactory.create(getNetworkType(), getDeadline(), LockHashAlgorithm.SHA3_256, recipient, secret, proof).maxFee(maxFee).build();
announceAndValidate(type, account, secretProofTransaction);
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method outgoingTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void outgoingTransactions(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
PublicAccount recipient = this.helper().getTestAccount(type).getLeft().getPublicAccount();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Collections.singletonList(TransactionType.TRANSFER)).recipientAddress(recipient.getAddress()))).getData();
System.out.println(transactions.size());
transactions.forEach(transaction -> {
assertTransaction(transaction, null);
TransferTransaction transferTransaction = (TransferTransaction) transaction;
Assertions.assertEquals(recipient.getAddress(), transferTransaction.getRecipient());
});
}
Aggregations