Search in sources :

Example 31 with DiskStoreFactory

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

the class DiskRegionIllegalArguementsJUnitTest method testQueueSize.

@Test
public void testQueueSize() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    try {
        dsf.setQueueSize(-1);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    dsf.setQueueSize(1);
    assertEquals(1, dsf.create("test").getQueueSize(), 1);
}
Also used : DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 32 with DiskStoreFactory

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

the class DiskRegionIllegalArguementsJUnitTest method testDiskUsageCriticalPercentage.

@Test
public void testDiskUsageCriticalPercentage() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    try {
        dsf.setDiskUsageCriticalPercentage(-1);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        dsf.setDiskUsageCriticalPercentage(101);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    dsf.setDiskUsageCriticalPercentage(50);
    assertEquals(50.0f, dsf.create("test").getDiskUsageCriticalPercentage(), 0.01);
}
Also used : DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 33 with DiskStoreFactory

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

the class DiskRegionIllegalArguementsJUnitTest method testDiskDirSize.

@Test
public void testDiskDirSize() {
    File file1 = new File("file1");
    File file2 = new File("file2");
    File file3 = new File("file3");
    File file4 = new File("file4");
    file1.mkdir();
    file2.mkdir();
    file3.mkdir();
    file4.mkdir();
    file1.deleteOnExit();
    file2.deleteOnExit();
    file3.deleteOnExit();
    file4.deleteOnExit();
    File[] dirs = { file1, file2, file3, file4 };
    int[] ints = { 1, 2, 3, -4 };
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    try {
        dsf.setDiskDirsAndSizes(dirs, ints);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException ok) {
    }
    int[] ints1 = { 1, 2, 3 };
    try {
        dsf.setDiskDirsAndSizes(dirs, ints1);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException ok) {
    }
    ints[3] = 4;
    dsf.setDiskDirsAndSizes(dirs, ints);
}
Also used : File(java.io.File) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 34 with DiskStoreFactory

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

the class DiskRegionIllegalArguementsJUnitTest method testCompactionThreshold.

@Test
public void testCompactionThreshold() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    try {
        dsf.setCompactionThreshold(-1);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        dsf.setCompactionThreshold(101);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    dsf.setCompactionThreshold(0);
    dsf.setCompactionThreshold(100);
    assertEquals(100, dsf.create("test").getCompactionThreshold());
}
Also used : DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 35 with DiskStoreFactory

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

the class DiskRegionIllegalArguementsJUnitTest method testDiskUsageWarningPercentage.

@Test
public void testDiskUsageWarningPercentage() {
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    try {
        dsf.setDiskUsageWarningPercentage(-1);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        dsf.setDiskUsageWarningPercentage(101);
        fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    dsf.setDiskUsageWarningPercentage(50);
    assertEquals(50.0f, dsf.create("test").getDiskUsageWarningPercentage(), 0.01);
}
Also used : DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

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