Search in sources :

Example 1 with BucketManagerFactory

use of jakarta.nosql.keyvalue.BucketManagerFactory in project jnosql-diana by eclipse.

the class BucketManagerFactoryConverterTest method shouldReturnManagerFactory.

@Test
public void shouldReturnManagerFactory() {
    final String prefix = UUID.randomUUID().toString();
    System.setProperty(prefix, prefix);
    System.setProperty(prefix + ".settings.key", "value");
    System.setProperty(prefix + ".settings.key2", "value2");
    System.setProperty(prefix + ".provider", KeyValueConfigurationMock.class.getName());
    final BucketManagerFactory managerFactory = config.getValue(prefix, BucketManagerFactory.class);
    final BucketManagerFactoryMock factoryMock = BucketManagerFactoryMock.class.cast(managerFactory);
    final Settings settings = factoryMock.getSettings();
    assertEquals(2, settings.size());
    assertEquals(settings.get("key").get(), "value");
    assertEquals(settings.get("key2").get(), "value2");
    assertNotNull(managerFactory);
    System.clearProperty(prefix);
    System.clearProperty(prefix + ".settings.key");
    System.clearProperty(prefix + ".settings.key2");
    System.clearProperty(prefix + ".provider");
}
Also used : BucketManagerFactoryMock(org.eclipse.jnosql.mapping.keyvalue.configuration.KeyValueConfigurationMock.BucketManagerFactoryMock) Settings(jakarta.nosql.Settings) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) Test(org.junit.jupiter.api.Test)

Example 2 with BucketManagerFactory

use of jakarta.nosql.keyvalue.BucketManagerFactory in project jnosql-diana by eclipse.

the class BucketManagerConverter method success.

@Override
public BucketManager success(String value) {
    Config config = BeanManagers.getInstance(Config.class);
    final BucketManagerFactory managerFactory = config.getValue(value, BucketManagerFactory.class);
    final String database = value + ".database";
    final String entity = config.getValue(database, String.class);
    return managerFactory.getBucketManager(entity);
}
Also used : Config(org.eclipse.microprofile.config.Config) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory)

Example 3 with BucketManagerFactory

use of jakarta.nosql.keyvalue.BucketManagerFactory in project jnosql-diana-driver by eclipse.

the class ArangoDBConfigurationTest method shouldCreateKeyValueFactoryFromFile.

@Test
public void shouldCreateKeyValueFactoryFromFile() {
    BucketManagerFactory managerFactory = configuration.get();
    assertNotNull(managerFactory);
}
Also used : BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) Test(org.junit.jupiter.api.Test)

Example 4 with BucketManagerFactory

use of jakarta.nosql.keyvalue.BucketManagerFactory in project jnosql-diana-driver by eclipse.

the class CouchbaseKeyValueConfigurationTest method shouldCreateKeyValueFactoryFromFile.

@Test
public void shouldCreateKeyValueFactoryFromFile() {
    BucketManagerFactory managerFactory = configuration.get();
    assertNotNull(managerFactory);
}
Also used : BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) Test(org.junit.jupiter.api.Test)

Example 5 with BucketManagerFactory

use of jakarta.nosql.keyvalue.BucketManagerFactory in project jnosql-diana-driver by eclipse.

the class CouchbaseMapTest method afterClass.

@AfterAll
public static void afterClass() {
    CouchbaseKeyValueConfiguration configuration = CouchbaseKeyValueTcConfiguration.getTcConfiguration();
    BucketManagerFactory keyValueEntityManagerFactory = configuration.get();
    BucketManager keyValueEntityManager = keyValueEntityManagerFactory.getBucketManager(CouchbaseUtil.BUCKET_NAME);
    keyValueEntityManager.delete("jnosql:map");
}
Also used : BucketManager(jakarta.nosql.keyvalue.BucketManager) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) AfterAll(org.junit.jupiter.api.AfterAll)

Aggregations

BucketManagerFactory (jakarta.nosql.keyvalue.BucketManagerFactory)25 Test (org.junit.jupiter.api.Test)13 BucketManager (jakarta.nosql.keyvalue.BucketManager)8 AfterAll (org.junit.jupiter.api.AfterAll)8 HashMap (java.util.HashMap)4 KeyValueConfiguration (jakarta.nosql.keyvalue.KeyValueConfiguration)3 CouchbaseKeyValueConfiguration (org.eclipse.jnosql.communication.couchbase.keyvalue.CouchbaseKeyValueConfiguration)3 Settings (jakarta.nosql.Settings)1 HazelcastKeyValueConfiguration (org.eclipse.jnosql.communication.hazelcast.keyvalue.HazelcastKeyValueConfiguration)1 InfinispanKeyValueConfiguration (org.eclipse.jnosql.communication.infinispan.keyvalue.InfinispanKeyValueConfiguration)1 BucketManagerFactoryMock (org.eclipse.jnosql.mapping.keyvalue.configuration.KeyValueConfigurationMock.BucketManagerFactoryMock)1 Config (org.eclipse.microprofile.config.Config)1