You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2012/01/10 12:35:43 UTC

svn commit: r1229514 - /incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java

Author: edwardyoon
Date: Tue Jan 10 11:35:42 2012
New Revision: 1229514

URL: http://svn.apache.org/viewvc?rev=1229514&view=rev
Log:
Delete temp dirs finally.

Modified:
    incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java

Modified: incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java?rev=1229514&r1=1229513&r2=1229514&view=diff
==============================================================================
--- incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java (original)
+++ incubator/hama/trunk/examples/src/test/java/org/apache/hama/examples/ShortestPathsTest.java Tue Jan 10 11:35:42 2012
@@ -41,18 +41,19 @@ public class ShortestPathsTest extends T
   private Configuration conf;
   private FileSystem fs;
 
-  public void testShortestPaths() throws IOException,
-      InterruptedException, ClassNotFoundException, InstantiationException,
-      IllegalAccessException {
+  public void testShortestPaths() throws IOException, InterruptedException,
+      ClassNotFoundException, InstantiationException, IllegalAccessException {
     conf = new HamaConfiguration();
     fs = FileSystem.get(conf);
 
     generateTestData();
-    ShortestPaths.main(new String[] { "Frankfurt", OUTPUT, INPUT });
+    try {
+      ShortestPaths.main(new String[] { "Frankfurt", OUTPUT, INPUT });
 
-    verifyResult();
-    fs.delete(new Path(INPUT), true);
-    fs.delete(new Path(OUTPUT), true);
+      verifyResult();
+    } finally {
+      deleteTempDirs();
+    }
   }
 
   private void verifyResult() throws IOException {
@@ -168,4 +169,15 @@ public class ShortestPathsTest extends T
     }
     writer.close();
   }
+  
+  private void deleteTempDirs() {
+    try {
+      if (fs.exists(new Path(INPUT)))
+        fs.delete(new Path(INPUT), true);
+      if (fs.exists(new Path(OUTPUT)))
+        fs.delete(new Path(OUTPUT), true);
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
 }