Search in sources :

Example 1 with RepositoryFactoryVertxImpl

use of io.nem.symbol.sdk.infrastructure.vertx.RepositoryFactoryVertxImpl in project nem2-sdk-java by nemtech.

the class RepositoryFactoryConfigurationExamplesIntegrationTest method bootAppUsingLegacyHardcodedCurrencies.

@Test
void bootAppUsingLegacyHardcodedCurrencies() throws ExecutionException, InterruptedException {
    // Option 3) Client app boot time relaying on some of the rest configuration.
    // User uses the
    // legacy hardcoded sdk currencies
    RepositoryFactoryConfiguration configuration = new RepositoryFactoryConfiguration("http://localhost:3000");
    configuration.withNetworkCurrencies(new NetworkCurrencies(Currency.CAT_CURRENCY, Currency.CAT_HARVEST));
    try (RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(configuration)) {
        appDoSomeStuff(repositoryFactory);
    }
}
Also used : NetworkCurrencies(io.nem.symbol.sdk.model.mosaic.NetworkCurrencies) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) RepositoryFactoryConfiguration(io.nem.symbol.sdk.api.RepositoryFactoryConfiguration) RepositoryFactoryVertxImpl(io.nem.symbol.sdk.infrastructure.vertx.RepositoryFactoryVertxImpl) Test(org.junit.jupiter.api.Test)

Example 2 with RepositoryFactoryVertxImpl

use of io.nem.symbol.sdk.infrastructure.vertx.RepositoryFactoryVertxImpl in project nem2-sdk-java by nemtech.

the class RepositoryFactoryConfigurationExamplesIntegrationTest method bootAppFullyOffline.

@Test
void bootAppFullyOffline() throws ExecutionException, InterruptedException {
    // Option 1) Client app boot time. The clients defines the configuration to work
    // offline.
    RepositoryFactoryConfiguration configuration = new RepositoryFactoryConfiguration("http://localhost:3000");
    configuration.withNetworkType(NetworkType.MAIN_NET);
    configuration.withGenerationHash("abc");
    Currency currency = new CurrencyBuilder(NamespaceId.createFromName("my.custom.currency"), 6).build();
    Currency harvest = new CurrencyBuilder(NamespaceId.createFromName("my.custom.harvest"), 3).build();
    configuration.withNetworkCurrencies(new NetworkCurrencies(currency, harvest));
    try (RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(configuration)) {
        appDoSomeStuff(repositoryFactory);
    }
}
Also used : CurrencyBuilder(io.nem.symbol.sdk.model.mosaic.CurrencyBuilder) Currency(io.nem.symbol.sdk.model.mosaic.Currency) NetworkCurrencies(io.nem.symbol.sdk.model.mosaic.NetworkCurrencies) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) RepositoryFactoryConfiguration(io.nem.symbol.sdk.api.RepositoryFactoryConfiguration) RepositoryFactoryVertxImpl(io.nem.symbol.sdk.infrastructure.vertx.RepositoryFactoryVertxImpl) Test(org.junit.jupiter.api.Test)

Aggregations

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