Search in sources :

Example 6 with ColumnFamilyManager

use of jakarta.nosql.column.ColumnFamilyManager in project jnosql-diana by eclipse.

the class ColumnTemplateConverter method success.

@Override
public ColumnTemplate success(String value) {
    Config config = BeanManagers.getInstance(Config.class);
    final ColumnFamilyManager manager = config.getValue(value, ColumnFamilyManager.class);
    ColumnTemplateProducer producer = BeanManagers.getInstance(ColumnTemplateProducer.class);
    return producer.get(manager);
}
Also used : ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) Config(org.eclipse.microprofile.config.Config) ColumnTemplateProducer(jakarta.nosql.mapping.column.ColumnTemplateProducer)

Example 7 with ColumnFamilyManager

use of jakarta.nosql.column.ColumnFamilyManager in project jnosql-diana by eclipse.

the class ManagerProducerProducer method getColumnFamilyManager.

@Produces
public ColumnFamilyManager getColumnFamilyManager() {
    ColumnFamilyManager columnFamilyManager = Mockito.mock(ColumnFamilyManager.class);
    ColumnEntity entity = ColumnEntity.of("person");
    entity.add(Column.of("name", "Ada"));
    entity.add(Column.of("age", 10));
    entity.add(Column.of("salary", BigDecimal.TEN));
    entity.add(Column.of("phones", singletonList("22342342")));
    when(columnFamilyManager.insert(Mockito.any(ColumnEntity.class))).thenReturn(entity);
    when(columnFamilyManager.update(Mockito.any(ColumnEntity.class))).thenReturn(entity);
    return columnFamilyManager;
}
Also used : ColumnEntity(jakarta.nosql.column.ColumnEntity) ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) Produces(javax.enterprise.inject.Produces)

Example 8 with ColumnFamilyManager

use of jakarta.nosql.column.ColumnFamilyManager in project jnosql-diana-driver by eclipse.

the class CassandraColumnFamilyManagerFactoryTest method shouldReturnEntityManager.

@Test
public void shouldReturnEntityManager() {
    ColumnFamilyManager columnEntityManager = subject.get(Constants.KEY_SPACE);
    assertNotNull(columnEntityManager);
}
Also used : ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) Test(org.junit.jupiter.api.Test)

Example 9 with ColumnFamilyManager

use of jakarta.nosql.column.ColumnFamilyManager in project jnosql-diana by eclipse.

the class DefaultSelectQueryBuilderTest method shouldExecuteManager.

@Test
public void shouldExecuteManager() {
    ColumnFamilyManager manager = Mockito.mock(ColumnFamilyManager.class);
    ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
    String columnFamily = "columnFamily";
    Stream<ColumnEntity> entities = select().from(columnFamily).getResult(manager);
    entities.collect(Collectors.toList());
    Mockito.verify(manager).select(queryCaptor.capture());
    checkQuery(queryCaptor, columnFamily);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) ColumnEntity(jakarta.nosql.column.ColumnEntity) ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) Test(org.junit.jupiter.api.Test)

Example 10 with ColumnFamilyManager

use of jakarta.nosql.column.ColumnFamilyManager in project jnosql-diana by eclipse.

the class ReactiveTemplateBean method create.

@Override
public ReactiveColumnTemplate create(CreationalContext<ReactiveColumnTemplate> context) {
    ColumnTemplateProducer producer = getInstance(ColumnTemplateProducer.class);
    ColumnFamilyManager manager = getManager();
    return producer.get(manager);
}
Also used : ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) ColumnTemplateProducer(jakarta.nosql.mapping.column.ColumnTemplateProducer)

Aggregations

ColumnFamilyManager (jakarta.nosql.column.ColumnFamilyManager)16 ColumnEntity (jakarta.nosql.column.ColumnEntity)8 Test (org.junit.jupiter.api.Test)7 Produces (javax.enterprise.inject.Produces)5 ColumnTemplateProducer (jakarta.nosql.mapping.column.ColumnTemplateProducer)3 ColumnQuery (jakarta.nosql.column.ColumnQuery)2 Database (jakarta.nosql.mapping.Database)2 Column (jakarta.nosql.column.Column)1 ColumnDeleteQuery (jakarta.nosql.column.ColumnDeleteQuery)1 Pagination (jakarta.nosql.mapping.Pagination)1 ColumnEventPersistManager (jakarta.nosql.mapping.column.ColumnEventPersistManager)1 ColumnQueryPagination (jakarta.nosql.mapping.column.ColumnQueryPagination)1 ColumnTemplate (jakarta.nosql.mapping.column.ColumnTemplate)1 PersonRepository (jakarta.nosql.tck.entities.PersonRepository)1 Config (org.eclipse.microprofile.config.Config)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1