diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoresConfiguration.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoresConfiguration.java index d85930c8..0670e7fe 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoresConfiguration.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoresConfiguration.java @@ -64,7 +64,7 @@ public class DiskStoresConfiguration extends DiskStoreConfiguration { enableDiskStoresAttributes.getNumber("compactionThreshold"), 50); setAttributeIfNotDefault(diskStoreAttributes, "maxOplogSize", - enableDiskStoresAttributes.getNumber("maxOplogSize"), 1024); + enableDiskStoresAttributes.getNumber("maxOplogSize"), 1024L); return diskStoreAttributes; } diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfigurerIntegrationTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfigurerIntegrationTests.java index 2344982c..7dca70f2 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfigurerIntegrationTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfigurerIntegrationTests.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.gemfire.config.annotation; import static org.assertj.core.api.Assertions.assertThat; @@ -35,7 +34,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; /** - * Integration tests for {@link DiskStoreConfigurer}. + * Integration Tests for {@link DiskStoreConfigurer}. * * @author John Blum * @see org.junit.Test diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java index 07089d33..17e9ba0d 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java @@ -13,19 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.gemfire.config.annotation; import static org.assertj.core.api.Assertions.assertThat; import java.util.Optional; -import org.apache.geode.cache.DiskStore; -import org.apache.geode.cache.DiskStoreFactory; - import org.junit.After; import org.junit.Test; +import org.apache.geode.cache.DiskStore; +import org.apache.geode.cache.DiskStoreFactory; + import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -35,7 +34,7 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb import org.springframework.mock.env.MockPropertySource; /** - * Integration tests for {@link EnableDiskStore}. + * Integration Tests for {@link EnableDiskStore}. * * @author John Blum * @see org.junit.Test @@ -167,6 +166,7 @@ public class DiskStorePropertiesIntegrationTests { @Bean DiskStoreConfigurer testDiskStoreConfigurer() { + return (beanName, factoryBean) -> { factoryBean.setCompactionThreshold(75); //factoryBean.setDiskUsageWarningPercentage(95.0f); @@ -180,6 +180,6 @@ public class DiskStorePropertiesIntegrationTests { @EnableDiskStores(diskStores = { @EnableDiskStore(name = "TestDiskStoreOne"), @EnableDiskStore(name = "TestDiskStoreTwo") }) - static class TestDiskStoresConfiguration { - } + static class TestDiskStoresConfiguration { } + } diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java index c4cac042..be16d9c3 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java @@ -14,7 +14,6 @@ * limitations under the License. * */ - package org.springframework.data.gemfire.config.annotation; import static org.assertj.core.api.Assertions.assertThat; @@ -24,18 +23,18 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.apache.geode.cache.DiskStore; - import org.junit.After; import org.junit.Test; import org.mockito.stubbing.Answer; +import org.apache.geode.cache.DiskStore; + import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects; /** - * Unit tests for the {@link EnableDiskStore} and {@link EnableDiskStores} annotations as well as + * Unit Tests for the {@link EnableDiskStore} and {@link EnableDiskStores} annotations as well as * the {@link DiskStoreConfiguration} and {@link DiskStoresConfiguration} classes. * * @author John Blum @@ -60,7 +59,6 @@ public class EnableDiskStoresConfigurationUnitTests { Optional.ofNullable(this.applicationContext).ifPresent(ConfigurableApplicationContext::close); } - /* (non-Javadoc) */ private void assertDiskStore(DiskStore diskStore, String name, boolean allowForceCompaction, boolean autoCompact, int compactionThreshold, float diskUsageCriticalPercentage, float diskUsageWarningPercentage, long maxOplogSize, int queueSize, long timeInterval, int writeBufferSize) { @@ -78,7 +76,6 @@ public class EnableDiskStoresConfigurationUnitTests { assertThat(diskStore.getWriteBufferSize()).isEqualTo(writeBufferSize); } - /* (non-Javadoc) */ private void assertDiskStoreDirectoryLocations(DiskStore diskStore, File... diskDirectories) { assertThat(diskStore).isNotNull(); @@ -95,7 +92,6 @@ public class EnableDiskStoresConfigurationUnitTests { } } - /* (non-Javadoc) */ private void assertDiskStoreDirectorySizes(DiskStore diskStore, int... diskDirectorySizes) { assertThat(diskStore).isNotNull(); @@ -112,14 +108,15 @@ public class EnableDiskStoresConfigurationUnitTests { } } - /* (non-Javadoc) */ private ConfigurableApplicationContext newApplicationContext(Class... annotatedClasses) { + ConfigurableApplicationContext applicationContext = new AnnotationConfigApplicationContext(annotatedClasses); + applicationContext.registerShutdownHook(); + return applicationContext; } - /* (non-Javadoc) */ private File newFile(String location) { return new File(location); } @@ -155,13 +152,12 @@ public class EnableDiskStoresConfigurationUnitTests { return String.format("%s%d", baseName, MOCK_ID.incrementAndGet()); } - /* (non-Javadoc) */ protected static Answer newGetter(AtomicReference returnValue) { return invocation -> returnValue.get(); } - /* (non-Javadoc) */ protected static Answer newSetter(Class parameterType, AtomicReference argument, R returnValue) { + return invocation -> { argument.set(invocation.getArgument(0)); return returnValue; @@ -176,9 +172,7 @@ public class EnableDiskStoresConfigurationUnitTests { @EnableDiskStore.DiskDirectory(location = "/absolute/path/to/gemfire/disk/directory", maxSize = 1024), @EnableDiskStore.DiskDirectory(location = "relative/path/to/gemfire/disk/directory", maxSize = 4096) }) - static class SingleDiskStoreConfiguration { - - } + static class SingleDiskStoreConfiguration { } @PeerCacheApplication @EnableGemFireMockObjects @@ -187,7 +181,6 @@ public class EnableDiskStoresConfigurationUnitTests { @EnableDiskStore(name = "TestDiskStoreTwo", allowForceCompaction = true, compactionThreshold = 85, maxOplogSize = 4096) }) - static class MultipleDiskStoresConfiguration { + static class MultipleDiskStoresConfiguration { } - } }