InitJob extends MetadataAPIBase { @Override public List<InitJobRowInfo> execute(String[] params) { List<InitJobRowInfo> initJobRowInfos = new ArrayList<InitJobRowInfo>(); try { InitJobRowInfo initJobInfo = new InitJobRowInfo(); CommandLine commandLine = getCommandLine(params, PARAMS_STRUCTURE); String pid = commandLine.getOptionValue("process-id"); LOGGER.debug("processId is " + pid); String maxBId = commandLine.getOptionValue("max-batch"); LOGGER.debug("maxBatch is " + maxBId); initJobInfo.setProcessId(Integer.parseInt(pid)); initJobInfo.setMaxBatch(Integer.parseInt(maxBId)); initJobRowInfos = jobDAO.initJob(initJobInfo.getProcessId(), initJobInfo.getMaxBatch()); processExecutionQueueDAO.updateStatusToRunning(initJobInfo.getProcessId()); return initJobRowInfos; } catch (Exception e) { LOGGER.error("Error occurred", e); throw new MetadataException(e); } } InitJob(); static InitJobInfo parseBean(List<InitJobRowInfo> initJobRowInfos); @Override List<InitJobRowInfo> execute(String[] params);  }
@Test @Ignore public void testExecute() throws Exception { String[] args = {"--max-batch", "1", "--process-id", "10802"}; InitJob bs = new InitJob(); List<InitJobRowInfo> initJobRowInfos = bs.execute(args); for (InitJobRowInfo initJobRowInfo : initJobRowInfos) { LOGGER.debug("process id is " + initJobRowInfo.getProcessId() + " and file associated is" + initJobRowInfo.getFileList() + "batch is" + initJobRowInfo.getSourceBatchId()); } InitJobInfo initJob = bs.parseBean(initJobRowInfos); LOGGER.debug("file list is" + initJob.getFileListMap().get("10805")); LOGGER.debug("executed!"); }