use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script37.
@Test
@Ignore("Traversing of NamedAssociations is not implemented")
public void script37() {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.accounts().get("anns").number(), "accountOfAnnDoe")));
System.out.println("*** script37: " + query);
verifyUnorderedResults(query, "Jack Doe", "Ann Doe");
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script42_Date.
@Test
public void script42_Date() {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb.where(ne(person.dateValue(), new DateTime("2010-03-04T14:24:35", forID("CET")).toDate())));
System.out.println("*** script42_Date: " + query);
verifyUnorderedResults(query, "Joe Doe");
}
use of org.qi4j.test.indexing.model.Person 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.Person in project qi4j-sdk by Qi4j.
the class AbstractComplexQueryTest method script04.
@Test
public void script04() {
ValueBuilder<QueryParam> queryParamBuilder = this.module.newValueBuilder(QueryParam.class);
List<QueryParam> queryParams = new ArrayList<>(2);
QueryParam param = queryParamBuilder.prototype();
// Different order
param.name().set("password");
param.value().set("somepassword");
queryParams.add(queryParamBuilder.newInstance());
queryParamBuilder = this.module.newValueBuilder(QueryParam.class);
param = queryParamBuilder.prototype();
param.name().set("user");
param.value().set("jackdoe");
queryParams.add(queryParamBuilder.newInstance());
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Property<Collection<QueryParam>> paramsProp = templateFor(Person.class).personalWebsite().get().queryParams();
qb = qb.where(eq(paramsProp, queryParams));
Query<Person> query = unitOfWork.newQuery(qb);
System.out.println("*** script04: " + query);
verifyUnorderedResults(query);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractComplexQueryTest method script01.
@Test
public void script01() {
ValueBuilder<Address> addressBuilder = this.module.newValueBuilder(Address.class);
Address address = addressBuilder.prototype();
address.line1().set("Qi Street 4j");
address.line2().set("Off main Java Street");
address.zipcode().set("12345");
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Property<Address> addressProp = templateFor(Person.class).address();
qb = qb.where(eq(addressProp, addressBuilder.newInstance()));
Query<Person> query = unitOfWork.newQuery(qb);
System.out.println("*** script01: " + query);
verifyUnorderedResults(query, ANN);
}
Aggregations