CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implements LogEnabled { @Override public void process(MessageTree tree) { String domain = tree.getDomain(); CrossReport report = m_reportManager.getHourlyReport(getStartTime(), domain, true); report.addIp(tree.getIpAddress()); List<Transaction> transactions = tree.getTransactions(); for (Transaction t : transactions) { processTransaction(report, tree, (Transaction) t); } }  CrossInfo convertCrossInfo(String client, CrossInfo crossInfo); @Override synchronized void doCheckpoint(boolean atEnd); @Override void enableLogging(Logger logger); @Override CrossReport getReport(String domain); @Override ReportManager<CrossReport> getReportManager(); void setReportManager(ReportManager<CrossReport> reportManager); @Override boolean isEligable(MessageTree tree); CrossInfo parseCrossTransaction(Transaction t, MessageTree tree); @Override void process(MessageTree tree); void setIpConvertManager(IpConvertManager ipConvertManager); void setServerConfigManager(ServerConfigManager serverConfigManager); static final String ID; static final String DEFAULT; }
@Test public void testProcess() throws Exception { for (int i = 1; i <= 100; i++) { MessageTree tree = ((DefaultMessageTree) generateMessageTree(i)).copyForTest(); m_analyzer.process(tree); } CrossReport report = m_analyzer.getReport(m_domain); String expected = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer.xml"), "utf-8"); Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", "")); CrossReport reportCaller = m_analyzer.getReport("server"); String expectedCaller = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer_caller.xml"), "utf-8"); Assert.assertEquals(expectedCaller.replaceAll("\r", ""), reportCaller.toString().replaceAll("\r", "")); }