Home | History | Annotate | Download | only in ls
      1 /*
      2  * Copyright (c) 2001-2003 World Wide Web Consortium,
      3  * (Massachusetts Institute of Technology, Institut National de
      4  * Recherche en Informatique et en Automatique, Keio University). All
      5  * Rights Reserved. This program is distributed under the W3C's Software
      6  * Intellectual Property License. This program is distributed in the
      7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
      8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      9  * PURPOSE.
     10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     11  */
     12 
     13 
     14 package org.w3c.domts.level3.ls;
     15 
     16 import java.lang.reflect.Constructor;
     17 
     18 import javax.xml.parsers.DocumentBuilderFactory;
     19 
     20 import junit.framework.TestSuite;
     21 
     22 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     23 import org.w3c.domts.DOMTestSuite;
     24 import org.w3c.domts.JAXPDOMTestDocumentBuilderFactory;
     25 import org.w3c.domts.JUnitTestSuiteAdapter;
     26 
     27 /**
     28  * A JUnit test suite that will run all Load and Save tests
     29  * using Xerces-J
     30  *
     31  * @author Curt Arnold
     32  *
     33  */
     34 public class TestXerces extends TestSuite {
     35 
     36   public static TestSuite suite() throws Exception
     37   {
     38     Class testClass = ClassLoader.getSystemClassLoader().loadClass("org.w3c.domts.level3.ls.alltests");
     39     Constructor testConstructor = testClass.getConstructor(new Class[] { DOMTestDocumentBuilderFactory.class });
     40 
     41     DocumentBuilderFactory xercesFactory = (DocumentBuilderFactory)
     42       ClassLoader.getSystemClassLoader().loadClass("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl").newInstance();
     43 
     44     DOMTestDocumentBuilderFactory factory =
     45         new JAXPDOMTestDocumentBuilderFactory(xercesFactory,
     46           JAXPDOMTestDocumentBuilderFactory.getConfiguration1());
     47 
     48 
     49     Object test = testConstructor.newInstance(new Object[] { factory });
     50 
     51     return new JUnitTestSuiteAdapter((DOMTestSuite) test);
     52   }
     53 
     54 
     55 }
     56 
     57