|
@@ -26,8 +26,6 @@ import java.util.concurrent.atomic.*;
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
-import org.hamcrest.CoreMatchers;
|
|
|
-import org.junit.Assert;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
@@ -561,50 +559,6 @@ public class TestMetricsSystemImpl {
|
|
|
ms.shutdown();
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void testInitShutdown() {
|
|
|
- boolean oldMode = DefaultMetricsSystem.inMiniClusterMode();
|
|
|
- try {
|
|
|
- DefaultMetricsSystem.setMiniClusterMode(true);
|
|
|
- runInitShutdownTests();
|
|
|
-
|
|
|
- DefaultMetricsSystem.setMiniClusterMode(false);
|
|
|
- runInitShutdownTests();
|
|
|
- } finally {
|
|
|
- DefaultMetricsSystem.setMiniClusterMode(oldMode);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void runInitShutdownTests() {
|
|
|
- MetricsSystemImpl ms = new MetricsSystemImpl();
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(false));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(0));
|
|
|
-
|
|
|
- ms.init("TestMetricsSystem1");
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(true));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(1));
|
|
|
-
|
|
|
- ms.shutdown();
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(false));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(0));
|
|
|
-
|
|
|
- ms.init("TestMetricsSystem2");
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(true));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(1));
|
|
|
-
|
|
|
- ms.init("TestMetricsSystem3");
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(true));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(2));
|
|
|
-
|
|
|
- ms.shutdown();
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(true));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(1));
|
|
|
-
|
|
|
- ms.shutdown();
|
|
|
- Assert.assertThat(ms.isMonitoring(), CoreMatchers.is(false));
|
|
|
- Assert.assertThat(ms.getRefCount(), CoreMatchers.is(0));
|
|
|
- }
|
|
|
-
|
|
|
@Metrics(context="test")
|
|
|
private static class TestSource {
|
|
|
@Metric("C1 desc") MutableCounterLong c1;
|