You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by dl...@locus.apache.org on 2000/10/23 08:17:26 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/test VelocityTestSuite.java

dlr         00/10/22 23:17:26

  Modified:    src/java/org/apache/velocity/test VelocityTestSuite.java
  Log:
  Load the template test cases (still needs a lot of work).
  
  Revision  Changes    Path
  1.3       +52 -1     jakarta-velocity/src/java/org/apache/velocity/test/VelocityTestSuite.java
  
  Index: VelocityTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/VelocityTestSuite.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VelocityTestSuite.java	2000/10/15 03:21:41	1.2
  +++ VelocityTestSuite.java	2000/10/23 06:17:25	1.3
  @@ -54,24 +54,75 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.Properties;
  +import java.util.List;
  +import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.io.IOException;
  +import java.io.FileInputStream;
  +import java.io.BufferedInputStream;
  +
   import junit.framework.*;
   
  +import org.apache.velocity.runtime.Runtime;
  +
   /**
    * Test suite for Apache Velocity.
    *
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: VelocityTestSuite.java,v 1.2 2000/10/15 03:21:41 dlr Exp $
  + * @version $Id: VelocityTestSuite.java,v 1.3 2000/10/23 06:17:25 dlr Exp $
    */
   public class VelocityTestSuite extends TestSuite
   {
       /**
  +     * The name of the test suite properties file.
  +     */
  +    private static final String PROPS_FILE_NAME = "TestSuite.properties";
  +
  +    /**
  +     * The test suite properties.
  +     */
  +    private Properties props;
  +
  +    /**
        * Creates an instace of the Apache Velocity test suite.
        */
       public VelocityTestSuite ()
       {
           super("Apache Velocity test suite");
   
  +        // Read in properties file.
  +        props = new Properties();
  +        try
  +        {
  +            props.load
  +                (new BufferedInputStream(new FileInputStream(PROPS_FILE_NAME)));
  +        }
  +        catch (IOException e)
  +        {
  +            // TODO: Need to initialize the Runtime first.
  +            Runtime.error(e);
  +        }
  +
           // Add test cases here.
  +        List templateTestCases = getTemplateTestCases();
  +        for (Iterator iter = templateTestCases.iterator(); iter.hasNext(); )
  +        {
  +            addTest(new TemplateTestCase((String)iter.next()));
  +        }
           addTest(new VelocityTest("Apache Velocity"));
  +    }
  +
  +    /**
  +     * Returns a list of the template test cases to run.
  +     *
  +     * @return A <code>List</code> of <code>String</code> objects naming the 
  +     *         test cases.
  +     */
  +    private List getTemplateTestCases ()
  +    {
  +        List testCases = new ArrayList();
  +        // TODO: Parse the template test cases from the properties file.
  +        return testCases;
       }
   }