1/*
2 * Copyright (c) 2003 World Wide Web Consortium, (Massachusetts Institute
3 * of 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
12package org.w3c.domts.level3.ls;
13
14import java.lang.reflect.Constructor;
15
16import javax.xml.parsers.DocumentBuilderFactory;
17
18import junit.framework.TestSuite;
19
20import org.w3c.domts.DOMTestDocumentBuilderFactory;
21import org.w3c.domts.DOMTestSuite;
22import org.w3c.domts.JAXPDOMTestDocumentBuilderFactory;
23import org.w3c.domts.JUnitTestSuiteAdapter;
24
25/**
26 * A JUnit test suite that will run all Load and Save tests
27 * using the Oracle XML Parser for Java
28 *
29 * @author Curt Arnold
30 *
31 */
32public class TestOracle extends TestSuite {
33
34	/**
35	 * Constructs the test suite
36	 *
37	 * @return test suite
38	 * @throws Exception can throw class load exceptions
39	 * if class path does not contain dom3-ls.jar or
40	 * xmlparserv2.jar
41	 */
42	public static TestSuite suite() throws Exception {
43		Class testClass =
44			ClassLoader.getSystemClassLoader().loadClass(
45				"org.w3c.domts.level3.ls.alltests");
46		Constructor testConstructor =
47			testClass.getConstructor(
48				new Class[] { DOMTestDocumentBuilderFactory.class });
49
50		DocumentBuilderFactory jxFactory =
51			(DocumentBuilderFactory) ClassLoader
52				.getSystemClassLoader()
53				.loadClass("oracle.xml.jaxp.JXDocumentBuilderFactory")
54				.newInstance();
55
56		DOMTestDocumentBuilderFactory factory =
57			new JAXPDOMTestDocumentBuilderFactory(
58				jxFactory,
59				JAXPDOMTestDocumentBuilderFactory.getConfiguration1());
60
61		Object test = testConstructor.newInstance(new Object[] { factory });
62
63		return new JUnitTestSuiteAdapter((DOMTestSuite) test);
64	}
65
66}
67