Search in sources :

Example 86 with ColumnEntity

use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.

the class DefaultColumnTemplateAsyncTest method shouldInsertTTL.

@Test
public void shouldInsertTTL() {
    ColumnEntity entity = ColumnEntity.of("Person");
    entity.addAll(Stream.of(columns).collect(Collectors.toList()));
    subject.insert(this.person, Duration.ofSeconds(1L));
    verify(managerMock).insert(Mockito.any(ColumnEntity.class), Mockito.eq(Duration.ofSeconds(1L)), Mockito.any(Consumer.class));
}
Also used : ColumnEntity(org.jnosql.diana.api.column.ColumnEntity) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test)

Example 87 with ColumnEntity

use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.

the class DefaultColumnTemplateAsyncTest method shouldUpdate.

@Test
public void shouldUpdate() {
    ColumnEntity entity = ColumnEntity.of("Person");
    entity.addAll(Stream.of(columns).collect(Collectors.toList()));
    subject.update(this.person);
    verify(managerMock).update(captor.capture(), Mockito.any(Consumer.class));
    ColumnEntity value = captor.getValue();
    assertEquals(entity.getName(), value.getName());
}
Also used : ColumnEntity(org.jnosql.diana.api.column.ColumnEntity) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test)

Example 88 with ColumnEntity

use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.

the class MockProducer method getColumnFamilyManagerMock.

@Produces
@Database(value = DatabaseType.COLUMN, provider = "columnRepositoryMock")
public ColumnFamilyManager getColumnFamilyManagerMock() {
    ColumnEntity entity = ColumnEntity.of("Person");
    entity.add(org.jnosql.diana.api.column.Column.of("name", "columnRepositoryMock"));
    entity.add(org.jnosql.diana.api.column.Column.of("age", 10));
    ColumnFamilyManager manager = mock(ColumnFamilyManager.class);
    when(manager.insert(Mockito.any(ColumnEntity.class))).thenReturn(entity);
    return manager;
}
Also used : ColumnEntity(org.jnosql.diana.api.column.ColumnEntity) ColumnFamilyManager(org.jnosql.diana.api.column.ColumnFamilyManager) Produces(javax.enterprise.inject.Produces)

Aggregations

ColumnEntity (org.jnosql.diana.api.column.ColumnEntity)88 Test (org.junit.jupiter.api.Test)76 ColumnQuery (org.jnosql.diana.api.column.ColumnQuery)26 Column (org.jnosql.diana.api.column.Column)22 Arrays.asList (java.util.Arrays.asList)17 List (java.util.List)17 Consumer (java.util.function.Consumer)14 Collections.singletonList (java.util.Collections.singletonList)13 ColumnDeleteQuery (org.jnosql.diana.api.column.ColumnDeleteQuery)13 Person (org.jnosql.artemis.model.Person)12 Duration (java.time.Duration)11 Collections.emptyList (java.util.Collections.emptyList)10 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)10 AtomicReference (java.util.concurrent.atomic.AtomicReference)10 ColumnQueryBuilder.delete (org.jnosql.diana.api.column.query.ColumnQueryBuilder.delete)9 ColumnQueryBuilder.select (org.jnosql.diana.api.column.query.ColumnQueryBuilder.select)9 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)9 BeforeEach (org.junit.jupiter.api.BeforeEach)9 ArrayList (java.util.ArrayList)8 Arrays (java.util.Arrays)8