use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana-driver by eclipse.
the class QueryUtilsTest method shouldRunEqualsQuery.
@Test
public void shouldRunEqualsQuery() {
ColumnQuery query = select().from("collection").where("name").eq("value").build();
BuiltStatement select = QueryUtils.select(query, "keyspace");
String cql = select.toString();
assertEquals("value", select.getObject(0));
assertEquals("SELECT * FROM keyspace.collection WHERE name='value';", cql);
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana-driver by eclipse.
the class QueryUtilsTest method shouldNegate.
@Test
public void shouldNegate() {
ColumnQuery query = select().from("collection").where("city").eq("Assis").and("name").eq("Otavio").and("name").eq("Lucas").build();
BuiltStatement select = QueryUtils.select(query, "keyspace");
String cql = select.toString();
assertEquals("Assis", select.getObject(0));
assertEquals("Otavio", select.getObject(1));
assertEquals("Lucas", select.getObject(2));
assertEquals("SELECT * FROM keyspace.collection WHERE city='Assis' AND name='Otavio' AND name='Lucas';", cql);
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana-driver by eclipse.
the class QueryUtilsTest method shouldRunEqualsQuerySort2.
@Test
public void shouldRunEqualsQuerySort2() {
ColumnQuery query = select().from("collection").where("name").eq("value").orderBy("name").asc().orderBy("age").desc().build();
BuiltStatement select = QueryUtils.select(query, "keyspace");
String cql = select.toString();
assertEquals("value", select.getObject(0));
assertEquals("SELECT * FROM keyspace.collection WHERE name='value' ORDER BY name ASC,age DESC;", cql);
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana-driver by eclipse.
the class QueryUtilsTest method shouldRunEqualsQueryAnd.
@Test
public void shouldRunEqualsQueryAnd() {
ColumnQuery query = select().from("collection").where("name").eq("value").and("age").lte(10).build();
BuiltStatement select = QueryUtils.select(query, "keyspace");
String cql = select.toString();
assertEquals("value", select.getObject(0));
assertEquals("SELECT * FROM keyspace.collection WHERE name='value' AND age<=10;", cql);
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana-driver by eclipse.
the class HBaseColumnFamilyManagerTest method shouldFindInBatch.
@Test
public void shouldFindInBatch() {
columnFamilyManager.insert(createEntity());
columnFamilyManager.insert(createEntity2());
ColumnQuery query = select().from(FAMILY).where(ID_FIELD).eq("otaviojava").or(ID_FIELD).eq("poliana").build();
List<ColumnEntity> entities = columnFamilyManager.select(query);
assertEquals(Integer.valueOf(2), Integer.valueOf(entities.size()));
}
Aggregations