Search in sources :

Example 1 with DocumentConfiguration

use of jakarta.nosql.document.DocumentConfiguration in project jnosql-diana by eclipse.

the class DocumentCollectionManagerFactoryConverter method success.

@Override
public DocumentCollectionManagerFactory 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 (DocumentConfiguration.class.isAssignableFrom(configurationClass)) {
        final Reflections reflections = BeanManagers.getInstance(Reflections.class);
        final DocumentConfiguration configuration = (DocumentConfiguration) reflections.newInstance(configurationClass);
        return configuration.get(settings);
    }
    throw new ConfigurationException("The class " + configurationClass + " is not valid to " + DocumentConfiguration.class);
}
Also used : SettingsConverter(org.eclipse.jnosql.mapping.configuration.SettingsConverter) ConfigurationException(org.eclipse.jnosql.mapping.configuration.ConfigurationException) Config(org.eclipse.microprofile.config.Config) DocumentConfiguration(jakarta.nosql.document.DocumentConfiguration) Settings(jakarta.nosql.Settings) Reflections(org.eclipse.jnosql.mapping.reflection.Reflections)

Example 2 with DocumentConfiguration

use of jakarta.nosql.document.DocumentConfiguration in project jnosql-diana-driver by eclipse.

the class CouchbaseDocumentConfigurationTest method shouldGetConfiguration.

@Test
public void shouldGetConfiguration() {
    DocumentConfiguration configuration = DocumentConfiguration.getConfiguration();
    Assertions.assertNotNull(configuration);
    Assertions.assertTrue(configuration instanceof CouchbaseDocumentConfiguration);
}
Also used : DocumentConfiguration(jakarta.nosql.document.DocumentConfiguration) Test(org.junit.jupiter.api.Test)

Example 3 with DocumentConfiguration

use of jakarta.nosql.document.DocumentConfiguration in project jnosql-diana-driver by eclipse.

the class MongoDBDocumentConfigurationTest method shouldCreateDocumentCollectionManagerFactoryByFile.

@Test
public void shouldCreateDocumentCollectionManagerFactoryByFile() {
    DocumentConfiguration configuration = new MongoDBDocumentConfiguration();
    DocumentCollectionManagerFactory managerFactory = configuration.get();
    assertNotNull(managerFactory);
}
Also used : DocumentCollectionManagerFactory(jakarta.nosql.document.DocumentCollectionManagerFactory) DocumentConfiguration(jakarta.nosql.document.DocumentConfiguration) Test(org.junit.jupiter.api.Test)

Example 4 with DocumentConfiguration

use of jakarta.nosql.document.DocumentConfiguration in project jnosql-diana-driver by eclipse.

the class RavenDBDocumentConfigurationTest method shouldCreateDocumentCollectionManagerFactoryByFile.

@Test
public void shouldCreateDocumentCollectionManagerFactoryByFile() {
    DocumentConfiguration configuration = new RavenDBDocumentConfiguration();
    DocumentCollectionManagerFactory managerFactory = configuration.get();
    assertNotNull(managerFactory);
}
Also used : DocumentCollectionManagerFactory(jakarta.nosql.document.DocumentCollectionManagerFactory) DocumentConfiguration(jakarta.nosql.document.DocumentConfiguration) Test(org.junit.jupiter.api.Test)

Example 5 with DocumentConfiguration

use of jakarta.nosql.document.DocumentConfiguration in project jnosql-diana-driver by eclipse.

the class RavenDBDocumentConfigurationTest method shouldReturnErrorWhendSettingsIsNull.

@Test
public void shouldReturnErrorWhendSettingsIsNull() {
    DocumentConfiguration configuration = new RavenDBDocumentConfiguration();
    assertThrows(NullPointerException.class, () -> configuration.get(null));
}
Also used : DocumentConfiguration(jakarta.nosql.document.DocumentConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

DocumentConfiguration (jakarta.nosql.document.DocumentConfiguration)11 Test (org.junit.jupiter.api.Test)10 DocumentCollectionManagerFactory (jakarta.nosql.document.DocumentCollectionManagerFactory)3 Settings (jakarta.nosql.Settings)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