Review Board 1.7.22


Fix for SQOOP-981

Review Request #10478 - Created April 15, 2013 and updated

Venkat Ranganathan
Reviewers
Sqoop
jarcec
sqoop-trunk
Recognize --hadoop-home also as backward compatible option
Added two tests (one to recognize hadoop-home) and one to test hadoop-mapred-home overriding hadoop-home)
All tests pass

Diff revision 2 (Latest)

1 2
1 2

  1. src/java/org/apache/sqoop/tool/BaseSqoopTool.java: Loading...
  2. src/test/com/cloudera/sqoop/TestSqoopOptions.java: Loading...
src/java/org/apache/sqoop/tool/BaseSqoopTool.java
Revision 684d4a5 New Change
[20] 388 lines
[+20] [+] protected RelatedOptions getCommonOptions() {
389
    commonOpts.addOption(OptionBuilder.withArgName("dir")
389
    commonOpts.addOption(OptionBuilder.withArgName("dir")
390
        .hasArg().withDescription("Override $HADOOP_MAPRED_HOME_ARG")
390
        .hasArg().withDescription("Override $HADOOP_MAPRED_HOME_ARG")
391
        .withLongOpt(HADOOP_MAPRED_HOME_ARG)
391
        .withLongOpt(HADOOP_MAPRED_HOME_ARG)
392
        .create());
392
        .create());
393

    
   
393

   

    
   
394
    commonOpts.addOption(OptionBuilder.withArgName("hdir")

    
   
395
            .hasArg().withDescription("Override $HADOOP_MAPRED_HOME_ARG")

    
   
396
            .withLongOpt(HADOOP_HOME_ARG)

    
   
397
            .create());

    
   
398

   
394
    // misc (common)
399
    // misc (common)
395
    commonOpts.addOption(OptionBuilder
400
    commonOpts.addOption(OptionBuilder
396
        .withDescription("Print more information while working")
401
        .withDescription("Print more information while working")
397
        .withLongOpt(VERBOSE_ARG)
402
        .withLongOpt(VERBOSE_ARG)
398
        .create());
403
        .create());
[+20] [20] 350 lines
[+20] [+] protected void applyCommonOptions(CommandLine in, SqoopOptions out)
749

    
   
754

   
750
    if (in.hasOption(PASSWORD_PROMPT_ARG)) {
755
    if (in.hasOption(PASSWORD_PROMPT_ARG)) {
751
      out.setPasswordFromConsole();
756
      out.setPasswordFromConsole();
752
    }
757
    }
753

    
   
758

   
754
    if (in.hasOption(HADOOP_HOME_ARG)) {
759

   
755
      out.setHadoopMapRedHome(in.getOptionValue(HADOOP_HOME_ARG));

   
756
    }

   
757
    if (in.hasOption(HADOOP_MAPRED_HOME_ARG)) {
760
    if (in.hasOption(HADOOP_MAPRED_HOME_ARG)) {
758
      out.setHadoopMapRedHome(in.getOptionValue(HADOOP_MAPRED_HOME_ARG));
761
      out.setHadoopMapRedHome(in.getOptionValue(HADOOP_MAPRED_HOME_ARG));

    
   
762
      // Only consider HADOOP_HOME if HADOOP_MAPRED_HOME is not set

    
   
763
    } else if (in.hasOption(HADOOP_HOME_ARG)) {

    
   
764
        out.setHadoopMapRedHome(in.getOptionValue(HADOOP_HOME_ARG));
759
    }
765
    }
760

    
   
766

   
761
  }
767
  }
762

    
   
768

   
763
  protected void applyHiveOptions(CommandLine in, SqoopOptions out)
769
  protected void applyHiveOptions(CommandLine in, SqoopOptions out)
[+20] [20] 321 lines
src/test/com/cloudera/sqoop/TestSqoopOptions.java
Revision fcc38eb New Change
 
  1. src/java/org/apache/sqoop/tool/BaseSqoopTool.java: Loading...
  2. src/test/com/cloudera/sqoop/TestSqoopOptions.java: Loading...