Search in sources :

Example 16 with DiskWriteAttributesFactory

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());
}
Also used : DiskWriteAttributes(org.apache.geode.cache.DiskWriteAttributes) DiskWriteAttributesFactory(org.apache.geode.cache.DiskWriteAttributesFactory) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 17 with DiskWriteAttributesFactory

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();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) DiskWriteAttributesFactory(org.apache.geode.cache.DiskWriteAttributesFactory) Set(java.util.Set) Region(org.apache.geode.cache.Region) DiskWriteAttributesFactory(org.apache.geode.cache.DiskWriteAttributesFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

DiskWriteAttributesFactory (org.apache.geode.cache.DiskWriteAttributesFactory)17 Test (org.junit.Test)14 DiskWriteAttributes (org.apache.geode.cache.DiskWriteAttributes)8 UnitTest (org.apache.geode.test.junit.categories.UnitTest)8 AttributesFactory (org.apache.geode.cache.AttributesFactory)4 Region (org.apache.geode.cache.Region)4 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)4 ClientCacheCreation (org.apache.geode.internal.cache.xmlcache.ClientCacheCreation)4 RegionAttributesCreation (org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation)4 Set (java.util.Set)3 RegionCreation (org.apache.geode.internal.cache.xmlcache.RegionCreation)3 Cache (org.apache.geode.cache.Cache)2 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)2 File (java.io.File)1 Properties (java.util.Properties)1 EvictionAttributes (org.apache.geode.cache.EvictionAttributes)1 ExpirationAttributes (org.apache.geode.cache.ExpirationAttributes)1 FixedPartitionAttributes (org.apache.geode.cache.FixedPartitionAttributes)1 PartitionAttributes (org.apache.geode.cache.PartitionAttributes)1 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)1