Search in sources :

Example 86 with DocumentQuery

use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectOrderDesc.

@Test
public void shouldSelectOrderDesc() {
    DocumentQuery query = mapperBuilder.selectFrom(Worker.class).orderBy("salary").desc().build();
    DocumentQuery queryExpected = select().from("Worker").orderBy("money").desc().build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(org.jnosql.diana.api.document.DocumentQuery) Worker(org.jnosql.artemis.model.Worker) Test(org.junit.jupiter.api.Test)

Example 87 with DocumentQuery

use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameNot.

@Test
public void shouldSelectWhereNameNot() {
    DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").not().like("Ada").build();
    DocumentQuery queryExpected = select().from("Person").where("name").not().like("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(org.jnosql.diana.api.document.DocumentQuery) Test(org.junit.jupiter.api.Test)

Example 88 with DocumentQuery

use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameEq.

@Test
public void shouldSelectWhereNameEq() {
    DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").eq("Ada").build();
    DocumentQuery queryExpected = select().from("Person").where("name").eq("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(org.jnosql.diana.api.document.DocumentQuery) Person(org.jnosql.artemis.model.Person) Test(org.junit.jupiter.api.Test)

Example 89 with DocumentQuery

use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectOrderAsc.

@Test
public void shouldSelectOrderAsc() {
    DocumentQuery query = mapperBuilder.selectFrom(Worker.class).orderBy("salary").asc().build();
    DocumentQuery queryExpected = select().from("Worker").orderBy("money").asc().build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(org.jnosql.diana.api.document.DocumentQuery) Worker(org.jnosql.artemis.model.Worker) Test(org.junit.jupiter.api.Test)

Example 90 with DocumentQuery

use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameOr.

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

Aggregations

DocumentQuery (org.jnosql.diana.api.document.DocumentQuery)201 Test (org.junit.jupiter.api.Test)186 DocumentEntity (org.jnosql.diana.api.document.DocumentEntity)95 Document (org.jnosql.diana.api.document.Document)84 List (java.util.List)50 DocumentDeleteQuery (org.jnosql.diana.api.document.DocumentDeleteQuery)46 Person (org.jnosql.artemis.model.Person)37 DocumentCondition (org.jnosql.diana.api.document.DocumentCondition)35 Arrays.asList (java.util.Arrays.asList)27 ArrayList (java.util.ArrayList)21 Duration (java.time.Duration)20 DocumentQueryBuilder.select (org.jnosql.diana.api.document.query.DocumentQueryBuilder.select)20 Optional (java.util.Optional)18 AtomicReference (java.util.concurrent.atomic.AtomicReference)18 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)18 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)17 DocumentQueryBuilder.delete (org.jnosql.diana.api.document.query.DocumentQueryBuilder.delete)17 BeforeEach (org.junit.jupiter.api.BeforeEach)17 Consumer (java.util.function.Consumer)16 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)16