Search in sources :

Example 1 with DocumentConfiguration

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

the class MongoDBDocumentConfigurationTest method shouldReturnErrorWhendSettingsIsNull.

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

Example 2 with DocumentConfiguration

use of org.jnosql.diana.api.document.DocumentConfiguration in project jnosql-artemis by eclipse.

the class DocumentCollectionFactoryProducer method getDocumentCollection.

private <T extends DocumentCollectionManager> DocumentCollectionManagerFactory<T> getDocumentCollection(InjectionPoint injectionPoint) {
    Annotated annotated = injectionPoint.getAnnotated();
    ConfigurationUnit annotation = getConfigurationUnit(injectionPoint, annotated).orElseThrow(() -> new IllegalStateException("The @ConfigurationUnit does not found"));
    ConfigurationSettingsUnit unit = configurationReader.get().read(annotation, DocumentConfiguration.class);
    Class<DocumentConfiguration> configurationClass = unit.<DocumentConfiguration>getProvider().orElseThrow(() -> new IllegalStateException("The DocumentConfiguration provider is required in the configuration"));
    DocumentConfiguration configuration = reflections.newInstance(configurationClass);
    return configuration.get(unit.getSettings());
}
Also used : Annotated(javax.enterprise.inject.spi.Annotated) ConfigurationSettingsUnit(org.jnosql.artemis.ConfigurationSettingsUnit) ConfigurationUnit(org.jnosql.artemis.ConfigurationUnit) DocumentConfiguration(org.jnosql.diana.api.document.DocumentConfiguration)

Example 3 with DocumentConfiguration

use of org.jnosql.diana.api.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(org.jnosql.diana.api.document.DocumentCollectionManagerFactory) DocumentConfiguration(org.jnosql.diana.api.document.DocumentConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

DocumentConfiguration (org.jnosql.diana.api.document.DocumentConfiguration)3 Test (org.junit.jupiter.api.Test)2 Annotated (javax.enterprise.inject.spi.Annotated)1 ConfigurationSettingsUnit (org.jnosql.artemis.ConfigurationSettingsUnit)1 ConfigurationUnit (org.jnosql.artemis.ConfigurationUnit)1 DocumentCollectionManagerFactory (org.jnosql.diana.api.document.DocumentCollectionManagerFactory)1