public Collection<ToolType> getAllParameters() { return config.getExternalTools().getMap().values(); }
private String getParameterValue(TemplateParameter templateParameter) { if (config.getExternalTools() == null) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Config doesn't contain any external tools."); } ToolType param = config.getExternalTools().getMap().get(templateParameter.getName()); if (param == null) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Config doesn't contain '%s' external tool."); } String paramValue = param.getValue(); if (StringUtils.isEmpty(paramValue)) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Config contains an empty '%s' external tool value."); } paramValue = paramValue.trim(); if (StringUtils.isEmpty(paramValue)) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Config contains an empty '%s' external tool value."); } return paramValue; }
private void initInputParameters() { logger.debug("Initializing input parameters..."); // 1. setting working directory (if it's in config.xml) inputParameters.setDefaultWorkingDir(configProvider.getConfig().getWorkingDirectory()); // 2. setting IMP (if it's in config.xml) inputParameters.setDefaultImp(configProvider.getConfig().getImp()); // 3. setting CPL (if it's in config.xml) inputParameters.setDefaultCpl(configProvider.getConfig().getCpl()); // 4. custom IMF validation if (configProvider.getConfig().getExternalTools().getMap().containsKey(CoreConstants.IMF_VALIDATION_TOOL)) { String customImfValidation = configProvider.getConfig().getExternalTools().getMap() .get(CoreConstants.IMF_VALIDATION_TOOL).getValue(); if (!StringUtils.isEmpty(customImfValidation)) { inputParameters.setCustomImfValidationTool(customImfValidation); } } logger.debug("Initialized input parameters: OK\n"); }
@Test public void testParseCorrectConfig() throws Exception { ConfigXmlProvider configProvider = new ConfigXmlProvider(ConfigUtils.getCorrectConfigXml(), ConfigUtils.getCorrectConfigXmlPath()); assertNotNull(configProvider.getConfig()); assertNotNull(configProvider.getConfig().getExternalTools()); assertNotNull(configProvider.getConfig().getExternalTools().getMap().get("toolSimple")); assertEquals("root\\toolSimple", configProvider.getConfig().getExternalTools().getMap().get("toolSimple").getValue()); assertNotNull(configProvider.getConfig().getExternalTools().getMap().get("toolWhitespace")); assertEquals("root\\tool whitespace", configProvider.getConfig().getExternalTools().getMap().get("toolWhitespace").getValue()); }