use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script18.
@Test
public void script18() throws EntityFinderException {
QueryBuilder<Nameable> qb = this.module.newQueryBuilder(Nameable.class);
// should return all Nameable entities sorted by name
Nameable nameable = templateFor(Nameable.class);
Query<Nameable> query = unitOfWork.newQuery(qb);
query.orderBy(orderBy(nameable.name()));
System.out.println("*** script18: " + query);
verifyOrderedResults(query, "Ann Doe", "Cars", "Cooking", "Gaming", "Jack Doe", "Joe Doe", "Kuala Lumpur", "Penang", "Programming");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script24.
@Test
public void script24() throws EntityFinderException {
final QueryBuilder<Domain> qb = this.module.newQueryBuilder(Domain.class);
final Nameable nameable = templateFor(Nameable.class);
final Query<Domain> query = unitOfWork.newQuery(qb.where(eq(nameable.name(), "Gaming")));
System.out.println("*** script24: " + query);
assertThat(query.find().name().get(), is(equalTo("Gaming")));
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script02.
@Test
public void script02() throws EntityFinderException {
final QueryBuilder<Domain> qb = this.module.newQueryBuilder(Domain.class);
final Nameable nameable = templateFor(Nameable.class);
final Query<Domain> query = unitOfWork.newQuery(qb.where(eq(nameable.name(), "Gaming")));
System.out.println("*** script02: " + query);
verifyUnorderedResults(query, "Gaming");
}
use of org.qi4j.test.indexing.model.Nameable in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script17.
@Test
public void script17() throws EntityFinderException {
QueryBuilder<Nameable> qb = this.module.newQueryBuilder(Nameable.class);
// should return only 3 entities starting with forth one
Nameable nameable = templateFor(Nameable.class);
Query<Nameable> query = unitOfWork.newQuery(qb);
query.orderBy(orderBy(nameable.name()));
query.firstResult(3);
query.maxResults(2);
System.out.println("*** script17: " + query);
verifyOrderedResults(query, "Gaming", "Jack Doe");
}