Search in sources :

Example 1 with Settings

use of org.jnosql.diana.api.Settings in project jnosql-diana-driver by eclipse.

the class MongoDBDocumentConfigurationTest method shouldCreateSettings.

@Test
public void shouldCreateSettings() {
    Settings settings = Settings.builder().put("mongodb-server-host-1", "172.17.0.2:27017").build();
    MongoDBDocumentConfiguration configuration = new MongoDBDocumentConfiguration();
    DocumentCollectionManagerFactory managerFactory = configuration.get(settings);
    assertNotNull(managerFactory);
    assertNotNull(configuration.getAsync(settings));
}
Also used : DocumentCollectionManagerFactory(org.jnosql.diana.api.document.DocumentCollectionManagerFactory) Settings(org.jnosql.diana.api.Settings) Test(org.junit.jupiter.api.Test)

Example 2 with Settings

use of org.jnosql.diana.api.Settings in project jnosql-diana-driver by eclipse.

the class RiakKeyValueConfiguration method get.

@Override
public RiakBucketManagerFactory get(Settings settings) {
    requireNonNull(settings, "settings is required");
    List<RiakNode> nodes = new ArrayList<>();
    settings.keySet().stream().filter(k -> k.startsWith(SERVER_PREFIX)).sorted().map(settings::get).map(a -> new RiakNode.Builder().withRemoteAddress(a.toString()).build()).forEach(nodes::add);
    if (nodes.isEmpty()) {
        nodes.add(DEFAULT_NODE);
    }
    RiakCluster cluster = new RiakCluster.Builder(nodes).build();
    return new RiakBucketManagerFactory(cluster);
}
Also used : RiakNode(com.basho.riak.client.core.RiakNode) List(java.util.List) ConfigurationReader(org.jnosql.diana.driver.ConfigurationReader) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) RiakCluster(com.basho.riak.client.core.RiakCluster) KeyValueConfiguration(org.jnosql.diana.api.key.KeyValueConfiguration) Settings(org.jnosql.diana.api.Settings) Logger(java.util.logging.Logger) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) RiakCluster(com.basho.riak.client.core.RiakCluster) RiakNode(com.basho.riak.client.core.RiakNode)

Example 3 with Settings

use of org.jnosql.diana.api.Settings in project jnosql-diana-driver by eclipse.

the class CassandraConfigurationTest method shoudlCreateDocumentEntityManagerFactoryFromSettings.

@Test
public void shoudlCreateDocumentEntityManagerFactoryFromSettings() {
    Settings settings = Settings.builder().put("cassandra-hoster-1", "localhost").put("cassandra-port", "9142").build();
    CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
    ColumnFamilyManagerFactory entityManagerFactory = cassandraConfiguration.get(settings);
    assertNotNull(entityManagerFactory);
}
Also used : ColumnFamilyManagerFactory(org.jnosql.diana.api.column.ColumnFamilyManagerFactory) Settings(org.jnosql.diana.api.Settings) Test(org.junit.jupiter.api.Test)

Aggregations

Settings (org.jnosql.diana.api.Settings)3 Test (org.junit.jupiter.api.Test)2 RiakCluster (com.basho.riak.client.core.RiakCluster)1 RiakNode (com.basho.riak.client.core.RiakNode)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Logger (java.util.logging.Logger)1 ColumnFamilyManagerFactory (org.jnosql.diana.api.column.ColumnFamilyManagerFactory)1 DocumentCollectionManagerFactory (org.jnosql.diana.api.document.DocumentCollectionManagerFactory)1 KeyValueConfiguration (org.jnosql.diana.api.key.KeyValueConfiguration)1 ConfigurationReader (org.jnosql.diana.driver.ConfigurationReader)1