01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
03: * Steven Grimm <koreth[remove] at midwinter dot com>
04: * Distributed under the terms of either:
05: * - the common development and distribution license (CDDL), v1.0; or
06: * - the GNU Lesser General Public License, v2.1 or later
07: * $Id: TestsuiteDatabaseAuthenticated.java 3643 2007-01-12 15:29:45Z gbevin $
08: */
09: package com.uwyn.rife.authentication.elements;
10:
11: import com.uwyn.rife.TestCaseServerside;
12: import com.uwyn.rife.config.Config;
13: import com.uwyn.rife.database.Datasources;
14: import com.uwyn.rife.ioc.HierarchicalProperties;
15:
16: public abstract class TestsuiteDatabaseAuthenticated extends
17: TestCaseServerside {
18: private String mDatasourceName = null;
19: protected HierarchicalProperties mProperties = null;
20:
21: public TestsuiteDatabaseAuthenticated(String datasourceName,
22: int siteType, String name) {
23: super (siteType, name);
24:
25: mDatasourceName = datasourceName;
26: mProperties = new HierarchicalProperties();
27: }
28:
29: public void setUp() throws Exception {
30: super .setUp();
31:
32: Config.getRepInstance().setParameter("unittestsdatasource",
33: mDatasourceName);
34: Config.getRepInstance().setParameter(
35: "sessiondurationunittestsdatasource",
36: "sessionduration" + mDatasourceName);
37: Config.getRepInstance().setParameter(
38: "purgingunittestsdatasource",
39: "purging" + mDatasourceName);
40: }
41:
42: public void tearDown() throws Exception {
43: // reset all the connections since some databases don't support meta data
44: // updates when other connections are active
45: Datasources.getRepInstance().getDatasource(
46: Config.getRepInstance().getString(
47: "purgingunittestsdatasource")).cleanup();
48: Datasources.getRepInstance().getDatasource(
49: Config.getRepInstance().getString(
50: "sessiondurationunittestsdatasource"))
51: .cleanup();
52: Datasources.getRepInstance().getDatasource(
53: Config.getRepInstance()
54: .getString("unittestsdatasource")).cleanup();
55:
56: Config.getRepInstance().removeParameter(
57: "purgingunittestsdatasource");
58: Config.getRepInstance().removeParameter(
59: "sessiondurationunittestsdatasource");
60: Config.getRepInstance().removeParameter("unittestsdatasource");
61:
62: super.tearDown();
63: }
64: }
|