use of org.apache.geode.cache.query.data.Position in project geode by apache.
the class IUMJUnitTest method testWithOutIndexCreatedMultiCondQueryTest.
@Test
public void testWithOutIndexCreatedMultiCondQueryTest() throws Exception {
Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
for (int i = 0; i < 4; i++) {
region.put("" + i, new Portfolio(i));
// CacheUtils.log(new Portfolio(i));
}
CacheUtils.getQueryService();
String[] queries = { "SELECT DISTINCT * from /portfolios pf , pf.positions.values pos where pos.getSecId = 'IBM' and status = 'inactive'" };
for (int i = 0; i < queries.length; i++) {
Query q = null;
try {
q = CacheUtils.getQueryService().newQuery(queries[i]);
Object r3 = q.execute();
resType3 = (StructType) ((SelectResults) r3).getCollectionType().getElementType();
resSize3 = (((SelectResults) r3).size());
// CacheUtils.log(resType3);
strg3 = resType3.getFieldNames();
// CacheUtils.log(strg3[0]);
// CacheUtils.log(strg2[1]);
set3 = (((SelectResults) r3).asSet());
Iterator iter = set3.iterator();
while (iter.hasNext()) {
Struct stc3 = (Struct) iter.next();
valPf2 = stc3.get(strg3[0]);
valPos2 = stc3.get(strg3[1]);
isActive3 = ((Portfolio) stc3.get(strg3[0])).isActive();
// CacheUtils.log(valPf2);
// CacheUtils.log(valPos2);
}
} catch (Exception e) {
e.printStackTrace();
fail(q.getQueryString());
}
}
itert3 = set3.iterator();
while (itert3.hasNext()) {
Struct stc3 = (Struct) itert3.next();
if (!((Position) stc3.get(strg3[1])).secId.equals("IBM"))
fail("FAILED: secId found is not IBM");
if (((Portfolio) stc3.get(strg3[0])).isActive() != false)
fail("FAILED:Portfolio in Search result is Active");
}
}
Aggregations