*/
protected void initialTasks () {
System.out.println("In initialTasks()");
try {
// Test Chukwa Agent Controller and Agent Communication
ChukwaAgentController cli = new ChukwaAgentController("localhost", agentPort);
String[] source = new File(System.getenv("CHUKWA_DATA_DIR") + File.separator + "log").list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".log");
}
});
System.out.println(System.getenv("CHUKWA_DATA_DIR") + File.separator + "log");
for(String fname : source) {
if (!(fname.equals("JobHistory.log") || fname.equals("ClientTrace.log"))) {
continue;
}
StringBuilder fullPath = new StringBuilder();
fullPath.append(System.getProperty("CHUKWA_DATA_DIR"));
fullPath.append(File.separator);
fullPath.append("log");
fullPath.append(File.separator);
fullPath.append(fname);
String recordType = fname.substring(0,fname.indexOf("."));
String adaptorId = cli.add(
"org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.CharFileTailingAdaptorUTF8NewLineEscaped",
recordType, "0 " + fullPath.toString(), 0);
assertNotNull(adaptorId);
Thread.sleep(2000);
}
cli.removeAll();
Thread.sleep(30000);
} catch (Exception e) {
e.printStackTrace();
fail(e.toString());
}