use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractComplexQueryTest method script06.
@Test
public void script06() {
ValueBuilder<URL> urlBuilder = this.module.newValueBuilder(URL.class);
ValueBuilder<Protocol> protocolBuilder = this.module.newValueBuilder(Protocol.class);
ValueBuilder<QueryParam> queryParamBuilder = this.module.newValueBuilder(QueryParam.class);
Protocol protocol = protocolBuilder.prototype();
protocol.value().set("http");
List<QueryParam> queryParams = new ArrayList<>(2);
QueryParam param = queryParamBuilder.prototype();
param.name().set("user");
param.value().set("jackdoe");
queryParams.add(queryParamBuilder.newInstance());
queryParamBuilder = this.module.newValueBuilder(QueryParam.class);
param = queryParamBuilder.prototype();
param.name().set("password");
param.value().set("somepassword");
queryParams.add(queryParamBuilder.newInstance());
URL url = urlBuilder.prototype();
url.protocol().set(protocolBuilder.newInstance());
url.queryParams().set(queryParams);
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Property<URL> websiteProp = templateFor(Person.class).personalWebsite();
qb = qb.where(eq(websiteProp, urlBuilder.newInstance()));
Query<Person> query = unitOfWork.newQuery(qb);
System.out.println("*** script06: " + query);
verifyUnorderedResults(query, JACK);
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script31.
@Test
@Ignore("Equality on Property<Map<?,?>> not implemented")
public void script31() {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Map<String, String> info = new HashMap<>(0);
Query<Person> query = unitOfWork.newQuery(qb.where(eq(person.additionalInfo(), info)));
System.out.println("*** script31: " + query);
verifyUnorderedResults(query, "Jack Doe");
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script23.
@Test
public void script23() throws EntityFinderException {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Domain interests = oneOf(person.interests());
Query<Person> query = unitOfWork.newQuery(qb.where(eq(interests.name(), "Cars")));
System.out.println("*** script23: " + query);
verifyOrderedResults(query, "Jack Doe");
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractQueryTest method script12.
@Test
public void script12() throws EntityFinderException {
QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
Person person = templateFor(Person.class);
Query<Person> query = unitOfWork.newQuery(qb.where(isNull(person.email())));
System.out.println("*** script12: " + query);
verifyUnorderedResults(query, "Ann Doe", "Jack Doe");
}
use of org.qi4j.test.indexing.model.Person in project qi4j-sdk by Qi4j.
the class AbstractNamedQueryTest method script21.
@Test
public void script21() throws EntityFinderException {
Person person = templateFor(Person.class);
final Query<Person> query = unitOfWork.newQuery(this.module.newQueryBuilder(Person.class).where(queries.get("script21")));
query.orderBy(orderBy(person.placeOfBirth().get().name()), orderBy(person.yearOfBirth()));
System.out.println("*** script21: " + query);
verifyOrderedResults(query, "Ann Doe", "Joe Doe", "Jack Doe");
}
Aggregations