Browse Source

HADOOP-3100. Develop tests to test the DFS command line interface. Contributed by Mukund Madhugiri

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@673209 13f79535-47bb-0310-9956-ffa450edef68
Mukund Madhugiri 17 years ago
parent
commit
fc4b912405

+ 2 - 0
CHANGES.txt

@@ -367,6 +367,8 @@ Release 0.18.0 - Unreleased
 
     HADOOP-3532. Add jdiff reports to the build scripts. (omalley)
 
+    HADOOP-3100. Develop tests to test the DFS command line interface. (mukund)
+
   OPTIMIZATIONS
 
     HADOOP-3274. The default constructor of BytesWritable creates empty 

+ 5 - 0
build.xml

@@ -586,6 +586,11 @@
     <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.tar.gz" todir="${test.cache.data}"/>
     <copy file="${test.src.dir}/org/apache/hadoop/dfs/hadoop-14-dfs-dir.tgz" todir="${test.cache.data}"/>
     <copy file="${test.src.dir}/org/apache/hadoop/dfs/hadoop-dfs-dir.txt" todir="${test.cache.data}"/>
+    <copy file="${test.src.dir}/org/apache/hadoop/cli/testConf.xml" todir="${test.cache.data}"/>
+    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data15bytes" todir="${test.cache.data}"/>
+    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data30bytes" todir="${test.cache.data}"/>
+    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data60bytes" todir="${test.cache.data}"/>
+    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data120bytes" todir="${test.cache.data}"/>
   </target>
 
   <!-- ================================================================== -->

+ 445 - 0
src/test/org/apache/hadoop/cli/TestCLI.java

