KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > suites > AllPackages


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.suites.AllPackages
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (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 JavaDoc;
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 JavaDoc name) {
47         super(name);
48     }
49
50     public static Test suite() throws Exception JavaDoc {
51
52         TestSuite suite = new TestSuite("AllPackages");
53         
54         suite.addTest(org.apache.derbyTesting.functionTests.tests.lang._Suite.suite());
55         suite.addTest(org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite.suite());
56         suite.addTest(org.apache.derbyTesting.functionTests.tests.tools._Suite.suite());
57
58         // Suites that are compiled using Java SE 6 target need to
59
// be added this way, otherwise creating the suite
60
// will throw an invalid class version error
61
if (JDBC.vmSupportsJDBC4())
62         {
63             suite.addTest(
64                     addSuiteByReflection(
65                             "org.apache.derbyTesting.functionTests.tests.jdbc4._Suite"));
66         }
67
68         return suite;
69     }
70     
71     /**
72      * Get a class's set of tests from its suite method through reflection.
73      */

74     private static Test addSuiteByReflection(String JavaDoc className) throws Exception JavaDoc
75     {
76         Class JavaDoc clz = Class.forName(className);
77         
78         Method JavaDoc sm = clz.getMethod("suite", null);
79               
80         return (Test) sm.invoke(null, null);
81     }
82
83 }
84
Popular Tags