use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByAgeGreaterThan.
@Test
public void shouldDeleteByAgeGreaterThan() {
ColumnDeleteQuery query = parser.parse("deleteByAgeGreaterThan", 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());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByNameAndAge.
@Test
public void shouldDeleteByNameAndAge() {
ColumnDeleteQuery query = parser.parse("deleteByNameAndAge", 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.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByNameOrAge.
@Test
public void shouldDeleteByNameOrAge() {
ColumnDeleteQuery query = parser.parse("deleteByNameOrAge", new Object[] { "name", 10 }, classRepresentation, converters);
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.OR, 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.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByAgeGreaterThanEqual.
@Test
public void shouldDeleteByAgeGreaterThanEqual() {
ColumnDeleteQuery query = parser.parse("deleteByAgeGreaterThanEqual", new Object[] { 10 }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.GREATER_EQUALS_THAN, query.getCondition().get().getCondition());
assertEquals(Column.of("age", 10), query.getCondition().get().getColumn());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnRepositoryAsyncProxyTest method shouldDeleteByName.
@Test
public void shouldDeleteByName() {
ArgumentCaptor<ColumnDeleteQuery> captor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
personRepository.deleteByName("name");
verify(template).delete(captor.capture());
ColumnDeleteQuery query = captor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.EQUALS, condition.getCondition());
assertEquals(Column.of("name", "name"), condition.getColumn());
}
Aggregations