01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.suites.AllPackages
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21: package org.apache.derbyTesting.functionTests.suites;
22:
23: import java.lang.reflect.Method;
24:
25: import junit.framework.Test;
26: import junit.framework.TestSuite;
27:
28: import org.apache.derbyTesting.junit.BaseTestCase;
29: import org.apache.derbyTesting.junit.JDBC;
30:
31: /**
32: * All package suites for the function tests.
33: *
34: * Suites added:
35: * <UL>
36: * <LI> tests.lang
37: * <LI> tests.jdbcapi
38: * <LI> tests.tools
39: * <LI> tests.jdbc4 (Java SE 6 only)
40: * </UL>
41: */
42: public class AllPackages extends BaseTestCase {
43: /**
44: * Use suite method instead.
45: */
46: private AllPackages(String name) {
47: super (name);
48: }
49:
50: public static Test suite() throws Exception {
51:
52: TestSuite suite = new TestSuite("AllPackages");
53:
54: suite
55: .addTest(org.apache.derbyTesting.functionTests.tests.lang._Suite
56: .suite());
57: suite
58: .addTest(org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite
59: .suite());
60: suite
61: .addTest(org.apache.derbyTesting.functionTests.tests.tools._Suite
62: .suite());
63:
64: // Suites that are compiled using Java SE 6 target need to
65: // be added this way, otherwise creating the suite
66: // will throw an invalid class version error
67: if (JDBC.vmSupportsJDBC4()) {
68: suite
69: .addTest(addSuiteByReflection("org.apache.derbyTesting.functionTests.tests.jdbc4._Suite"));
70: }
71:
72: return suite;
73: }
74:
75: /**
76: * Get a class's set of tests from its suite method through reflection.
77: */
78: private static Test addSuiteByReflection(String className)
79: throws Exception {
80: Class clz = Class.forName(className);
81:
82: Method sm = clz.getMethod("suite", null);
83:
84: return (Test) sm.invoke(null, null);
85: }
86:
87: }
|