public void xtestVoidMethods() throws Exception { Region region = CacheUtils.createRegion("Data", Data.class); region.put("0", new Data()); Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM /Data where voidMethod"); Collection result = (Collection) query.execute(); if (result.size() != 0) fail(query.getQueryString()); query = CacheUtils.getQueryService() .newQuery("SELECT DISTINCT * FROM /Data where voidMethod = null "); result = (Collection) query.execute(); if (result.size() != 1) fail(query.getQueryString()); }
public void xtestNestQueryInWhereClause() throws Exception { Region region = CacheUtils.createRegion("Portfolios", Portfolio.class); region.put("0", new Portfolio(0)); region.put("1", new Portfolio(1)); region.put("2", new Portfolio(2)); region.put("3", new Portfolio(3)); Query query = CacheUtils.getQueryService() .newQuery( "SELECT DISTINCT * FROM /Portfolios WHERE NOT (SELECT DISTINCT * FROM positions.values p WHERE p.secId = 'IBM').isEmpty"); Collection result = (Collection) query.execute(); Portfolio p = (Portfolio) (result.iterator().next()); if (!p.positions.containsKey("IBM")) fail(query.getQueryString()); // query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM // /Portfolios where status = ELEMENT(SELECT DISTINCT * FROM /Portfolios p // where p.ID = 0).status"); // result = (Collection)query.execute(); // CacheUtils.log(result); // query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM // /Portfolios x where status = ELEMENT(SELECT DISTINCT * FROM /Portfolios // p where p.ID = x.ID).status"); // result = (Collection)query.execute(); // SELECT DISTINCT * FROM /Portfolios where status = ELEMENT(SELECT // DISTINCT * FROM /Portfolios where ID = 0).status // SELECT DISTINCT * FROM /Portfolios x where status = ELEMENT(SELECT // DISTINCT * FROM /Portfolios p where p.ID = x.ID).status }
public void xtestMiscQueries() throws Exception { String testData[] = {"NULL", "UNDEFINED"}; for (int i = 0; i < testData.length; i++) { Query query = CacheUtils.getQueryService().newQuery("SELECT DISTINCT * FROM " + testData[i]); Object result = query.execute(); if (!result.equals(QueryService.UNDEFINED)) fail(query.getQueryString()); } }
public void xtestNestQueryInFromClause() throws Exception { Region region = CacheUtils.createRegion("Portfolios", Portfolio.class); region.put("0", new Portfolio(0)); region.put("1", new Portfolio(1)); region.put("2", new Portfolio(2)); region.put("3", new Portfolio(3)); Query query = CacheUtils.getQueryService() .newQuery( "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM /Portfolios where status = 'active') p where p.ID = 0"); // DebuggerSupport.waitForJavaDebugger(CacheUtils.getLogger()); Collection result = (Collection) query.execute(); Portfolio p = (Portfolio) (result.iterator().next()); if (!p.status.equals("active") || p.getID() != 0) fail(query.getQueryString()); }