Search in sources :

Example 31 with ColumnQuery

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

the class DefaultColumnMapperSelectBuilderTest method shouldExecuteQuery.

@Test
public void shouldExecuteQuery() {
    ColumnTemplate template = Mockito.mock(ColumnTemplate.class);
    ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
    mapperBuilder.selectFrom(Person.class).getResult(template);
    Mockito.verify(template).select(queryCaptor.capture());
    ColumnQuery query = queryCaptor.getValue();
    ColumnQuery queryExpected = select().from("Person").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) ColumnTemplate(jakarta.nosql.mapping.column.ColumnTemplate) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Example 32 with ColumnQuery

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

the class DefaultColumnMapperSelectBuilderTest method shouldQueryBySubEntity.

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

Example 33 with ColumnQuery

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

the class DefaultColumnMapperSelectBuilderTest method shouldReturnSelectStarFrom.

@Test
public void shouldReturnSelectStarFrom() {
    ColumnMapperFrom columnFrom = mapperBuilder.selectFrom(Person.class);
    ColumnQuery query = columnFrom.build();
    ColumnQuery queryExpected = select().from("Person").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) ColumnMapperFrom(jakarta.nosql.mapping.column.ColumnQueryMapper.ColumnMapperFrom) Test(org.junit.jupiter.api.Test)

Example 34 with ColumnQuery

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

the class DefaultColumnMapperSelectBuilderTest method shouldSelectWhereNameLike.

@Test
public void shouldSelectWhereNameLike() {
    ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("name").like("Ada").build();
    ColumnQuery queryExpected = select().from("Person").where("name").like("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Example 35 with ColumnQuery

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

the class DefaultColumnMapperSelectBuilderTest method shouldSelectWhereNameEq.

@Test
public void shouldSelectWhereNameEq() {
    ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("name").eq("Ada").build();
    ColumnQuery queryExpected = select().from("Person").where("name").eq("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnQuery (jakarta.nosql.column.ColumnQuery)160 Test (org.junit.jupiter.api.Test)120 ColumnCondition (jakarta.nosql.column.ColumnCondition)64 Person (jakarta.nosql.tck.entities.Person)50 Column (jakarta.nosql.column.Column)35 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)30 ValueSource (org.junit.jupiter.params.provider.ValueSource)30 Pagination (jakarta.nosql.mapping.Pagination)27 ColumnEntity (jakarta.nosql.column.ColumnEntity)26 List (java.util.List)26 Collections.singletonList (java.util.Collections.singletonList)10 Value (jakarta.nosql.Value)8 ColumnQueryPagination (jakarta.nosql.mapping.column.ColumnQueryPagination)8 Arrays.asList (java.util.Arrays.asList)8 Params (jakarta.nosql.Params)7 ColumnDeleteQuery (jakarta.nosql.column.ColumnDeleteQuery)7 ColumnPreparedStatement (jakarta.nosql.column.ColumnPreparedStatement)7 ColumnQueryParams (jakarta.nosql.column.ColumnQueryParams)7 ColumnTemplate (jakarta.nosql.mapping.column.ColumnTemplate)6 SelectQuery (jakarta.nosql.query.SelectQuery)6