BatchEnqueuer extends MetadataAPIBase { @Override public List<BatchConsumpQueue> execute(String[] params) { try { RegisterFileInfo registerFileInfo = new RegisterFileInfo(); List<BatchConsumpQueue> bcqs; CommandLine commandLine = getCommandLine(params, PARAMS_STRUCTURE); String pid = commandLine.getOptionValue("parent-process-id"); LOGGER.debug("parentProcessId is " + pid); String sId = commandLine.getOptionValue("server-id"); LOGGER.debug("serverId is " + sId); String path = commandLine.getOptionValue("path"); LOGGER.debug("path is " + path); String fSize = commandLine.getOptionValue("file-size"); LOGGER.debug("file size is " + fSize); String fHash = commandLine.getOptionValue("file-hash"); LOGGER.debug("file-hash " + fHash); String creationTs = commandLine.getOptionValue("creation-timestamp"); LOGGER.debug("creation Ts " + creationTs); String batchId = commandLine.getOptionValue("batch-id"); LOGGER.debug("batchId " + batchId); if ("0".equalsIgnoreCase(batchId) || "NULL".equalsIgnoreCase(batchId)) { registerFileInfo.setBatchId(null); } else { registerFileInfo.setBatchId(new Long(batchId)); } String batchMarking = commandLine.getOptionValue("batch-marking"); LOGGER.debug("batch-marking " + batchMarking); registerFileInfo.setParentProcessId(Integer.parseInt(pid)); registerFileInfo.setPath(path); registerFileInfo.setServerId(Integer.parseInt(sId)); registerFileInfo.setFileSize(Long.parseLong(fSize)); registerFileInfo.setFileHash(fHash); registerFileInfo.setCreationTs(Timestamp.valueOf(creationTs)); registerFileInfo.setBatchMarking(batchMarking); bcqs = batchEnqueuerDAO.batchEnqueue(registerFileInfo); LOGGER.debug("registerFileInfo " + registerFileInfo.getPath() + " " + registerFileInfo.getBatchId()); LOGGER.debug("registerFileInfo " + registerFileInfo.getParentProcessId() + " " + registerFileInfo.getCreationTs()); return bcqs; } catch (Exception e) { LOGGER.error("Error occurred", e); throw new MetadataException(e); } } BatchEnqueuer(); @Override List<BatchConsumpQueue> execute(String[] params);  }
@Ignore @Test public void testExecute() throws Exception { String[] args = {"-cTS", "2014-12-11 11:56:17", "-fh", "1", "-sId", "123461", "-fs", "1", "-p", "1", "--path", "1", "--batch-id", "1", "-bm", "1"}; List<BatchConsumpQueue> info = new BatchEnqueuer().execute(args); LOGGER.info(info.size()); }