Search in sources :

Example 61 with Person

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

the class AbstractQueryTest method script10.

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

Example 62 with Person

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

the class AbstractQueryTest method script40_Date.

@Test
public void script40_Date() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.dateValue(), new DateTime("2010-03-04T13:24:35", UTC).toDate())));
    System.out.println("*** script40_Date: " + query);
    verifyUnorderedResults(query, "Jack Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) DateTime(org.joda.time.DateTime) LocalDateTime(org.joda.time.LocalDateTime) Test(org.junit.Test)

Example 63 with Person

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

the class AbstractQueryTest method script40_LocalDate.

@Test
public void script40_LocalDate() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.localDateValue(), new LocalDate("2010-03-04", UTC))));
    System.out.println("*** script40_LocalDate: " + query);
    verifyUnorderedResults(query, "Jack Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 64 with Person

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

the class AbstractQueryTest method script33.

@Test
public void script33() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Domain gaming = unitOfWork.get(Domain.class, "Gaming");
    Query<Person> query = unitOfWork.newQuery(qb.where(contains(person.interests(), gaming)));
    System.out.println("*** script33: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Domain(org.qi4j.test.indexing.model.Domain) Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 65 with Person

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

the class AbstractQueryTest method script34.

@Test
public void script34() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Female annDoe = unitOfWork.get(Female.class, "anndoe");
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.mother(), annDoe)));
    System.out.println("*** script34: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Female(org.qi4j.test.indexing.model.Female) 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