Search in sources :

Example 36 with Person

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

the class AbstractQueryTest method script43_Date.

@Test
public void script43_Date() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(and(gt(person.dateValue(), new DateTime("2005-03-04T13:24:35", UTC).toDate()), lt(person.dateValue(), new DateTime("2015-03-04T13:24:35", UTC).toDate()))));
    System.out.println("*** script43_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 37 with Person

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

the class AbstractQueryTest method script51_BigDecimal.

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

Example 38 with Person

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

the class AbstractQueryTest method script30.

@Test
@Ignore("Wait till 1.1?")
// Paul: I don't understand this test
@SuppressWarnings("unchecked")
public void script30() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    // oneOf( person.personalWebsite().get().queryParams() );
    QueryParam queryParam = null;
    Query<Person> query = unitOfWork.newQuery(qb.where(and(eq(queryParam.name(), "foo"), eq(queryParam.value(), "bar"))));
    System.out.println("*** script30: " + query);
    verifyUnorderedResults(query, "Jack Doe");
}
Also used : QueryParam(org.qi4j.test.indexing.model.QueryParam) Person(org.qi4j.test.indexing.model.Person) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 39 with Person

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

the class AbstractQueryTest method script41_LocalDate.

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

Example 40 with Person

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

the class AbstractQueryTest method script42_LocalDate.

@Test
public void script42_LocalDate() {
    QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
    Person person = templateFor(Person.class);
    Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.localDateValue(), new LocalDate("2010-03-04", forID("CET")))));
    System.out.println("*** script42_LocalDate: " + query);
    verifyUnorderedResults(query, "Joe Doe");
}
Also used : Person(org.qi4j.test.indexing.model.Person) LocalDate(org.joda.time.LocalDate) 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