use of io.nem.symbol.sdk.model.namespace.NamespaceInfo in project nem2-sdk-java by nemtech.
the class NamespaceRepositoryIntegrationTest method getNamespace.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getNamespace(RepositoryType type) {
NamespaceInfo namespaceInfo = get(getNamespaceRepository(type).getNamespace(namespaceId));
assertEquals(new BigInteger("1"), namespaceInfo.getStartHeight());
assertEquals(namespaceId, namespaceInfo.getId());
assertEquals(namespaceId, namespaceInfo.getLevels().get(1));
}
use of io.nem.symbol.sdk.model.namespace.NamespaceInfo in project nem2-sdk-java by nemtech.
the class NamespaceRepositoryIntegrationTest method getNamespacesFromAccount.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getNamespacesFromAccount(RepositoryType type) {
Account account = config().getDefaultAccount();
List<NamespaceInfo> namespacesInfo = get(getNamespaceRepository(type).search(new NamespaceSearchCriteria().ownerAddress(account.getAddress()))).getData();
namespacesInfo.forEach(n -> {
Assertions.assertEquals(account.getAddress(), n.getOwnerAddress());
});
}
use of io.nem.symbol.sdk.model.namespace.NamespaceInfo 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());
}
use of io.nem.symbol.sdk.model.namespace.NamespaceInfo in project nem2-sdk-java by nemtech.
the class NamespaceRegistrationIntegrationTest method standaloneSubNamespaceRegisterNamespaceTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void standaloneSubNamespaceRegisterNamespaceTransaction(RepositoryType type) {
this.standaloneRootRegisterNamespaceTransaction(type);
String namespaceName = "test-sub-namespace-" + Double.valueOf(Math.floor(Math.random() * 10000)).intValue();
NamespaceRegistrationTransaction namespaceRegistrationTransaction = NamespaceRegistrationTransactionFactory.createSubNamespace(getNetworkType(), getDeadline(), namespaceName, this.rootNamespaceId).maxFee(maxFee).build();
announceAndValidate(type, this.account, namespaceRegistrationTransaction);
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 io.nem.symbol.sdk.model.namespace.NamespaceInfo 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());
}
Aggregations