use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DiskStoreFactoryJUnitTest method testMaxOplogSize.
@Test
public void testMaxOplogSize() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
String name = "testMaxOplogSize";
DiskStore ds = dsf.setMaxOplogSize(0).create(name);
assertEquals(0, ds.getMaxOplogSize());
name = "testMaxOplogSize2";
long max = Long.MAX_VALUE / (1024 * 1024);
ds = dsf.setMaxOplogSize(max).create(name);
assertEquals(max, ds.getMaxOplogSize());
// check illegal stuff
try {
dsf.setMaxOplogSize(-1);
fail("expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
try {
dsf.setMaxOplogSize(max + 1);
fail("expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DiskStoreFactoryJUnitTest method testQueueSize.
@Test
public void testQueueSize() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
String name = "testQueueSize";
DiskStore ds = dsf.setQueueSize(0).create(name);
assertEquals(0, ds.getQueueSize());
name = "testQueueSize2";
ds = dsf.setQueueSize(Integer.MAX_VALUE).create(name);
assertEquals(Integer.MAX_VALUE, ds.getQueueSize());
// check illegal stuff
try {
dsf.setQueueSize(-1);
fail("expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DiskStoreFactoryJUnitTest method testMissingCrfFile.
@Test
public void testMissingCrfFile() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
String name = "testMissingCrfFile";
DiskStore diskStore = dsf.create(name);
File crfFile = new File(diskStore.getDiskDirs()[0], "BACKUP" + name + "_1.crf");
AttributesFactory af = new AttributesFactory();
af.setDiskStoreName(name);
af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
Region r = cache.createRegion("r", af.create());
r.put("key", "value");
assertTrue(crfFile.exists());
cache.close();
assertTrue(crfFile.exists());
assertTrue(crfFile.delete());
assertFalse(crfFile.exists());
cache = createCache();
dsf = cache.createDiskStoreFactory();
assertEquals(null, ((GemFireCacheImpl) cache).findDiskStore(name));
try {
dsf.create(name);
fail("expected IllegalStateException");
} catch (IllegalStateException expected) {
}
// if test passed clean up files
removeFiles(diskStore);
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DiskStoreFactoryJUnitTest method testFlush.
@Test
public void testFlush() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
String name = "testFlush";
DiskStore ds = dsf.create(name);
ds.flush();
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DiskStoreFactoryJUnitTest method testDestroyWithClosedRegion.
@Test
public void testDestroyWithClosedRegion() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
String name = "testDestroy";
DiskStore ds = dsf.create(name);
Region region = cache.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setDiskStoreName("testDestroy").create("region");
region.close();
// This should now work
ds.destroy();
}
Aggregations