This is an automated email from the ASF dual-hosted git repository. hulee pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/helix.git
commit 51abb5353fbd87bf9f7d7171212ca26ce9d3b069 Author: chenboat <[email protected]> AuthorDate: Tue Aug 13 23:20:59 2019 -0700 Add a unit test case.. #382 --- .../monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java | 2 +- .../org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java index e45820e..64e5c69 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java @@ -230,7 +230,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr * Return the interval length for the underlying reservoir used by the MBean metric configured * in the system env variables. If not found, use default value. */ - protected Long getResetIntervalInMs() { + public Long getResetIntervalInMs() { return HelixUtil .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS); } diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java index 9c04913..ca461f5 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java @@ -151,4 +151,13 @@ public class TestZkClientMonitor { .assertEquals((long) _beanServer.getAttribute(idealStateName, "DataPropagationLatencyGuage.Max"), 0); } + + @Test + public void testCustomizedResetInverval() { + // Use a customized reservoir length of 1 mins. + System.setProperty("reservoir.length.ms", "60000"); + ZkClientMonitor monitor = + new ZkClientMonitor("TEST_TAG", "TEST_KEY", "TEST_INSTANCE", false, null); + Assert.assertEquals(monitor.getResetIntervalInMs().longValue(), 60000L); + } }
