use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script23.
@Test
public void script23() throws EntityFinderException {
Nameable nameable = templateFor(Nameable.class);
// Try using variables
Map<String, Object> variables = new HashMap<>(1);
variables.put("domain", "Gaming");
Iterable<EntityReference> entities = entityFinder.findEntities(Domain.class, eq(nameable.name(), variable("domain")), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, variables);
assertNames(entities, "Gaming");
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script22.
@Test
public void script22() throws EntityFinderException {
Nameable nameable = templateFor(Nameable.class);
// should return Jack and Joe Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Nameable.class, matches(nameable.name(), "J.*Doe"), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JACK, JOE);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script06.
@Test
public void script06() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Joe and Ann Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, ge(person.yearOfBirth(), 1973), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE, ANN);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script18.
@Test
public void script18() throws EntityFinderException {
// should return all Nameable entities sorted by name
Nameable nameable = templateFor(Nameable.class);
final String[] allNames = NameableAssert.allNames();
Arrays.sort(allNames);
Iterable<EntityReference> entities = entityFinder.findEntities(Nameable.class, ALL, new OrderBy[] { orderBy(nameable.name()) }, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(false, entities, allNames);
}
use of org.qi4j.api.entity.EntityReference in project qi4j-sdk by Qi4j.
the class AbstractEntityFinderTest method script04.
@Test
public void script04() throws EntityFinderException {
Person person = templateFor(Person.class);
// should return Joe and Ann Doe
Iterable<EntityReference> entities = entityFinder.findEntities(Person.class, eq(person.placeOfBirth().get().name(), "Kuala Lumpur"), NO_SORTING, NO_FIRST_RESULT, NO_MAX_RESULTS, NO_VARIABLES);
assertNames(entities, JOE, ANN);
}
Aggregations