Package com.dianping.cat.report.task.problem

Examples of com.dianping.cat.report.task.problem.HistoryProblemReportMerger


    String newXml = Files.forIO().readFrom(getClass().getResourceAsStream("ProblemReportNew.xml"), "utf-8");
    ProblemReport reportOld = DefaultSaxParser.parse(oldXml);
    ProblemReport reportNew = DefaultSaxParser.parse(newXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("ProblemReportMergeAllResult.xml"),
          "utf-8");
    ProblemReportMerger merger = new HistoryProblemReportMerger(new ProblemReport(reportOld.getDomain()));

    reportOld.accept(merger);
    reportNew.accept(merger);

    Assert.assertEquals("Check the merge result!", expected.replaceAll("\r", ""), merger.getProblemReport().toString()
          .replace("\r", ""));
    Assert.assertEquals("Source report is changed!", newXml.replaceAll("\r", ""), reportNew.toString().replaceAll("\r", ""));
  }
View Full Code Here


  @Test
  public void testProblemReportMergerSize() throws Exception {
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("ProblemMobile.xml"), "utf-8");
    ProblemReport reportOld = DefaultSaxParser.parse(oldXml);
    ProblemReportMerger merger = new HistoryProblemReportMerger(new ProblemReport(reportOld.getDomain()));

    for (int i = 0; i < 24; i++) {
      reportOld.accept(merger);
    }
    ProblemReport problemReport = merger.getProblemReport();
    for (Machine machine : problemReport.getMachines().values()) {
      List<Entry> entries = machine.getEntries();
      for (Entry entry : entries) {
        int size = entry.getThreads().size();
        Assert.assertEquals(0, size);
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.task.problem.HistoryProblemReportMerger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.