ReportEvent extends EventImpl { public void hierarchicalMerge(String prefix, ReportEvent e) { super.hierarchicalMerge(prefix, e); mergeWithPrefix(prefix + ".", e); } ReportEvent(ReportEvent e);  ReportEvent(String src);  ReportEvent(Map<String, Long> longMetrics,
      Map<String, String> stringMetrics, Map<String, Double> doubleMetrics); void setLongMetric(String name, long value); void setDoubleMetric(String name, double value); void setStringMetric(String name, String value); Long getLongMetric(String name); Double getDoubleMetric(String name); String getStringMetric(String name); Map<String, Double> getAllDoubleMetrics(); Map<String, String> getAllStringMetrics(); Map<String, Long> getAllLongMetrics(); long getNumMetrics(); void toJson(Writer o); void toHtml(Writer o); String toString(); void toText(Writer o); static ReportEvent createLegacyHtmlReport(String name, String data); void merge(ReportEvent e); void hierarchicalMerge(String prefix, ReportEvent e); String toText(); @Deprecated String toJson(); String toHtml(); final static String R_NAME; final static String A_COUNT; }
@Test public void testHierarchicalMerge() throws IOException { ReportEvent e1 = new ReportEvent("test"); e1.setLongMetric("another", 12345); e1.setLongMetric("duplicateLong", 23456); long attrs = e.getNumMetrics(); System.out.println("- before merge, " + attrs + " attributes"); Writer out = new OutputStreamWriter(System.out); e.toJson(out); out.flush(); System.out.println("- after merge, " + attrs + " + 2 metrics"); e.hierarchicalMerge("event1", e1); e.toJson(out); out.flush(); assertEquals(attrs + 2, e.getNumMetrics()); assertEquals(e.getLongMetric("event1.another"), Long.valueOf(12345L)); assertEquals(e.getLongMetric("event1.duplicateLong"), Long.valueOf(54321L)); }