test_class.file: micro-jmx-metrics/src/test/java/com/oath/micro/server/application/metrics/jmx/JmxMetricsAcquirerTest.java
test_class.identifier: JmxMetricsAcquirerTest
test_case.body: @Test
      public void test() {
  
          MetricRegistry metricRegistry = mock(MetricRegistry.class);
  
          JmxMetricsAcquirer acquirer = new JmxMetricsAcquirer(metricRegistry, 1, TimeUnit.SECONDS,
                  "jvm.heap_memory_max,jvm.non_heap_memory_max");
  
          acquirer.init();
  
          verify(metricRegistry, times(0)).register(eq("jvm.heap_memory_max"), any());
          verify(metricRegistry, times(0)).register(eq("jvm.non_heap_memory_max"), any());
  
      }
test_case.class_method_signature: JmxMetricsAcquirerTest.test()
test_case.full_signature: @Test public void test()
test_case.identifier: test
test_case.invocations: mock init register verify times eq any register verify times eq any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test()
focal_class.declarator: logger = LoggerFactory.getLogger(JmxMetricsAcquirer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(JmxMetricsAcquirer.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: server = ManagementFactory.getPlatformMBeanServer()
focal_class.modifier: private final
focal_class.original_string: private final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
focal_class.type: MBeanServer
focal_class.var_name: server
focal_class.declarator: metricDescriptions
focal_class.modifier: private final
focal_class.original_string: private final Map<String, MetricDescription> metricDescriptions;
focal_class.type: Map<String, MetricDescription>
focal_class.var_name: metricDescriptions
focal_class.declarator: period
focal_class.modifier: private final
focal_class.original_string: private final int period;
focal_class.type: int
focal_class.var_name: period
focal_class.declarator: timeUnit
focal_class.modifier: private final
focal_class.original_string: private final TimeUnit timeUnit;
focal_class.type: TimeUnit
focal_class.var_name: timeUnit
focal_class.declarator: metricRegistry
focal_class.modifier: private final
focal_class.original_string: private final MetricRegistry metricRegistry;
focal_class.type: MetricRegistry
focal_class.var_name: metricRegistry
focal_class.file: micro-jmx-metrics/src/main/java/com/oath/micro/server/application/metrics/jmx/JmxMetricsAcquirer.java
focal_class.identifier: JmxMetricsAcquirer
focal_class.class_method_signature: JmxMetricsAcquirer.memoryConverter(String name)
focal_class.full_signature: private Function<Object, Long> memoryConverter(String name)
focal_class.identifier: memoryConverter
focal_class.modifiers: private
focal_class.parameters: (String name)
focal_class.return: Function<Object, Long>
focal_class.signature: Function<Object, Long> memoryConverter(String name)
focal_class.class_method_signature: JmxMetricsAcquirer.threadsConverter()
focal_class.full_signature: private Function<Object, Long> threadsConverter()
focal_class.identifier: threadsConverter
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Function<Object, Long>
focal_class.signature: Function<Object, Long> threadsConverter()
focal_class.class_method_signature: JmxMetricsAcquirer.createMetricDescriptions(String excludedString)
focal_class.full_signature: private Map<String, MetricDescription> createMetricDescriptions(String excludedString)
focal_class.identifier: createMetricDescriptions
focal_class.modifiers: private
focal_class.parameters: (String excludedString)
focal_class.return: Map<String, MetricDescription>
focal_class.signature: Map<String, MetricDescription> createMetricDescriptions(String excludedString)
focal_class.class_method_signature: JmxMetricsAcquirer.JmxMetricsAcquirer(MetricRegistry metricRegistry, @Value("${datadog.report.period:1}") int period,
              @Value("${datadog.report.timeunit:SECONDS}") TimeUnit timeUnit,
              @Value("${jmx.metrics.excluded:}") String excluded)
focal_class.full_signature: @Autowired public  JmxMetricsAcquirer(MetricRegistry metricRegistry, @Value("${datadog.report.period:1}") int period,
              @Value("${datadog.report.timeunit:SECONDS}") TimeUnit timeUnit,
              @Value("${jmx.metrics.excluded:}") String excluded)
focal_class.identifier: JmxMetricsAcquirer
focal_class.modifiers: @Autowired public
focal_class.parameters: (MetricRegistry metricRegistry, @Value("${datadog.report.period:1}") int period,
              @Value("${datadog.report.timeunit:SECONDS}") TimeUnit timeUnit,
              @Value("${jmx.metrics.excluded:}") String excluded)
focal_class.signature:  JmxMetricsAcquirer(MetricRegistry metricRegistry, @Value("${datadog.report.period:1}") int period,
              @Value("${datadog.report.timeunit:SECONDS}") TimeUnit timeUnit,
              @Value("${jmx.metrics.excluded:}") String excluded)
focal_class.class_method_signature: JmxMetricsAcquirer.init()
focal_class.full_signature: @PostConstruct public void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_method.body: @PostConstruct
      public void init() {
          for (Map.Entry<String, MetricDescription> metric : metricDescriptions.entrySet()) {
  
              Metric m = new Gauge<Long>() {
  
                  @Override
                  public Long getValue() {
                      MetricDescription desc = metric.getValue();
                      Object o;
                      try {
                          o = server.getAttribute(desc.getObjectName(), desc.getName());
                          return metric.getValue().getConverter().apply(o);
                      } catch (AttributeNotFoundException | InstanceNotFoundException | MBeanException
                              | ReflectionException e) {
                          return null;
                      }
  
                  }
              };
  
              metricRegistry.register(MetricRegistry.name(JmxMetricsAcquirer.class, metric.getKey(), metric.getKey()), m);
          }
      }
focal_method.class_method_signature: JmxMetricsAcquirer.init()
focal_method.full_signature: @PostConstruct public void init()
focal_method.identifier: init
focal_method.invocations: entrySet getValue getAttribute getObjectName getName apply getConverter getValue register name getKey getKey
focal_method.modifiers: @PostConstruct public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void init()