use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script07.
@Test
@SuppressWarnings("unchecked")
public void script07() throws EntityFinderException {
QueryBuilder<Nameable> qb = this.module.newQueryBuilder(Nameable.class);
Person person = templateFor(Person.class);
Query<Nameable> query = unitOfWork.newQuery(qb.where(and(ge(person.yearOfBirth(), 1900), eq(person.placeOfBirth().get().name(), "Penang"))));
System.out.println("*** script07: " + query);
verifyUnorderedResults(query, "Jack Doe");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script02.
@Test
public void script02() throws EntityFinderException {
Nameable nameable = templateFor(Nameable.class);
// should return Gaming domain
Iterable<EntityReference> entities = entityFinder.findEntities(Domain.class, eq(nameable.name(), "Gaming"), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, "Gaming");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractNamedQueryTest method script16.
@Test
public void script16() throws EntityFinderException {
Nameable nameable = templateFor(Nameable.class);
final Query<Nameable> query = unitOfWork.newQuery(this.module.newQueryBuilder(Nameable.class).where(queries.get("script16")));
query.orderBy(orderBy(nameable.name()));
query.maxResults(2);
System.out.println("*** script16: " + query);
verifyOrderedResults(query, "Ann Doe", "Cars");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script22.
@Test
public void script22() throws EntityFinderException {
QueryBuilder<Nameable> qb = this.module.newQueryBuilder(Nameable.class);
Nameable nameable = templateFor(Nameable.class);
// should return Jack and Joe Doe
Query<Nameable> query = unitOfWork.newQuery(qb.where(matches(nameable.name(), "J.*Doe")));
System.out.println("*** script22: " + query);
verifyUnorderedResults(query, "Jack Doe", "Joe Doe");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractNamedQueryTest method script17.
@Test
public void script17() throws EntityFinderException {
Nameable nameable = templateFor(Nameable.class);
final Query<Nameable> query = unitOfWork.newQuery(this.module.newQueryBuilder(Nameable.class).where(queries.get("script17")));
query.orderBy(orderBy(nameable.name()));
query.firstResult(3);
query.maxResults(3);
System.out.println("*** script17: " + query);
verifyOrderedResults(query, "Gaming", "Jack Doe", "Joe Doe");
}