/** * ACCESSED VIA REFLECTION */ protected static DistributedMember getMemberId() throws CacheException { return getRegion().getCache().getDistributedSystem().getDistributedMember(); }
/** * Update an entry in this test's region with the given name, assuming that the update * is actually causing creation of the entry * * ACCESSED VIA REFLECTION */ protected static void updateNewEntry(String name, SubscriptionAttributes subAttrs, GenericListener l) throws CacheException { Region sub = _createRegion(name, 0, ExpirationAction.INVALIDATE, subAttrs, l); sub.put(name, new Integer(0), sub.getCache().getDistributedSystem().getDistributedMember()); }
@Override public void beforeDestroy(EntryEvent event) throws CacheWriterException { invoked = true; event.getRegion().getCache().getLogger().info("SWAP:writer:"+event); assertTrue(event.isOriginRemote()); } }
@Override public void afterCreate(EntryEvent event) { LogWriterI18n logger = event.getRegion().getCache().getLoggerI18n(); PartitionRegionConfig prConfig = (PartitionRegionConfig)event.getNewValue(); if (!prConfig.getElderFPAs().isEmpty()) { updatePartitionMap(prConfig, logger); } }
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 run2() throws CacheException { try { getOrCreateRootRegion().getCache().setLockTimeout(2); Region r2 = getOrCreateRootRegion().createSubregion(name, getGlobalAttrs()); assertEquals("value 1", r2.get(key)); r2.put(key, "wrong value"); fail("put() should have thrown TimeoutException"); } catch (TimeoutException ex) { // pass } } });
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 { getOrCreateRootRegion().getCache().setLockTimeout(2); Region r = getOrCreateRootRegion().createSubregion(name, getGlobalAttrs()); try { r.invalidate(key); fail("invalidate() should have thrown TimeoutException"); } catch (TimeoutException ex) { // pass } } });
public Object call() throws Exception { Region r = getCache().getRegion(regionName); assertFalse(r.containsKey("key0")); assertFalse(r.containsValueForKey("key0")); assertTrue(r.containsKey("key2")); assertEquals("newValue2", r.get("key2")); r.getCache().getLogger().fine("SWAP:doingGet"); assertEquals("value4", r.get("key4")); return null; } });
@Override public void afterInvalidate(EntryEvent event) { event.getRegion().getCache().getLogger().warning("ZZZ AFTER UPDATE:"+event.getKey()); invoked = true; invokeCount++; invalidateCount++; isOriginRemote = event.isOriginRemote(); }
public void afterWritingBytes() { region.getCache().getLogger().info("in afterWritingBytes didClear=" + didClear); if (!didClear) return; CacheObserverHolder.setInstance(new CacheObserverAdapter()); // now that the flusher finished the async create of VALUE1 // do another create region.create("KEY", "VALUE2"); signalCompletion(); } public void goingToFlush() {
@Override public void afterCreate(EntryEvent event) { event.getRegion().getCache().getLogger().warning("ZZZ AFTER CREATE:"+event.getKey()); invoked = true; invokeCount++; putCount++; creates++; event.getRegion().getCache().getLogger().warning("ZZZ AFTER CREATE:"+event.getKey()+" isPutAll:"+event.getOperation().isPutAll()+" op:"+event.getOperation()); putAllOp = event.getOperation().isPutAll(); isOriginRemote = event.isOriginRemote(); } @Override
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; } });
@Override public void afterCreate(EntryEvent event) { event.getRegion().getCache().getLoggerI18n().info( LocalizedStrings.ONE_ARG, "Create Event for allPR: key = " + event.getKey() + " oldVal = " + event.getOldValue() + " newVal = " + event.getNewValue() + " Op = " + event.getOperation() + " origin = " + event.getDistributedMember() + " isNetSearch = " + event.getOperation().isNetSearch()); }
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); //factory.setDataPolicy(DataPolicy.PARTITION); factory.setPartitionAttributes((new PartitionAttributesFactory()).setTotalNumBuckets(8).create()); createRegion(exampleRegionName, factory.create()); createRegion(exampleRegionName2, factory.create()); Region exampleRegion = getRootRegion().getSubregion(exampleRegionName); exampleRegion.getCache().getLogger().fine("#### CREATING PR REGION...."); } });