use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class SnapshotDUnitTest method loadCache.
public void loadCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@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;
}
};
forEachVm(setup, true);
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class RegionSnapshotJUnitTest method testDSID.
@Test
public void testDSID() throws Exception {
cache.close();
CacheFactory cf = new CacheFactory().set(MCAST_PORT, "0").set(LOG_LEVEL, "error").setPdxSerializer(new MyPdxSerializer()).set(DISTRIBUTED_SYSTEM_ID, "1");
cache = cf.create();
RegionType rt = RegionType.REPLICATE;
SerializationType st = SerializationType.PDX_SERIALIZER;
String name = "test-" + rt.name() + "-" + st.name() + "-dsid";
Region<Integer, MyObject> region = rgen.createRegion(cache, ds.getName(), rt, name);
final Map<Integer, MyObject> expected = createExpected(st);
region.putAll(expected);
region.getSnapshotService().save(f, SnapshotFormat.GEMFIRE);
cache.close();
// change the DSID from 1 -> 100
CacheFactory cf2 = new CacheFactory().set(MCAST_PORT, "0").set(LOG_LEVEL, "error").setPdxSerializer(new MyPdxSerializer()).set(DISTRIBUTED_SYSTEM_ID, "100");
cache = cf2.create();
final Map<Integer, Object> read = new HashMap<Integer, Object>();
SnapshotIterator<Integer, Object> iter = SnapshotReader.read(f);
try {
while (iter.hasNext()) {
Entry<Integer, Object> entry = iter.next();
read.put(entry.getKey(), entry.getValue());
}
assertEquals("Comparison failure for " + rt.name() + "/" + st.name(), expected, read);
} finally {
iter.close();
}
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class OfflineSnapshotJUnitTest method reset.
private 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");
}
Aggregations