01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: RifeTestSuite.java 3728 2007-05-01 16:07:54Z gbevin $
07: */
08: package com.uwyn.rife;
09:
10: import com.uwyn.rife.database.Datasource;
11: import com.uwyn.rife.database.Datasources;
12: import java.util.ArrayList;
13:
14: public class RifeTestSuite extends ParametrizedTestSuite {
15: public RifeTestSuite(String name) {
16: super (name);
17: }
18:
19: public void addDatasourcedTestSuite(Class testClass) {
20: ArrayList<Object[]> args_list = new ArrayList<Object[]>();
21: for (String datasource_name : Datasources.getRepInstance()
22: .getDatasourceNames()) {
23: if (datasource_name.startsWith("unittests")) {
24: args_list
25: .add(new Object[] {
26: Datasources.getRepInstance()
27: .getDatasource(datasource_name),
28: datasource_name, null });
29: }
30: }
31:
32: addTest(new ParametrizedTestSuite(testClass, new Class[] {
33: Datasource.class, String.class, String.class },
34: args_list));
35: }
36:
37: public void addServersideTestSuite(Class testClass) {
38: ArrayList<Object[]> args_list = new ArrayList<Object[]>();
39: args_list.add(new Object[] { TestCaseServerside.SITE_FILTER,
40: null });
41: args_list.add(new Object[] { TestCaseServerside.SITE_SERVLET,
42: null });
43:
44: addTest(new ParametrizedTestSuite(testClass, new Class[] {
45: int.class, String.class }, args_list));
46: }
47:
48: public void addDatasourcedServersideTestSuite(Class testClass) {
49: ArrayList<Object[]> args_list = new ArrayList<Object[]>();
50: for (String datasource_name : Datasources.getRepInstance()
51: .getDatasourceNames()) {
52: if (datasource_name.startsWith("unittests")) {
53: args_list.add(new Object[] { datasource_name,
54: TestCaseServerside.SITE_FILTER, null });
55: args_list.add(new Object[] { datasource_name,
56: TestCaseServerside.SITE_SERVLET, null });
57: }
58: }
59:
60: addTest(new ParametrizedTestSuite(testClass, new Class[] {
61: String.class, int.class, String.class }, args_list));
62: }
63: }
|