use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldCreatePage.
@Test
public void shouldCreatePage() {
Pagination pagination = Pagination.page(2).size(2);
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentQueryPagination> queryCaptor = ArgumentCaptor.forClass(DocumentQueryPagination.class);
Page<Person> page = mapperBuilder.selectFrom(Person.class).page(template, pagination);
Mockito.verify(template).select(queryCaptor.capture());
DocumentQuery query = queryCaptor.getValue();
assertEquals(pagination.getLimit(), query.getLimit());
assertEquals(pagination.getSkip(), query.getSkip());
}
use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class DefaultDocumentRepositoryProducerTest method shouldCreateFromTemplate.
@Test
public void shouldCreateFromTemplate() {
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
PersonRepository personRepository = producer.get(PersonRepository.class, template);
assertNotNull(personRepository);
}
use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class ReactiveRepositoryDocumentBean method create.
@Override
public ReactiveRepository<?, ?> create(CreationalContext<ReactiveRepository<?, ?>> context) {
ClassMappings classMappings = getInstance(ClassMappings.class);
DocumentTemplate template = provider.isEmpty() ? getInstance(DocumentTemplate.class) : getInstance(DocumentTemplate.class, DatabaseQualifier.ofDocument(provider));
ReactiveDocumentTemplateProducer reactiveProducer = getInstance(ReactiveDocumentTemplateProducer.class);
final ReactiveDocumentTemplate reactiveDocumentTemplate = reactiveProducer.get(template);
Converters converters = getInstance(Converters.class);
ReactiveDocumentRepositoryProxy<?> handler = new ReactiveDocumentRepositoryProxy<>(reactiveDocumentTemplate, template, converters, classMappings, type);
return (ReactiveRepository<?, ?>) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class DefaultReactiveDocumentTemplateProducerTest method shouldReturnTemplate.
@Test
public void shouldReturnTemplate() {
final DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
final ReactiveDocumentTemplate reactiveTemplate = producer.get(template);
assertNotNull(reactiveTemplate);
}
Aggregations