Author: edwardyoon
Date: Thu May 14 07:50:53 2015
New Revision: 1679321

URL: http://svn.apache.org/r1679321
Log:
cleanup unit test's output

Modified:
    
hama/trunk/core/src/test/java/org/apache/hama/bsp/TestKeyValueTextInputFormat.java

Modified: 
hama/trunk/core/src/test/java/org/apache/hama/bsp/TestKeyValueTextInputFormat.java
URL: 
http://svn.apache.org/viewvc/hama/trunk/core/src/test/java/org/apache/hama/bsp/TestKeyValueTextInputFormat.java?rev=1679321&r1=1679320&r2=1679321&view=diff
==============================================================================
--- 
hama/trunk/core/src/test/java/org/apache/hama/bsp/TestKeyValueTextInputFormat.java
 (original)
+++ 
hama/trunk/core/src/test/java/org/apache/hama/bsp/TestKeyValueTextInputFormat.java
 Thu May 14 07:50:53 2015
@@ -123,7 +123,7 @@ public class TestKeyValueTextInputFormat
   }
   
   @Test
-  public void testInput() {
+  public void testInput() throws IOException {
     
     Configuration fsConf = new Configuration();
     String strDataPath = "/tmp/test_keyvalueinputformat";
@@ -131,11 +131,15 @@ public class TestKeyValueTextInputFormat
     Path outPath = new Path("/tmp/test_keyvalueinputformat_out");
     
     int maxValue = 1000;
+    FileSystem fs = null;
     
     try {
       URI uri = new URI(strDataPath);
-      FileSystem fs = FileSystem.get(uri, fsConf);
+      fs = FileSystem.get(uri, fsConf);
       fs.delete(dataPath, true);
+      if (fs.exists(outPath)) {
+        fs.delete(outPath, true);
+      }
       FSDataOutputStream fileOut = fs.create(dataPath, true);
 
       StringBuilder str = new StringBuilder();
@@ -178,6 +182,9 @@ public class TestKeyValueTextInputFormat
 
     } catch (Exception e) {
       e.printStackTrace();
+    } finally {
+      // clean-up output
+      fs.delete(outPath, true);
     }
   }
 }


Reply via email to