ChukwaAgent agent = new ChukwaAgent(conf);
String adaptorID = agent.processAddCommand("add lr = filetailer.RCheckFTAdaptor test " + tmpOutput.getAbsolutePath() + " 0");
assertNotNull(adaptorID);
Chunk c = chunks.waitForAChunk(2000);
assertNotNull(c);
assertTrue(c.getData().length == 6);
assertTrue("First\n".equals(new String(c.getData())));
c = chunks.waitForAChunk(2000);
assertNotNull(c);
assertTrue(c.getData().length == 7);
assertTrue("Second\n".equals(new String(c.getData())));
pw = new PrintWriter(new FileOutputStream(tmpOutput, true));
pw.println("Third");
pw.close();
c = chunks.waitForAChunk(2000);
assertNotNull(c);
assertTrue(c.getData().length == 6);
assertTrue("Third\n".equals(new String(c.getData())));
Thread.sleep(1500);
tmpOutput.renameTo(new File(baseDir, "rotateTest.2"));
pw = new PrintWriter(new FileOutputStream(tmpOutput, true));
pw.println("Fourth");
pw.close();
c = chunks.waitForAChunk(2000);
assertNotNull(c);
System.out.println("got " + new String(c.getData()));
assertTrue("Fourth\n".equals(new String(c.getData())));
Thread.sleep(1500);
tmpOutput.renameTo(new File(baseDir, "rotateTest.3"));
Thread.sleep(400);
pw = new PrintWriter(new FileOutputStream(tmpOutput, true));
pw.println("Fifth");
pw.close();
c = chunks.waitForAChunk(2000);
assertNotNull(c);
System.out.println("got " + new String(c.getData()));
assertTrue("Fifth\n".equals(new String(c.getData())));
agent.shutdown();
Thread.sleep(2000);
}