use of org.apache.geode.cache.DiskWriteAttributesFactory in project geode by apache.
the class DiskWriteAttributesJUnitTest method testGetDefaultNonRollingSync.
/**
* Test method for 'org.apache.geode.cache.DiskWriteAttributes.getDefaultNonRollingSync()'
*/
@Test
public void testGetDefaultNonRollingSync() {
DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
dwaf.setRollOplogs(false);
dwaf.setSynchronous(true);
DiskWriteAttributes dwa = dwaf.create();
assertTrue(dwa.isSynchronous());
assertTrue(!dwa.isRollOplogs());
}
use of org.apache.geode.cache.DiskWriteAttributesFactory in project geode by apache.
the class DiskOldAPIsJUnitTest method testDWA_2.
@Test
public void testDWA_2() throws Exception {
DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
dwaf.setMaxOplogSize(2);
dwaf.setTimeInterval(1);
dwaf.setBytesThreshold(0);
AttributesFactory af = new AttributesFactory();
af.setDiskWriteAttributes(dwaf.create());
af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
Region r = cache.createRegion("r", af.create());
{
LocalRegion lr = (LocalRegion) r;
DiskStoreImpl ds = lr.getDiskStore();
assertEquals(2, ds.getMaxOplogSize());
assertEquals(1, ds.getTimeInterval());
assertEquals(0, ds.getQueueSize());
}
r.localDestroyRegion();
// now try it with a pr
af.setDiskWriteAttributes(dwaf.create());
af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
r = cache.createRegion("r", af.create());
{
LocalRegion lr = (LocalRegion) r;
DiskStoreImpl ds = lr.getDiskStore();
assertEquals(2, ds.getMaxOplogSize());
assertEquals(1, ds.getTimeInterval());
assertEquals(0, ds.getQueueSize());
}
r.put("key", "value");
{
PartitionedRegion pr = (PartitionedRegion) r;
PartitionedRegionDataStore prds = pr.getDataStore();
Set<BucketRegion> s = prds.getAllLocalBucketRegions();
assertTrue(s.size() > 0);
for (BucketRegion br : s) {
LocalRegion lr = (LocalRegion) br;
DiskStoreImpl ds = lr.getDiskStore();
assertEquals(2, ds.getMaxOplogSize());
assertEquals(1, ds.getTimeInterval());
assertEquals(0, ds.getQueueSize());
}
}
r.localDestroyRegion();
}
Aggregations