Search in sources :

Example 1 with Value

use of org.jnosql.diana.api.Value in project jnosql-diana by eclipse.

the class DocumentTest method shouldReturnGetObject.

@Test
public void shouldReturnGetObject() {
    Value value = Value.of("text");
    Document document = Document.of("name", value);
    assertEquals(value.get(), document.get());
}
Also used : Value(org.jnosql.diana.api.Value) Test(org.junit.jupiter.api.Test)

Example 2 with Value

use of org.jnosql.diana.api.Value in project jnosql-diana by eclipse.

the class DocumentTest method shouldReturnGetClass.

@Test
public void shouldReturnGetClass() {
    Value value = Value.of("text");
    Document document = Document.of("name", value);
    assertEquals(value.get(String.class), document.get(String.class));
}
Also used : Value(org.jnosql.diana.api.Value) Test(org.junit.jupiter.api.Test)

Example 3 with Value

use of org.jnosql.diana.api.Value in project jnosql-diana by eclipse.

the class DocumentTest method shouldReturnGetType.

@Test
public void shouldReturnGetType() {
    Value value = Value.of("text");
    Document document = Document.of("name", value);
    TypeReference<List<String>> typeReference = new TypeReference<List<String>>() {
    };
    assertEquals(value.get(typeReference), document.get(typeReference));
}
Also used : Value(org.jnosql.diana.api.Value) List(java.util.List) TypeReference(org.jnosql.diana.api.TypeReference) Test(org.junit.jupiter.api.Test)

Example 4 with Value

use of org.jnosql.diana.api.Value in project jnosql-diana-driver by eclipse.

the class CassandraColumnFamilyManagerTest method shouldFindByIdWithConsistenceLevel.

@Test
public void shouldFindByIdWithConsistenceLevel() {
    entityManager.insert(getColumnFamily());
    ColumnQuery query = select().from(COLUMN_FAMILY).where("id").eq(10L).build();
    List<ColumnEntity> columnEntity = entityManager.select(query, CONSISTENCY_LEVEL);
    assertFalse(columnEntity.isEmpty());
    List<Column> columns = columnEntity.get(0).getColumns();
    assertThat(columns.stream().map(Column::getName).collect(toList()), containsInAnyOrder("name", "version", "options", "id"));
    assertThat(columns.stream().map(Column::getValue).map(Value::get).collect(toList()), containsInAnyOrder("Cassandra", 3.2, asList(1, 2, 3), 10L));
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) ColumnEntity(org.jnosql.diana.api.column.ColumnEntity) Column(org.jnosql.diana.api.column.Column) Value(org.jnosql.diana.api.Value) Test(org.junit.jupiter.api.Test)

Example 5 with Value

use of org.jnosql.diana.api.Value in project jnosql-diana-driver by eclipse.

the class CassandraColumnFamilyManagerTest method shouldFindById.

@Test
public void shouldFindById() {
    entityManager.insert(getColumnFamily());
    ColumnQuery query = select().from(COLUMN_FAMILY).where("id").eq(10L).build();
    List<ColumnEntity> columnEntity = entityManager.select(query);
    assertFalse(columnEntity.isEmpty());
    List<Column> columns = columnEntity.get(0).getColumns();
    assertThat(columns.stream().map(Column::getName).collect(toList()), containsInAnyOrder("name", "version", "options", "id"));
    assertThat(columns.stream().map(Column::getValue).map(Value::get).collect(toList()), containsInAnyOrder("Cassandra", 3.2, asList(1, 2, 3), 10L));
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) ColumnEntity(org.jnosql.diana.api.column.ColumnEntity) Column(org.jnosql.diana.api.column.Column) Value(org.jnosql.diana.api.Value) Test(org.junit.jupiter.api.Test)

Aggregations

Value (org.jnosql.diana.api.Value)17 Test (org.junit.jupiter.api.Test)12 Predicate (com.hazelcast.query.Predicate)3 List (java.util.List)3 Optional (java.util.Optional)3 FieldRepresentation (org.jnosql.artemis.reflection.FieldRepresentation)3 Field (java.lang.reflect.Field)2 Map (java.util.Map)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Converters (org.jnosql.artemis.Converters)2 ClassRepresentation (org.jnosql.artemis.reflection.ClassRepresentation)2 TypeReference (org.jnosql.diana.api.TypeReference)2 Column (org.jnosql.diana.api.column.Column)2 ColumnEntity (org.jnosql.diana.api.column.ColumnEntity)2 ColumnQuery (org.jnosql.diana.api.column.ColumnQuery)2 DeleteValue (com.basho.riak.client.api.commands.kv.DeleteValue)1 FetchValue (com.basho.riak.client.api.commands.kv.FetchValue)1 StoreValue (com.basho.riak.client.api.commands.kv.StoreValue)1 IMap (com.hazelcast.core.IMap)1 SqlPredicate (com.hazelcast.query.SqlPredicate)1