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

Examples of com.dianping.cat.consumer.transaction.model.entity.TransactionReport


  @Override
  protected TransactionReport merge(ModelRequest request, List<ModelResponse<TransactionReport>> responses) {
    if (responses.size() == 0) {
      return null;
    }
    TransactionReportMerger merger = new TransactionReportMerger(new TransactionReport(request.getDomain()));

    for (ModelResponse<TransactionReport> response : responses) {
      if (response != null) {
        TransactionReport model = response.getModel();
        if (model != null) {
          model.accept(merger);
        }
      }
    }
    return merger.getTransactionReport();
  }
View Full Code Here


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

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

      if (payload.getPeriod().isLast()) {
        Date start = new Date(payload.getDate());
        Date end = new Date(payload.getDate() + TimeHelper.ONE_HOUR);

        if (Constants.ALL.equals(domain)) {
          report = m_reportService.queryTransactionReport(domain, start, end);
        }
        Set<String> domains = m_reportService.queryAllDomainNames(start, end, TransactionAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

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

      request.setProperty("name", "*");
      request.setProperty("all", "true");
      name = Constants.ALL;
    }
    ModelResponse<TransactionReport> response = m_service.invoke(request);
    TransactionReport report = response.getModel();
    return report;
  }
View Full Code Here

    }
    model.setGroupIps(m_configManager.queryIpByDomainAndGroup(domain, group));
    model.setGroups(m_configManager.queryDomainGroup(payload.getDomain()));
    switch (action) {
    case HOURLY_REPORT:
      TransactionReport report = getHourlyReport(payload);

      report = m_mergeManager.mergerAllIp(report, ipAddress);
      calculateTps(payload, report);
      if (report != null) {
        model.setReport(report);
View Full Code Here

public class TransactionReportFilterTest {
  @Test
  public void test() throws Exception {
    String source = Files.forIO().readFrom(getClass().getResourceAsStream("transaction_filter.xml"), "utf-8");
    TransactionReport report = DefaultSaxParser.parse(source);
    TransactionReportFilter f1 = new TransactionReportFilter(null, null, "10.1.77.193");
    String expected1 = Files.forIO().readFrom(getClass().getResourceAsStream("transaction_filter_type.xml"), "utf-8");
    Assert.assertEquals(expected1.replaceAll("\r", ""), f1.buildXml(report).replaceAll("\r", ""));
   
    TransactionReportFilter f2 = new TransactionReportFilter("URL", null, null);
View Full Code Here

    }
  }

  @Test
  public void testForMergerDaily() throws Exception {
    TransactionReport report = m_meger.mergeForDaily(m_reportDomain, reports, m_domains);
    String expeted = Files.forIO().readFrom(getClass().getResourceAsStream("TransactionMergerDaily.xml"), "utf-8");

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

    Assert.assertEquals(expeted.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }

  private TransactionReport creatReport() {
    TransactionReport result = new TransactionReport();
    try {
      String xml = Files.forIO().readFrom(getClass().getResourceAsStream("BaseTransactionReport.xml"), "utf-8");

      return DefaultSaxParser.parse(xml);
    } catch (Exception e) {
View Full Code Here

  @Test
  public void testSplitReportToGraphs() throws Exception {
    TransactionGraphCreator creator = new TransactionGraphCreator();
    String xml = Files.forIO().readFrom(getClass().getResourceAsStream("BaseTransactionReportForGraph.xml"), "utf-8");
    TransactionReport report = DefaultSaxParser.parse(xml);
    List<Graph> graphs = creator.splitReportToGraphs(report.getStartTime(), report.getDomain(), "transaction", report);
    Map<String, Range> realResult = new HashMap<String, Range>();
    Map<String, Range> excepectedResult = buildExcepetedResult();
    buildRealResult(graphs, realResult);

    Assert.assertEquals(excepectedResult.size(),realResult.size());
View Full Code Here

public class HistoryTransactionMergerTest {

  @Test
  public void testMerge() throws Exception {
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("HistoryTransaction.xml"), "utf-8");
    TransactionReport report1 = DefaultSaxParser.parse(oldXml);
    TransactionReport report2 = DefaultSaxParser.parse(oldXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("HistoryTransactionMergeResult.xml"),
          "utf-8");
    TransactionReportMerger merger = new HistoryTransactionReportMerger(new TransactionReport(report1.getDomain()));

    report1.accept(merger);
    report2.accept(merger);

    String actual = new DefaultXmlBuilder().buildXml(merger.getTransactionReport());

    Assert.assertEquals("Check the merge result!", expected.replace("\r", ""), actual.replace("\r", ""));
View Full Code Here

  @Test
  public void test() throws Exception {
    String oldXml = Files.forIO()
          .readFrom(getClass().getResourceAsStream("TransactionReportDailyGraph.xml"), "utf-8");
    TransactionReport report1 = DefaultSaxParser.parse(oldXml);

    DailyTransactionGraphCreator creator = new DailyTransactionGraphCreator();

    List<DailyGraph> graphs = creator.buildDailygraph(report1);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.transaction.model.entity.TransactionReport

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.