@@ -0,0 +1,445 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.cli.util.ComparatorBase;
+import org.apache.hadoop.cli.util.ComparatorData;
+import org.apache.hadoop.cli.util.CLITestData;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.apache.hadoop.cli.util.CommandExecutor;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.dfs.DataNode;
+import org.apache.hadoop.dfs.DistributedFileSystem;
+import org.apache.hadoop.dfs.MiniDFSCluster;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FsShell;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.ToolRunner;
+
+/**
+ * Tests for the Command Line Interface (CLI)
+ */
+public class TestCLI extends TestCase {
+  private static final Log LOG =
+    LogFactory.getLog(TestCLI.class.getName());
+  
+  // In this mode, it runs the command and compares the actual output
+  // with the expected output  
+  public static final String TESTMODE_TEST = "test"; // Run the tests
+  
+  // If it is set to nocompare, run the command and do not compare.
+  // This can be useful populate the testConfig.xml file the first time
+  // a new command is added
+  public static final String TESTMODE_NOCOMPARE = "nocompare";
+  
+  //By default, run the tests. The other mode is to run the commands and not
+  // compare the output
+  public static String testMode = TESTMODE_TEST;
+  
+  // Storage for tests read in from the config file
+  static ArrayList<CLITestData> testsFromConfigFile = null;
+  static ArrayList<ComparatorData> testComparators = null;
+  static String testConfigFile = "testConf.xml";
+  String thisTestCaseName = null;
+  static ComparatorData comparatorData = null;
+  
+  private static Configuration conf = null;
+  private static MiniDFSCluster cluster = null;
+  private static DistributedFileSystem dfs = null;
+  private static String namenode = null;
+  private static String clitestDataDir = null;
+  private static String username = null;
+  
+  /**
+   * Read the test config file - testConfig.xml
+   */
+  private void readTestConfigFile() {
+    
+    if (testsFromConfigFile == null) {
+      boolean success = false;
+      Properties props = System.getProperties();
+      testConfigFile = 
+        props.getProperty("test.cache.data") + File.separator + testConfigFile;
+      try {
+        SAXParser p = (SAXParserFactory.newInstance()).newSAXParser();
+        p.parse(testConfigFile, new TestConfigFileParser());
+        success = true;
+      } catch (Exception e) {
+        LOG.info("File: " + testConfigFile + " not found");
+        success = false;
+      }
+      assertTrue("Error reading test config file", success);
+    }
+  }
+  
+  /*
+   * Setup
+   */
+  public void setUp() {
+    // Read the testConfig.xml file
+    readTestConfigFile();
+    
+    // Start up the mini dfs cluster
+    boolean success = false;
+    try {
+      conf = new Configuration();
+      cluster = new MiniDFSCluster(conf, 1, true, null);
+      namenode = conf.get("fs.default.name", "file:///");
+      clitestDataDir = new File(System.getProperty("test.cache.data")).
+        toURI().toString().replace(' ', '+');
+      username = System.getProperty("user.name");
+      
+      FileSystem fs = cluster.getFileSystem();
+      assertTrue("Not a HDFS: "+fs.getUri(),
+                 fs instanceof DistributedFileSystem);
+      dfs = (DistributedFileSystem) fs;
+      success = true;
+    } catch (Exception e) {
+      LOG.info("Exception starting MiniDFS cluster: " + e);
+    }
+    
+    assertTrue("Error setting up Mini DFS cluster", success);
+  }
+  
+  /**
+   * Tear down
+   */
+  public void tearDown() {
+    boolean success = false;
+    try {
+      dfs.close();
+      cluster.shutdown();
+      success = true;
+      Thread.sleep(2000);
+    } catch (Exception e) {
+      LOG.info("Exception shutting down MiniDFS cluster: " + e);
+    }
+    
+    assertTrue("Error tearing down Mini DFS cluster", success);
+    
+    displayResults();
+  }
+  
+  /**
+   * Expand the commands from the test config xml file
+   * @param cmd
+   * @return String expanded command
+   */
+  private String expandCommand(final String cmd) {
+    String expCmd = cmd;
+    expCmd = expCmd.replaceAll("NAMENODE", namenode);
+    expCmd = expCmd.replaceAll("CLITEST_DATA", clitestDataDir);
+    expCmd = expCmd.replaceAll("USERNAME", username);
+    
+    return expCmd;
+  }
+  
+  /**
+   * Display the summarized results
+   */
+  private void displayResults() {
+    LOG.info("Detailed results:");
+    LOG.info("----------------------------------\n");
+    
+    for (int i = 0; i < testsFromConfigFile.size(); i++) {
+      CLITestData td = testsFromConfigFile.get(i);
+      
+      boolean testResult = td.getTestResult();
+      
+      // Display the details only if there is a failure
+      if (!testResult) {
+        LOG.info("-------------------------------------------");
+        LOG.info("                    Test ID: [" + (i + 1) + "]");
+        LOG.info("           Test Description: [" + td.getTestDesc() + "]");
+        LOG.info("");
+
+        ArrayList<String> testCommands = td.getTestCommands();
+        for (int j = 0; j < testCommands.size(); j++) {
+          LOG.info("              Test Commands: [" + 
+              expandCommand((String) testCommands.get(j)) + "]");
+        }
+
+        LOG.info("");
+        ArrayList<String> cleanupCommands = td.getCleanupCommands();
+        for (int j = 0; j < cleanupCommands.size(); j++) {
+          LOG.info("           Cleanup Commands: [" +
+              expandCommand((String) cleanupCommands.get(j)) + "]");
+        }
+
+        LOG.info("");
+        ArrayList<ComparatorData> compdata = td.getComparatorData();
+        for (int j = 0; j < compdata.size(); j++) {
+          boolean resultBoolean = compdata.get(j).getTestResult();
+          LOG.info("                 Comparator: [" + 
+              compdata.get(j).getComparatorType() + "]");
+          LOG.info("         Comparision result:   [" + 
+              (resultBoolean ? "pass" : "fail") + "]");
+          LOG.info("            Expected output:   [" + 
+              compdata.get(j).getExpectedOutput() + "]");
+          LOG.info("              Actual output:   [" + 
+              compdata.get(j).getActualOutput() + "]");
+        }
+        LOG.info("");
+      }
+    }
+    
+    LOG.info("Summary results:");
+    LOG.info("----------------------------------\n");
+    
+    boolean overallResults = true;
+    int totalPass = 0;
+    int totalFail = 0;
+    int totalComparators = 0;
+    for (int i = 0; i < testsFromConfigFile.size(); i++) {
+      CLITestData td = testsFromConfigFile.get(i);
+      totalComparators += 
+    	  testsFromConfigFile.get(i).getComparatorData().size();
+      boolean resultBoolean = td.getTestResult();
+      if (resultBoolean) {
+        totalPass ++;
+      } else {
+        totalFail ++;
+      }
+      overallResults &= resultBoolean;
+    }
+    
+    
+    LOG.info("               Testing mode: " + testMode);
+    LOG.info("");
+    LOG.info("             Overall result: " + 
+    		(overallResults ? "+++ PASS +++" : "--- FAIL ---"));
+    LOG.info("               # Tests pass: " + totalPass +
+    		" (" + (100 * totalPass / (totalPass + totalFail)) + "%)");
+    LOG.info("               # Tests fail: " + totalFail + 
+    		" (" + (100 * totalFail / (totalPass + totalFail)) + "%)");
+    LOG.info("         # Validations done: " + totalComparators + 
+    		" (each test may do multiple validations)");
+    
+    LOG.info("");
+    LOG.info("Failing tests:");
+    LOG.info("--------------");
+    int i = 0;
+    boolean foundTests = false;
+    for (i = 0; i < testsFromConfigFile.size(); i++) {
+      boolean resultBoolean = testsFromConfigFile.get(i).getTestResult();
+      if (!resultBoolean) {
+        LOG.info((i + 1) + ": " + 
+        		testsFromConfigFile.get(i).getTestDesc());
+        foundTests = true;
+      }
+    }
+    if (!foundTests) {
+    	LOG.info("NONE");
+    }
+    
+    foundTests = false;
+    LOG.info("");
+    LOG.info("Passing tests:");
+    LOG.info("--------------");
+    for (i = 0; i < testsFromConfigFile.size(); i++) {
+      boolean resultBoolean = testsFromConfigFile.get(i).getTestResult();
+      if (resultBoolean) {
+        LOG.info((i + 1) + ": " + 
+        		testsFromConfigFile.get(i).getTestDesc());
+        foundTests = true;
+      }
+    }
+    if (!foundTests) {
+    	LOG.info("NONE");
+    }
+
+    assertTrue("One of the tests failed. " +
+    		"See the Detailed results to identify " +
+    		"the command that failed", overallResults);
+    
+  }
+  
+  /**
+   * Compare the actual output with the expected output
+   * @param compdata
+   * @return
+   */
+  private boolean compareTestOutput(ComparatorData compdata) {
+    // Compare the output based on the comparator
+    String comparatorType = compdata.getComparatorType();
+    Class<?> comparatorClass = null;
+    
+    // If testMode is "test", then run the command and compare the output
+    // If testMode is "nocompare", then run the command and dump the output.
+    // Do not compare
+    
+    boolean compareOutput = false;
+    
+    if (testMode.equals(TESTMODE_TEST)) {
+      try {
+    	// Initialize the comparator class and run its compare method
+        comparatorClass = Class.forName("org.apache.hadoop.cli.util." + 
+          comparatorType);
+        ComparatorBase comp = (ComparatorBase) comparatorClass.newInstance();
+        compareOutput = comp.compare(CommandExecutor.getLastCommandOutput(), 
+          compdata.getExpectedOutput());
+      } catch (Exception e) {
+        LOG.info("Error in instantiating the comparator" + e);
+      }
+    }
+    
+    return compareOutput;
+  }
+  
+  /***********************************
+   ************* TESTS
+   *********************************/
+  
+  public void testAll() {
+    LOG.info("TestAll");
+    
+    // Run the tests defined in the testConf.xml config file.
+    for (int index = 0; index < testsFromConfigFile.size(); index++) {
+      
+      CLITestData testdata = (CLITestData) testsFromConfigFile.get(index);
+   
+      // Execute the test commands
+      ArrayList<String> testCommands = testdata.getTestCommands();
+      for (int i = 0; i < testCommands.size(); i++) {
+        CommandExecutor.executeFSCommand(testCommands.get(i), 
+        		namenode);
+      }
+      
+      boolean overallTCResult = true;
+      // Run comparators
+      ArrayList<ComparatorData> compdata = testdata.getComparatorData();
+      for (int i = 0; i < compdata.size(); i++) {
+        final String comptype = compdata.get(i).getComparatorType();
+        
+        boolean compareOutput = false;
+        
+        if (! comptype.equalsIgnoreCase("none")) {
+          compareOutput = compareTestOutput(compdata.get(i));
+          overallTCResult &= compareOutput;
+        }
+        
+        compdata.get(i).setExitCode(CommandExecutor.getLastExitCode());
+        compdata.get(i).setActualOutput(
+          CommandExecutor.getLastCommandOutput());
+        compdata.get(i).setTestResult(compareOutput);
+      }
+      testdata.setTestResult(overallTCResult);
+      
+      // Execute the cleanup commands
+      ArrayList<String> cleanupCommands = testdata.getCleanupCommands();
+      for (int i = 0; i < cleanupCommands.size(); i++) {
+        CommandExecutor.executeFSCommand(cleanupCommands.get(i), 
+        		namenode);
+      }
+    }
+  }
+  
+  /*
+   * Parser class for the test config xml file
+   */
+  static class TestConfigFileParser extends DefaultHandler {
+    String charString = null;
+    CLITestData td = null;
+    ArrayList<String> testCommands = null;
+    ArrayList<String> cleanupCommands = null;
+    
+    @Override
+    public void startDocument() throws SAXException {
+      testsFromConfigFile = new ArrayList<CLITestData>();
+    }
+    
+    @Override
+    public void startElement(String uri, 
+    		String localName, 
+    		String qName, 
+    		Attributes attributes) throws SAXException {
+      if (qName.equals("test")) {
+        td = new CLITestData();
+      } else if (qName.equals("test-commands")) {
+        testCommands = new ArrayList<String>();
+      } else if (qName.equals("cleanup-commands")) {
+        cleanupCommands = new ArrayList<String>();
+      } else if (qName.equals("comparators")) {
+        testComparators = new ArrayList<ComparatorData>();
+      } else if (qName.equals("comparator")) {
+        comparatorData = new ComparatorData();
+      }
+      charString = "";
+    }
+    
+    @Override
+    public void endElement(String uri, 
+    		String localName, 
+    		String qName) throws SAXException {
+      if (qName.equals("description")) {
+        td.setTestDesc(charString);
+      } else if (qName.equals("test-commands")) {
+        td.setTestCommands(testCommands);
+        testCommands = null;
+      } else if (qName.equals("cleanup-commands")) {
+        td.setCleanupCommands(cleanupCommands);
+        cleanupCommands = null;
+      } else if (qName.equals("command")) {
+        if (testCommands != null) {
+          testCommands.add(charString);
+        } else if (cleanupCommands != null) {
+          cleanupCommands.add(charString);
+        }
+      } else if (qName.equals("comparators")) {
+        td.setComparatorData(testComparators);
+      } else if (qName.equals("comparator")) {
+        testComparators.add(comparatorData);
+      } else if (qName.equals("type")) {
+        comparatorData.setComparatorType(charString);
+      } else if (qName.equals("expected-output")) {
+        comparatorData.setExpectedOutput(charString);
+      } else if (qName.equals("test")) {
+        testsFromConfigFile.add(td);
+        td = null;
+      } else if (qName.equals("mode")) {
+        testMode = charString;
+        if (!testMode.equals(TESTMODE_NOCOMPARE) &&
+            !testMode.equals(TESTMODE_TEST)) {
+          testMode = TESTMODE_TEST;
+        }
+      }
+    }
+    
+    @Override
+    public void characters(char[] ch, 
+    		int start, 
+    		int length) throws SAXException {
+      String s = new String(ch, start, length);
+      charString += s;
+    }
+  }
+}

