SystemPropertyHelper { public static Optional<Integer> getProductIntegerProperty(String name) { Integer propertyValue = Integer.getInteger(GEODE_PREFIX + name); if (propertyValue == null) { propertyValue = Integer.getInteger(GEMFIRE_PREFIX + name); } if (propertyValue != null) { return Optional.of(propertyValue); } else { return Optional.empty(); } }  static Optional<Boolean> getProductBooleanProperty(String name); static Optional<Integer> getProductIntegerProperty(String name); static Optional<String> getProductStringProperty(String name); static String getProperty(String name); static boolean restoreSetOperationTransactionBehavior(); static boolean restoreIdleExpirationBehavior(); static final String GEODE_PREFIX; static final String GEMFIRE_PREFIX; static final String EVICTION_SCAN_ASYNC; static final String EVICTION_SCAN_MAX_THREADS; static final String EVICTION_SCAN_THRESHOLD_PERCENT; static final String EVICTION_SEARCH_MAX_ENTRIES; static final String EARLY_ENTRY_EVENT_SERIALIZATION; static final String DEFAULT_DISK_DIRS_PROPERTY; static final String HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY; static final String THREAD_ID_EXPIRY_TIME_PROPERTY; static final String PERSISTENT_VIEW_RETRY_TIMEOUT_SECONDS; static final String USE_HTTP_SYSTEM_PROPERTY; static final String PACKAGES_TO_SCAN; static final String PARALLEL_DISK_STORE_RECOVERY; }
@Test public void getIntegerPropertyPrefersGeodePrefix() { String testProperty = "testIntegerProperty"; String gemfirePrefixProperty = "gemfire." + testProperty; String geodePrefixProperty = "geode." + testProperty; System.setProperty(geodePrefixProperty, "1"); System.setProperty(gemfirePrefixProperty, "0"); assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).get()).isEqualTo(1); System.clearProperty(geodePrefixProperty); System.clearProperty(gemfirePrefixProperty); }
@Test public void getIntegerPropertyReturnsGemfirePrefixIfGeodeMissing() { String testProperty = "testIntegerProperty"; String gemfirePrefixProperty = "gemfire." + testProperty; System.setProperty(gemfirePrefixProperty, "1"); assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).get()).isEqualTo(1); System.clearProperty(gemfirePrefixProperty); }
@Test public void getIntegerPropertyReturnsEmptyOptionalIfPropertiesMissing() { String testProperty = "notSetProperty"; assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).isPresent()).isFalse(); }