public boolean initializeFromProperties()

in java/src/org/apache/qetest/FileBasedTest.java [399:483]


    public boolean initializeFromProperties(Properties props)
    {
        // Copy over all properties into our local block
        //  this is a little unusual, but it does allow users 
        //  to set any new sort of properties via the properties 
        //  file, and we'll pick it up - that way this class doesn't
        //  have to get updated when we have new properties
        // Note that this may result in duplicates since we
        //  re-set many of the things from bleow
        for (Enumeration names = props.propertyNames();
                names.hasMoreElements(); /* no increment portion */ )
        {
            Object key = names.nextElement();

            testProps.put(key, props.get(key));
        }


        // Parse out any values that match our internal convenience variables
        // default all values to our current values
        // String values are simply getProperty()'d
        inputDir = props.getProperty(OPT_INPUTDIR, inputDir);
        if (inputDir != null)
            testProps.put(OPT_INPUTDIR, inputDir);

        outputDir = props.getProperty(OPT_OUTPUTDIR, outputDir);
        if (outputDir != null)
            testProps.put(OPT_OUTPUTDIR, outputDir);

        goldDir = props.getProperty(OPT_GOLDDIR, goldDir);
        if (goldDir != null)
            testProps.put(OPT_GOLDDIR, goldDir);

        // The actual fileChecker object is created in preTestFileInit()

        // Use a temp string for those properties we only set 
        //  in our testProps, but don't bother to save ourselves
        String temp = null;

        temp = props.getProperty(OPT_FILECHECKER);
        if (temp != null)
            testProps.put(OPT_FILECHECKER, temp);

        temp = props.getProperty(OPT_CATEGORY);
        if (temp != null)
            testProps.put(OPT_CATEGORY, temp);

        temp = props.getProperty(OPT_EXCLUDES);
        if (temp != null)
            testProps.put(OPT_EXCLUDES, temp);

        temp = props.getProperty(Reporter.OPT_LOGGERS);
        if (temp != null)
            testProps.put(Reporter.OPT_LOGGERS, temp);

        temp = props.getProperty(Logger.OPT_LOGFILE);
        if (temp != null)
            testProps.put(Logger.OPT_LOGFILE, temp);

        // boolean values just check for the non-default value
        String dbg = props.getProperty(Reporter.OPT_DEBUG);

        if ((dbg != null) && dbg.equalsIgnoreCase("true"))
        {
            debug = true;

            testProps.put(Reporter.OPT_DEBUG, "true");
        }

        String pLog = props.getProperty(Reporter.OPT_PERFLOGGING);

        if ((pLog != null) && pLog.equalsIgnoreCase("true"))
        {
            perfLogging = true;

            testProps.put(Reporter.OPT_PERFLOGGING, "true");
        }

        temp = props.getProperty(Reporter.OPT_LOGGINGLEVEL);

        if (temp != null)
            testProps.put(Reporter.OPT_LOGGINGLEVEL, temp);

        return true;
    }