protected String expandCommand(final String cmd) { String expCmd = cmd; expCmd = expCmd.replaceAll("JOBTRACKER", jobtracker); expCmd = super.expandCommand(cmd); return expCmd; }
@After @Override public void tearDown() throws Exception { super.tearDown(); String removeTestcliDirCmd = "hadoop fs -rm -r " + TEST_DIR_ABSOLUTE; shHDFS.exec(removeTestcliDirCmd); }
public void setUp() throws Exception { super.setUp(); conf.setClass(PolicyProvider.POLICY_PROVIDER_CONFIG, HadoopPolicyProvider.class, PolicyProvider.class); jobtracker = System.getProperty("test.cli.mapred.job.tracker"); JobConf mrConf = new JobConf(conf); if (jobtracker == null) { // Start up mini mr cluster mrCluster = new MiniMRCluster(1, dfsCluster.getFileSystem().getUri().toString(), 1, null, null, mrConf); jobtracker = mrCluster.createJobConf().get(JTConfig.JT_IPC_ADDRESS, "local"); } else { conf.set(JTConfig.JT_IPC_ADDRESS, jobtracker); } cmdExecutor = new MRCmdExecutor(jobtracker); archiveCmdExecutor = new ArchiveCmdExecutor(namenode, mrConf); }
protected Result execute(TestCmd cmd) throws Exception { if(cmd.getType() == TestCmd.CommandType.MRADMIN) { return cmdExecutor.executeCommand(cmd.getCmd()); } else if(cmd.getType() == TestCmd.CommandType.ARCHIVE) { return archiveCmdExecutor.executeCommand(cmd.getCmd()); } else { return super.execute(cmd); } }
public void tearDown() throws Exception { boolean success = false; if (mrCluster != null) { mrCluster.shutdown(); success = true; } assertTrue("Error tearing down Mini MR cluster", success); super.tearDown(); }
/** * Expand commands from the test config file. * This method is used in displayResults() and compareTestOutput() only, * so it doesn't have any effect on the test execution itself. * * @param cmd executed command * @return String expanded command */ @Override protected String expandCommand(String cmd) { String expCmd = super.expandCommand(cmd); // note: super.expandCommand() expands CLITEST_DATA and USERNAME expCmd = expCmd.replaceAll("NAMENODETEST_DIR_ABSOLUTE", NAMENODE_TESTDIR_HACK); expCmd = expCmd.replaceAll("TEST_DIR_ABSOLUTE", TEST_DIR_ABSOLUTE); expCmd = expCmd.replaceAll("supergroup", supergroup); expCmd = expCmd.replaceAll("NAMENODE", namenode); expCmd = expCmd.replaceAll("USER_NAME", System.getProperty("user.name")); return expCmd; } }