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 "License"); 7 * you may not use this file except in compliance with the License. 8 * 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, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.qetest; 19 20 /** 21 * A test driver class, to invoke an XML document parser. 22 * 23 * @author mukulg@apache.org 24 * @version $Id$ 25 */ 26 public class XMLParserTestDriver { 27 28 private static String SUCCESS_MESG = "The test case passed"; 29 30 private static String FAIL_MESG = "Test failed. Please solve this, before checking in"; 31 32 private static String FILE_EXT_SEPARATOR = "."; 33 main(String[] args)34 public static void main(String[] args) { 35 String xmlFilePath = args[0]; 36 String contextProcessor = args[1]; 37 documentParse(xmlFilePath, contextProcessor); 38 } 39 documentParse(String xmlFilePath, String contextProcessor)40 private static void documentParse(String xmlFilePath, String contextProcessor) { 41 XMLParse xmlParse = new XMLParse(xmlFilePath); 42 boolean isDocumentWellFormedXml = xmlParse.parse(); 43 if (isDocumentWellFormedXml) { 44 System.out.println(SUCCESS_MESG + " [" + contextProcessor + " : " + xmlFilePath.substring(0, 45 xmlFilePath.indexOf(FILE_EXT_SEPARATOR)) + "]!"); 46 } 47 else { 48 System.out.println(FAIL_MESG + " [" + contextProcessor + " : " + xmlFilePath.substring(0, 49 xmlFilePath.indexOf(FILE_EXT_SEPARATOR)) + "]!"); 50 } 51 } 52 53 } 54