package de.is24.util.monitoring;

import de.is24.util.monitoring.jmx.JmxAppMon4JNamingStrategy;
import de.is24.util.monitoring.keyhandler.DefaultKeyEscaper;


public class TestHelper {
  public static InApplicationMonitor setInstanceForTesting() {
    resetInstanceForTesting();

    DefaultKeyEscaper keyEscaper = new DefaultKeyEscaper();
    CorePlugin corePlugin = new CorePlugin(new JmxAppMon4JNamingStrategy() {
        @Override
        public String getJmxPrefix() {
          return "lala";
        }
      }, keyEscaper);
    return TestingInApplicationMonitor.initInstanceForTesting(corePlugin, keyEscaper);
  }

  public static void resetInstanceForTesting() {
    TestingInApplicationMonitor.resetInstanceForTesting();
  }

  public static CorePlugin initializeWithJMXNaming() {
    DefaultKeyEscaper keyEscaper = new DefaultKeyEscaper();
    CorePlugin corePlugin = new CorePlugin(new JmxAppMon4JNamingStrategy() {
        @Override
        public String getJmxPrefix() {
          return "lala";
        }
      }, keyEscaper);
    InApplicationMonitor.initInstance(corePlugin, keyEscaper);
    return corePlugin;
  }

}

@@ -178,16 +178,144 @@
 elper %7B%0A
+  /**%0A   * initialize a TestingInApplicationMonitor with JMX Plugin%0A   * @return the TestingInApplicationMonitor instance%0A   */%0A
   public
@@ -736,32 +736,273 @@
 yEscaper);%0A  %7D%0A%0A
+  /**%0A   * initialize a fresh TestingInApplicationMonitor without JMX Plugin as global InApplicationMonitor instance.%0A   * This method is not safe to use during multithreaded tests%0A   * @return the TestingInApplicationMonitor instance%0A   */%0A
   public static 

add comments