GetProperties extends MetadataAPIBase { @Override public List<GetPropertiesInfo> execute(String[] params) { List<com.wipro.ats.bdre.md.dao.jpa.Properties> propertyList; try { GetPropertiesInfo getPropertiesInfo = new GetPropertiesInfo(); CommandLine commandLine = getCommandLine(params, PARAMS_STRUCTURE); String pid = commandLine.getOptionValue("process-id"); LOGGER.debug("process-id is " + pid); String configGrp = commandLine.getOptionValue("config-group"); LOGGER.debug("config-group is " + configGrp); getPropertiesInfo.setProcessId(Integer.parseInt(pid)); getPropertiesInfo.setConfigGroup(configGrp); propertyList = propertiesDAO.getPropertiesForConfig(Integer.parseInt(pid), configGrp); List<GetPropertiesInfo> propertiesInfoList = new ArrayList<GetPropertiesInfo>(); for (com.wipro.ats.bdre.md.dao.jpa.Properties property : propertyList) { GetPropertiesInfo propertyInfo = new GetPropertiesInfo(); propertyInfo.setConfigGroup(property.getConfigGroup()); propertyInfo.setProcessId(property.getProcess().getProcessId()); propertyInfo.setKey(property.getId().getPropKey()); propertyInfo.setValue(property.getPropValue()); propertiesInfoList.add(propertyInfo); } if (LOGGER.isDebugEnabled()) { for (GetPropertiesInfo info : propertiesInfoList) { LOGGER.debug("Got props from DB: " + info.getKey() + "=" + info.getValue()); } } return propertiesInfoList; } catch (Exception e) { LOGGER.error("Error occurred", e); throw new MetadataException(e); } } GetProperties(); Properties getProperties(String pid, String configGroup); @Override List<GetPropertiesInfo> execute(String[] params);  }
@Ignore @Test public void testExecute() throws Exception { GetProperties gp = new GetProperties(); String[] args = {"--process-id", "10802", "--config-group", "credential"}; gp.execute(args); LOGGER.debug("executed! "); }