X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fpersistence%2FExternalDatabase.java;h=b8167036cbfb3c60e40977f7a1634d1797c1f20b;hb=17775e14ecfb286e59f67117e5cee7e21e95ab1f;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..b8167036 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,3 +1,18 @@ +/* + * 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; @@ -13,70 +28,71 @@ 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"; - - - 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 getPassword() { - return itsPassword; - } - - public String getUsername() { - return itsUser; - } - - public void doStart() { - itsUrl = getProperty(DB_URL_PROP); - itsUser = getProperty(DB_USER_PROP); - itsPassword = getProperty(DB_PASSWORD_PROP); - - createDataSource(); - } - - public void doStop() { - // Empty. - } + + 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"; + + 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 getPassword() { + return itsPassword; + } + + public String getUsername() { + return itsUser; + } + + public void doStart() { + itsUrl = getProperty(DB_URL_PROP); + itsUser = getProperty(DB_USER_PROP); + itsPassword = getProperty(DB_PASSWORD_PROP); + + createDataSource(); + } + + public void doStop() { + // Empty. + } }