StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implements LogEnabled { @Override protected void process(MessageTree tree) { String domain = tree.getDomain(); if (m_serverFilterConfigManager.validateDomain(domain)) { StateReport report = m_reportManager.getHourlyReport(getStartTime(), Constants.CAT, true); String ip = tree.getIpAddress(); Machine machine = report.findOrCreateMachine(NetworkInterfaceManager.INSTANCE.getLocalHostAddress()); machine.findOrCreateProcessDomain(domain).addIp(ip); Project project = m_projectService.findProject(domain); if (project == null) { m_projectService.insert(domain); } } }  @Override synchronized void doCheckpoint(boolean atEnd); @Override void enableLogging(Logger logger); @Override StateReport getReport(String domain); @Override ReportManager<StateReport> getReportManager(); @Override boolean isEligable(MessageTree tree); static final String ID; }
@Test public void testProcess() throws Exception { StateReport report = m_analyzer.getReport(m_domain); String expected = Files.forIO().readFrom(getClass().getResourceAsStream("state_analyzer.xml"), "utf-8"); Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", "")); }