@Test public void testResolvePath() { when(configurationLocatorHelper.getEnvironmentProperty("MIFOS_CONF")).thenReturn("/users/admin/.mifos"); when(configurationLocatorHelper.getHomeProperty("question.group.folder")).thenReturn("question/groups/xmls"); String path = configurationLocator.resolvePath("$MIFOS_CONF/${question.group.folder}/ppi/PPIIndia.xml"); Assert.assertEquals("/users/admin/.mifos/question/groups/xmls/ppi/PPIIndia.xml", path); verify(configurationLocatorHelper, times(1)).getEnvironmentProperty("MIFOS_CONF"); verify(configurationLocatorHelper, times(1)).getHomeProperty("question.group.folder"); Assert.assertEquals("/users/admin/.mifos/question/groups/xmls/ppi/PPIIndia.xml", configurationLocator.resolvePath("/users/admin/.mifos/question/groups/xmls/ppi/PPIIndia.xml")); }
public String resolvePath(String fileName) { StringBuilder fileBuffer = new StringBuilder(fileName); resolveHomeProperties(fileName, fileBuffer); resolveEnvironmentProperties(fileName, fileBuffer); return fileBuffer.toString(); }
ConfigurationLocator { public String resolvePath(String fileName) { StringBuilder fileBuffer = new StringBuilder(fileName); resolveHomeProperties(fileName, fileBuffer); resolveEnvironmentProperties(fileName, fileBuffer); return fileBuffer.toString(); } }
ConfigurationLocator { public String resolvePath(String fileName) { StringBuilder fileBuffer = new StringBuilder(fileName); resolveHomeProperties(fileName, fileBuffer); resolveEnvironmentProperties(fileName, fileBuffer); return fileBuffer.toString(); } ConfigurationLocator(); }
ConfigurationLocator { public String resolvePath(String fileName) { StringBuilder fileBuffer = new StringBuilder(fileName); resolveHomeProperties(fileName, fileBuffer); resolveEnvironmentProperties(fileName, fileBuffer); return fileBuffer.toString(); } ConfigurationLocator(); @SuppressWarnings("PMD") // TODO It may be clearer if this returned an URI or URL instead of a String? String getCustomFilePath(String filename); String getFilePath(String filename); @SuppressWarnings({"PMD.OnlyOneReturn"}) String getConfigurationDirectory(); Resource getResource(String configurationName); Resource getUploadedMifosLogo(); void setConfigurationLocatorHelper(ConfigurationLocatorHelper fileFactory); void setDefaultConfigPath(String path); String resolvePath(String fileName); String getLogoDirectory(); String getLogoName(); }
ConfigurationLocator { public String resolvePath(String fileName) { StringBuilder fileBuffer = new StringBuilder(fileName); resolveHomeProperties(fileName, fileBuffer); resolveEnvironmentProperties(fileName, fileBuffer); return fileBuffer.toString(); } ConfigurationLocator(); @SuppressWarnings("PMD") // TODO It may be clearer if this returned an URI or URL instead of a String? String getCustomFilePath(String filename); String getFilePath(String filename); @SuppressWarnings({"PMD.OnlyOneReturn"}) String getConfigurationDirectory(); Resource getResource(String configurationName); Resource getUploadedMifosLogo(); void setConfigurationLocatorHelper(ConfigurationLocatorHelper fileFactory); void setDefaultConfigPath(String path); String resolvePath(String fileName); String getLogoDirectory(); String getLogoName(); static final String LOCATOR_ENVIRONMENT_PROPERTY_NAME; }