use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnMapperSelectBuilderTest method shouldExecuteSingleQuery.
@Test
public void shouldExecuteSingleQuery() {
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
mapperBuilder.selectFrom(Person.class).getSingleResult(template);
Mockito.verify(template).singleResult(queryCaptor.capture());
ColumnQuery query = queryCaptor.getValue();
ColumnQuery queryExpected = select().from("Person").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnRepositoryProducerTest method shouldCreateFromTemplate.
@Test
public void shouldCreateFromTemplate() {
ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
PersonRepository personRepository = producer.get(PersonRepository.class, template);
assertNotNull(personRepository);
}
use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class RepositoryColumnBean method create.
@Override
public Repository create(CreationalContext<Repository> creationalContext) {
ClassMappings classMappings = getInstance(ClassMappings.class);
ColumnTemplate template = provider.isEmpty() ? getInstance(ColumnTemplate.class) : getInstance(ColumnTemplate.class, DatabaseQualifier.ofColumn(provider));
Converters converters = getInstance(Converters.class);
ColumnRepositoryProxy handler = new ColumnRepositoryProxy(template, classMappings, type, converters);
return (Repository) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of jakarta.nosql.mapping.column.ColumnTemplate in project jnosql-diana by eclipse.
the class DefaultColumnRepositoryProducer method get.
@Override
public <T, K, R extends Repository<T, K>> R get(Class<R> repositoryClass, ColumnFamilyManager manager) {
Objects.requireNonNull(repositoryClass, "repository class is required");
Objects.requireNonNull(manager, "manager class is required");
ColumnTemplate template = producer.get(manager);
return get(repositoryClass, template);
}
Aggregations