public Index createIndex(String name, String field, String region) throws CacheException { try { return cache.getQueryService().createIndex(name, field, region); } catch (Exception e) { throw new RuntimeException("Index creation failed for index on region: " + region + "." + field, e); } }
public void setUp() throws Exception { Properties props = new Properties(); props.setProperty("mcast-port", "0"); props.setProperty("log-level", "config"); this.ds = DistributedSystem.connect(props); this.cache = CacheFactory.create(ds); this.qs = cache.getQueryService(); }
public void run2() throws CacheException { // Get CQ Service. QueryService cqService = null; try { cqService = getCache().getQueryService(); cqService.stopCqs(); } catch (Exception cqe) { cqe.printStackTrace(); fail("Failed to getCQService."); } } });
public void run2() throws CacheException { // Get CQ Service. QueryService cqService = null; try { cqService = getCache().getQueryService(); cqService.stopCqs("/root/" + regions[0]); } catch (Exception cqe) { cqe.printStackTrace(); fail("Failed to getCQService."); } } });
public void run2() throws CacheException { // Get CQ Service. QueryService cqService = null; try { cqService = getCache().getQueryService(); cqService.executeCqs("/root/" + regions[0]); } catch (Exception cqe) { cqe.printStackTrace(); fail("Failed to getCQService."); } } });
public void run2() throws CacheException { try { QueryService qs = getCache().getQueryService(); qs.createIndex(indexName, indexedExpression, regionPath); } catch (Exception e) { throw new CacheException(e){}; } } });
public Object call() throws Exception { QueryService qs = getCache().getQueryService(); Query q = qs.newQuery("select * from /sample where age < 50"); assertEquals(0, ((SelectResults)q.execute()).size()); return null; } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(regionName); QueryService qs = getCache().getQueryService(); try { qs.createIndex("idIndex", IndexType.FUNCTIONAL, "entry.value.id", regName + ".entries entry"); qs.createIndex("tickerIndex", IndexType.FUNCTIONAL, "p.ticker", regName + ".values p"); } catch (Exception ex) { fail("Unable to create index. " + ex.getMessage()); } } });
public void run2() throws CacheException { // Get CQ Service. QueryService cqService = null; try { cqService = getCache().getQueryService(); cqService.executeCqs(); } catch (Exception cqe) { fail("Failed to getCQService.", cqe); } } });
public void run2() throws CacheException { // Get CQ Service. QueryService cqService = null; try { cqService = getCache().getQueryService(); cqService.executeCqs("/root/" + regions[0]); } catch (Exception cqe) { fail("Failed to getCQService.", cqe); } } });
public static void startCache() { try { if (cache.isClosed()) { cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); qs = cache.getQueryService(); } } catch (Exception e) { e.printStackTrace(); } }
private void removeIndex() { QueryService queryService = region.getCache().getQueryService(); Collection<Index> indexes = queryService.getIndexes(region); if (indexes != null && indexes.size() > 0) { int randomNum = TestConfig.tab().getRandGen().nextInt(0, (indexes.size() - 1)); Index index = (Index) indexes.toArray()[randomNum]; _removeIndex(index); } else { logInfo("No indexes found for region " + region.getName()); } }
public void removeIndex(String name) { QueryService queryService = region.getCache().getQueryService(); Index index = (Index) queryService.getIndex(region, name); if (index == null) throw new TestException("Index named " + name + " not found"); _removeIndex(index); }
public void stopCq(String name) { QueryService queryService = region.getCache().getQueryService(); CqQuery query = queryService.getCq(name); if (query == null) throw new TestException("CqQuery named " + name + " not found"); _stopCq(query); }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); for (int i=0; i<numberOfEntries; i++) { region.put("key-"+i, new TestObject(i, "ibm")); } QueryService qs = getCache().getQueryService(); DefaultQuery query = (DefaultQuery)qs.newQuery("Select * from " + regName); query.setTestCompiledQueryClearTime(2 * 1000); } });
private void _removeIndex(Index index) { QueryService queryService = region.getCache().getQueryService(); try { queryService.removeIndex(index); logInfo(opPrefix + " removed index named " + index.getName()); operationRecorder.indexRemoved(index.getName()); } catch (Exception e) { throw new TestException(TestHelper.getStackTrace(e)); } }
public Object call() throws Exception { Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); getCache().getRegion(ORDER); getCache().getRegion(D_REFERENCE); ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; getCache().getLogger().info("SWAP:CLIENTinvoked:"+cl.invoked); assertTrue(((ClientCQListener)custRegion.getCache().getQueryService().getCqs()[0].getCqAttributes().getCqListener()).invoked); assertTrue(cl.invoked); return null; } });
public Object call() throws Exception { Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); getCache().getRegion(ORDER); getCache().getRegion(D_REFERENCE); ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; getCache().getLogger().info("SWAP:CLIENTinvoked:"+cl.invoked); assertTrue(cl.invoked); assertTrue(((ClientCQListener)custRegion.getCache().getQueryService().getCqs()[0].getCqAttributes().getCqListener()).invoked); return null; } });
public Object call() throws Exception { Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); getCache().getRegion(ORDER); getCache().getRegion(D_REFERENCE); ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; getCache().getLogger().info("SWAP:CLIENTinvoked:"+cl.invoked); assertTrue(cl.invoked); assertTrue(((ClientCQListener)custRegion.getCache().getQueryService().getCqs()[0].getCqAttributes().getCqListener()).invoked); return null; } });
public Object call() throws Exception { Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); getCache().getRegion(ORDER); getCache().getRegion(D_REFERENCE); ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; getCache().getLogger().info("SWAP:CLIENTinvoked:"+cl.invoked); assertTrue(cl.invoked); assertTrue(((ClientCQListener)custRegion.getCache().getQueryService().getCqs()[0].getCqAttributes().getCqListener()).invoked); return null; } });