public void createCache(Properties prop) { if (null != prop && !prop.isEmpty()) { cache = new CacheFactory(prop).create(); } else{ cache = new CacheFactory().create(); } }
/** * Creates and returns the test cache. */ protected GemFireCacheImpl createCache() { Properties props = new Properties(); props.setProperty("locators", ""); props.setProperty("mcast-port", "0"); props.setProperty("off-heap-memory-size", getOffHeapMemorySize()); GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).create(); return result; }
protected void setUp() throws Exception { super.setUp(); cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); DiskStoreImpl.SET_IGNORE_PREALLOCATE = true; }
protected void setUp() throws Exception { super.setUp(); cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); }
public Object call() throws Exception { Properties props = new Properties(); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); props.setProperty(DistributionConfig.LOCATORS_NAME, ""); getSystem(props); CacheFactory cf = new CacheFactory(); cf.setPdxPersistent(true); getCache(cf); return null; } };
protected Cache createCache() { cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); return cache; }
@Override public void setUp() throws Exception { final InternalDistributedSystem sys = InternalDistributedSystem .getConnectedInstance(); if (sys != null && sys.isConnected()) { sys.disconnect(); } final Properties props = new Properties(); props.setProperty("mcast-port", "0"); // loner this.cache = new CacheFactory(props).create(); }
protected Cache createCache() { // useful for debugging: // props.put(DistributionConfig.LOG_FILE_NAME, "diskRegionTestingBase_system.log"); // props.put(DistributionConfig.LOG_LEVEL_NAME, getGemFireLogLevel()); cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); logWriter = cache.getLogger(); return cache; }
public static void startCache() { try { if (cache.isClosed()) { cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); qs = cache.getQueryService(); } } catch (Exception e) { e.printStackTrace(); } }
protected GemFireCacheImpl createCache() { return (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0").set("log-level", "info") .create(); } }
@Override protected Cache createCache() { CacheFactory cf = new CacheFactory().set("mcast-port", "0") .set("log-level", "info") .set("enable-time-statistics", "true") // .set("statistic-archive-file", "statArchive.gfs") ; cache = cf.create(); return cache; } }
public void run2() throws CacheException { if (CachedDeserializableFactory.preferObject()) { getCache(new CacheFactory().setPdxReadSerialized(true)); } configAndStartBridgeServer(); Region region = getRootRegion().getSubregion(regionName); System.out.println("##### Region size is: " + region.size()); assertEquals(0, TestObject.numInstance); } });
@Override public void run() { Cache cache = getCache(new CacheFactory()); Region<Integer, Object> region = cache.<Integer, Object>createRegionFactory(RegionShortcut.PARTITION).create("test"); if (region == null) { getLogWriter().error("oops!"); } } };
private void setupSerializer(ReflectionBasedAutoSerializer s, boolean readSerialized) { this.serializer = s; this.manager = AutoSerializableManager.getInstance(s); this.c = (GemFireCacheImpl) new CacheFactory(). set("mcast-port", "0"). setPdxReadSerialized(readSerialized). setPdxSerializer(s). create(); } /*
public void test_GatewaySenderWithGatewaySenderEventListener2() { cache = new CacheFactory().create(); GatewaySenderFactory fact = cache.createGatewaySenderFactory(); AsyncEventListener listener = new MyGatewaySenderEventListener(); ((GatewaySenderFactoryImpl)fact).addAsyncEventListener(listener); try { ((GatewaySenderFactoryImpl)fact).create("ln"); } catch (Exception e) { fail("Received Exception :" + e); } }
public void run2() throws CacheException { if (CachedDeserializableFactory.preferObject()) { getCache(new CacheFactory().setPdxReadSerialized(true)); } configAndStartBridgeServer(); Region region = getRootRegion().getSubregion(regionName); } });
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()) .setPdxPersistent(true); Cache cache = getCache(cf); RegionGenerator rgen = new RegionGenerator(); rgen.createRegion(cache, null, RegionType.REPLICATE, "snapshot-ops"); return null; } };
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()); Cache cache = getCache(cf); Region r = cache.createRegionFactory(RegionShortcut.REPLICATE).create("pdxtest"); r.put(1, new MyObjectPdx(1, "test", MyEnumPdx.const1)); return null; } };
public void setUp() throws Exception { Properties props = getDSProps(); cache = new CacheFactory(props).create(); System.setProperty(HDFSStoreImpl.ALLOW_STANDALONE_HDFS_FILESYSTEM_PROP, "true"); String storeName = getName()+"-store"; HDFSStoreFactory hsf = cache.createHDFSStoreFactory(); hsf.setHomeDir(getName()+"-test"); HDFSEventQueueAttributesFactory f = new HDFSEventQueueAttributesFactory(); f.setBatchTimeInterval(getBatchTimeInterval()); hsf.setHDFSEventQueueAttributes(f.create()); hdfsStore = hsf.create(storeName); }
@Override public void run() { Cache cache = getCache(new CacheFactory().set("log-level", getDUnitLogLevel())); cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("fooStore"); cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("barStore"); getRegionFactory(cache).setDiskStoreName("fooStore").create("fooRegion"); getRegionFactory(cache).setDiskStoreName("barStore").create("barRegion"); }