Search in sources :

Example 6 with RepositoryFactoryConfiguration

use of io.nem.symbol.sdk.api.RepositoryFactoryConfiguration in project nem2-sdk-java by nemtech.

the class RepositoryFactoryVertxImplTest method getRestProvidedNetworkCurrencies.

@Test
public void getRestProvidedNetworkCurrencies() throws Exception {
    String baseUrl = "https://localhost:1934/path";
    RepositoryFactoryConfiguration configuration = new RepositoryFactoryConfiguration(baseUrl);
    configuration.withGenerationHash("abc");
    configuration.withNetworkType(NetworkType.MAIN_NET);
    RepositoryFactory factory = new RepositoryFactoryVertxImpl(configuration) {

        @Override
        protected Observable<NetworkCurrencies> loadNetworkCurrencies() {
            return Observable.just(new NetworkCurrencies(Currency.CAT_CURRENCY, Currency.CAT_HARVEST));
        }
    };
    Assertions.assertEquals(configuration.getNetworkType(), factory.getNetworkType().toFuture().get());
    Assertions.assertEquals(configuration.getGenerationHash(), factory.getGenerationHash().toFuture().get());
    Assertions.assertEquals(Currency.CAT_HARVEST, factory.getHarvestCurrency().toFuture().get());
    Assertions.assertEquals(Currency.CAT_CURRENCY, factory.getNetworkCurrency().toFuture().get());
}
Also used : NetworkCurrencies(io.nem.symbol.sdk.model.mosaic.NetworkCurrencies) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) RepositoryFactoryConfiguration(io.nem.symbol.sdk.api.RepositoryFactoryConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)6 RepositoryFactoryConfiguration (io.nem.symbol.sdk.api.RepositoryFactoryConfiguration)6 Test (org.junit.jupiter.api.Test)6 NetworkCurrencies (io.nem.symbol.sdk.model.mosaic.NetworkCurrencies)4 RepositoryFactoryVertxImpl (io.nem.symbol.sdk.infrastructure.vertx.RepositoryFactoryVertxImpl)2 Currency (io.nem.symbol.sdk.model.mosaic.Currency)1 CurrencyBuilder (io.nem.symbol.sdk.model.mosaic.CurrencyBuilder)1