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