1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 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 * Console Runner. 32 * 33 * This runner can be started for a console and accepts two parameters: OpenCMIS 34 * Session parameters file name and group list file name. 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 public void startGroup(CmisTestGroup group) { 59 System.out.println(group.getName() + " (" + group.getTests().size() + " tests)"); 60 } 61 62 public void endGroup(CmisTestGroup group) { 63 System.out.println(); 64 } 65 66 public void startTest(CmisTest test) { 67 System.out.print("."); 68 } 69 70 public void endTest(CmisTest test) { 71 } 72 73 public void message(String msg) { 74 System.out.println(msg); 75 } 76 } 77 78 public static void main(String[] args) throws Exception { 79 new ConsoleRunner(args); 80 } 81 }