### Question:
HadoopUtils implements Closeable { public ExecutionStatus getApplicationStatus(String applicationId) throws Exception { if (StringUtils.isEmpty(applicationId)) { return null; } String result = Constants.FAILED; String applicationUrl = getApplicationUrl(applicationId); logger.info("applicationUrl={}", applicationUrl); String responseContent; if (PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) { responseContent = KerberosHttpClient.get(applicationUrl); } else { responseContent = HttpUtils.get(applicationUrl); } if (responseContent != null) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("app")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("app").path("finalStatus").asText(); } else { String jobHistoryUrl = getJobHistoryUrl(applicationId); logger.info("jobHistoryUrl={}", jobHistoryUrl); responseContent = HttpUtils.get(jobHistoryUrl); if (null != responseContent) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("job")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("job").path("state").asText(); } else { return ExecutionStatus.FAILURE; } } switch (result) { case Constants.ACCEPTED: return ExecutionStatus.SUBMITTED_SUCCESS; case Constants.SUCCEEDED: return ExecutionStatus.SUCCESS; case Constants.NEW: case Constants.NEW_SAVING: case Constants.SUBMITTED: case Constants.FAILED: return ExecutionStatus.FAILURE; case Constants.KILLED: return ExecutionStatus.KILL; case Constants.RUNNING: default: return ExecutionStatus.RUNNING_EXECUTION; } } private  HadoopUtils(); static HadoopUtils getInstance(); Configuration getConfiguration(); String getApplicationUrl(String applicationId); String getJobHistoryUrl(String applicationId); byte[] catFile(String hdfsFilePath); List<String> catFile(String hdfsFilePath, int skipLineNums, int limit); boolean mkdir(String hdfsPath); boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite); boolean copyLocalToHdfs(String srcFile, String dstHdfsPath, boolean deleteSource, boolean overwrite); boolean copyHdfsToLocal(String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite); boolean delete(String hdfsFilePath, boolean recursive); boolean exists(String hdfsFilePath); FileStatus[] listFileStatus(String filePath); boolean rename(String src, String dst); boolean isYarnEnabled(); ExecutionStatus getApplicationStatus(String applicationId); static String getHdfsDataBasePath(); static String getHdfsDir(ResourceType resourceType, String tenantCode); static String getHdfsResDir(String tenantCode); static String getHdfsUserDir(String tenantCode, int userId); static String getHdfsUdfDir(String tenantCode); static String getHdfsFileName(ResourceType resourceType, String tenantCode, String fileName); static String getHdfsResourceFileName(String tenantCode, String fileName); static String getHdfsUdfFileName(String tenantCode, String fileName); static String getHdfsTenantDir(String tenantCode); static String getAppAddress(String appAddress, String rmHa); @Override void close(); static final String resourceUploadPath; static final String rmHaIds; static final String appAddress; static final String jobHistoryAddress; }### Answer:
@Test public void getApplicationStatus() { try { logger.info(hadoopUtils.getApplicationStatus("application_1542010131334_0029").toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } }