chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r826797 - /hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java
Date Mon, 19 Oct 2009 20:15:40 GMT
Author: asrabkin
Date: Mon Oct 19 20:15:39 2009
New Revision: 826797

URL: http://svn.apache.org/viewvc?rev=826797&view=rev
Log:
CHUKWA-401. DTA bug.

Modified:
    hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java

Modified: hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java?rev=826797&r1=826796&r2=826797&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java
(original)
+++ hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/datacollection/adaptor/TestDirTailingAdaptor.java
Mon Oct 19 20:15:39 2009
@@ -35,7 +35,7 @@
   ChukwaAgent.AlreadyRunningException, InterruptedException {
     
     Configuration conf = new Configuration();
-    baseDir = new File(System.getProperty("test.build.data", "/tmp"));
+    baseDir = new File(System.getProperty("test.build.data", "/tmp")).getCanonicalFile();
     File checkpointDir = new File(baseDir, "dirtailerTestCheckpoints");
     createEmptyDir(checkpointDir);
     
@@ -50,7 +50,7 @@
     createEmptyDir(emptyDir);
     
     assertEquals(0, agent.adaptorCount());
-    agent.processAddCommand("add DirTailingAdaptor raw " + emptyDir + " filetailer.CharFileTailingAdaptorUTF8
0");
+    agent.processAddCommand("add emptydir= DirTailingAdaptor raw " + emptyDir + " filetailer.CharFileTailingAdaptorUTF8
0");
     assertEquals(1, agent.adaptorCount());
 
     File dirWithFile = new File(baseDir, "dir2");
@@ -60,7 +60,7 @@
     dirWithFile.mkdir();
     File inDir = File.createTempFile("atemp", "file", dirWithFile);
     inDir.deleteOnExit();
-    agent.processAddCommand("add DirTailingAdaptor raw " + dirWithFile + " filetailer.CharFileTailingAdaptorUTF8
0");
+    agent.processAddCommand("add dir2= DirTailingAdaptor raw " + dirWithFile + " filetailer.CharFileTailingAdaptorUTF8
0");
     Thread.sleep(3000);
     assertEquals(3, agent.adaptorCount());
     System.out.println("DirTailingAdaptor looks OK before restart");
@@ -75,8 +75,9 @@
     anOldFile.setLastModified(10);//just after epoch
     agent = new ChukwaAgent(conf); //restart agent.
     
-    Thread.sleep(3 * SCAN_INTERVAL); //wait a bit for the new file to be detected.
-    
+   Thread.sleep(3 * SCAN_INTERVAL); //wait a bit for the new file to be detected.
+   assertTrue(aNewFile.exists());
+   
     //make sure we started tailing the new, not the old, file.
     for(Map.Entry<String, String> adaptors : agent.getAdaptorList().entrySet()) {
       System.out.println(adaptors.getKey() +": " + adaptors.getValue());
@@ -85,6 +86,7 @@
     //should be four adaptors: the DirTailer on emptyDir, the DirTailer on the full dir,
     //and FileTailers for File inDir and file newfile
     assertEquals(4, agent.adaptorCount());
+    agent.shutdown();
     
     nukeDirContents(checkpointDir);//nuke dir
     checkpointDir.delete();



Mime
View raw message