13 * This code is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * version 2 for more details (a copy is included in the LICENSE file that
17 * accompanied this code).
18 *
19 * You should have received a copy of the GNU General Public License version
20 * 2 along with this work; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24 * or visit www.oracle.com if you need additional information or have any
25 * questions.
26 */
27 package com.sun.javatest.batch;
28
29 import java.io.PrintWriter;
30 import java.text.DateFormat;
31 import java.util.Date;
32 import java.util.Iterator;
33
34 import com.sun.javatest.Harness;
35 import com.sun.javatest.Parameters;
36 import com.sun.javatest.Status;
37 import com.sun.javatest.TestFinder;
38 import com.sun.javatest.TestResult;
39 import com.sun.javatest.tool.Command;
40 import com.sun.javatest.tool.CommandContext;
41 import com.sun.javatest.tool.VerboseCommand;
42 import com.sun.javatest.util.HelpTree;
43 import com.sun.javatest.util.I18NResourceBundle;
44
45 class RunTestsCommand extends Command
46 {
47 static String getName() {
48 return "runTests";
49 }
50
51 private static final String DATE_OPTION = "date";
52 private static final String NON_PASS_OPTION = "non-pass";
53 private static final String START_OPTION = "start";
54 private static final String FINISH_OPTION = "stop";
55 private static final String PROGRESS_OPTION = "progress";
56
57 private Harness harness;
58
59 static void initVerboseOptions() {
60 VerboseCommand.addOption(DATE_OPTION, new HelpTree.Node(i18n, "runTests.verbose.date"));
61 VerboseCommand.addOption(NON_PASS_OPTION, new HelpTree.Node(i18n, "runTests.verbose.nonPass"));
62 VerboseCommand.addOption(START_OPTION, new HelpTree.Node(i18n, "runTests.verbose.start"));
63 VerboseCommand.addOption(FINISH_OPTION, new HelpTree.Node(i18n, "runTests.verbose.stop"));
64 VerboseCommand.addOption(PROGRESS_OPTION, new HelpTree.Node(i18n, "runTests.verbose.progress"));
65 }
66
67 RunTestsCommand() {
68 super(getName());
69 }
70
71 RunTestsCommand(Iterator argIter) {
72 super(getName());
73 }
74
75 public boolean isActionCommand() {
76 return true;
77 }
78
79 public void run(CommandContext ctx) throws Fault {
80 this.ctx = ctx;
81
82 try {
83 Parameters p = getConfig(ctx); // throws fault if not set
84
85 // might want to move harness down into CommandContext
86 // to share with GUI
87 Harness h = new Harness();
88 harness = h;
89
90 Harness.Observer[] observers = ctx.getHarnessObservers();
91 for (int i = 0; i < observers.length; i++)
|
13 * This code is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * version 2 for more details (a copy is included in the LICENSE file that
17 * accompanied this code).
18 *
19 * You should have received a copy of the GNU General Public License version
20 * 2 along with this work; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24 * or visit www.oracle.com if you need additional information or have any
25 * questions.
26 */
27 package com.sun.javatest.batch;
28
29 import java.io.PrintWriter;
30 import java.text.DateFormat;
31 import java.util.Date;
32 import java.util.Iterator;
33 import java.util.ListIterator;
34
35 import com.sun.javatest.Harness;
36 import com.sun.javatest.Parameters;
37 import com.sun.javatest.Status;
38 import com.sun.javatest.TestFinder;
39 import com.sun.javatest.TestResult;
40 import com.sun.javatest.tool.Command;
41 import com.sun.javatest.tool.CommandContext;
42 import com.sun.javatest.tool.VerboseCommand;
43 import com.sun.javatest.util.HelpTree;
44 import com.sun.javatest.util.I18NResourceBundle;
45
46 class RunTestsCommand extends Command
47 {
48 static String getName() {
49 return "runTests";
50 }
51
52 private static final String DATE_OPTION = "date";
53 private static final String NON_PASS_OPTION = "non-pass";
54 private static final String START_OPTION = "start";
55 private static final String FINISH_OPTION = "stop";
56 private static final String PROGRESS_OPTION = "progress";
57
58 private Harness harness;
59
60 static void initVerboseOptions() {
61 VerboseCommand.addOption(DATE_OPTION, new HelpTree.Node(i18n, "runTests.verbose.date"));
62 VerboseCommand.addOption(NON_PASS_OPTION, new HelpTree.Node(i18n, "runTests.verbose.nonPass"));
63 VerboseCommand.addOption(START_OPTION, new HelpTree.Node(i18n, "runTests.verbose.start"));
64 VerboseCommand.addOption(FINISH_OPTION, new HelpTree.Node(i18n, "runTests.verbose.stop"));
65 VerboseCommand.addOption(PROGRESS_OPTION, new HelpTree.Node(i18n, "runTests.verbose.progress"));
66 }
67
68 RunTestsCommand() {
69 super(getName());
70 }
71
72 RunTestsCommand(ListIterator<String> argIter) {
73 super(getName());
74 }
75
76 public boolean isActionCommand() {
77 return true;
78 }
79
80 public void run(CommandContext ctx) throws Fault {
81 this.ctx = ctx;
82
83 try {
84 Parameters p = getConfig(ctx); // throws fault if not set
85
86 // might want to move harness down into CommandContext
87 // to share with GUI
88 Harness h = new Harness();
89 harness = h;
90
91 Harness.Observer[] observers = ctx.getHarnessObservers();
92 for (int i = 0; i < observers.length; i++)
|