use of org.jnosql.artemis.document.DocumentTemplate in project jnosql-artemis by eclipse.
the class RepositoryDocumentBean method create.
@Override
public Repository create(CreationalContext<Repository> creationalContext) {
ClassRepresentations classRepresentations = getInstance(ClassRepresentations.class);
DocumentTemplate repository = provider.isEmpty() ? getInstance(DocumentTemplate.class) : getInstance(DocumentTemplate.class, provider);
Reflections reflections = getInstance(Reflections.class);
Converters converters = getInstance(Converters.class);
DocumentRepositoryProxy handler = new DocumentRepositoryProxy(repository, classRepresentations, type, reflections, converters);
return (Repository) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of org.jnosql.artemis.document.DocumentTemplate in project jnosql-artemis by eclipse.
the class MockProducer method getDocumentRepository.
@Produces
@Database(value = DatabaseType.DOCUMENT, provider = "documentRepositoryMock")
public DocumentTemplate getDocumentRepository() {
DocumentTemplate documentTemplate = mock(DocumentTemplate.class);
when(documentTemplate.insert(Mockito.any(Person.class))).thenReturn(Person.builder().withName("documentRepositoryMock").build());
when(documentTemplate.singleResult(any(DocumentQuery.class))).thenReturn(Optional.empty());
when(documentTemplate.find(eq(Person.class), Mockito.any())).thenReturn(Optional.empty());
return documentTemplate;
}
Aggregations