X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fpersistence%2FExternalDatabase.java;h=31bcf1e2e090bf2e7522b0677e557086fd1728d0;hb=dec278a67997ea8e85d10662e31548afd8890ed3;hp=2533df427ebebffc836767dc7cb5e49493c88031;hpb=2207a1e695ce23e79678c232cff2ceb84ebaa801;p=utils diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/ExternalDatabase.java b/test/enterprise/src/main/java/org/wamblee/support/persistence/ExternalDatabase.java index 2533df42..31bcf1e2 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/persistence/ExternalDatabase.java +++ b/test/enterprise/src/main/java/org/wamblee/support/persistence/ExternalDatabase.java @@ -1,82 +1,82 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.wamblee.support.persistence; -import java.util.Arrays; -import java.util.List; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp.ConnectionFactory; -import org.apache.commons.dbcp.DriverManagerConnectionFactory; -import org.apache.commons.dbcp.PoolableConnectionFactory; -import org.apache.commons.dbcp.PoolingDataSource; -import org.apache.commons.pool.impl.GenericObjectPool; /** - * Database that encapsulates connection to an external database. - * Database connection details can be configured through system properties - * and environment variables, see {@link #DB_URL_PROP}, {@link #DB_USER_PROP}, and - * {@link #DB_PASSWORD_PROP|. + * Database that encapsulates connection to an external database. Database + * connection details can be configured through system properties and + * environment variables, see {@link #DB_URL_PROP}, {@link #DB_USER_PROP}, and + * {@link #DB_PASSWORD_PROP|. * - * This class assumes modern database drivers that work together with java.util.ServiceLoader - * so that explicitly doing a Class.forName() is not necessary to load the database driver. + * This class assumes modern database drivers that work together with + * java.util.ServiceLoader so that explicitly doing a Class.forName() is not + * necessary to load the database driver. */ public class ExternalDatabase extends AbstractDatabase { - - private static final Logger LOGGER = Logger.getLogger(ExternalDatabase.class.getName()); - - /** - * System property/environment variable that defines the database URL. - */ - public static final String DB_URL_PROP = "TEST_DB_URL"; - - /** - * System property/environment variable that defines the database user. - */ - public static final String DB_USER_PROP = "TEST_DB_USER"; - - /** - * System property/environment variable that defines the database password. - */ - public static final String DB_PASSWORD_PROP = "TEST_DB_PASSWORD"; + /** + * System property/environment variable that defines the database URL. + */ + public static final String DB_URL_PROP = "TEST_DB_URL"; + + /** + * System property/environment variable that defines the database user. + */ + public static final String DB_USER_PROP = "TEST_DB_USER"; + + /** + * System property/environment variable that defines the database password. + */ + public static final String DB_PASSWORD_PROP = "TEST_DB_PASSWORD"; + + private String itsUrl; + private String itsUser; + private String itsPassword; + + public ExternalDatabase() { + // Empty + } + + public String getExternalJdbcUrl() { + return itsUrl; + } - private String itsUrl; - private String itsUser; - private String itsPassword; - - private DataSource itsDataSource; - - public ExternalDatabase() { - // Empty - } - - public String getExternalJdbcUrl() { - return itsUrl; - } + public String getJdbcUrl() { + return itsUrl; + } - public String getJdbcUrl() { - return itsUrl; - } + public String getPassword() { + return itsPassword; + } - public String getPassword() { - return itsPassword; - } + public String getUsername() { + return itsUser; + } - public String getUsername() { - return itsUser; - } + public void doStart() { + itsUrl = getProperty(DB_URL_PROP); + itsUser = getProperty(DB_USER_PROP); + itsPassword = getProperty(DB_PASSWORD_PROP); - public void doStart() { - itsUrl = getProperty(DB_URL_PROP); - itsUser = getProperty(DB_USER_PROP); - itsPassword = getProperty(DB_PASSWORD_PROP); - - createDataSource(); - } + createDataSource(); + } - public void doStop() { - // Empty. - } + public void doStop() { + // Empty. + } }