ProcessLog extends MetadataAPIBase { @Override public ProcessLogInfo execute(String[] params) { try { ProcessLogInfo processLogInfo = new ProcessLogInfo(); CommandLine commandLine = getCommandLine(params, PARAMS_STRUCTURE); String pId = commandLine.getOptionValue("process-id"); LOGGER.debug("processId is " + pId); String logCat = commandLine.getOptionValue("log-category"); LOGGER.debug("log category is " + logCat); String message = commandLine.getOptionValue("message"); LOGGER.debug("message is " + message); String mId = commandLine.getOptionValue("message-id"); LOGGER.debug("message id is" + mId); String iRef = commandLine.getOptionValue("instance-ref"); LOGGER.debug("instance ref is " + iRef); String addTs = commandLine.getOptionValue("add-ts"); LOGGER.debug("add ts " + addTs); processLogInfo.setProcessId(Integer.parseInt(pId)); processLogInfo.setLogCategory(logCat); processLogInfo.setMessage(message); processLogInfo.setMessageId(mId); processLogInfo.setInstanceRef(Long.parseLong(iRef)); processLogInfo.setAddTs(Timestamp.valueOf(addTs)); com.wipro.ats.bdre.md.dao.jpa.ProcessLog processLog = new com.wipro.ats.bdre.md.dao.jpa.ProcessLog(); processLog.setAddTs(Timestamp.valueOf(addTs)); processLog.setInstanceRef(Long.parseLong(iRef)); processLog.setLogCategory(logCat); processLog.setMessage(message); processLog.setMessageId(mId); Process process = new Process(); process.setProcessId(Integer.parseInt(pId)); processLog.setProcess(process); Long logId = processLogDAO.insert(processLog); processLogInfo.setLogId(logId); return processLogInfo; } catch (Exception e) { LOGGER.error("Error occurred", e); throw new MetadataException(e); } } ProcessLog(); ProcessLogInfo getLastValue(String pid, String msgId, String logCategory); @Override ProcessLogInfo execute(String[] params); void log(ProcessLogInfo processLogInfo); void logList(List<ProcessLogInfo> processLogInfo); List<ProcessLogInfo> listLastInstanceRef(int processId, String messageId);  }
@Ignore @Test public void testExecute() throws Exception { String[] args = {"--process-id", "1", "--add-ts", "2015-03-10 08:00:00", "--log-category", "Category 1", "--message", "Message 1", "--message-id", "Id 1", "--instance-ref", "1"}; ProcessLog processLog = new ProcessLog(); processLog.execute(args); LOGGER.debug("executed!"); }