You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by cu...@apache.org on 2005/07/28 22:50:12 UTC

svn commit: r225880 - /lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java

Author: cutting
Date: Thu Jul 28 13:50:11 2005
New Revision: 225880

URL: http://svn.apache.org/viewcvs?rev=225880&view=rev
Log:
Add -noread and -nowrite options.

Modified:
    lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java

Modified: lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java?rev=225880&r1=225879&r2=225880&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java (original)
+++ lucene/nutch/branches/mapred/src/test/org/apache/nutch/fs/TestNutchFileSystem.java Thu Jul 28 13:50:11 2005
@@ -247,9 +247,11 @@
   public static void main(String[] args) throws Exception {
     int megaBytes = 10;
     int files = 100;
-    boolean check = true;
+    boolean noRead = false;
+    boolean noWrite = false;
+    long seed = new Random().nextLong();
 
-    String usage = "Usage: TestNutchFileSystem -files N -megaBytes M";
+    String usage = "Usage: TestNutchFileSystem -files N -megaBytes M [-noread] [-nowrite]";
     
     if (args.length == 0) {
         System.err.println(usage);
@@ -260,12 +262,26 @@
         files = Integer.parseInt(args[++i]);
       } else if (args[i].equals("-megaBytes")) {
         megaBytes = Integer.parseInt(args[++i]);
+      } else if (args[i].equals("-noread")) {
+        noRead = true;
+      } else if (args[i].equals("-nowrite")) {
+        noWrite = true;
       }
     }
+
+    LOG.info("seed = "+seed);
     LOG.info("files = " + files);
     LOG.info("megaBytes = " + megaBytes);
-    LOG.info("check = " + check);
   
-    testFs(megaBytes * MEGA, files, 0);
+    NutchFileSystem fs = NutchFileSystem.get();
+
+    if (!noWrite) {
+      createControlFile(fs, megaBytes*MEGA, files, seed);
+      writeTest(fs);
+    }
+    if (!noRead) {
+      readTest(fs);
+    }
   }
+
 }