use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByNameAndAAgeBetween.
@Test
public void shouldDeleteByNameAndAAgeBetween() {
ColumnDeleteQuery query = parser.parse("deleteByNameAndAgeBetween", 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.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByName.
@Test
public void shouldDeleteByName() {
ColumnDeleteQuery query = parser.parse("deleteByName", 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());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnQueryDeleteParserTest method shouldDeleteByAgeLessThan.
@Test
public void shouldDeleteByAgeLessThan() {
ColumnDeleteQuery query = parser.parse("deleteByAgeLessThan", new Object[] { 10 }, classRepresentation, converters);
assertEquals("Person", query.getColumnFamily());
assertEquals(Condition.LESSER_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 shouldDeleteByAgeLessThanEqual.
@Test
public void shouldDeleteByAgeLessThanEqual() {
ColumnDeleteQuery query = parser.parse("deleteByAgeLessThanEqual", 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());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class ColumnRepositoryAsyncProxyTest method shouldDeleteByNameCallBack.
@Test
public void shouldDeleteByNameCallBack() {
ArgumentCaptor<ColumnDeleteQuery> captor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
ArgumentCaptor<Consumer> consumerCaptor = ArgumentCaptor.forClass(Consumer.class);
Consumer<Void> voidConsumer = v -> {
};
personRepository.deleteByName("name", voidConsumer);
verify(template).delete(captor.capture(), consumerCaptor.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());
assertEquals(voidConsumer, consumerCaptor.getValue());
}
Aggregations