Exemple #1
0
 // Validate child java opts in properties.
 private void validateChildJavaOpts(Properties props) {
   // if old property mapred.child.java.opts is set, then extraction of all
   // the following 3 properties should give that value.
   assertEquals(
       "mapred.child.java.opts is not extracted properly.",
       "-server -Xmx640m -Djava.net.preferIPv4Stack=true",
       JobBuilder.extract(props, JobConfPropertyNames.TASK_JAVA_OPTS_S.getCandidates(), null));
   assertEquals(
       "New config property "
           + JobConf.MAPRED_MAP_TASK_JAVA_OPTS
           + " is not extracted properly when the old config property "
           + "mapred.child.java.opts is set.",
       "-server -Xmx640m -Djava.net.preferIPv4Stack=true",
       JobBuilder.extract(props, JobConfPropertyNames.MAP_JAVA_OPTS_S.getCandidates(), null));
   assertEquals(
       "New config property "
           + JobConf.MAPRED_REDUCE_TASK_JAVA_OPTS
           + " is not extracted properly when the old config property "
           + "mapred.child.java.opts is set.",
       "-server -Xmx640m -Djava.net.preferIPv4Stack=true",
       JobBuilder.extract(props, JobConfPropertyNames.REDUCE_JAVA_OPTS_S.getCandidates(), null));
 }
Exemple #2
0
  private void validateJobConfParser(String confFile) throws Exception {

    final Configuration conf = new Configuration();
    final FileSystem lfs = FileSystem.getLocal(conf);

    @SuppressWarnings("deprecation")
    final Path rootInputDir =
        new Path(System.getProperty("test.tools.input.dir", "")).makeQualified(lfs);

    final Path rootInputPath = new Path(rootInputDir, "rumen/small-trace-test");

    final Path inputPath = new Path(rootInputPath, confFile);

    InputStream inputConfStream = new PossiblyDecompressedInputStream(inputPath, conf);

    try {
      Properties props = JobConfigurationParser.parse(inputConfStream);
      inputConfStream.close();

      // Make sure that parser puts the interested properties into props1 and
      // props2 as defined by list1 and list2.
      assertEquals(
          "Config property for job queue name is not " + " extracted properly.",
          "TheQueue",
          JobBuilder.extract(props, JobConfPropertyNames.QUEUE_NAMES.getCandidates(), null));
      assertEquals(
          "Config property for job name is not " + " extracted properly.",
          "MyMRJob",
          JobBuilder.extract(props, JobConfPropertyNames.JOB_NAMES.getCandidates(), null));

      validateChildJavaOpts(props);

    } finally {
      inputConfStream.close();
    }
  }