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; } };
@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; } };
public Object call() throws Exception { //Make sure the type registry is persistent CacheFactory cf = new CacheFactory(); cf.setPdxPersistent(true); getCache(cf); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); createRootRegion("testSimplePdx", af.create()); return null; } };
public void reset() { CacheFactory cf = new CacheFactory() .set("mcast-port", "0") .set("log-level", "error") .setPdxSerializer(new MyPdxSerializer()) .setPdxPersistent(true); cache = cf.create(); ds = cache.createDiskStoreFactory().setMaxOplogSize(1).create("snapshotTest"); }
public void testNoDiskStore() throws Exception { this.c.close(); this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .setPdxDiskStore("doesNotExist") .create(); HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT); PdxSerializable object = new SimpleClass(1, (byte)5, null); try { DataSerializer.writeObject(object, out); fail("expected PdxInitializationException"); } catch (PdxInitializationException expected) { } }
/** * Configures the cache factory using this cache description. * Instantiates and caches the pdx serializer, if any. */ public void configure(CacheFactory f) { if (this.getPdxDiskStoreDescription() != null) { f.setPdxDiskStore(this.getPdxDiskStoreDescription().getName()); } f.setPdxIgnoreUnreadFields(this.getPdxIgnoreUnreadFields()); f.setPdxPersistent(this.getPdxPersistent()); f.setPdxReadSerialized(this.getPdxReadSerialized()); if (this.getPdxSerializerClass() != null) { f.setPdxSerializer(this.getPdxSerializerInstance()); } }
private Cache startWithGemFireApi(final Properties gemfireProperties ) { final CacheConfig cacheConfig = getCacheConfig(); final CacheFactory cacheFactory = new CacheFactory(gemfireProperties); if (cacheConfig.pdxPersistentUserSet) { cacheFactory.setPdxPersistent(cacheConfig.isPdxPersistent()); } if (cacheConfig.pdxDiskStoreUserSet) { cacheFactory.setPdxDiskStore(cacheConfig.getPdxDiskStore()); } if (cacheConfig.pdxIgnoreUnreadFieldsUserSet) { cacheFactory.setPdxIgnoreUnreadFields(cacheConfig.getPdxIgnoreUnreadFields()); } if (cacheConfig.pdxReadSerializedUserSet) { cacheFactory.setPdxReadSerialized(cacheConfig.isPdxReadSerialized()); } if (cacheConfig.pdxSerializerUserSet) { cacheFactory.setPdxSerializer(cacheConfig.getPdxSerializer()); } return cacheFactory.create(); }
public void testPdxPersistentKeysDefDS() throws Exception { this.c.close(); this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .create(); try { this.c.close(); this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .create(); this.c.createDiskStoreFactory().create("r2DS");
public void testPdxPersistentKeys() throws Exception { this.c.close(); this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create(); this.c.close(); this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create();
public void testPdxDiskStore() throws Exception { { CacheFactory cf = new CacheFactory(); cf.set("mcast-port", "0"); cf.setPdxPersistent(true); cf.setPdxDiskStore("diskstore1"); Cache cache = cf.create(); cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDir}).setMaxOplogSize(1).create("diskstore1"); //define a type. defineAType(); Region pdxRegion = cache.getRegion(PeerTypeRegistration.REGION_NAME); assertEquals("diskstore1", pdxRegion.getAttributes().getDiskStoreName()); cache.close(); } tearDown(); setUp(); { CacheFactory cf = new CacheFactory(); cf.set("mcast-port", "0"); cf.setPdxPersistent(true); Cache cache = cf.create(); //define a type defineAType(); Region pdxRegion = cache.getRegion(PeerTypeRegistration.REGION_NAME); assertEquals(DataPolicy.PERSISTENT_REPLICATE, pdxRegion.getAttributes().getDataPolicy()); cache.close(); } }
public Object call() throws Exception { //Make sure the type registry is persistent CacheFactory cf = new CacheFactory(); cf.setPdxPersistent(true); cf.setPdxDiskStore("store1"); Cache cache = getCache(cf); cache.createDiskStoreFactory() .setMaxOplogSize(1) .setDiskDirs(getDiskDirs()) .create("store1"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store1"); createRootRegion("testSimplePdx", af.create()); return null; } };
CacheFactory c = new CacheFactory(dsProps); if (this.persistingDD) { c.setPdxPersistent(true); c.setPdxDiskStore(GfxdConstants.GFXD_DD_DISKSTORE_NAME);
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()) .setPdxPersistent(true); Cache cache = getCache(cf); DiskStore ds = cache.createDiskStoreFactory() .setMaxOplogSize(1) .setDiskDirs(getDiskDirs()) .create("snapshotTest"); RegionGenerator rgen = new RegionGenerator(); for (final RegionType rt : RegionType.values()) { for (final SerializationType st : SerializationType.values()) { rgen.createRegion(cache, ds.getName(), rt, "test-" + rt.name() + "-" + st.name()); } } return null; } };
CacheFactory c = new CacheFactory(dsProps); if (this.persistingDD) { c.setPdxPersistent(true); c.setPdxDiskStore(GfxdConstants.GFXD_DD_DISKSTORE_NAME);
c.setPdxPersistent(true); c.setPdxDiskStore(GfxdConstants.GFXD_DD_DISKSTORE_NAME);
public Object call() throws Exception { CacheFactory cf = new CacheFactory(); if(persistentPdxRegistry) { cf.setPdxPersistent(true) .setPdxDiskStore("store"); } // Cache cache = getCache(cf); cache.createDiskStoreFactory() .setDiskDirs(getDiskDirs()) .create("store"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store"); createRootRegion("testSimplePdx", af.create()); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); return port; } };
public Object call() throws Exception { CacheFactory cf = new CacheFactory(); if(persistentPdxRegistry) { cf.setPdxPersistent(true) .setPdxDiskStore("store"); } // Cache cache = getCache(cf); cache.createDiskStoreFactory() .setDiskDirs(getDiskDirs()) .create("store"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store"); createRootRegion("testSimplePdx", af.create()); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); return port; } };
public Object call() throws Exception { CacheFactory cf = new CacheFactory(); if(persistentPdxRegistry) { cf.setPdxPersistent(true) .setPdxDiskStore("store"); } // Cache cache = getCache(cf); cache.createDiskStoreFactory() .setDiskDirs(getDiskDirs()) .create("store"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store"); createRootRegion("testSimplePdx", af.create()); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); return port; } };
public void testPdxPersistent() throws Exception { { CacheFactory cf = new CacheFactory(); cf.set("mcast-port", "0"); Cache cache = cf.create(); //define a type defineAType(); Region pdxRegion = cache.getRegion(PeerTypeRegistration.REGION_NAME); assertEquals(DataPolicy.REPLICATE, pdxRegion.getAttributes().getDataPolicy()); } tearDown(); setUp(); { CacheFactory cf = new CacheFactory(); cf.set("mcast-port", "0"); cf.setPdxPersistent(true); Cache cache = cf.create(); //define a type defineAType(); Region pdxRegion = cache.getRegion(PeerTypeRegistration.REGION_NAME); assertEquals(DataPolicy.PERSISTENT_REPLICATE, pdxRegion.getAttributes().getDataPolicy()); cache.close(); } }
cf.setPdxPersistent(false); cf.setPdxIgnoreUnreadFields(false); c = getCache(cf);