use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script07.
@Test
@SuppressWarnings("unchecked")
public void script07() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Jack Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Nameable.class, and(ge(person.yearOfBirth(), 1900), eq(person.placeOfBirth().get().name(), "Penang")), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JACK);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script10.
@Test
public void script10() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Joe and Jack Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, not(eq(person.yearOfBirth(), 1975)), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE, JACK);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script20.
@Test
public void script20() throws EntityFinderException {
// should return all Persons born after 1973 (Ann and Joe Doe) sorted descending by name
Person person = templateFor(Person.class);
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, gt(person.yearOfBirth(), 1973), new OrderBy[] { orderBy(person.name(), OrderBy.Order.DESCENDING) }, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(false, entities, JOE, ANN);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script21.
@Test
public void script21() throws EntityFinderException {
// should return all Persons sorted name of the city they were born
Person person = templateFor(Person.class);
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, ALL, new OrderBy[] { orderBy(person.placeOfBirth().get().name()), orderBy(person.name()) }, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(false, entities, ANN, JOE, JACK);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script21.
@Test
public void script21() throws EntityFinderException {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
// should return all Persons sorted by name of the city they were born, and then by year they were born
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb);
query.orderBy(orderBy(person.placeOfBirth().get().name()), orderBy(person.yearOfBirth()));
System.out.println("*** script21: " + query);
verifyOrderedResults(query, "Ann Doe", "Joe Doe", "Jack Doe");
}
Aggregations