use of org.apache.geode.internal.cache.snapshot.SnapshotOptionsImpl in project geode by apache.
the class ParallelSnapshotDUnitTest method doExport.
private void doExport(boolean explode) throws Exception {
Region region = getCache().getRegion("test");
for (int i = 0; i < 1000; i++) {
region.put(i, ffff);
}
RegionSnapshotService rss = region.getSnapshotService();
final TestSnapshotFileMapper mapper = new TestSnapshotFileMapper();
mapper.explode = explode;
SnapshotOptionsImpl opt = (SnapshotOptionsImpl) rss.createOptions();
opt.setParallelMode(true);
opt.setMapper(mapper);
final File f = new File("mysnap");
rss.save(f, SnapshotFormat.GEMFIRE, opt);
mapper.explode = false;
SerializableCallable check = new SerializableCallable() {
@Override
public Object call() throws Exception {
getCache().getDistributedSystem().getDistributedMember();
File snap = mapper.mapExportPath(getCache().getDistributedSystem().getDistributedMember(), f);
assertTrue("Could not find snapshot: " + snap, snap.exists());
return null;
}
};
forEachVm(check, true);
}
use of org.apache.geode.internal.cache.snapshot.SnapshotOptionsImpl in project geode by apache.
the class ParallelSnapshotDUnitTest method doImport.
private void doImport(boolean explode) throws ClassNotFoundException, IOException {
Region region = getCache().getRegion("test");
RegionSnapshotService rss = region.getSnapshotService();
final TestSnapshotFileMapper mapper = new TestSnapshotFileMapper();
mapper.explode = explode;
SnapshotOptionsImpl opt = (SnapshotOptionsImpl) rss.createOptions();
opt.setParallelMode(true);
opt.setMapper(mapper);
final File f = new File("mysnap");
for (int i = 0; i < 1000; i++) {
region.put(i, eeee);
}
rss.load(f, SnapshotFormat.GEMFIRE, opt);
for (int i = 0; i < 1000; i++) {
assertTrue(Arrays.equals(ffff, (byte[]) region.get(i)));
}
}
Aggregations