Search in sources :

Example 21 with Person

use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.

the class AbstractEntityFinderTest method script09.

@Test
@SuppressWarnings("unchecked")
public void script09() throws EntityFinderException {
    Person person = templateFor(Person.class);
    // should return Ann Doe
    Iterable<EntityReference> entities = entityFinder.findEntities(Female.class, or(eq(person.yearOfBirth(), 1970), eq(person.yearOfBirth(), 1975)), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
    assertNames(entities, ANN);
}
Also used : EntityReference(org.qi4j.api.entity.EntityReference) Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 22 with Person

use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.

the class AbstractNamedQueryTest method script20.

@Test
public void script20() throws EntityFinderException {
    Person person = templateFor(Person.class);
    final Query<Person> query = unitOfWork.newQuery(this.module.newQueryBuilder(Person.class).where(queries.get("script20")));
    query.orderBy(orderBy(person.name(), OrderBy.Order.DESCENDING));
    System.out.println("*** script20: " + query);
    verifyOrderedResults(query, "Joe Doe", "Ann Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 23 with Person

use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.

the class AbstractQueryTest method script50_BigDecimal.

@Test
public void script50_BigDecimal() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.bigDecimal(), new BigDecimal("2342.76931348623157e+307"))));
    System.out.println("*** script50_BigDecimal: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 24 with Person

use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.

the class AbstractQueryTest method script39.

@Test
public void script39() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.title(), Person.Title.DR)));
    System.out.println("*** script39: " + query);
    verifyUnorderedResults(query, "Ann Doe", "Joe Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 25 with Person

use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.

the class AbstractQueryTest method script11.

@Test
public void script11() throws EntityFinderException {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(isNotNull(person.email())));
    System.out.println("*** script11: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)76 Person (org.qi4j.test.indexing.model.Person)76 LocalDateTime (org.joda.time.LocalDateTime)12 EntityReference (org.qi4j.api.entity.EntityReference)11 QueryParam (org.qi4j.test.indexing.model.QueryParam)10 DateTime (org.joda.time.DateTime)8 ArrayList (java.util.ArrayList)7 Collection (java.util.Collection)7 LocalDate (org.joda.time.LocalDate)4 BigDecimal (java.math.BigDecimal)3 BigInteger (java.math.BigInteger)3 Ignore (org.junit.Ignore)3 Address (org.qi4j.test.indexing.model.Address)2 City (org.qi4j.test.indexing.model.City)2 Domain (org.qi4j.test.indexing.model.Domain)2 Female (org.qi4j.test.indexing.model.Female)2 Male (org.qi4j.test.indexing.model.Male)2 Protocol (org.qi4j.test.indexing.model.Protocol)2 URL (org.qi4j.test.indexing.model.URL)2 HashMap (java.util.HashMap)1