~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/historic/org/crosswire/bible/view/cli/Test.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
package org.crosswire.bible.view.cli;
3
 
 
4
 
import java.io.PrintWriter;
5
 
import java.util.Enumeration;
6
 
import java.util.Hashtable;
7
 
 
8
 
import org.crosswire.bible.control.test.TestList;
9
 
import org.crosswire.bible.util.Project;
10
 
import org.crosswire.util.TestBase;
11
 
 
12
 
/**
13
 
* Test is a command line utility that runs all the configured tests.
14
 
* <p>I may at some stage add some functionality to select the tests
15
 
* that can be run.
16
 
*
17
 
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
18
 
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
19
 
* Distribution Licence:<br />
20
 
* Project B is free software; you can redistribute it
21
 
* and/or modify it under the terms of the GNU General Public License,
22
 
* version 2 as published by the Free Software Foundation.<br />
23
 
* This program is distributed in the hope that it will be useful,
24
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
 
* General Public License for more details.<br />
27
 
* The License is available on the internet
28
 
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
29
 
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30
 
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
31
 
* The copyright to this program is held by it's authors.
32
 
* </font></td></tr></table>
33
 
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
34
 
* @see <{docs.Licence}>
35
 
* @author Joe Walker
36
 
* @version D0.I0.T0
37
 
*/
38
 
public class Test
39
 
{
40
 
    /**
41
 
    * Basic constructor
42
 
    */
43
 
    public static void main(String[] args)
44
 
    {
45
 
        Project.init();
46
 
 
47
 
        switch (args.length)
48
 
        {
49
 
        case 0:
50
 
            Enumeration en = hash.elements();
51
 
            while (en.hasMoreElements())
52
 
            {
53
 
                TestBase all = (TestBase) en.nextElement();
54
 
                all.test(new PrintWriter(System.out), false);
55
 
            }
56
 
            break;
57
 
 
58
 
        case 1:
59
 
            TestBase single = (TestBase) hash.get(args[0]);
60
 
            if (single == null)
61
 
                usage();
62
 
            else
63
 
                single.test(new PrintWriter(System.out), false);
64
 
            break;
65
 
 
66
 
        default:
67
 
            usage();
68
 
            break;
69
 
        }
70
 
 
71
 
        // Since the Swing test creates some dialogs we need this to
72
 
        // make sure that we actually exit the program.
73
 
        System.exit(0);
74
 
    }
75
 
 
76
 
    /**
77
 
    * Usage text
78
 
    */
79
 
    public static void usage()
80
 
    {
81
 
        System.out.println("Syntax: ctest [module]");
82
 
        System.out.println("  Where [module] is blank to run all tests or one of:");
83
 
        Enumeration en = hash.keys();
84
 
        while (en.hasMoreElements())
85
 
        {
86
 
            String key = (String) en.nextElement();
87
 
            TestBase test = (TestBase) hash.get(key);
88
 
            System.out.println("    "+key+" (which runs "+test.getClass()+")");
89
 
        }
90
 
    }
91
 
 
92
 
    /** The set of tests */
93
 
    private static Hashtable hash = TestList.getTesters();
94
 
}