@Test public void propertiesConfigurationTest() throws PEException { PropertiesConfiguration pc = PEFileUtils.loadPropertiesConfigFromClasspath(getClass(), "fileutils.properties"); List<Object> propList = pc.getList("propList"); assertEquals(3, propList.size()); assertEquals("singleValue", pc.getString("singleProp")); }
public static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName) throws PEException { PropertiesConfiguration props = new PropertiesConfiguration(); try { props.load(getResourceStream(testClass, fileName)); } catch (ConfigurationException e) { throw new PEException("Error loading properties file '" + fileName + "'", e); } return props; }
PEFileUtils { public static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName) throws PEException { PropertiesConfiguration props = new PropertiesConfiguration(); try { props.load(getResourceStream(testClass, fileName)); } catch (ConfigurationException e) { throw new PEException("Error loading properties file '" + fileName + "'", e); } return props; } }
PEFileUtils { public static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName) throws PEException { PropertiesConfiguration props = new PropertiesConfiguration(); try { props.load(getResourceStream(testClass, fileName)); } catch (ConfigurationException e) { throw new PEException("Error loading properties file '" + fileName + "'", e); } return props; } protected  PEFileUtils(); }
PEFileUtils { public static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName) throws PEException { PropertiesConfiguration props = new PropertiesConfiguration(); try { props.load(getResourceStream(testClass, fileName)); } catch (ConfigurationException e) { throw new PEException("Error loading properties file '" + fileName + "'", e); } return props; } protected  PEFileUtils(); static Properties loadPropertiesFile(Class<?> testClass, String fileName); static Properties loadPropertiesFile(Class<?> testClass, String fileName, boolean skipDecryption); static void savePropertiesToClasspath(Class<?> testClass, String fileName, Properties props); static Properties loadPropertiesFromClasspath(Class<?> testClass, String fileName); static Properties loadPropertiesFile(String fileName); static Properties loadPropertiesFile(String fileName, boolean skipDecryption); static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName); static InputStream getResourceStream(Class<?> testClass, String fileName); static InputStream getClasspathResourceStream(Class<?> testClass, String fileName); static URL getResourceURL(final Class<?> testClass, final String fileName); static URL getClasspathURL(final Class<?> testClass, final String fileName); static File getResourceFile(final Class<?> testClass, final String fileName); static File getClasspathFile(final Class<?> testClass, final String fileName); static URI convert(final URL url); static String readToString(Class<?> testClass, String fileName); static String readToString(Class<?> testClass, String fileName, Charset cs); static String readToString(final String path); static String readToString(final String path, final Charset cs); static String readToString(final File file); static String readToString(final File file, final Charset charset); static String readToString(InputStream istream); static String readToString(InputStream istream, Charset cs); static void writeToFile(String fileName, String text, boolean overwriteContents); static void writeToFile(File file, String text, boolean overwriteContents); static String[] readToArray(String fileName); static boolean createDirectory(final String dirName); static boolean createDirectory(final File dir); static String getCanonicalResourcePath(final Class<?> clazz, final String fileName); static String getCanonicalClasspathPath(final Class<?> clazz, final String fileName); }
PEFileUtils { public static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName) throws PEException { PropertiesConfiguration props = new PropertiesConfiguration(); try { props.load(getResourceStream(testClass, fileName)); } catch (ConfigurationException e) { throw new PEException("Error loading properties file '" + fileName + "'", e); } return props; } protected  PEFileUtils(); static Properties loadPropertiesFile(Class<?> testClass, String fileName); static Properties loadPropertiesFile(Class<?> testClass, String fileName, boolean skipDecryption); static void savePropertiesToClasspath(Class<?> testClass, String fileName, Properties props); static Properties loadPropertiesFromClasspath(Class<?> testClass, String fileName); static Properties loadPropertiesFile(String fileName); static Properties loadPropertiesFile(String fileName, boolean skipDecryption); static PropertiesConfiguration loadPropertiesConfigFromClasspath(Class<?> testClass, String fileName); static InputStream getResourceStream(Class<?> testClass, String fileName); static InputStream getClasspathResourceStream(Class<?> testClass, String fileName); static URL getResourceURL(final Class<?> testClass, final String fileName); static URL getClasspathURL(final Class<?> testClass, final String fileName); static File getResourceFile(final Class<?> testClass, final String fileName); static File getClasspathFile(final Class<?> testClass, final String fileName); static URI convert(final URL url); static String readToString(Class<?> testClass, String fileName); static String readToString(Class<?> testClass, String fileName, Charset cs); static String readToString(final String path); static String readToString(final String path, final Charset cs); static String readToString(final File file); static String readToString(final File file, final Charset charset); static String readToString(InputStream istream); static String readToString(InputStream istream, Charset cs); static void writeToFile(String fileName, String text, boolean overwriteContents); static void writeToFile(File file, String text, boolean overwriteContents); static String[] readToArray(String fileName); static boolean createDirectory(final String dirName); static boolean createDirectory(final File dir); static String getCanonicalResourcePath(final Class<?> clazz, final String fileName); static String getCanonicalClasspathPath(final Class<?> clazz, final String fileName); static final String PEFU_EOL_MATCH; }