Search in sources :

Example 11 with ColumnQuery

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

the class ColumnQueryParserTest method shouldConvertsJavaFieldToColumn.

@Test
public void shouldConvertsJavaFieldToColumn() {
    ColumnQuery query = parser.parse("findById", new Object[] { "10" }, classRepresentation, converters);
    assertEquals("Person", query.getColumnFamily());
    assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
    assertEquals(Column.of("_id", 10L), query.getCondition().get().getColumn());
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Example 12 with ColumnQuery

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

the class ColumnQueryParserTest method shouldFindByNameLikeOrderByNameDescOrderByAgeAsc.

@Test
public void shouldFindByNameLikeOrderByNameDescOrderByAgeAsc() {
    ColumnQuery query = parser.parse("findByNameLikeOrderByNameDescOrderByAgeAsc", 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));
    assertEquals(Sort.of("age", Sort.SortType.ASC), query.getSorts().get(1));
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Example 13 with ColumnQuery

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

the class ColumnQueryParserTest method shouldFindByAgeLessThanEqual.

@Test
public void shouldFindByAgeLessThanEqual() {
    ColumnQuery query = parser.parse("findByAgeLessThanEqual", new Object[] { 10 }, classRepresentation, converters);
    assertEquals("Person", query.getColumnFamily());
    assertEquals(Condition.LESSER_EQUALS_THAN, query.getCondition().get().getCondition());
    assertEquals(Column.of("age", 10), query.getCondition().get().getColumn());
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Example 14 with ColumnQuery

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

the class ColumnQueryParserTest method shouldFindByNameLike.

@Test
public void shouldFindByNameLike() {
    ColumnQuery query = parser.parse("findByNameLike", 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());
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Example 15 with ColumnQuery

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

the class ColumnQueryParserTest method shouldFindByAgeGreaterThan.

@Test
public void shouldFindByAgeGreaterThan() {
    ColumnQuery query = parser.parse("findByAgeGreaterThan", new Object[] { 10 }, classRepresentation, converters);
    assertEquals("Person", query.getColumnFamily());
    assertEquals(Condition.GREATER_THAN, query.getCondition().get().getCondition());
    assertEquals(Column.of("age", 10), query.getCondition().get().getColumn());
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnQuery (org.jnosql.diana.api.column.ColumnQuery)117 Test (org.junit.jupiter.api.Test)113 Person (org.jnosql.artemis.model.Person)37 ColumnCondition (org.jnosql.diana.api.column.ColumnCondition)35 Column (org.jnosql.diana.api.column.Column)29 List (java.util.List)26 ColumnEntity (org.jnosql.diana.api.column.ColumnEntity)26 Collections.singletonList (java.util.Collections.singletonList)20 ColumnDeleteQuery (org.jnosql.diana.api.column.ColumnDeleteQuery)19 Arrays.asList (java.util.Arrays.asList)15 Duration (java.time.Duration)14 ColumnQueryBuilder.delete (org.jnosql.diana.api.column.query.ColumnQueryBuilder.delete)14 ColumnQueryBuilder.select (org.jnosql.diana.api.column.query.ColumnQueryBuilder.select)14 BeforeEach (org.junit.jupiter.api.BeforeEach)14 Optional (java.util.Optional)13 Consumer (java.util.function.Consumer)13 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)13 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)13 Inject (javax.inject.Inject)12 CDIExtension (org.jnosql.artemis.CDIExtension)12