private void endDynamicRegionFactory() { File dir = null; RegionAttributesCreation attrs; { Object o = stack.pop(); if (o instanceof File) { dir = (File)o; stack.pop(); //dir size to be popped out. being used by persistent directories attrs = (RegionAttributesCreation) stack.pop(); } else { attrs = (RegionAttributesCreation) o; } } String poolName = (String)stack.pop(); String disableRegisterInterest = (String)stack.pop(); String disablePersistBackup = (String)stack.pop(); DynamicRegionFactory.Config cfg; cfg = new DynamicRegionFactory.Config(dir, poolName, !Boolean.valueOf(disablePersistBackup).booleanValue(), !Boolean.valueOf(disableRegisterInterest).booleanValue()); CacheCreation cache = (CacheCreation)stack.peek(); cache.setDynamicRegionFactoryConfig(cfg); }
public void run2() throws CacheException { beginCacheXml(); { File d = new File("DynamicRegionData" + ProcessMgr.getProcessId()); d.mkdirs(); CacheCreation cc = (CacheCreation)getCache(); cc.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(d, null)); } createParentRegion("parent", true); finishCacheXml("dynamicRegionDUnitTest"); // now make sure we recovered from disk ok assertEquals(true, DynamicRegionFactory.get().isOpen()); } });
File d = new File(dsName + DYNAMIC_REGION_DIR + hydra.ProcessMgr.getProcessId()); d.mkdirs(); cc.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(d, null));
/** * Generates a dummy cache from the given cache configuration. */ private static CacheCreation generateDummyCache(String cacheConfig, DynamicRegionFactory.Config dynamicRegionConfig, String fn) { // open the DynamicRegionFactory, if any // before creating the cache if (dynamicRegionConfig != null) { log("Opening the configured DynamicRegionFactory"); DynamicRegionFactory.get().open(dynamicRegionConfig); } // create and configure the dummy cache log("Creating dummy cache from config: " + cacheConfig); CacheDescription cd = getCacheDescription(cacheConfig); CacheCreation dummyCache = new CacheCreation(); CacheVersionHelper.generateDummyResourceManager(cd, dummyCache); cd.configureDummy(dummyCache); // add the dynamic region factory configuration, if any if (dynamicRegionConfig != null) { dummyCache.setDynamicRegionFactoryConfig(dynamicRegionConfig); } // save the cache config for future reference XmlCacheConfigs.put(fn, cacheConfig); log("Created dummy cache: " + cacheToString(dummyCache)); return dummyCache; }
File d = new File(dsName + DYNAMIC_REGION_DIR + hydra.ProcessMgr.getProcessId()); d.mkdirs(); cc.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(d, null));
/** * @since 4.3 */ public void testDynamicRegionFactoryDiskDir() throws CacheException { CacheCreation cache = new CacheCreation(); File f = new File("diskDir"); f.mkdirs(); cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(f, null)); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); cache.createRegion("root", attrs); // note that testXml can't check if they are same because enabling // dynamic regions causes a meta region to be produced. testXml(cache, false); assertEquals(true, DynamicRegionFactory.get().isOpen()); assertEquals(f.getAbsoluteFile(), DynamicRegionFactory.get().getConfig().getDiskDir()); assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter()); Region dr =getCache().getRegion("__DynamicRegions"); if(dr != null) { dr.localDestroyRegion(); } } /**
public void run2() throws CacheException { createLonerDS(dsName + "_loner_" + NYC_CLIENT_NAME + "_vm3"); beginCacheXml(); PoolImpl pi = null; if (getTestDynamicRegions()) { CacheCreation cc = (CacheCreation)getCache(); pi = (PoolImpl)BridgeTestCase.configureConnectionPoolWithNameAndFactory(null, getServerHostName(host), bsPorts, true, -1, -1, null,"testPool",cc.createPoolFactory()); File d = new File(dsName + DYNAMIC_REGION_DIR + hydra.ProcessMgr.getProcessId()); d.mkdirs(); cc.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(d, pi.getName(),false,true)); } else { pi = (PoolImpl)BridgeTestCase.configureConnectionPool(null, getServerHostName(host), bsPorts, true, -1, -1, null); } createParentRegionOnClient(dsName, false,pi); finishCacheXml(dsName + "_" + NYC_CLIENT_NAME); Region r = getCache().getRegion(dsName); r.registerInterestRegex(".*"); } });
public void run2() throws CacheException { createLonerDS(dsName + "_loner_ " + LONDON_CLIENT_NAME + "_vm1"); beginCacheXml(); PoolImpl pi = null; if (getTestDynamicRegions()) { CacheCreation cc = (CacheCreation)getCache(); pi = (PoolImpl)BridgeTestCase.configureConnectionPoolWithNameAndFactory(null, getServerHostName(host), bsPorts, true, -1, -1, null,"testPool",cc.createPoolFactory()); File d = new File(dsName + DYNAMIC_REGION_DIR + hydra.ProcessMgr.getProcessId()); d.mkdirs(); cc.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(d, pi.getName(),false,true)); } else { pi = (PoolImpl)BridgeTestCase.configureConnectionPool(null, getServerHostName(host), bsPorts, true, -1, -1, null); } createParentRegionOnClient(dsName, false, pi); finishCacheXml(dsName + "_" + LONDON_CLIENT_NAME); Region r = getCache().getRegion(dsName); r.registerInterestRegex(".*"); } });
/** * disabled test because it can only be done from a bridge client cache. */ public void _testDynamicRegionFactoryCacheWriter() throws CacheException { CacheCreation cache = new CacheCreation(); CacheWriter writer = new MyTestCacheWriter(); cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(null, (com.gemstone.gemfire.cache.util.BridgeWriter)writer)); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); cache.createRegion("root", attrs); // note that testXml can't check if they are same because enabling // dynamic regions causes a meta region to be produced. testXml(cache, false); assertEquals(true, DynamicRegionFactory.get().isOpen()); assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir()); assertEquals(writer, DynamicRegionFactory.get().getConfig().getBridgeWriter()); }
public void testDynamicRegionFactoryNonDefault() throws CacheException { CacheCreation cache = new CacheCreation(); cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config((File)null, (com.gemstone.gemfire.cache.util.BridgeWriter)null, false, false)); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); cache.createRegion("root", attrs); // note that testXml can't check if they are same because enabling // dynamic regions causes a meta region to be produced. testXml(cache, false); assertEquals(false, DynamicRegionFactory.get().getConfig().getRegisterInterest()); assertEquals(false, DynamicRegionFactory.get().getConfig().getPersistBackup()); assertEquals(true, DynamicRegionFactory.get().isOpen()); assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir()); assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter()); Region dr = getCache().getRegion("__DynamicRegions"); if(dr != null) { dr.localDestroyRegion(); } }
/** * @since 4.3 */ public void testDynamicRegionFactoryDefault() throws CacheException { CacheCreation cache = new CacheCreation(); cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config()); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); cache.createRegion("root", attrs); // note that testXml can't check if they are same because enabling // dynamic regions causes a meta region to be produced. testXml(cache, false); assertEquals(true, DynamicRegionFactory.get().getConfig().getRegisterInterest()); assertEquals(true, DynamicRegionFactory.get().getConfig().getPersistBackup()); assertEquals(true, DynamicRegionFactory.get().isOpen()); assertEquals(null, DynamicRegionFactory.get().getConfig().getDiskDir()); assertEquals(null, DynamicRegionFactory.get().getConfig().getBridgeWriter()); Region dr = getCache().getRegion("__DynamicRegions"); if(dr != null) { dr.localDestroyRegion(); } } public void testDynamicRegionFactoryNonDefault() throws CacheException {
.setSubscriptionEnabled(true) .create("connectionPool"); cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(null, "connectionPool", false, false)); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); cache.createRegion("root", attrs);