use of siena.base.test.model.Discovery4Search in project siena by mandubian.
the class DrizzleTest method testSearchMultipleWordsSingleField.
public void testSearchMultipleWordsSingleField() {
Discovery4Search AB = new Discovery4Search("alpha beta", LongAutoID_CURIE);
Discovery4Search GB = new Discovery4Search("gamma beta", LongAutoID_CURIE);
Discovery4Search GD = new Discovery4Search("gamma delta", LongAutoID_CURIE);
Discovery4Search ET = new Discovery4Search("epsilon theta", LongAutoID_CURIE);
pm.insert(AB);
pm.insert(GB);
pm.insert(GD);
pm.insert(ET);
Query<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha delta", "name").order("name");
List<Discovery4Search> res = query.fetch();
assertEquals(2, res.size());
assertEquals(AB, res.get(0));
assertEquals(GD, res.get(1));
}
use of siena.base.test.model.Discovery4Search in project siena by mandubian.
the class GaeAsyncTest method testSearchSingleFieldBeginSeveralResultsKeysOnly.
public void testSearchSingleFieldBeginSeveralResultsKeysOnly() {
Discovery4Search[] discs = new Discovery4Search[5];
discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
discs[2] = new Discovery4Search("alphagamma", LongAutoID_CURIE);
discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
pm.insert((Object[]) discs).get();
QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha*", "name");
SienaFuture<List<Discovery4Search>> future = query.fetchKeys();
List<Discovery4Search> res = future.get();
assertEquals(2, res.size());
assertEquals(discs[0].id, res.get(0).id);
assertTrue(res.get(0).isOnlyIdFilled());
assertEquals(discs[2].id, res.get(1).id);
assertTrue(res.get(1).isOnlyIdFilled());
}
use of siena.base.test.model.Discovery4Search in project siena by mandubian.
the class GaeAsyncTest method testSearchSingleFieldEndException.
public void testSearchSingleFieldEndException() {
Discovery4Search[] discs = new Discovery4Search[5];
discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
discs[2] = new Discovery4Search("alphagamma", LongAutoID_CURIE);
discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
pm.insert((Object[]) discs).get();
try {
QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("*gamma", "name");
query.fetch();
} catch (SienaException ex) {
return;
}
fail();
}
use of siena.base.test.model.Discovery4Search in project siena by mandubian.
the class GaeAsyncTest method testSearchSingleFieldBeginSingleResults.
public void testSearchSingleFieldBeginSingleResults() {
Discovery4Search[] discs = new Discovery4Search[5];
discs[0] = new Discovery4Search("alpha", LongAutoID_CURIE);
discs[1] = new Discovery4Search("beta", LongAutoID_CURIE);
discs[2] = new Discovery4Search("gamma", LongAutoID_CURIE);
discs[3] = new Discovery4Search("delta", LongAutoID_CURIE);
discs[4] = new Discovery4Search("eta", LongAutoID_CURIE);
pm.insert((Object[]) discs).get();
QueryAsync<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("gamma*", "name");
SienaFuture<List<Discovery4Search>> future = query.fetch();
List<Discovery4Search> res = future.get();
assertEquals(1, res.size());
assertEquals(discs[2], res.get(0));
}
use of siena.base.test.model.Discovery4Search in project siena by mandubian.
the class JdbcTest method testSearchMultipleWordsSingleField.
public void testSearchMultipleWordsSingleField() {
Discovery4Search AB = new Discovery4Search("alpha beta", LongAutoID_CURIE);
Discovery4Search GB = new Discovery4Search("gamma beta", LongAutoID_CURIE);
Discovery4Search GD = new Discovery4Search("gamma delta", LongAutoID_CURIE);
Discovery4Search ET = new Discovery4Search("epsilon theta", LongAutoID_CURIE);
pm.insert(AB);
pm.insert(GB);
pm.insert(GD);
pm.insert(ET);
Query<Discovery4Search> query = pm.createQuery(Discovery4Search.class).search("alpha delta", "name").order("name");
List<Discovery4Search> res = query.fetch();
assertEquals(2, res.size());
assertEquals(AB, res.get(0));
assertEquals(GD, res.get(1));
}
Aggregations