use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class ReactiveDocumentManagerConverter method success.
@Override
protected ReactiveDocumentTemplate success(String value) {
Config config = BeanManagers.getInstance(Config.class);
final DocumentTemplate template = config.getValue(value, DocumentTemplate.class);
ReactiveDocumentTemplateProducer producer = BeanManagers.getInstance(ReactiveDocumentTemplateProducer.class);
return producer.get(template);
}
use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class DefaultDocumentTemplateProducerTest method shouldReturn.
@Test
public void shouldReturn() {
DocumentCollectionManager manager = Mockito.mock(DocumentCollectionManager.class);
DocumentTemplate documentTemplate = producer.get(manager);
assertNotNull(documentTemplate);
}
use of jakarta.nosql.mapping.document.DocumentTemplate in project jnosql-diana by eclipse.
the class DefaultDocumentMapperSelectBuilderTest method shouldExecuteQueryPagination.
@Test
public void shouldExecuteQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentQuery> queryCaptor = ArgumentCaptor.forClass(DocumentQuery.class);
mapperBuilder.selectFrom(Person.class).getResult(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 DefaultDocumentMapperSelectBuilderTest method shouldExecuteSingleQueryPagination.
@Test
public void shouldExecuteSingleQueryPagination() {
Pagination pagination = Pagination.page(2).size(2);
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentQuery> queryCaptor = ArgumentCaptor.forClass(DocumentQuery.class);
mapperBuilder.selectFrom(Person.class).getSingleResult(template, pagination);
Mockito.verify(template).singleResult(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 DefaultDocumentMapperDeleteBuilderTest method shouldExecuteDelete.
@Test
public void shouldExecuteDelete() {
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentDeleteQuery> queryCaptor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
mapperBuilder.deleteFrom(Person.class).delete(template);
Mockito.verify(template).delete(queryCaptor.capture());
DocumentDeleteQuery query = queryCaptor.getValue();
DocumentDeleteQuery queryExpected = delete().from("Person").build();
assertEquals(queryExpected, query);
}
Aggregations