@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer()); getCache(cf); return null; } };
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(); } /*
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()); Cache cache = getCache(cf); RegionGenerator rgen = new RegionGenerator(); rgen.createRegion(cache, null, RegionType.PARTITION, "test"); return null; } };
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer()); Cache cache = getCache(cf); cache.<Integer, MyObject>createRegionFactory(RegionShortcut.REPLICATE).create("clienttest"); 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; } };
@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 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"); }
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); Region r = getCache().createRegionFactory(RegionShortcut.REPLICATE).create("pdxtest"); return port; } };
.setPdxSerializer(new MyPdxSerializer()) .set("distributed-system-id", "1"); cache = cf.create(); .setPdxSerializer(new MyPdxSerializer()) .set("distributed-system-id", "100"); cache = cf2.create();
/** * 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(); }
@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; } };
@SuppressWarnings("serial") public void loadCache() throws Exception { CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer()); Cache cache = getCache(cf);
cf.setPdxSerializer(null); c = getCache(cf); assertTrue(c instanceof GemFireCacheImpl);