@Test public void testCreate() { MRJobDescFactory mrFac = new MRJobDescFactory(); Configuration conf = new Configuration(); conf.set(Constants.USER_CONF_KEY, "testuser"); QualifiedJobId qid = new QualifiedJobId("clusterId", "job_211212010355_45240"); JobDesc jd = null; jd = mrFac.create(qid, 1354772953639L, conf); Assert.assertEquals(jd.getAppId(), Constants.UNKNOWN); String name = "Crazy Job name! : test 1 2 3!"; String processedName = "Crazy_Job_name__:_test_1_2_3_"; conf.set("mapred.job.name", name); jd = mrFac.create(qid, 1354772953639L, conf); Assert.assertEquals(jd.getAppId(), processedName); name = "Other Crazy Job name! : test 1 2 3!"; processedName = "Other_Crazy_Job_name__:_test_1_2_3_"; conf.set("batch.desc", name); jd = mrFac.create(qid, 1354772953639L, conf); Assert.assertEquals(jd.getAppId(), processedName); conf = new Configuration(); conf.set(Constants.USER_CONF_KEY, "testuser"); name = "Third Crazy Job name! : test 1 2 3!"; processedName = "Third_Crazy_Job_name__:_test_1_2_3_"; conf.set("batch.desc", name); jd = mrFac.create(qid, 1354772953639L, conf); Assert.assertEquals(jd.getAppId(), processedName); }
@Override JobDesc create(QualifiedJobId qualifiedJobId, long submitTimeMillis, Configuration jobConf) { String appId = getAppId(jobConf); long appSubmitTimeMillis = jobConf.getLong(Constants.MR_RUN_CONF_KEY, submitTimeMillis); return create(qualifiedJobId, jobConf, appId, Constants.UNKNOWN, Framework.NONE, appSubmitTimeMillis); }
MRJobDescFactory extends JobDescFactoryBase { @Override JobDesc create(QualifiedJobId qualifiedJobId, long submitTimeMillis, Configuration jobConf) { String appId = getAppId(jobConf); long appSubmitTimeMillis = jobConf.getLong(Constants.MR_RUN_CONF_KEY, submitTimeMillis); return create(qualifiedJobId, jobConf, appId, Constants.UNKNOWN, Framework.NONE, appSubmitTimeMillis); } }
MRJobDescFactory extends JobDescFactoryBase { @Override JobDesc create(QualifiedJobId qualifiedJobId, long submitTimeMillis, Configuration jobConf) { String appId = getAppId(jobConf); long appSubmitTimeMillis = jobConf.getLong(Constants.MR_RUN_CONF_KEY, submitTimeMillis); return create(qualifiedJobId, jobConf, appId, Constants.UNKNOWN, Framework.NONE, appSubmitTimeMillis); }  }
MRJobDescFactory extends JobDescFactoryBase { @Override JobDesc create(QualifiedJobId qualifiedJobId, long submitTimeMillis, Configuration jobConf) { String appId = getAppId(jobConf); long appSubmitTimeMillis = jobConf.getLong(Constants.MR_RUN_CONF_KEY, submitTimeMillis); return create(qualifiedJobId, jobConf, appId, Constants.UNKNOWN, Framework.NONE, appSubmitTimeMillis); }   }
MRJobDescFactory extends JobDescFactoryBase { @Override JobDesc create(QualifiedJobId qualifiedJobId, long submitTimeMillis, Configuration jobConf) { String appId = getAppId(jobConf); long appSubmitTimeMillis = jobConf.getLong(Constants.MR_RUN_CONF_KEY, submitTimeMillis); return create(qualifiedJobId, jobConf, appId, Constants.UNKNOWN, Framework.NONE, appSubmitTimeMillis); }    }