@Test(enabled = true) public void testPlaceholderWithSysPropSetToDefault() { underTest = new SysPropHandler("[testPlaceholderWithSysPropSetToDefault]"); String inputString = SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER + "[" + PROPERTY_TO_TEST + ",pippo_default]}"; String outputStr = underTest.processString(inputString); Assert.assertEquals(outputStr, "pippo_default"); }
public String processString(String inputString) { String outputString = inputString; try { if (inputString.contains(SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER)) { String patternForFormat = ".*?(\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}).*?"; String placeholder = processRegex(patternForFormat, inputString); String placeholderProcessed = getSysProperty(placeholder); String patternForFormatBefore = "(.*?)\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}.*?"; String outputStrBefore = processRegex(patternForFormatBefore, inputString); String patternForFormatAfter = ".*?\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}(.*)"; String outputStrAfter = processRegex(patternForFormatAfter, inputString); outputString = outputStrBefore + placeholderProcessed + outputStrAfter; } } catch (Exception oEx) { logger.error("{} SysPropHandler - processString --> Exception occurred '{}' / description '{}'", testDetails, oEx.getClass(), oEx.getLocalizedMessage()); } return outputString; }
SysPropHandler { public String processString(String inputString) { String outputString = inputString; try { if (inputString.contains(SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER)) { String patternForFormat = ".*?(\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}).*?"; String placeholder = processRegex(patternForFormat, inputString); String placeholderProcessed = getSysProperty(placeholder); String patternForFormatBefore = "(.*?)\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}.*?"; String outputStrBefore = processRegex(patternForFormatBefore, inputString); String patternForFormatAfter = ".*?\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}(.*)"; String outputStrAfter = processRegex(patternForFormatAfter, inputString); outputString = outputStrBefore + placeholderProcessed + outputStrAfter; } } catch (Exception oEx) { logger.error("{} SysPropHandler - processString --> Exception occurred '{}' / description '{}'", testDetails, oEx.getClass(), oEx.getLocalizedMessage()); } return outputString; } }
SysPropHandler { public String processString(String inputString) { String outputString = inputString; try { if (inputString.contains(SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER)) { String patternForFormat = ".*?(\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}).*?"; String placeholder = processRegex(patternForFormat, inputString); String placeholderProcessed = getSysProperty(placeholder); String patternForFormatBefore = "(.*?)\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}.*?"; String outputStrBefore = processRegex(patternForFormatBefore, inputString); String patternForFormatAfter = ".*?\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}(.*)"; String outputStrAfter = processRegex(patternForFormatAfter, inputString); outputString = outputStrBefore + placeholderProcessed + outputStrAfter; } } catch (Exception oEx) { logger.error("{} SysPropHandler - processString --> Exception occurred '{}' / description '{}'", testDetails, oEx.getClass(), oEx.getLocalizedMessage()); } return outputString; } SysPropHandler(String testDetails); }
SysPropHandler { public String processString(String inputString) { String outputString = inputString; try { if (inputString.contains(SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER)) { String patternForFormat = ".*?(\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}).*?"; String placeholder = processRegex(patternForFormat, inputString); String placeholderProcessed = getSysProperty(placeholder); String patternForFormatBefore = "(.*?)\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}.*?"; String outputStrBefore = processRegex(patternForFormatBefore, inputString); String patternForFormatAfter = ".*?\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}(.*)"; String outputStrAfter = processRegex(patternForFormatAfter, inputString); outputString = outputStrBefore + placeholderProcessed + outputStrAfter; } } catch (Exception oEx) { logger.error("{} SysPropHandler - processString --> Exception occurred '{}' / description '{}'", testDetails, oEx.getClass(), oEx.getLocalizedMessage()); } return outputString; } SysPropHandler(String testDetails); String processString(String inputString); }
SysPropHandler { public String processString(String inputString) { String outputString = inputString; try { if (inputString.contains(SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER)) { String patternForFormat = ".*?(\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}).*?"; String placeholder = processRegex(patternForFormat, inputString); String placeholderProcessed = getSysProperty(placeholder); String patternForFormatBefore = "(.*?)\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}.*?"; String outputStrBefore = processRegex(patternForFormatBefore, inputString); String patternForFormatAfter = ".*?\\$\\{" + SysPropHeatPlaceholderModule.SYS_PROP_PLACEHOLDER_KEYWORD + ".*?\\}(.*)"; String outputStrAfter = processRegex(patternForFormatAfter, inputString); outputString = outputStrBefore + placeholderProcessed + outputStrAfter; } } catch (Exception oEx) { logger.error("{} SysPropHandler - processString --> Exception occurred '{}' / description '{}'", testDetails, oEx.getClass(), oEx.getLocalizedMessage()); } return outputString; } SysPropHandler(String testDetails); String processString(String inputString);  }