Package com.dianping.cat.consumer.matrix.model.entity

Examples of com.dianping.cat.consumer.matrix.model.entity.MatrixReport


        CrossReport crossReport = m_reportService.queryCrossReport(domain, start, end);
        m_reportService.insertWeeklyReport(buildWeeklyReport(domain, start, CrossAnalyzer.ID),
              com.dianping.cat.consumer.cross.model.transform.DefaultNativeBuilder.build(crossReport));

        MatrixReport matrixReport = m_reportService.queryMatrixReport(domain, start, end);
        new MatrixReportFilter().visitMatrixReport(matrixReport);
        m_reportService.insertWeeklyReport(buildWeeklyReport(domain, start, MatrixAnalyzer.ID),
              com.dianping.cat.consumer.matrix.model.transform.DefaultNativeBuilder.build(matrixReport));

        t.setStatus(Transaction.SUCCESS);
View Full Code Here


  @Override
  protected MatrixReport buildModel(ModelRequest request) throws Exception {
    String domain = request.getDomain();
    long date = request.getStartTime();
    MatrixReport report;

    if (isLocalMode()) {
      report = getReportFromLocalDisk(date, domain);
    } else {
      report = getReportFromDatabase(date, domain);
View Full Code Here

public class MatrixReportMergerTest {
  @Test
  public void testMatrixReportMerge() throws Exception {
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_analyzer.xml"), "utf-8");
    String newXml = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_analyzer.xml"), "utf-8");
    MatrixReport reportOld = DefaultSaxParser.parse(oldXml);
    MatrixReport reportNew = DefaultSaxParser.parse(newXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_analyzer_merger.xml"), "utf-8");
    MatrixReportMerger merger = new MatrixReportMerger(new MatrixReport(reportOld.getDomain()));

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

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

public class MatrixModelTest {
  @Test
  public void testModel() throws Exception {
    String source = Files.forIO().readFrom(getClass().getResourceAsStream("matrix.xml"), "utf-8");
    MatrixReport report = DefaultSaxParser.parse(source);
    MatrixReportFilter filter = new MatrixReportFilter();

    filter.setMaxSize(10);
    report.accept(filter);
    String expected1 = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_result.xml"), "utf-8");

    Assert.assertEquals(expected1.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }
View Full Code Here

      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    MatrixReport report = m_analyzer.getReport(m_domain);

    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_analyzer.xml"), "utf-8");
    Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }
View Full Code Here

    super(MatrixAnalyzer.ID);
  }

  @Override
  protected MatrixReport getReport(ModelRequest request, ModelPeriod period, String domain) throws Exception {
    MatrixReport report = super.getReport(request, period, domain);

    if (report == null && period.isLast()) {
      long startTime = request.getStartTime();
      report = getReportFromLocalDisk(startTime, domain);
     
      if (report == null) {
        report = new MatrixReport(domain);
        report.setStartTime(new Date(startTime));
        report.setEndTime(new Date(startTime + TimeHelper.ONE_HOUR - 1));
      }
    }
    return report;
  }
View Full Code Here

  @Override
  protected MatrixReport merge(ModelRequest request, List<ModelResponse<MatrixReport>> responses) {
    if (responses.size() == 0) {
      return null;
    }
    MatrixReportMerger merger = new MatrixReportMerger(new MatrixReport(request.getDomain()));
    for (ModelResponse<MatrixReport> response : responses) {
      MatrixReport model = response.getModel();
      if (model != null) {
        model.accept(merger);
      }
    }

    return merger.getMatrixReport();
  }
View Full Code Here

    ModelRequest request = new ModelRequest(domain, payload.getDate()) //
          .setProperty("ip", ipAddress);

    if (m_service.isEligable(request)) {
      ModelResponse<MatrixReport> response = m_service.invoke(request);
      MatrixReport report = response.getModel();

      if (payload.getPeriod().isLast()) {
        Set<String> domains = m_reportService.queryAllDomainNames(new Date(payload.getDate()),
              new Date(payload.getDate() + TimeHelper.ONE_HOUR), MatrixAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }
      return report;
    } else {
View Full Code Here

    switch (payload.getAction()) {
    case HISTORY_REPORT:
      showSummarizeReport(model, payload);
      break;
    case HOURLY_REPORT:
      MatrixReport report = getHourlyReport(payload);
      model.setReport(report);
      model.setMatrix(new DisplayMatrix(report).setSortBy(payload.getSortBy()));
      break;
    }
    m_jspViewer.view(ctx, model);
View Full Code Here

  private void showSummarizeReport(Model model, Payload payload) {
    String domain = payload.getDomain();

    Date start = payload.getHistoryStartDate();
    Date end = payload.getHistoryEndDate();
    MatrixReport matrixReport = m_reportService.queryMatrixReport(domain, start, end);

    if (matrixReport == null) {
      return;
    }
    matrixReport.setStartTime(start);
    matrixReport.setEndTime(end);
    model.setReport(matrixReport);
    model.setMatrix(new DisplayMatrix(matrixReport).setSortBy(payload.getSortBy()));
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.matrix.model.entity.MatrixReport

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.