Search in sources :

Example 31 with ColumnQuery

use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.

the class DefaultColumnMapperSelectBuilderTest method shouldSelectStart.

@Test
public void shouldSelectStart() {
    ColumnQuery query = mapperBuilder.selectFrom(Worker.class).start(10).build();
    ColumnQuery queryExpected = select().from("Worker").start(10L).build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Test(org.junit.jupiter.api.Test)

Example 32 with ColumnQuery

use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.

the class DefaultColumnMapperSelectBuilderTest method shouldSelectWhereNameBetween.

@Test
public void shouldSelectWhereNameBetween() {
    ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("id").between(10, 20).build();
    ColumnQuery queryExpected = select().from("Person").where("_id").between(10L, 20L).build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Person(org.jnosql.artemis.model.Person) Test(org.junit.jupiter.api.Test)

Example 33 with ColumnQuery

use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis 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(org.jnosql.diana.api.column.ColumnQuery) Person(org.jnosql.artemis.model.Person) Test(org.junit.jupiter.api.Test)

Example 34 with ColumnQuery

use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.

the class DefaultColumnMapperSelectBuilderTest method shouldUseAttibuteConverter.

@Test
public void shouldUseAttibuteConverter() {
    ColumnQuery query = mapperBuilder.selectFrom(Worker.class).where("salary").eq(new Money("USD", BigDecimal.TEN)).build();
    ColumnQuery queryExpected = select().from("Worker").where("money").eq("USD 10").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Money(org.jnosql.artemis.model.Money) Worker(org.jnosql.artemis.model.Worker) Test(org.junit.jupiter.api.Test)

Example 35 with ColumnQuery

use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-artemis by eclipse.

the class DefaultColumnMapperSelectBuilderTest method shouldQueryByEmbeddable.

@Test
public void shouldQueryByEmbeddable() {
    ColumnQuery query = mapperBuilder.selectFrom(Worker.class).where("job.city").eq("Salvador").build();
    ColumnQuery queryExpected = select().from("Worker").where("job.city").eq("Salvador").build();
    assertEquals(queryExpected, query);
}
Also used : ColumnQuery(org.jnosql.diana.api.column.ColumnQuery) Worker(org.jnosql.artemis.model.Worker) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnQuery (org.jnosql.diana.api.column.ColumnQuery)117 Test (org.junit.jupiter.api.Test)113 Person (org.jnosql.artemis.model.Person)37 ColumnCondition (org.jnosql.diana.api.column.ColumnCondition)35 Column (org.jnosql.diana.api.column.Column)29 List (java.util.List)26 ColumnEntity (org.jnosql.diana.api.column.ColumnEntity)26 Collections.singletonList (java.util.Collections.singletonList)20 ColumnDeleteQuery (org.jnosql.diana.api.column.ColumnDeleteQuery)19 Arrays.asList (java.util.Arrays.asList)15 Duration (java.time.Duration)14 ColumnQueryBuilder.delete (org.jnosql.diana.api.column.query.ColumnQueryBuilder.delete)14 ColumnQueryBuilder.select (org.jnosql.diana.api.column.query.ColumnQueryBuilder.select)14 BeforeEach (org.junit.jupiter.api.BeforeEach)14 Optional (java.util.Optional)13 Consumer (java.util.function.Consumer)13 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)13 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)13 Inject (javax.inject.Inject)12 CDIExtension (org.jnosql.artemis.CDIExtension)12