Modified: hadoop/core/trunk/src/test/org/apache/hadoop/cli/testMRConf.xml URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/cli/testMRConf.xml?rev=772688&r1=772687&r2=772688&view=diff ============================================================================== --- hadoop/core/trunk/src/test/org/apache/hadoop/cli/testMRConf.xml (original) +++ hadoop/core/trunk/src/test/org/apache/hadoop/cli/testMRConf.xml Thu May 7 16:01:44 2009 @@ -46,5 +46,468 @@ </comparator> </comparators> </test> + + <!-- Test for Archive --> + <test> <!-- TESTED --> + <description>Archive: Archive does not occur in the destination</description> + <test-commands> + <command>-fs NAMENODE -touchz /dir0/file0</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dest/test.har /dir0/ </archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /dir0 /dest</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>archive -archiveName NAME <src>\* <dest></expected-output> + </comparator> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid usage.</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Archive does not get overwritten without any warning</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /dir0 /dest</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid Output.</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: source and destination are same</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dir0/</archive-command> + <command>-fs NAMENODE -ls /dir0/</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 4 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>drwxr-xr-x( )*-( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/dir0.har</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>drwxr-xr-x( )*-( )*[a-zA-Z0-9]+( )*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-zA-Z0-9]+( )*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>-rw-r--r--( )*1( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir0/file0</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Destination is an existing file</description> + <test-commands> + <command>-fs NAMENODE -touchz /file1</command> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /file1</archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid Output.</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Deleting a file in archive</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + <command>-fs NAMENODE -rm har:///dest/dir0.har/dir0/file0</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>rm: Har: delete not allowed</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Renaming a file in archive</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + <command>-fs NAMENODE -mv har:///dest/dir0.har/dir0/file0 har:///dest/dir0.har/dir0/file1</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>mv: Wrong FS: har:/dest/dir0.har/dir0/file0, expected: hdfs://localhost[.a-z]*:[0-9]+</expected-output> + </comparator> + <comparator> + <type>TokenComparator</type> + <expected-output>Usage: java FsShell [-mv <src> <dst>]</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Testing count in archive</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/dir2</command> + <command>-fs NAMENODE -put CLITEST_DATA/data60bytes /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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + <command>-fs NAMENODE -count har:///dest/dir0.har/dir0/file0</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>( |\t)*0( )*1( )*60( )*har:/dest/dir0.har/dir0/file0</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Destination is not specified</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -touchz /dir0/file0</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0 </archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>archive -archiveName NAME <src>\* <dest></expected-output> + </comparator> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid usage.</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Archive name is not specified</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -touchz /dir0/file0</command> + <archive-command>-fs NAMENODE -archiveName /dir0 /dest </archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>archive -archiveName NAME <src>\* <dest></expected-output> + </comparator> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid usage.</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Source files are specified through globbing</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -touchz /dir0/file0</command> + <command>-fs NAMENODE -touchz /dir0/file1</command> + <command>-fs NAMENODE -touchz /dir0/file2</command> + <command>-fs NAMENODE -mkdir /dir1</command> + <archive-command>-fs NAMENODE -archiveName test.har /dir0/file* /dir1</archive-command> + <command>-fs NAMENODE -ls /dir1</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 1 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir1/test.har</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Source directories are specified through globbing</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir1</command> + <command>-fs NAMENODE -mkdir /dir2</command> + <command>-fs NAMENODE -touchz /dir0/file0</command> + <command>-fs NAMENODE -touchz /dir1/file1</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName test.har /dir* /dest </archive-command> + <command>-fs NAMENODE -ls /dest</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 1 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dest/test.har</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Source is a files</description> + <test-commands> + <command>-fs NAMENODE -touchz /file0</command> + <command>-fs NAMENODE -mkdir /dir1</command> + <archive-command>-fs NAMENODE -archiveName test.har /file0 /dir1</archive-command> + <command>-fs NAMENODE -ls /dir1</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 1 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dir1/test.har</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Source is a directory</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName test.har /dir0 /dest </archive-command> + <command>-fs NAMENODE -ls /dest</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 1 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dest/test.har</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Invalid Source is specified</description> + <test-commands> + <archive-command>-fs NAMENODE -archiveName test.har file0 /dest </archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>java.lang.NullPointerException</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Invalid name for archives is specified</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName test /dir0 /dest </archive-command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>archive -archiveName NAME <src>* <dest></expected-output> + </comparator> + <comparator> + <type>TokenComparator</type> + <expected-output>Invalid name for archives. test</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Deleting the complete archive file</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName test.har /dir0 /dest </archive-command> + <command>-fs NAMENODE -rmr /dest/test.har</command> + <command>-fs NAMENODE -ls /dest/</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output></expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Renaming the archive file</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName test.har /dir0 /dest </archive-command> + <command>-fs NAMENODE -mv /dest/test.har /dest/test1.har</command> + <command>-fs NAMENODE -ls /dest/</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /*</command> + </cleanup-commands> + <comparators> + <comparator> + <type>TokenComparator</type> + <expected-output>Found 1 items</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/dest/test1.har</expected-output> + </comparator> + </comparators> + </test> + + <test> <!-- TESTED --> + <description>Archive: Listing of archive</description> + <test-commands> + <command>-fs NAMENODE -mkdir /dir0</command> + <command>-fs NAMENODE -mkdir /dir0/dir1</command> + <command>-fs NAMENODE -mkdir /dir0/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 -mkdir /dest</command> + <archive-command>-fs NAMENODE -archiveName dir0.har /dir0/ /dest</archive-command> + <command>-fs NAMENODE -lsr har:///dest/dir0.har/dir0</command> + </test-commands> + <cleanup-commands> + <command>-fs NAMENODE -rmr /dir0 /dest</command> + </cleanup-commands> + <comparators> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/dir1</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/dir2</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/file0</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/dir1/file1</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/dir1/file2</expected-output> + </comparator> + <comparator> + <type>RegexpComparator</type> + <expected-output>^[drwx-]+( )*[0-9\-]+( )*[a-zA-Z0-9]+( )*supergroup( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*[a-zA-Z0-9\/\.]+/dir0/dir2/file1</expected-output> + </comparator> + </comparators> + </test> + </tests> </configuration>
Modified: hadoop/core/trunk/src/test/org/apache/hadoop/cli/util/CLITestData.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/cli/util/CLITestData.java?rev=772688&r1=772687&r2=772688&view=diff ============================================================================== --- hadoop/core/trunk/src/test/org/apache/hadoop/cli/util/CLITestData.java (original) +++ hadoop/core/trunk/src/test/org/apache/hadoop/cli/util/CLITestData.java Thu May 7 16:01:44 2009 @@ -37,13 +37,14 @@ /** * Class to define Test Command. includes type of the command and command itself - * Valid types FS, DFSADMIN and MRADMIN. + * Valid types FS, DFSADMIN, MRADMIN and ARCHIVE. */ static public class TestCmd { public enum CommandType { FS, DFSADMIN, - MRADMIN + MRADMIN, + ARCHIVE } private final CommandType type; private final String cmd;
