use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.
the class ColumnQueryParserTest method shouldFindByNameAndAge.
@Test
public void shouldFindByNameAndAge() {
ColumnQuery query = parser.parse("findByNameAndAge", new Object[] { "name", 10 }, classRepresentation, converters);
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.AND, condition.getCondition());
List<ColumnCondition> conditions = condition.getColumn().get(new TypeReference<List<ColumnCondition>>() {
});
ColumnCondition condition1 = conditions.get(0);
assertEquals(Condition.EQUALS, condition1.getCondition());
assertEquals(Column.of("name", "name"), condition1.getColumn());
ColumnCondition condition2 = conditions.get(1);
assertEquals(Condition.EQUALS, condition2.getCondition());
assertEquals(Column.of("age", 10), condition2.getColumn());
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.
the class ColumnQueryParserTest method shouldFindByNameLikeOrderByName.
@Test
public void shouldFindByNameLikeOrderByName() {
ColumnQuery query = parser.parse("findByNameLikeOrderByName", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.LIKE, query.getCondition().get().getCondition());
assertEquals(Column.of("name", "name"), query.getCondition().get().getColumn());
assertEquals(Sort.of("name", Sort.SortType.ASC), query.getSorts().get(0));
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.
the class ColumnQueryParserTest method shouldFindByNameLikeOrderByNameDesc.
@Test
public void shouldFindByNameLikeOrderByNameDesc() {
ColumnQuery query = parser.parse("findByNameLikeOrderByNameDesc", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.LIKE, query.getCondition().get().getCondition());
assertEquals(Column.of("name", "name"), query.getCondition().get().getColumn());
assertEquals(Sort.of("name", Sort.SortType.DESC), query.getSorts().get(0));
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.
the class ColumnQueryParserTest method shouldFindByNameAndAAgeBetween.
@Test
public void shouldFindByNameAndAAgeBetween() {
ColumnQuery query = parser.parse("findByNameAndAgeBetween", new Object[] { "name", 10, 11 }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
ColumnCondition condition = query.getCondition().get();
assertEquals(Condition.AND, condition.getCondition());
List<ColumnCondition> conditions = condition.getColumn().get(new TypeReference<List<ColumnCondition>>() {
});
ColumnCondition condition1 = conditions.get(0);
assertEquals(Condition.EQUALS, condition1.getCondition());
assertEquals(Column.of("name", "name"), condition1.getColumn());
ColumnCondition condition2 = conditions.get(1);
assertEquals(Condition.BETWEEN, condition2.getCondition());
assertEquals(Column.of("age", Arrays.asList(10, 11)), condition2.getColumn());
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.
the class ColumnQueryParserTest method shouldFindByName.
@Test
public void shouldFindByName() {
ColumnQuery query = parser.parse("findByName", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
assertEquals(Column.of("name", "name"), query.getCondition().get().getColumn());
}
Aggregations