Search in sources :

Example 41 with ColumnDeleteQuery

use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.

the class ColumnRepositoryProxyTest method shouldDeleteByName.

@Test
public void shouldDeleteByName() {
    ArgumentCaptor<ColumnDeleteQuery> captor = ArgumentCaptor.forClass(ColumnDeleteQuery.class);
    personRepository.deleteByName("Ada");
    verify(template).delete(captor.capture());
    ColumnDeleteQuery deleteQuery = captor.getValue();
    ColumnCondition condition = deleteQuery.getCondition().get();
    assertEquals("Person", deleteQuery.getColumnFamily());
    assertEquals(Condition.EQUALS, condition.getCondition());
    assertEquals(Column.of("name", "Ada"), condition.getColumn());
}
Also used : ColumnCondition(jakarta.nosql.column.ColumnCondition) ColumnDeleteQuery(jakarta.nosql.column.ColumnDeleteQuery) Test(org.junit.jupiter.api.Test)

Example 42 with ColumnDeleteQuery

use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.

the class DefaultColumnEventPersistManagerTest method shouldFirePreDeleteQuery.

@Test
public void shouldFirePreDeleteQuery() {
    ColumnDeleteQuery query = delete().from("person").build();
    subject.firePreDeleteQuery(query);
    ArgumentCaptor<ColumnDeleteQueryExecute> captor = ArgumentCaptor.forClass(ColumnDeleteQueryExecute.class);
    verify(columnDeleteQueryExecute).fire(captor.capture());
    assertEquals(query, captor.getValue().getQuery());
}
Also used : ColumnDeleteQueryExecute(jakarta.nosql.mapping.column.ColumnDeleteQueryExecute) ColumnDeleteQuery(jakarta.nosql.column.ColumnDeleteQuery) Test(org.junit.jupiter.api.Test)

Example 43 with ColumnDeleteQuery

use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.

the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameLte.

@Test
public void shouldSelectWhereNameLte() {
    ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").lte(10).build();
    ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").lte(10L).build();
    assertEquals(queryExpected, query);
}
Also used : Person(jakarta.nosql.tck.entities.Person) ColumnDeleteQuery(jakarta.nosql.column.ColumnDeleteQuery) Test(org.junit.jupiter.api.Test)

Example 44 with ColumnDeleteQuery

use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.

the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameBetween.

@Test
public void shouldSelectWhereNameBetween() {
    ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").between(10, 20).build();
    ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").between(10L, 20L).build();
    assertEquals(queryExpected, query);
}
Also used : Person(jakarta.nosql.tck.entities.Person) ColumnDeleteQuery(jakarta.nosql.column.ColumnDeleteQuery) Test(org.junit.jupiter.api.Test)

Example 45 with ColumnDeleteQuery

use of jakarta.nosql.column.ColumnDeleteQuery in project jnosql-diana by eclipse.

the class DefaultColumnMapperDeleteBuilderTest method shouldQueryBySubEntity.

@Test
public void shouldQueryBySubEntity() {
    ColumnDeleteQuery query = mapperBuilder.deleteFrom(Address.class).where("zipCode.zip").eq("01312321").build();
    ColumnDeleteQuery queryExpected = delete().from("Address").where("zipCode.zip").eq("01312321").build();
    assertEquals(queryExpected, query);
}
Also used : Address(jakarta.nosql.tck.entities.Address) ColumnDeleteQuery(jakarta.nosql.column.ColumnDeleteQuery) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnDeleteQuery (jakarta.nosql.column.ColumnDeleteQuery)70 Test (org.junit.jupiter.api.Test)41 ColumnCondition (jakarta.nosql.column.ColumnCondition)33 Column (jakarta.nosql.column.Column)22 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 ValueSource (org.junit.jupiter.params.provider.ValueSource)20 Person (jakarta.nosql.tck.entities.Person)12 List (java.util.List)12 ColumnEntity (jakarta.nosql.column.ColumnEntity)6 Params (jakarta.nosql.Params)5 ColumnDeleteQueryParams (jakarta.nosql.column.ColumnDeleteQueryParams)5 ColumnQuery (jakarta.nosql.column.ColumnQuery)5 ColumnPreparedStatement (jakarta.nosql.column.ColumnPreparedStatement)4 ColumnFamilyManager (jakarta.nosql.column.ColumnFamilyManager)3 DeleteQuery (jakarta.nosql.query.DeleteQuery)3 Optional (java.util.Optional)3 QueryException (jakarta.nosql.QueryException)2 ServiceLoaderProvider (jakarta.nosql.ServiceLoaderProvider)2 ColumnObserverParser (jakarta.nosql.column.ColumnObserverParser)2 DeleteQueryConverter (jakarta.nosql.column.DeleteQueryConverter)2