Search in sources :

Example 56 with Person

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

the class AbstractQueryTest method script41_Date.

@Test
public void script41_Date() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.dateValue(), new DateTime("2010-03-04T13:24:35", UTC).toDate())));
    System.out.println("*** script41_Date: " + query);
    verifyUnorderedResults(query, "Joe 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 57 with Person

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

the class AbstractQueryTest method script04.

@Test
public void script04() throws EntityFinderException {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person personTemplate = templateFor(Person.class);
    City placeOfBirth = personTemplate.placeOfBirth().get();
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(placeOfBirth.name(), "Kuala Lumpur")));
    System.out.println("*** script04: " + query);
    verifyUnorderedResults(query, "Joe Doe", "Ann Doe");
}
Also used : City(org.qi4j.test.indexing.model.City) Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 58 with Person

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

the class AbstractQueryTest method script42_LocalDateTime.

@Test
public void script42_LocalDateTime() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.localDateTimeValue(), new LocalDateTime("2010-03-04T13:23:00", forID("CET")))));
    System.out.println("*** script42_LocalDateTime: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : LocalDateTime(org.joda.time.LocalDateTime) Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 59 with Person

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

the class AbstractQueryTest method script42_DateTime.

@Test
public void script42_DateTime() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.dateTimeValue(), new DateTime("2010-03-04T14:24:35", forID("CET")))));
    System.out.println("*** script42_DateTime: " + query);
    verifyUnorderedResults(query, "Jack Doe", "Joe 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 60 with Person

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

the class AbstractQueryTest method script09.

@Test
@SuppressWarnings("unchecked")
public void script09() throws EntityFinderException {
    QueryBuilder<Female> qb = this.module.newQueryBuilder(Female.class);
    Person person = templateFor(Person.class);
    Query<Female> query = unitOfWork.newQuery(qb.where(or(eq(person.yearOfBirth(), 1970), eq(person.yearOfBirth(), 1975))));
    System.out.println("*** script09: " + query);
    verifyUnorderedResults(query, "Ann 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