Search in sources :

Example 11 with ColumnTemplate

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);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) ColumnTemplate(jakarta.nosql.mapping.column.ColumnTemplate) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Example 12 with ColumnTemplate

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);
}
Also used : ColumnTemplate(jakarta.nosql.mapping.column.ColumnTemplate) PersonRepository(jakarta.nosql.tck.entities.PersonRepository) Test(org.junit.jupiter.api.Test)

Example 13 with ColumnTemplate

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);
}
Also used : Repository(jakarta.nosql.mapping.Repository) ColumnTemplate(jakarta.nosql.mapping.column.ColumnTemplate) Converters(jakarta.nosql.mapping.Converters) ClassMappings(org.eclipse.jnosql.mapping.reflection.ClassMappings)

Example 14 with ColumnTemplate

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);
}
Also used : ColumnTemplate(jakarta.nosql.mapping.column.ColumnTemplate)

Aggregations

ColumnTemplate (jakarta.nosql.mapping.column.ColumnTemplate)14 Test (org.junit.jupiter.api.Test)10 Person (jakarta.nosql.tck.entities.Person)6 ColumnQuery (jakarta.nosql.column.ColumnQuery)5 Pagination (jakarta.nosql.mapping.Pagination)3 ColumnQueryPagination (jakarta.nosql.mapping.column.ColumnQueryPagination)3 Converters (jakarta.nosql.mapping.Converters)2 ReactiveColumnTemplate (org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate)2 ReactiveColumnTemplateProducer (org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplateProducer)2 ClassMappings (org.eclipse.jnosql.mapping.reflection.ClassMappings)2 ColumnDeleteQuery (jakarta.nosql.column.ColumnDeleteQuery)1 ColumnFamilyManager (jakarta.nosql.column.ColumnFamilyManager)1 Repository (jakarta.nosql.mapping.Repository)1 PersonRepository (jakarta.nosql.tck.entities.PersonRepository)1 ReactiveRepository (org.eclipse.jnosql.mapping.reactive.ReactiveRepository)1 Config (org.eclipse.microprofile.config.Config)1