1 /*
2 * DatabaseConnectionTest.java Mar 26, 2002
3 *
4 * The DbUnit Database Testing Framework
5 * Copyright (C)2002-2004, DbUnit.org
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23 package org.dbunit.database;
24
25 import org.dbunit.DatabaseProfile;
26 import org.dbunit.IDatabaseTester;
27 import org.dbunit.PropertiesBasedJdbcDatabaseTester;
28
29 /**
30 * @author Andres Almiray (aalmiray@users.sourceforge.net)
31 * @author Last changed by: $Author$
32 * @version $Revision$ $Date$
33 * @since 2.2.0
34 */
35 public class DefaultDatabaseTesterConnectionIT
36 extends AbstractDatabaseTesterConnectionIT
37 {
38 private PropertiesBasedJdbcDatabaseTester databaseTester;
39
40 @Override
41 protected IDatabaseTester getDatabaseTester() throws Exception
42 {
43 if (databaseTester == null)
44 {
45 final DatabaseProfile profile = getEnvironment().getProfile();
46 System.setProperty(
47 PropertiesBasedJdbcDatabaseTester.DBUNIT_DRIVER_CLASS,
48 profile.getDriverClass());
49 System.setProperty(
50 PropertiesBasedJdbcDatabaseTester.DBUNIT_CONNECTION_URL,
51 profile.getConnectionUrl());
52 System.setProperty(
53 PropertiesBasedJdbcDatabaseTester.DBUNIT_USERNAME,
54 profile.getUser());
55 System.setProperty(
56 PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD,
57 profile.getPassword());
58 System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_SCHEMA,
59 profile.getSchema());
60 databaseTester = new PropertiesBasedJdbcDatabaseTester();
61 }
62 return databaseTester;
63 }
64 }