Search in sources :

Example 71 with Person

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

the class AbstractQueryTest method script41_DateTime.

@Test
public void script41_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-04T13:24:35", UTC))));
    System.out.println("*** script41_DateTime: " + 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 72 with Person

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

the class AbstractQueryTest method script36.

@Test
public void script36() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Account anns = unitOfWork.get(Account.class, "accountOfAnnDoe");
    Query<Person> query = unitOfWork.newQuery(qb.where(contains(person.accounts(), anns)));
    System.out.println("*** script36: " + query);
    verifyUnorderedResults(query, "Jack Doe", "Ann Doe");
}
Also used : Account(org.qi4j.test.indexing.model.Account) Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 73 with Person

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

the class AbstractQueryTest method script43_LocalDateTime.

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

Example 74 with Person

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

the class AbstractQueryTest method script32.

@Test
public void script32() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.address().get().line1(), "Qi Alley 4j")));
    System.out.println("*** script32: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) Test(org.junit.Test)

Example 75 with Person

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

the class AbstractQueryTest method script13.

@Test
public void script13() throws EntityFinderException {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Male person = templateFor(Male.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(isNotNull(person.wife())));
    System.out.println("*** script13: " + query);
    verifyUnorderedResults(query, "Jack Doe");
}
Also used : Male(org.qi4j.test.indexing.model.Male) 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