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(); }
this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create(); try { this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0") .setPdxPersistent(true) .setPdxDiskStore("pdxDS") .create(); dsf = this.c.createDiskStoreFactory();
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; } };
if (this.persistingDD) { c.setPdxPersistent(true); c.setPdxDiskStore(GfxdConstants.GFXD_DD_DISKSTORE_NAME);
if (this.persistingDD) { 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; } };
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 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(); } }
cf.setPdxDiskStore("new disk store"); c = getCache(cf); assertTrue(c instanceof GemFireCacheImpl);