use of org.apache.geode.cache.query.dunit.QueryUsingPoolDUnitTest.TestObject in project geode by apache.
the class OrderByPartitionedJUnitTest method testBug.
// Asif: This test to me does not make sense as the bind parameter should be a
// constant
@Test
public void testBug() throws Exception {
// String queries[] =
// {"SELECT DISTINCT * FROM /test WHERE id < $1 ORDER BY $2" };
String[] queries = { "SELECT DISTINCT * FROM /test WHERE id < $1 ORDER BY id" };
Object[][] r = new Object[queries.length][2];
QueryService qs;
qs = CacheUtils.getQueryService();
Position.resetCounter();
// Create Regions
PartitionAttributesFactory paf = new PartitionAttributesFactory();
AttributesFactory af = new AttributesFactory();
// af.setPartitionAttributes(paf.create());
Region r1 = CacheUtils.createRegion("test", af.create(), false);
for (int i = 0; i < 100; i++) {
r1.put("key-" + i, new TestObject(i, "ibm"));
}
// Execute Queries without Indexes
for (int i = 0; i < queries.length; i++) {
Query q = null;
try {
q = CacheUtils.getQueryService().newQuery(queries[i]);
CacheUtils.getLogger().info("Executing query: " + queries[i]);
// r[i][0] = q.execute(new Object[]{new Integer(101),"id"});
r[i][0] = q.execute(new Object[] { new Integer(101) });
assertEquals(100, ((SelectResults) r[i][0]).size());
} catch (Exception e) {
e.printStackTrace();
fail(q.getQueryString());
}
}
}
Aggregations