/** * Should only be used outside of this class by the internal unit tests */ @Deprecated public static void reset() { reset(null); }
@AfterClass public static void resetStagemonitor() { Stagemonitor.reset(); SharedMetricRegistries.clear(); }
@BeforeClass @AfterClass public static void reset() { Stagemonitor.reset(); }
@AfterClass public static void resetStagemonitor() { Stagemonitor.reset(); SharedMetricRegistries.clear(); }
@AfterClass public static void resetStagemonitor() { GlobalTracerTestHelper.resetGlobalTracer(); Stagemonitor.reset(); }
@AfterClass public static void afterClass() { Stagemonitor.setConfiguration(originalConfiguration); Stagemonitor.reset(); }
@After public void cleanUp() { Stagemonitor.reset(); SharedMetricRegistries.clear(); }
@BeforeClass @AfterClass public static void attachProfiler() { Stagemonitor.reset(); }
@AfterClass public static void clear() { Stagemonitor.reset(); SharedMetricRegistries.clear(); }
@Test public void testDisabledPlugin() throws Exception { when(corePlugin.isStagemonitorActive()).thenReturn(true); when(corePlugin.getDisabledPlugins()).thenReturn(Collections.singletonList("TestExceptionPlugin")); Stagemonitor.reset(new MeasurementSession("StagemonitorTest", "testHost", "testInstance")); assertThat(healthCheckRegistry.runHealthCheck("TestPlugin").isHealthy()).isTrue(); assertThat(healthCheckRegistry.runHealthCheck("TestExceptionPlugin").isHealthy()).isFalse(); assertThat(healthCheckRegistry.runHealthCheck("TestExceptionPlugin").getMessage()).isEqualTo("disabled via configuration"); }
@Before public void before() { when(configuration.getConfig(CorePlugin.class)).thenReturn(corePlugin); when(corePlugin.isStagemonitorActive()).thenReturn(true); Stagemonitor.reset(); Stagemonitor.setConfiguration(configuration); // assertFalse(Stagemonitor.isStarted()); for (String name : healthCheckRegistry.getNames()) { healthCheckRegistry.unregister(name); } }
@Test public void testNotInitialized() throws Exception { when(corePlugin.isStagemonitorActive()).thenReturn(true); final MeasurementSession measurementSession = new MeasurementSession(null, "testHost", "testInstance"); Stagemonitor.reset(measurementSession); assertFalse(Stagemonitor.isStarted()); }
@After public void after() { Stagemonitor.reset(); for (String name : healthCheckRegistry.getNames()) { healthCheckRegistry.unregister(name); } }
@BeforeClass public static void attachProfiler() throws Exception { GlobalTracerTestHelper.resetGlobalTracer(); Stagemonitor.reset(new MeasurementSession("ConnectionMonitoringTransformerTest", "test", "test")); }
@AfterClass public static void cleanUp() { GlobalTracerTestHelper.resetGlobalTracer(); Stagemonitor.reset(); Stagemonitor.getMetric2Registry().removeMatching(MetricFilter.ALL); }
@After public void tearDown() throws Exception { assertThat(tracer.scopeManager().active()).isNull(); Stagemonitor.getMetric2Registry().removeMatching(Metric2Filter.ALL); Stagemonitor.reset(); }
@After public void after() { Stagemonitor.getMetric2Registry().removeMatching(Metric2Filter.ALL); Stagemonitor.reset(); assertThat(tracingPlugin.getTracer().scopeManager().active()).isNull(); } }
@Test public void testStartMonitoringNotActive() throws Exception { when(corePlugin.isStagemonitorActive()).thenReturn(false); final MeasurementSession measurementSession = new MeasurementSession("StagemonitorTest", "testHost", "testInstance"); Stagemonitor.reset(measurementSession); assertTrue(Stagemonitor.isDisabled()); assertFalse(Stagemonitor.isStarted()); assertTrue(Stagemonitor.getMeasurementSession().isInitialized()); assertThat(healthCheckRegistry.getNames()).doesNotContain("TestPlugin", "TestExceptionPlugin"); }
@Test public void testMdc() throws Exception { Stagemonitor.reset(new MeasurementSession("MDCSpanEventListenerTest", "testHost", "testInstance")); when(corePlugin.getMeasurementSession()) .thenReturn(new MeasurementSession("MDCSpanEventListenerTest", "testHost", "testInstance")); mdcSpanInterceptor.onStart(spanWrapper); assertNotNull(MDC.get("spanId")); assertNotNull(MDC.get("traceId")); assertNull(MDC.get("parentId")); mdcSpanInterceptor.onFinish(spanWrapper, null, 0); assertThat(MDC.getCopyOfContextMap()).isEmpty(); }
@Before public void before() throws Exception { Stagemonitor.reset(); SharedMetricRegistries.clear(); ConfigurationRegistry configuration = ConfigurationRegistry.builder() .addOptionProvider(new TracingPlugin()) .build(); config = configuration.getConfig(TracingPlugin.class); }