HaltJob extends MetadataAPIBase { @Override public HaltJobInfo execute(String[] params) { try { List<Process> downStreamList=new ArrayList<>(); HaltJobInfo haltJobInfo = new HaltJobInfo(); CommandLine commandLine = getCommandLine(params, PARAMS_STRUCTURE); String pid = commandLine.getOptionValue("process-id"); LOGGER.debug("processId is " + pid); String batchMarking = commandLine.getOptionValue("batch-marking"); LOGGER.debug("Batch Marking is " + batchMarking); haltJobInfo.setProcessId(Integer.parseInt(pid)); haltJobInfo.setBatchMarking(batchMarking); jobDAO.haltJob(haltJobInfo.getProcessId(), haltJobInfo.getBatchMarking()); downStreamList=jobTriggerDAO.getOozieDownstream(haltJobInfo.getProcessId()); for(Process process:downStreamList){ LOGGER.info("adding " + process.getProcessId() + " to process execution queue"); processExecutionQueueDAO.insert(process.getProcessId(),"admin"); } processExecutionQueueDAO.updateStatusToSuccess(haltJobInfo.getProcessId()); ProcessInfo processInfo = new ProcessInfo(); com.wipro.ats.bdre.md.dao.jpa.Process process = new com.wipro.ats.bdre.md.dao.jpa.Process(); process.setProcessId(Integer.parseInt(pid)); process = processDAO.get(Integer.parseInt(pid)); processInfo.setProcessName(process.getProcessName()); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); String haltMessage = " --processId=" + haltJobInfo.getProcessId() + " --stage=parent" + " --status=success" + " --processName=" + process.getProcessName() + " --endTs=" + (dateFormat.format(date)).toString(); try { BasicConfigurator.configure(); StatusNotification statusNotification = new StatusNotification(haltMessage, MDConfig.getProperty("status-notification.halt-queue")); LOGGER.info(statusNotification.toString()); } catch (Exception e) { LOGGER.error("Error occurred while notifying job status", e); } return haltJobInfo; } catch (Exception e) { LOGGER.error("Error occurred", e); throw new MetadataException(e); } } HaltJob(); @Override HaltJobInfo execute(String[] params);  }
@Ignore @Test public void testExecute() throws Exception { String[] args = {"--process-id", "10802", "--batch-marking", "day1"}; HaltJob bs = new HaltJob(); bs.execute(args); LOGGER.debug("executed!"); }