Search in sources :

Example 11 with KeyValueConfiguration

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

the class KeyValueEntityManagerFactoryTest method setUp.

@BeforeEach
public void setUp() {
    KeyValueConfiguration configuration = new InfinispanKeyValueConfiguration();
    managerFactory = configuration.get();
}
Also used : KeyValueConfiguration(jakarta.nosql.keyvalue.KeyValueConfiguration) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with KeyValueConfiguration

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

the class BucketManagerFactoryConverter method success.

@Override
public BucketManagerFactory success(String value) {
    final SettingsConverter settingsConverter = BeanManagers.getInstance(SettingsConverter.class);
    Config config = BeanManagers.getInstance(Config.class);
    final Settings settings = settingsConverter.convert(value);
    String provider = value + ".provider";
    final Class<?> configurationClass = config.getValue(provider, Class.class);
    if (KeyValueConfiguration.class.isAssignableFrom(configurationClass)) {
        final Reflections reflections = BeanManagers.getInstance(Reflections.class);
        final KeyValueConfiguration configuration = (KeyValueConfiguration) reflections.newInstance(configurationClass);
        return configuration.get(settings);
    }
    throw new ConfigurationException("The class " + configurationClass + " is not valid to " + KeyValueConfiguration.class);
}
Also used : KeyValueConfiguration(jakarta.nosql.keyvalue.KeyValueConfiguration) SettingsConverter(org.eclipse.jnosql.mapping.configuration.SettingsConverter) ConfigurationException(org.eclipse.jnosql.mapping.configuration.ConfigurationException) Config(org.eclipse.microprofile.config.Config) Settings(jakarta.nosql.Settings) Reflections(org.eclipse.jnosql.mapping.reflection.Reflections)

Aggregations

KeyValueConfiguration (jakarta.nosql.keyvalue.KeyValueConfiguration)12 Test (org.junit.jupiter.api.Test)6 BucketManagerFactory (jakarta.nosql.keyvalue.BucketManagerFactory)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Settings (jakarta.nosql.Settings)1 HazelcastKeyValueConfiguration (org.eclipse.jnosql.communication.hazelcast.keyvalue.HazelcastKeyValueConfiguration)1 InfinispanKeyValueConfiguration (org.eclipse.jnosql.communication.infinispan.keyvalue.InfinispanKeyValueConfiguration)1 ConfigurationException (org.eclipse.jnosql.mapping.configuration.ConfigurationException)1 SettingsConverter (org.eclipse.jnosql.mapping.configuration.SettingsConverter)1 Reflections (org.eclipse.jnosql.mapping.reflection.Reflections)1 Config (org.eclipse.microprofile.config.Config)1