Search in sources :

Example 86 with DiskStoreFactory

use of org.apache.geode.cache.DiskStoreFactory in project geode by apache.

the class DiskStoreFactoryJUnitTest method testNonDefaults.

@Test
public void testNonDefaults() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    String name = "testNonDefaults";
    DiskStore ds = dsf.setAutoCompact(!DiskStoreFactory.DEFAULT_AUTO_COMPACT).setCompactionThreshold(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD / 2).setAllowForceCompaction(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION).setMaxOplogSize(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE + 1).setTimeInterval(DiskStoreFactory.DEFAULT_TIME_INTERVAL + 1).setWriteBufferSize(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE + 1).setQueueSize(DiskStoreFactory.DEFAULT_QUEUE_SIZE + 1).create(name);
    assertEquals(!DiskStoreFactory.DEFAULT_AUTO_COMPACT, ds.getAutoCompact());
    assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD / 2, ds.getCompactionThreshold());
    assertEquals(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION, ds.getAllowForceCompaction());
    assertEquals(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE + 1, ds.getMaxOplogSize());
    assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL + 1, ds.getTimeInterval());
    assertEquals(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE + 1, ds.getWriteBufferSize());
    assertEquals(DiskStoreFactory.DEFAULT_QUEUE_SIZE + 1, ds.getQueueSize());
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 87 with DiskStoreFactory

use of org.apache.geode.cache.DiskStoreFactory in project geode by apache.

the class DiskStoreFactoryJUnitTest method testForceCompaction.

@Test
public void testForceCompaction() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    dsf.setAllowForceCompaction(true);
    String name = "testForceCompaction";
    DiskStore ds = dsf.create(name);
    assertEquals(false, ds.forceCompaction());
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 88 with DiskStoreFactory

use of org.apache.geode.cache.DiskStoreFactory in project geode by apache.

the class DiskStoreFactoryJUnitTest method testDestroyWithOverflowRegion.

@Test
public void testDestroyWithOverflowRegion() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    String name = "testDestroy";
    DiskStore ds = dsf.create(name);
    Region region = cache.createRegionFactory(RegionShortcut.LOCAL_OVERFLOW).setDiskStoreName("testDestroy").create("region");
    try {
        ds.destroy();
        fail("Should have thrown an exception");
    } catch (IllegalStateException expected) {
        System.err.println("Got expected :" + expected.getMessage());
    }
    region.close();
    // The destroy should now work.
    ds.destroy();
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) Region(org.apache.geode.cache.Region) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 89 with DiskStoreFactory

use of org.apache.geode.cache.DiskStoreFactory in project geode by apache.

the class OffHeapLRURecoveryRegressionTest method createDiskStore.

private void createDiskStore(GemFireCacheImpl gfc) {
    DiskStoreFactory dsf = gfc.createDiskStoreFactory();
    dsf.create(DS_NAME);
}
Also used : DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory)

Example 90 with DiskStoreFactory

use of org.apache.geode.cache.DiskStoreFactory in project geode by apache.

the class QueryMonitorDUnitTest method createRegion.

private void createRegion(final boolean eviction, final String dirName) {
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    factory.setDataPolicy(DataPolicy.REPLICATE);
    // setting the eviction attributes.
    if (eviction) {
        File[] f = new File[1];
        f[0] = new File(dirName);
        f[0].mkdir();
        DiskStoreFactory dsf = GemFireCacheImpl.getInstance().createDiskStoreFactory();
        DiskStore ds1 = dsf.setDiskDirs(f).create("ds1");
        factory.setDiskStoreName("ds1");
        EvictionAttributes evictAttrs = EvictionAttributes.createLRUEntryAttributes(100, EvictionAction.OVERFLOW_TO_DISK);
        factory.setEvictionAttributes(evictAttrs);
    }
    // Create region
    createRegion(exampleRegionName, factory.create());
    createRegion(exampleRegionName2, factory.create());
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) EvictionAttributes(org.apache.geode.cache.EvictionAttributes) AttributesFactory(org.apache.geode.cache.AttributesFactory) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) File(java.io.File) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory)

Aggregations

DiskStoreFactory (org.apache.geode.cache.DiskStoreFactory)132 File (java.io.File)95 DiskStore (org.apache.geode.cache.DiskStore)91 Test (org.junit.Test)86 AttributesFactory (org.apache.geode.cache.AttributesFactory)56 Region (org.apache.geode.cache.Region)46 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)46 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)35 Cache (org.apache.geode.cache.Cache)32 LocalRegion (org.apache.geode.internal.cache.LocalRegion)24 RegionFactory (org.apache.geode.cache.RegionFactory)22 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)21 DiskRegion (org.apache.geode.internal.cache.DiskRegion)19 Properties (java.util.Properties)18 VM (org.apache.geode.test.dunit.VM)18 LRUStatistics (org.apache.geode.internal.cache.lru.LRUStatistics)16 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)12 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)11 IOException (java.io.IOException)10 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)10