1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.tck.runner;
20
21 import java.io.File;
22 import java.io.PrintWriter;
23
24 import org.apache.chemistry.opencmis.tck.CmisTest;
25 import org.apache.chemistry.opencmis.tck.CmisTestGroup;
26 import org.apache.chemistry.opencmis.tck.CmisTestProgressMonitor;
27 import org.apache.chemistry.opencmis.tck.CmisTestReport;
28 import org.apache.chemistry.opencmis.tck.report.TextReport;
29
30
31
32
33
34
35
36 public class ConsoleRunner extends AbstractRunner {
37
38 public ConsoleRunner(String[] args) throws Exception {
39 if (args.length < 1) {
40 setParameters(null);
41 } else {
42 loadParameters(new File(args[0]));
43 }
44
45 if (args.length < 2) {
46 loadDefaultTckGroups();
47 } else {
48 loadGroups(new File(args[1]));
49 }
50
51 run(new ConsoleProgressMonitor());
52
53 CmisTestReport report = new TextReport();
54 report.createReport(getParameters(), getGroups(), new PrintWriter(System.out));
55 }
56
57 private static class ConsoleProgressMonitor implements CmisTestProgressMonitor {
58
59 @Override
60 @SuppressWarnings("PMD.SystemPrintln")
61 public void startGroup(CmisTestGroup group) {
62 System.out.println(group.getName() + " (" + group.getTests().size() + " tests)");
63 }
64
65 @Override
66 @SuppressWarnings("PMD.SystemPrintln")
67 public void endGroup(CmisTestGroup group) {
68 System.out.println();
69 }
70
71 @Override
72 @SuppressWarnings("PMD.SystemPrintln")
73 public void startTest(CmisTest test) {
74 System.out.print('.');
75 }
76
77 @Override
78 public void endTest(CmisTest test) {
79 }
80
81 @Override
82 @SuppressWarnings("PMD.SystemPrintln")
83 public void message(String msg) {
84 System.out.println(msg);
85 }
86 }
87
88 public static void main(String[] args) throws Exception {
89 new ConsoleRunner(args);
90 }
91 }