File baseDir = new File(System.getProperty("test.build.data", "/tmp"));
conf.set("chukwaAgent.checkpoint.dir", baseDir.getCanonicalPath());
conf.setBoolean("chukwaAgent.checkpoint.enabled", false);
conf.set("chukwaAgent.control.port", "0");
ChukwaAgent agent = new ChukwaAgent(conf);
ChunkCatcherConnector chunks = new ChunkCatcherConnector();
chunks.start();
System.setProperty("xtrace.reporter", "edu.berkeley.xtrace.reporting.TcpReporter");
System.setProperty("xtrace.tcpdest", "localhost:7831");
assertEquals(0, agent.adaptorCount());
agent.processAddCommand("add edu.berkeley.chukwa_xtrace.XtrAdaptor XTrace TcpReportSource 0");
assertEquals(1, agent.adaptorCount());
XTraceContext.startTrace("test", "testtrace", "atag");
XTraceContext.logEvent("test", "label");
Chunk c = chunks.waitForAChunk();
String report = new String(c.getData());
assertTrue(report.contains("Agent: test"));
assertTrue(report.contains("Tag: atag"));
System.out.println(report);
System.out.println("-- next chunk --- ");
c = chunks.waitForAChunk();
report = new String(c.getData());
assertTrue(report.contains("Agent: test"));
assertTrue(report.contains("Label: label"));
System.out.println(report);