src/main/java/com/xceptance/neodymium/module/statement/testdata/util/TestDataUtils.java
/**
     * Loads and returns the package test data for the given script package.
     *
     * @param clazz
     *            the class object to use for resource lookup
     * @param baseDir
     *            the base directory to use for data file lookup
     * @param packageName
     *            the name of the script package
     * @return test data of given script package
     */
Loads and returns the package test data for the given script package.
@param clazz
the class object to use for resource lookup
@param baseDir
the base directory to use for data file lookup
@param packageName
the name of the script package
@return test data of given script package
Loads and returns the package test data for the given script package . @param clazz the class object to use for resource lookup @param baseDir the base directory to use for data file lookup @param packageName the name of the script package @return test data of given script package
public static Map<String, String> readPackageTestData(final Class<?> clazz, final String baseDir, final String packageName)
    {
        final String baseName = packageName.replace('.', '/') + "/package_testdata.";
        final String base = baseDir + "/" + baseName;
        try
        {
            InputStream is = null;
            String path;
            path = base + "csv";
            is = clazz.getResourceAsStream(path);
            if (is != null)
            {
                return getFirstDataSetFromFile(CsvFileReader.readFile(is), path);
            }
            path = base + "xml";
            is = clazz.getResourceAsStream(path);
            if (is != null)
            {
                return getFirstDataSetFromFile(XmlFileReader.readFile(is), path);
            }
            path = base + "json";
            is = clazz.getResourceAsStream(path);
            if (is != null)
            {
                return getFirstDataSetFromFile(JsonFileReader.readFile(is), path);
            }
            path = base + "properties";
            is = clazz.getResourceAsStream(path);
            if (is != null)
            {
                return getFirstDataSetFromFile(PropertyFileReader.readFile(is), path);
            }
        }
        catch (final Exception e)
        {
            LOGGER.error("Failed to parse package test data for package '" + packageName + "'", e);
        }
        return Collections.emptyMap();
    }
public static Map < String , String > readPackageTestData ( final Class < ? > clazz , final String baseDir , final String packageName ) { final String baseName = packageName . replace ( '.' , '/' ) + "/package_testdata." ; final String base = baseDir + "/" + baseName ; try { InputStream is = null ; String path ; path = base + "csv" ; is = clazz . getResourceAsStream ( path ) ; if ( is != null ) { return getFirstDataSetFromFile ( CsvFileReader . readFile ( is ) , path ) ; } path = base + "xml" ; is = clazz . getResourceAsStream ( path ) ; if ( is != null ) { return getFirstDataSetFromFile ( XmlFileReader . readFile ( is ) , path ) ; } path = base + "json" ; is = clazz . getResourceAsStream ( path ) ; if ( is != null ) { return getFirstDataSetFromFile ( JsonFileReader . readFile ( is ) , path ) ; } path = base + "properties" ; is = clazz . getResourceAsStream ( path ) ; if ( is != null ) { return getFirstDataSetFromFile ( PropertyFileReader . readFile ( is ) , path ) ; } } catch ( final Exception e ) { LOGGER . error ( "Failed to parse package test data for package '" + packageName + "'" , e ) ; } return Collections . emptyMap ( ) ; }
Loads and returns the package test data for the given script package.
Loads and returns the package test data for the given script package .
// TODO: discuss order of file extensions