diff --git a/src/main/java/org/springframework/data/gemfire/DiskStoreFactoryBean.java b/src/main/java/org/springframework/data/gemfire/DiskStoreFactoryBean.java index 6fd0b6b2..112c4889 100644 --- a/src/main/java/org/springframework/data/gemfire/DiskStoreFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/DiskStoreFactoryBean.java @@ -55,6 +55,9 @@ public class DiskStoreFactoryBean implements BeanNameAware , FactoryBean diskDirs; private String name; @@ -90,6 +93,12 @@ public class DiskStoreFactoryBean implements BeanNameAware , FactoryBean + ]]> + + + + + + + + + + diff --git a/src/test/java/org/springframework/data/gemfire/DiskStoreFactoryBeanTest.java b/src/test/java/org/springframework/data/gemfire/DiskStoreFactoryBeanTest.java index 2213617c..5187daca 100644 --- a/src/test/java/org/springframework/data/gemfire/DiskStoreFactoryBeanTest.java +++ b/src/test/java/org/springframework/data/gemfire/DiskStoreFactoryBeanTest.java @@ -25,7 +25,6 @@ import org.junit.Test; * The DiskStoreFactoryBeanTest class is a test suite of test cases testing the contract and functionality of the * DiskStoreFactoryBean class. * - * * @author John Blum * @see org.junit.Test * @see org.springframework.data.gemfire.DiskStoreFactoryBean diff --git a/src/test/java/org/springframework/data/gemfire/config/DiskStoreNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/DiskStoreNamespaceTest.java new file mode 100644 index 00000000..b6dcc824 --- /dev/null +++ b/src/test/java/org/springframework/data/gemfire/config/DiskStoreNamespaceTest.java @@ -0,0 +1,81 @@ +/* + * Copyright 2010-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.data.gemfire.config; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; +import java.util.Properties; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.gemstone.gemfire.cache.DiskStore; + +/** + * The DiskStoreNamespaceTest class is a test suite of test cases testing the contract and functionality of using + * Spring Data GemFire's XML namespace to configure GemFire Disk Stores. + * + * @author John Blum + * @see org.junit.Test + * @see org.junit.runner.RunWith + * @see org.springframework.test.context.ContextConfiguration + * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner + * @since 2.0.0 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = "diskstore-ns.xml", initializers = GemfireTestApplicationContextInitializer.class) +@SuppressWarnings("unused") +public class DiskStoreNamespaceTest { + + @Autowired + @Qualifier("fullyConfiguredDiskStore") + private DiskStore diskStore; + + @Autowired + @Qualifier("props") + private Properties props; + + @Test + public void testDiskStoreConfiguration() { + assertNotNull("The 'fullyConfiguredDiskStore' was not properly configured and initialized", diskStore); + assertEquals("fullyConfiguredDiskStore", diskStore.getName()); + assertEquals(Boolean.valueOf(props.getProperty("allowForceCompaction")), diskStore.getAllowForceCompaction()); + assertEquals(Boolean.valueOf(props.getProperty("autoCompact")), diskStore.getAutoCompact()); + assertEquals(Long.valueOf(props.getProperty("compactionThreshold")), + Long.valueOf(diskStore.getCompactionThreshold())); + assertEquals(Double.valueOf(props.getProperty("diskUsageCriticalPercentage")), + Double.valueOf(diskStore.getDiskUsageCriticalPercentage())); + assertEquals(Double.valueOf(props.getProperty("diskUsageWarningPercentage")), + Double.valueOf(diskStore.getDiskUsageWarningPercentage())); + assertEquals(Long.valueOf(props.getProperty("maxOplogSize")), Long.valueOf(diskStore.getMaxOplogSize())); + assertEquals(Long.valueOf(props.getProperty("queueSize")), Long.valueOf(diskStore.getQueueSize())); + assertEquals(Long.valueOf(props.getProperty("timeInterval")), Long.valueOf(diskStore.getTimeInterval())); + assertEquals(Long.valueOf(props.getProperty("writeBufferSize")), Long.valueOf(diskStore.getWriteBufferSize())); + assertNotNull(diskStore.getDiskDirs()); + assertEquals(1, diskStore.getDiskDirs().length); + assertEquals(new File(props.getProperty("location")), diskStore.getDiskDirs()[0]); + assertEquals(Long.valueOf(props.getProperty("maxSize")), Long.valueOf(diskStore.getDiskDirSizes()[0])); + } + +} diff --git a/src/test/resources/org/springframework/data/gemfire/config/diskstore-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/diskstore-ns.xml index e84eeeab..be7e093e 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/diskstore-ns.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/diskstore-ns.xml @@ -11,21 +11,45 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd "> - + + DiskStoreNamespaceTest + 0 + warning + + + + true true + 70 + 90 + 75 ./build/tmp - 1 + 1 10 50 9999 + 4096 300 - + + + +