use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameLt.
@Test
public void shouldSelectWhereNameLt() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").lt(10).build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").lt(10L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").gte(10).build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").gte(10L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameAnd.
@Test
public void shouldSelectWhereNameAnd() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("age").between(10, 20).and("name").eq("Ada").build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("age").between(10, 20).and("name").eq("Ada").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultColumnTemplateTest method shouldDeleteEntity.
@Test
public void shouldDeleteEntity() {
subject.delete(Person.class, "10");
ArgumentCaptor<ColumnDeleteQuery> queryCaptor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
verify(managerMock).delete(queryCaptor.capture());
ColumnDeleteQuery query = queryCaptor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(ColumnCondition.eq(Column.of("_id", 10L)), condition);
}
use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultColumnQueryParserTest method shouldExecutePrepareStatement.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "delete from God where age = @age" })
public void shouldExecutePrepareStatement(String query) {
ArgumentCaptor<ColumnDeleteQuery> captor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
ColumnPreparedStatement prepare = parser.prepare(query, manager, ColumnObserverParser.EMPTY);
prepare.bind("age", 12);
prepare.getResult();
Mockito.verify(manager).delete(captor.capture());
ColumnDeleteQuery columnDeleteQuery = captor.getValue();
ColumnCondition columnCondition = columnDeleteQuery.getCondition().get();
Column column = columnCondition.getColumn();
assertEquals(Condition.EQUALS, columnCondition.getCondition());
assertEquals("age", column.getName());
assertEquals(12, column.get());
}
Aggregations