use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class MerkleLoaderIntegrationTest method accountRestrictions.
public List<Arguments> accountRestrictions() {
RepositoryFactory repositoryFactory = getRepositoryFactory(DEFAULT_REPOSITORY_TYPE);
RestrictionAccountRepository repository = repositoryFactory.createRestrictionAccountRepository();
return getArguments(repository, new AccountRestrictionSearchCriteria());
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method getNetworkCurrencies.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getNetworkCurrencies(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
NetworkCurrencies networkCurrencies = get(service.getNetworkCurrencies());
Assertions.assertNotNull(networkCurrencies.getCurrency());
Assertions.assertEquals(networkCurrencies.getCurrency().getUnresolvedMosaicId(), networkCurrencies.getCurrency().getMosaicId().get());
Assertions.assertNotNull(networkCurrencies.getCurrency().getMosaicId().get());
Assertions.assertEquals(networkCurrencies.getCurrency(), (get(repositoryFactory.getNetworkCurrency())));
Assertions.assertNotNull(networkCurrencies.getHarvest());
Assertions.assertEquals(networkCurrencies.getHarvest().getUnresolvedMosaicId(), networkCurrencies.getHarvest().getMosaicId().get());
Assertions.assertNotNull(networkCurrencies.getHarvest().getMosaicId().get());
Assertions.assertEquals(networkCurrencies.getHarvest(), (get(repositoryFactory.getHarvestCurrency())));
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method testNetworkCurrencyInvalidNamespaceId.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void testNetworkCurrencyInvalidNamespaceId(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
get(service.getCurrencyFromNamespaceId(NamespaceId.createFromName("invalid.currency")));
});
Assertions.assertEquals("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id 'C1DF8A076D934A50'", exception.getMessage());
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class CurrencyServiceIntegrationTest method testNetworkCurrencyInvaliMosaicId.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void testNetworkCurrencyInvaliMosaicId(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
CurrencyService service = new CurrencyServiceImpl(repositoryFactory);
RepositoryCallException exception = Assertions.assertThrows(RepositoryCallException.class, () -> {
get(service.getCurrency(new MosaicId(BigInteger.TEN)));
});
Assertions.assertEquals("ApiException: Not Found - 404 - ResourceNotFound - no resource exists with id '000000000000000A'", exception.getMessage());
}
use of io.nem.symbol.sdk.api.RepositoryFactory in project nem2-sdk-java by nemtech.
the class FinalizationRepositoryIntegrationTest method getFinalizationProofAtCurrentFinalizedHeight.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getFinalizationProofAtCurrentFinalizedHeight(RepositoryType type) {
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
FinalizedBlock finalizedBlock = get(repositoryFactory.createChainRepository().getChainInfo()).getLatestFinalizedBlock();
FinalizationRepository repository = repositoryFactory.createFinalizationRepository();
FinalizationProof finalizationProof = get(repository.getFinalizationProofAtHeight(finalizedBlock.getHeight()));
Assertions.assertEquals(finalizationProof.getFinalizationEpoch(), finalizationProof.getFinalizationEpoch());
Assertions.assertEquals(finalizationProof.getFinalizationPoint(), finalizationProof.getFinalizationPoint());
Assertions.assertEquals(finalizationProof.getHeight(), finalizationProof.getHeight());
Assertions.assertEquals(1, finalizationProof.getVersion());
}
Aggregations