+ 8 - 0
src/test/org/apache/hadoop/cli/clitest_data/data120bytes

@@ -0,0 +1,8 @@
+12345678901234
+12345678901234
+12345678901234
+12345678901234
+12345678901234
+12345678901234
+12345678901234
+12345678901234

+ 1 - 0
src/test/org/apache/hadoop/cli/clitest_data/data15bytes

@@ -0,0 +1 @@
+12345678901234

+ 2 - 0
src/test/org/apache/hadoop/cli/clitest_data/data30bytes

@@ -0,0 +1,2 @@
+12345678901234
+12345678901234

+ 4 - 0
src/test/org/apache/hadoop/cli/clitest_data/data60bytes

@@ -0,0 +1,4 @@
+12345678901234
+12345678901234
+12345678901234
+12345678901234

+ 3169 - 0
src/test/org/apache/hadoop/cli/testConf.xml

@@ -0,0 +1,3169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="testConf.xsl"?>
+
+<configuration>
+  <!-- Normal mode is test. To run just the commands and dump the output
+       to the log, set it to nocompare -->
+  <mode>test</mode>
+  
+  <!--  Comparator types:
+           ExactComparator
+           SubstringComparator
+           RegexpComparator
+           TokenComparator
+           -->
+  <tests>
+    <!-- Tests for ls -->
+    <test> <!-- TESTED -->
+      <description>ls: file using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -ls /file1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /file1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: file using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -ls file1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm file1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: files using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -touchz file2</command>
+        <command>-fs NAMENODE -touchz file3</command>
+        <command>-fs NAMENODE -touchz file4</command>
+        <command>-fs NAMENODE -ls file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file4</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: directory using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir1</command>
+        <command>-fs NAMENODE -ls /</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: directory using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir1</command>
+        <command>-fs NAMENODE -ls </command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: directory using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir1</command>
+        <command>-fs NAMENODE -mkdir dir2</command>
+        <command>-fs NAMENODE -mkdir dir3</command>
+        <command>-fs NAMENODE -mkdir dir4</command>
+        <command>-fs NAMENODE -ls </command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir4</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: file/directory that does not exist in /</description>
+      <test-commands>
+        <command>-fs NAMENODE -ls /file1</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^ls: Cannot access /file1: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>ls: file/directory that does not exist in home directory (/user/username)</description>
+      <test-commands>
+        <command>-fs NAMENODE -ls /user</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^ls: Cannot access /user: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for lsr -->
+    <test> <!-- TESTED -->
+      <description>lsr: files/directories using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -touchz /dir0/dir1/file1</command>
+        <command>-fs NAMENODE -touchz /dir0/dir1/file2</command>
+        <command>-fs NAMENODE -touchz /dir0/dir2/file1</command>
+        <command>-fs NAMENODE -touchz /dir0/dir2/file2</command>
+        <command>-fs NAMENODE -touchz /dir0/dir1/dir1/file1</command>
+        <command>-fs NAMENODE -touchz /dir0/dir1/dir1/file2</command>
+        <command>-fs NAMENODE -touchz /dir0/dir2/dir2/file1</command>
+        <command>-fs NAMENODE -touchz /dir0/dir2/dir2/file2</command>
+        <command>-fs NAMENODE -lsr /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir1/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir2/dir2/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>lsr: files/directories using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz dir0/file0</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/dir1/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/dir1/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/dir2/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/dir2/file2</command>
+        <command>-fs NAMENODE -lsr dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>lsr: files/directories using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz dir0/file0</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/dir1/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir1/dir1/file2</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/dir2/file1</command>
+        <command>-fs NAMENODE -touchz dir0/dir2/dir2/file2</command>
+        <command>-fs NAMENODE -lsr dir0/*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <!-- JIRA?
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^/user/[a-z]*/dir0/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^/user/[a-z]*/dir0/dir2</expected-output>
+        </comparator>
+       -->
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^drwxr-xr-x( )*-( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir1/dir1/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/dir0/dir2/dir2/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>lsr: file/directory that does not exist in /</description>
+      <test-commands>
+        <command>-fs NAMENODE -lsr /file1</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^lsr: Cannot access /file1: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>lsr: file/directory that does not exist in home directory (/user/username)</description>
+      <test-commands>
+        <command>-fs NAMENODE -lsr /user</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^lsr: Cannot access /user: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for du -->
+    <test> <!-- TESTED -->
+      <description>du: file using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -du /data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>du: file using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -du data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>du: files using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes data120bytes</command>
+        <command>-fs NAMENODE -du data*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 4 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>du: directory using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/data15bytes</command>
+        <command>-fs NAMENODE -du /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>du: directory using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes dir0/data15bytes</command>
+        <command>-fs NAMENODE -du dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>du: directory using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/data120bytes</command>
+        <command>-fs NAMENODE -du /dir0/*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 4 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for dus -->
+    <test> <!-- TESTED -->
+      <description>dus: directories/files using absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/dir1/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/dir1/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/dir2/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/dir2/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/dir1/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/dir1/dir2/data120bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/dir2/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/dir2/dir2/data120bytes</command>
+        <command>-fs NAMENODE -dus /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir0( |\t)*450</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>dus: directories/files using relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz dir0/file0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes dir0/dir1/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes dir0/dir1/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes dir0/dir2/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes dir0/dir2/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes dir0/dir1/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes dir0/dir1/dir2/data120bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes dir0/dir2/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes dir0/dir2/dir2/data120bytes</command>
+        <command>-fs NAMENODE -dus dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0( |\t)*450</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>dus: directories/files using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir1/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir1</command>
+        <command>-fs NAMENODE -mkdir /dir0/dir2/dir2</command>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/dir1/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/dir1/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/dir2/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/dir2/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/dir1/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/dir1/dir2/data120bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/dir2/dir1/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/dir2/dir2/data120bytes</command>
+        <command>-fs NAMENODE -mkdir /donotcountdir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /donotcountdir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /donotcountdir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /donotcountdir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /donotcountdir0/data15bytes</command>
+        <command>-fs NAMENODE -dus /dir*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+        <command>-fs NAMENODE -rmr /donotcountdir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir0( |\t)*450</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for mv -->
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mv /file1 /file2</command>
+        <command>-fs NAMENODE -ls /file*</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /file2</command>
+      </cleanup-commands>:
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file[^1]</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mv /file1 file2</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /file1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^mv: Failed to rename hdfs://localhost[.a-z]*:[0-9]*/file1 to file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to directory (absolute path); keep the same name at the destination</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mv /file1 /dir0</command>
+        <command>-fs NAMENODE -lsr /dir0</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to directory (absolute path); keep the same name at the destination [ TIED to previous test ]</description>
+      <test-commands>
+        <command>-fs NAMENODE -ls /file1</command>        
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>ls: Cannot access /file1: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to directory (absolute path); change the name at the destination</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mv /file1 /dir0/file2</command>
+        <command>-fs NAMENODE -ls /dir0</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (absolute path) to directory (absolute path); change the name at the destination [ TIED to previous test ]</description>
+      <test-commands>
+        <command>-fs NAMENODE -ls /file1</command>        
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>ls: Cannot access /file1: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: files (absolute path) to directory (absolute path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mv /file* /dir0</command>
+        <command>-fs NAMENODE -lsr /*</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file4</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: files (absolute path) to directory (absolute path) using globbing [ TIED to previous test ]</description>
+      <test-commands>
+        <command>-fs NAMENODE -ls /file*</command>        
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>ls: Cannot access /file*: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mv: file (relative) to file (relative)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -mv file1 file2</command>
+        <command>-fs NAMENODE -ls file*</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file[^1]</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for cp-->
+    <test> <!-- TESTED -->
+      <description>cp: file (absolute path) to file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -cp /file1 /file2</command>
+        <command>-fs NAMENODE -ls /file*</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /file*</command>
+      </cleanup-commands>:
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: file (absolute path) to file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -cp /file1 file2</command>
+        <command>-fs NAMENODE -ls /file1 file2</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /file1 file2</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: file (relative path) to file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -cp file1 /file2</command>
+        <command>-fs NAMENODE -ls file1 /file2</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr file1 /file2</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: file (relative path) to file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -cp file1 file2</command>
+        <command>-fs NAMENODE -ls file1 file2</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr file1 file2</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/user/[a-z]*/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: file (absolute path) to directory (absolute path); keep the same name at the destination</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -cp /file1 /dir0</command>
+        <command>-fs NAMENODE -ls /file1 /dir0</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: file (absolute path) to directory (absolute path); change the name at the destination</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -cp /file1 /dir0/file2</command>
+        <command>-fs NAMENODE -ls /file1 /dir0</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to directory (absolute path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -cp /file* /dir0</command>
+        <command>-fs NAMENODE -lsr /*</command>        
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file4</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file4</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to directory (absolute path) without globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -cp /file1 /file2 /file3 /file4 /dir0</command>
+        <command>-fs NAMENODE -lsr /*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/file4</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file3</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^-rw-r--r--( )*1( )*[a-z]*( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file4</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: copying non existent file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -cp /file /file1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>:
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: /file: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: copying non existent file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -cp file1 file2</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>:
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: file1: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to an existent file using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -touchz /file5</command>
+        <command>-fs NAMENODE -cp /file* /file5</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: When copying multiple files, destination should be a directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to an existent file without globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -touchz /file5</command>
+        <command>-fs NAMENODE -cp /file1 /file2 /file3 /file4 /file5</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: When copying multiple files, destination /file5 should be a directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to a non existent directory using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -cp /file* dir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: When copying multiple files, destination should be a directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cp: files to a non existent directory without globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -cp /file1 /file2 /file3 /file4 dir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cp: When copying multiple files, destination dir should be a directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for rm -->
+    <test> <!-- TESTED -->
+      <description>rm: removing a file (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -rm /dir0/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing a file (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -rm file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing files by globbing (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -touchz /dir0/file1</command>
+        <command>-fs NAMENODE -touchz /dir0/file2</command>
+        <command>-fs NAMENODE -touchz /dir0/file3</command>
+        <command>-fs NAMENODE -rm /dir0/file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file3</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing files by globbing (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -touchz file2</command>
+        <command>-fs NAMENODE -touchz file3</command>
+        <command>-fs NAMENODE -rm file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file3</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing a directory (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE mkdir /dir0</command>
+        <command>-fs NAMENODE -rm /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rm: Cannot remove directory "hdfs://localhost[.a-z]*:[0-9]*/dir0", use -rmr instead</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing a directory (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE mkdir dir0</command>
+        <command>-fs NAMENODE -rm dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rm: cannot remove dir0: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing a nonexistent file (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -rm /dir0/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rm: cannot remove /dir0/file0: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rm: removing a nonexistent file (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -rm file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rm: cannot remove file0: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!--Tests for rmr-->
+    <test> <!-- TESTED -->
+      <description>rmr: removing a file (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -rmr /dir0/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing a file (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -rmr file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing a directory (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0</command>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing a directory (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -rmr dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing directories by globbing (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mkdir /dir1</command>
+        <command>-fs NAMENODE -mkdir /dir2</command>
+        <command>-fs NAMENODE -mkdir /dir3</command>
+        <command>-fs NAMENODE -rmr /dir*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/dir3</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing directories by globbing (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -mkdir dir1</command>
+        <command>-fs NAMENODE -mkdir dir2</command>
+        <command>-fs NAMENODE -mkdir dir3</command>
+        <command>-fs NAMENODE -rmr dir*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir1</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir2</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Deleted hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir3</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--TESTED-->
+      <description>rmr: removing a nonexistent file (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -rmr /dir0/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rmr: cannot remove /dir0/file0: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>rmr: removing a nonexistent file (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -rmr file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^rmr: cannot remove file0: No such file or directory.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for expunge -->
+    <!-- Not yet implemented -->
+
+    <!-- Tests for put -->
+    <test> <!-- TESTED -->
+      <description>put: putting file into a file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -du /data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting file into a file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -du data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting file into a directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA /dir0/dir1/data</command>
+        <command>-fs NAMENODE -du /dir0/dir1/data</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting file into a directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA dir0/dir1/data</command>
+        <command>-fs NAMENODE -du dir0/dir1/data</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting many files into an existing directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes CLITEST_DATA/data30bytes /dir0</command>
+        <command>-fs NAMENODE -du /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 2 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data30bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting many files into an existing directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes CLITEST_DATA/data30bytes dir0</command>
+        <command>-fs NAMENODE -du dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 2 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/data30bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting non existent file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put /user/wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>put: /user/wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting non existent file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>put: wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting file into an already existing destination(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /user/file0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /user/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>put: Target /user/file0 already exists</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting file into an already existing destination(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>put: Target file0 already exists</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting many files into an existing file</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -put /data15bytes /data30bytes file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^put: copying multiple files, but last argument `file0' is not a directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>put: putting many files into a non existent directory</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -put /data15bytes /data30bytes wrongdir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^put: `wrongdir': specified destination directory doest not exist</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for copyFromLocal -->
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into a file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -du /data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into a file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -du data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/data15bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into a directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA /dir0/dir1/data</command>
+        <command>-fs NAMENODE -du /dir0/dir1/data</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost.*:[0-9]*/dir0/dir1/data/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into a directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA dir0/dir1/data</command>
+        <command>-fs NAMENODE -du dir0/dir1/data</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data30bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^60( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data60bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^120( |\t)*hdfs://localhost.*:[0-9]*/user/[a-z]*/dir0/dir1/data/data120bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying many files into an existing directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes CLITEST_DATA/data30bytes /dir0</command>
+        <command>-fs NAMENODE -du /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 2 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/dir0/data30bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying many files into an existing directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes CLITEST_DATA/data30bytes dir0</command>
+        <command>-fs NAMENODE -du dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 2 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^15( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/data15bytes</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^30( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/data30bytes</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying non existent file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal /user/wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyFromLocal: /user/wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying non existent file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyFromLocal: wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into an already existing destination(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /user/file0</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes /user/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyFromLocal: Target /user/file0 already exists</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying file into an already existing destination(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyFromLocal: Target file0 already exists</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying many files into an existing file</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -copyFromLocal /data15bytes /data30bytes file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^copyFromLocal: copying multiple files, but last argument `file0' is not a directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyFromLocal: copying many files into a non existent directory</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -copyFromLocal CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -copyFromLocal /data15bytes /data30bytes wrongdir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^copyFromLocal: `wrongdir': specified destination directory doest not exist</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for get -->
+    <test> <!-- TESTED -->
+      <description>get: getting non existent(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -get /user/file CLITEST_DATA/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>get: null</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>get: getting non existent file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -get file CLITEST_DATA/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>get: null</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for getmerge -->
+    <!-- Manual Testing -->
+
+    <!-- Tests for cat -->
+    <test> <!-- TESTED -->
+      <description>cat: contents of file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -cat /data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>12345678901234</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test>
+      <description>cat: contents of file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -cat data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr  /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>12345678901234</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test>  <!-- TESTED -->
+      <description>cat: contents of files(absolute path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/data120bytes</command>
+        <command>-fs NAMENODE -cat /dir0/data*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>12345678901234.*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED-->
+      <description>cat: contents of files(relative path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes dir0/data120bytes</command>
+        <command>-fs NAMENODE -cat dir0/data*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>12345678901234.*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test>  <!-- TESTED -->
+      <description>cat: contents of files(absolute path) without globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/data120bytes</command>
+        <command>-fs NAMENODE -cat /dir0/data15bytes /dir0/data30bytes /dir0/data60bytes /dir0/data120bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>12345678901234.*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED-->
+      <description>cat: contents of files(relative path) without globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes dir0/data120bytes</command>
+        <command>-fs NAMENODE -cat dir0/data15bytes dir0/data30bytes dir0/data60bytes dir0/data120bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>12345678901234.*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    
+    <test> <!-- TESTED -->
+      <description>cat: contents of file(absolute path) that does not exist</description>
+      <test-commands>
+        <command>-fs NAMENODE -cat /file</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cat: File does not exist: /file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cat: contents of file(relative path) that does not exist</description>
+      <test-commands>
+        <command>-fs NAMENODE -cat file</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cat: File does not exist: file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cat: contents of directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir1</command>
+        <command>-fs NAMENODE -cat /dir1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cat: Source must be a file.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>cat: contents of directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir1</command>
+        <command>-fs NAMENODE -cat dir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^cat: File does not exist: dir</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for copyToLocal -->
+    <test> <!-- TESTED -->
+      <description>copyToLocal: non existent relative path</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyToLocal file CLITEST_DATA/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyToLocal: null</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>copyToLocal: non existent absolute path</description>
+      <test-commands>
+        <command>-fs NAMENODE -copyToLocal /user/file CLITEST_DATA/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>copyToLocal: null</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for moveToLocal -->
+    <!-- Not yet implemented -->
+
+    <!-- Tests for mkdir -->
+    <test> <!-- TESTED -->
+      <description>mkdir: creating directory (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -dus /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir0(|\t)*0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mkdir: creating directory (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0 </command>
+        <command>-fs NAMENODE -dus dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0(|\t)*0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mkdir: creating many directories (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0 </command>
+        <command>-fs NAMENODE -mkdir /dir1 </command>        
+        <command>-fs NAMENODE -mkdir /dir2 </command>
+        <command>-fs NAMENODE -mkdir /dir3 </command>
+        <command>-fs NAMENODE -dus /dir*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /dir*</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir0(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir1(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir2(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/dir3(|\t)*0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mkdir: creating many directories (relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir0 </command>
+        <command>-fs NAMENODE -mkdir dir1 </command>
+        <command>-fs NAMENODE -mkdir dir2 </command>
+        <command>-fs NAMENODE -mkdir dir3 </command>
+        <command>-fs NAMENODE -dus dir*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir1(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir2(|\t)*0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir3(|\t)*0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mkdir: creating a directory with the name of an already existing directory</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+        <command>-fs NAMENODE -mkdir /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>mkdir: cannot create directory /dir0: File exists</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>mkdir: creating a directory with the name of an already existing file</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -mkdir data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>mkdir: data15bytes exists but is not a directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!--Tests for setrep-->
+    <test> <!-- TESTED -->
+      <description>setrep: existent file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -setrep 2 /dir0/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/dir0/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>setrep: existent file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -setrep 2 file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>setrep: existent directory (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /dir0/file0</command>
+        <command>-fs NAMENODE -touchz /dir0/file1</command>
+        <command>-fs NAMENODE -setrep -R 2 /dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/dir0/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>setrep: existent directory (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz dir0/file0</command>
+        <command>-fs NAMENODE -touchz dir0/file1</command>
+        <command>-fs NAMENODE -setrep -R 2 dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/file0</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^Replication 2 set: hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/dir0/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>setrep: non existent file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -setrep 2 /dir0/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^setrep: File does not exist: /dir0/file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>setrep: non existent file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -setrep 2 file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^setrep: File does not exist: file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    
+    <!-- Tests for touchz-->
+    <test> <!-- TESTED -->
+      <description>touchz: touching file (absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /user/file0</command>
+        <command>-fs NAMENODE -du /user/file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^0( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>touchz: touching file(relative path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0 </command>
+        <command>-fs NAMENODE -du file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 1 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^0( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>touchz: touching many files </description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file0 file1 file2</command>
+        <command>-fs NAMENODE -du file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>Found 3 items</expected-output>
+        </comparator>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^0( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file0</expected-output>
+          <expected-output>^0( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file1</expected-output>
+          <expected-output>^0( |\t)*hdfs://localhost[.a-z]*:[0-9]*/user/[a-z]*/file2</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>touchz: touching already existing file </description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -touchz data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm data15bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>touchz: data15bytes must be a zero-length file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!--Tests for test-->
+    <test> <!-- TESTED -->
+      <description>test: non existent file (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -test -z /dir0/file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^test: File does not exist: /dir0/file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>test: non existent file (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -test -z file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^test: File does not exist: file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>test: non existent directory (absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -test -d /dir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^test: File does not exist: /dir</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>test: non existent directory (relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -test -d dir0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^test: File does not exist: dir0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!--Tests for stat -->
+    <test> <!-- TESTED -->
+      <description>stat: statistics about file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /data60bytes</command>
+        <command>-fs NAMENODE -stat "%n-%b" /data60bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /data60bytes</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>data60bytes-60</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes data60bytes</command>
+        <command>-fs NAMENODE -stat "%n-%b" data60bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>data60bytes-60</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about directory(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dirtest</command>
+        <command>-fs NAMENODE -stat "%n-%b-%o" /dirtest</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dirtest</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>dirtest-0-0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dirtest</command>
+        <command>-fs NAMENODE -stat "%n-%b-%o" dirtest</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>dirtest-0-0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about files (absolute path) using globbing</description>
+      <test-commands>
+        <command>-fs -mkdir /dir0</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /dir0/data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes /dir0/data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /dir0/data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes /dir0/data120bytes</command>
+        <command>-fs NAMENODE -mkdir /dir0/datadir</command>
+        <command>-fs NAMENODE -stat "%n-%b" /dir0/data*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir0</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data15bytes-15"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data30bytes-30"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data60bytes-60"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data120bytes-120"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"datadir-0"</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about files (relative path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data30bytes data30bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data60bytes data60bytes</command>
+        <command>-fs NAMENODE -put CLITEST_DATA/data120bytes data120bytes</command>
+        <command>-fs NAMENODE -mkdir datadir</command>
+        <command>-fs NAMENODE -stat "%n-%b" data*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data15bytes-15"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data30bytes-30"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data60bytes-60"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"data120bytes-120"</expected-output>
+        </comparator>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>"datadir-0"</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about file or directory(absolute path) that does not exist</description>
+      <test-commands>
+        <command>-fs NAMENODE -stat /file</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^stat: cannot stat `/file': No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>stat: statistics about file or directory(relative path) that does not exist </description>
+      <test-commands>
+        <command>-fs NAMENODE -stat file1</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^stat: cannot stat `file1': No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    
+    <!-- Tests for tail -->
+    <test> <!-- TESTED -->
+      <description>tail: contents of file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -tail /data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rm /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>12345678901234</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--TESTED-->
+      <description>tail: contents of file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -put CLITEST_DATA/data15bytes data15bytes</command>
+        <command>-fs NAMENODE -tail data15bytes</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr  /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>12345678901234</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of files(absolute path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz /file1</command>
+        <command>-fs NAMENODE -touchz /file2</command>
+        <command>-fs NAMENODE -touchz /file3</command>
+        <command>-fs NAMENODE -touchz /file4</command>
+        <command>-fs NAMENODE -tail /file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: File does not exist: /file\*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of files(relative path) using globbing</description>
+      <test-commands>
+        <command>-fs NAMENODE -touchz file1</command>
+        <command>-fs NAMENODE -touchz file2</command>
+        <command>-fs NAMENODE -touchz file3</command>
+        <command>-fs NAMENODE -touchz file4</command>
+        <command>-fs NAMENODE -tail file*</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: File does not exist: file\*</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of file(absolute path) that does not exist</description>
+      <test-commands>
+        <command>-fs NAMENODE -tail /file</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: File does not exist: /file</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of file(relative path) that does not exist</description>
+      <test-commands>
+        <command>-fs NAMENODE -tail file1</command>
+      </test-commands>
+      <cleanup-commands>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: File does not exist: file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of directory(absolute path) </description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /dir1</command>
+        <command>-fs NAMENODE -tail /dir1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: Source must be a file.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>tail: contents of directory(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir dir1</command>
+        <command>-fs NAMENODE -tail dir1</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr dir1</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^tail: Source must be a file.</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <!-- Tests for moveFromLocal -->
+    <test> <!-- TESTED -->
+      <description>moveFromLocal: moving non existent file(absolute path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -moveFromLocal /user/wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>moveFromLocal: /user/wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>moveFromLocal: moving non existent file(relative path)</description>
+      <test-commands>
+        <command>-fs NAMENODE -moveFromLocal wrongdata file</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>TokenComparator</type>
+          <expected-output>moveFromLocal: wrongdata: No such file or directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>moveFromLocal: moving many files into an existing file</description>
+      <test-commands>
+        <command>-fs NAMENODE -moveFromLocal CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -moveFromLocal CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -touchz file0</command>
+        <command>-fs NAMENODE -moveFromLocal /data15bytes /data30bytes file0</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^moveFromLocal: copying multiple files, but last argument `file0' is not a directory</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!-- TESTED -->
+      <description>moveFromLocal: moving many files into a non existent directory</description>
+      <test-commands>
+        <command>-fs NAMENODE -moveFromLocal CLITEST_DATA/data15bytes /data15bytes</command>
+        <command>-fs NAMENODE -moveFromLocal CLITEST_DATA/data30bytes /data30bytes</command>
+        <command>-fs NAMENODE -moveFromLocal /data15bytes /data30bytes wrongdir</command>
+      </test-commands>
+      <cleanup-commands>
+        <command>-fs NAMENODE -rmr /user</command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>RegexpComparator</type>
+          <expected-output>^moveFromLocal: `wrongdir': specified destination directory doest not exist</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+  </tests>
+</configuration>

+ 28 - 0
src/test/org/apache/hadoop/cli/testConf.xsl

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  
+  <xsl:template match="/">
+    <html>
+      <body>
+        <h2>Hadoop DFS command-line tests</h2>
+        <table border="1">
+          <tr bgcolor="#9acd32">
+            <th align="left">ID</th>
+            <th align="left">Command</th>
+            <th align="left">Description</th>
+          </tr>
+          <xsl:for-each select="configuration/tests/test">
+            <!-- <xsl:sort select="description"/> -->
+            <tr>
+              <td><xsl:value-of select="position()"/></td>
+              <td><xsl:value-of select="substring-before(description,':')"/></td>
+              <td><xsl:value-of select="substring-after(description,':')"/></td>
+            </tr>
+          </xsl:for-each>
+        </table>
+      </body>
+    </html>
+  </xsl:template>
+  
+</xsl:stylesheet>

+ 107 - 0
src/test/org/apache/hadoop/cli/util/CLITestData.java

@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * Class to store CLI Test Data
+ */
+public class CLITestData {
+  private String testDesc = null;
+  private ArrayList<String> testCommands = null;
+  private ArrayList<String> cleanupCommands = null;
+  private ArrayList<ComparatorData> comparatorData = null;
+  private boolean testResult = false;
+  
+  public CLITestData() {
+
+  }
+
+  /**
+   * @return the testDesc
+   */
+  public String getTestDesc() {
+    return testDesc;
+  }
+
+  /**
+   * @param testDesc the testDesc to set
+   */
+  public void setTestDesc(String testDesc) {
+    this.testDesc = testDesc;
+  }
+
+  /**
+   * @return the testCommands
+   */
+  public ArrayList<String> getTestCommands() {
+    return testCommands;
+  }
+
+  /**
+   * @param testCommands the testCommands to set
+   */
+  public void setTestCommands(ArrayList<String> testCommands) {
+    this.testCommands = testCommands;
+  }
+
+  /**
+   * @return the comparatorData
+   */
+  public ArrayList<ComparatorData> getComparatorData() {
+    return comparatorData;
+  }
+
+  /**
+   * @param comparatorData the comparatorData to set
+   */
+  public void setComparatorData(ArrayList<ComparatorData> comparatorData) {
+    this.comparatorData = comparatorData;
+  }
+
+  /**
+   * @return the testResult
+   */
+  public boolean getTestResult() {
+    return testResult;
+  }
+
+  /**
+   * @param testResult the testResult to set
+   */
+  public void setTestResult(boolean testResult) {
+    this.testResult = testResult;
+  }
+
+  /**
+   * @return the cleanupCommands
+   */
+  public ArrayList<String> getCleanupCommands() {
+    return cleanupCommands;
+  }
+
+  /**
+   * @param cleanupCommands the cleanupCommands to set
+   */
+  public void setCleanupCommands(ArrayList<String> cleanupCommands) {
+    this.cleanupCommands = cleanupCommands;
+  }
+}

+ 109 - 0
src/test/org/apache/hadoop/cli/util/CommandExecutor.java

@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.PrintStream;
+import java.util.StringTokenizer;
+
+import org.apache.hadoop.fs.FsShell;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.hadoop.conf.Configuration;
+
+
+/**
+ *
+ * This class executed commands and captures the output
+ */
+public class CommandExecutor {
+  private static String commandOutput = null;
+  private static int exitCode = 0;
+  private static Exception lastException = null;
+  private static String cmdExecuted = null;
+  
+  private static String[] getFSCommandAsArgs(final String cmd, 
+		  final String namenode) {
+    StringTokenizer tokenizer = new StringTokenizer(cmd, " ");
+    String[] args = new String[tokenizer.countTokens()];
+    
+    int i = 0;
+    while (tokenizer.hasMoreTokens()) {
+      args[i] = tokenizer.nextToken();
+
+      args[i] = args[i].replaceAll("NAMENODE", namenode);
+      args[i] = args[i].replaceAll("CLITEST_DATA", 
+        new File(System.getProperty("test.cache.data")).
+        toURI().toString().replace(' ', '+'));
+      args[i] = args[i].replaceAll("USERNAME", System.getProperty("user.name"));
+
+      i++;
+    }
+    
+    return args;
+  }
+  
+  public static int executeFSCommand(final String cmd, final String namenode) {
+    exitCode = 0;
+    
+    ByteArrayOutputStream bao = new ByteArrayOutputStream();
+    PrintStream origOut = System.out;
+    PrintStream origErr = System.err;
+    
+    System.setOut(new PrintStream(bao));
+    System.setErr(new PrintStream(bao));
+    
+    FsShell shell = new FsShell();
+    String[] args = getFSCommandAsArgs(cmd, namenode);
+    cmdExecuted = cmd;
+    
+    try {
+      ToolRunner.run(shell, args);
+    } catch (Exception e) {
+      e.printStackTrace();
+      lastException = e;
+      exitCode = -1;
+    } finally {
+      System.setOut(origOut);
+      System.setErr(origErr);
+    }
+    
+    commandOutput = bao.toString();
+    
+    return exitCode;
+  }
+  
+  public static String getLastCommandOutput() {
+    return commandOutput;
+  }
+
+  public static int getLastExitCode() {
+    return exitCode;
+  }
+
+  public static Exception getLastException() {
+    return lastException;
+  }
+
+  public static String getLastCommand() {
+    return cmdExecuted;
+  }
+}

+ 39 - 0
src/test/org/apache/hadoop/cli/util/ComparatorBase.java

@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+/**
+ *
+ * Comparator interface. To define a new comparator, implement the compare
+ * method
+ */
+public abstract class ComparatorBase {
+  public ComparatorBase() {
+    
+  }
+  
+  /**
+   * Compare method for the comparator class.
+   * @param actual output. can be null
+   * @param expected output. can be null
+   * @return true if expected output compares with the actual output, else
+   *         return false. If actual or expected is null, return false
+   */
+  public abstract boolean compare(String actual, String expected);
+}

+ 108 - 0
src/test/org/apache/hadoop/cli/util/ComparatorData.java

@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+import java.util.Vector;
+
+/**
+ *
+ * Class to store CLI Test Comparators Data
+ */
+public class ComparatorData {
+  private String expectedOutput = null;
+  private String actualOutput = null;
+  private boolean testResult = false;
+  private int exitCode = 0;
+  private String comparatorType = null;
+  
+  public ComparatorData() {
+
+  }
+
+  /**
+   * @return the expectedOutput
+   */
+  public String getExpectedOutput() {
+    return expectedOutput;
+  }
+
+  /**
+   * @param expectedOutput the expectedOutput to set
+   */
+  public void setExpectedOutput(String expectedOutput) {
+    this.expectedOutput = expectedOutput;
+  }
+
+  /**
+   * @return the actualOutput
+   */
+  public String getActualOutput() {
+    return actualOutput;
+  }
+
+  /**
+   * @param actualOutput the actualOutput to set
+   */
+  public void setActualOutput(String actualOutput) {
+    this.actualOutput = actualOutput;
+  }
+
+  /**
+   * @return the testResult
+   */
+  public boolean getTestResult() {
+    return testResult;
+  }
+
+  /**
+   * @param testResult the testResult to set
+   */
+  public void setTestResult(boolean testResult) {
+    this.testResult = testResult;
+  }
+
+  /**
+   * @return the exitCode
+   */
+  public int getExitCode() {
+    return exitCode;
+  }
+
+  /**
+   * @param exitCode the exitCode to set
+   */
+  public void setExitCode(int exitCode) {
+    this.exitCode = exitCode;
+  }
+
+  /**
+   * @return the comparatorType
+   */
+  public String getComparatorType() {
+    return comparatorType;
+  }
+
+  /**
+   * @param comparatorType the comparatorType to set
+   */
+  public void setComparatorType(String comparatorType) {
+    this.comparatorType = comparatorType;
+  }
+
+}

+ 34 - 0
src/test/org/apache/hadoop/cli/util/ExactComparator.java

@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+/**
+ * Comparator for the Command line tests.
+ * 
+ * This comparator compares the actual to the expected and
+ * returns true only if they are the same
+ * 
+ */
+public class ExactComparator extends ComparatorBase {
+
+  @Override
+  public boolean compare(String actual, String expected) {
+    return actual.equals(expected);
+  }
+}

+ 50 - 0
src/test/org/apache/hadoop/cli/util/RegexpComparator.java

@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Comparator for the Command line tests. 
+ * 
+ * This comparator searches for the regular expression specified in 'expected'
+ * in the string 'actual' and returns true if the regular expression match is 
+ * done
+ * 
+ */
+public class RegexpComparator extends ComparatorBase {
+
+  @Override
+  public boolean compare(String actual, String expected) {
+    boolean success = false;
+    Pattern p = Pattern.compile(expected);
+    
+    StringTokenizer tokenizer = new StringTokenizer(actual, "\n\r");
+    while (tokenizer.hasMoreTokens() && !success) {
+      String actualToken = tokenizer.nextToken();
+      Matcher m = p.matcher(actualToken);
+      success = m.matches();
+    }
+    
+    return success;
+  }
+
+}

+ 33 - 0
src/test/org/apache/hadoop/cli/util/SubstringComparator.java

@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+public class SubstringComparator extends ComparatorBase {
+
+  @Override
+  public boolean compare(String actual, String expected) {
+    int compareOutput = actual.indexOf(expected);
+    if (compareOutput == -1) {
+      return false;
+    }
+
+    return true;
+  }
+
+}

+ 49 - 0
src/test/org/apache/hadoop/cli/util/TokenComparator.java

@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.cli.util;
+
+import java.util.StringTokenizer;
+
+/**
+ * Comparator for the Command line tests. 
+ * 
+ * This comparator compares each token in the expected output and returns true
+ * if all tokens are in the actual output
+ * 
+ */
+public class TokenComparator extends ComparatorBase {
+
+  @Override
+  public boolean compare(String actual, String expected) {
+    boolean compareOutput = true;
+    
+    StringTokenizer tokenizer = new StringTokenizer(expected, ",\n\r");
+    
+    while (tokenizer.hasMoreTokens()) {
+      String token = tokenizer.nextToken();
+      if (actual.indexOf(token) != -1) {
+        compareOutput &= true;
+      } else {
+        compareOutput &= false;
+      }
+    }
+    
+    return compareOutput;
+  }
+}