Refactor and polish codebase.

Fix compiler warnings.

Declare Properties class fields containing VCAP_APPLICATION properties as final.
This commit is contained in:
John Blum
2021-03-24 00:54:11 -07:00
parent 46ab547c92
commit 5b86f4f098
5 changed files with 16 additions and 7 deletions

View File

@@ -41,7 +41,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.data.gemfire.GemfireTemplate;
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
import org.springframework.data.gemfire.tests.integration.ClientServerIntegrationTestsSupport;
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
import org.springframework.data.gemfire.tests.util.FileUtils;
@@ -57,14 +57,21 @@ import example.app.golf.model.Golfer;
*
* @author John Blum
* @see org.junit.Test
* @see com.fasterxml.jackson.databind.ObjectMapper
* @see org.apache.geode.cache.Region
* @see org.springframework.boot.ApplicationRunner
* @see org.springframework.boot.SpringApplication
* @see org.springframework.boot.autoconfigure.SpringBootApplication
* @see org.springframework.boot.builder.SpringApplicationBuilder
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Profile
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.tests.process.ProcessWrapper
* @see org.springframework.data.gemfire.tests.integration.ClientServerIntegrationTestsSupport
* @see org.springframework.geode.boot.autoconfigure.DataImportExportAutoConfiguration
* @since 1.3.0
*/
public class CacheDataExportAutoConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
public class CacheDataExportAutoConfigurationIntegrationTests extends ClientServerIntegrationTestsSupport {
private static final File GEODE_WORKING_DIRECTORY =
new File(String.format("cache-data-export-%d", System.currentTimeMillis()));

View File

@@ -59,7 +59,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
*/
public class PdxInstanceWrapperRegionAspectUnitTests {
private PdxInstanceWrapperRegionAspect aspect = new PdxInstanceWrapperRegionAspect();
private final PdxInstanceWrapperRegionAspect aspect = new PdxInstanceWrapperRegionAspect();
@Test
public void regionGetAdviceWrapsPdx() throws Throwable {

View File

@@ -67,7 +67,7 @@ public class AutoConfiguredCloudSecurityContextIntegrationTests
private static final String VCAP_APPLICATION_PROPERTIES = "application-vcap.properties";
private static Properties vcapApplicationProperties = new Properties();
private static final Properties vcapApplicationProperties = new Properties();
@BeforeClass
public static void startGemFireServer() throws IOException {

View File

@@ -75,7 +75,7 @@ public class AutoConfiguredHybridSecurityContextIntegrationTests
private static final String VCAP_APPLICATION_PROPERTIES = "application-vcap-hybrid.properties";
private static Properties vcapApplicationProperties = new Properties();
private static final Properties vcapApplicationProperties = new Properties();
@BeforeClass
public static void startGemFireServer() throws IOException {

View File

@@ -24,6 +24,8 @@ import org.junit.Test;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.data.gemfire.client.PoolFactoryBean;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.ReflectionUtils;
/**
@@ -37,10 +39,10 @@ import org.springframework.util.ReflectionUtils;
*/
public class EnableSubscriptionConfigurationUnitTests {
private EnableSubscriptionConfiguration configuration = new EnableSubscriptionConfiguration();
private final EnableSubscriptionConfiguration configuration = new EnableSubscriptionConfiguration();
@SuppressWarnings("unchecked")
private <T> T getFieldValue(Object target, String fieldName) {
private <T> T getFieldValue(@Nullable Object target, @NonNull String fieldName) {
return Optional.ofNullable(target)
.map(Object::getClass)