added possibility for personalized development

(e.g. sharing a system between multiple developers)
This commit is contained in:
maroy 2005-04-08 11:56:37 +00:00
parent 7b09d7d251
commit 66bd876f08
130 changed files with 2742 additions and 2210 deletions

View file

@ -21,7 +21,7 @@
#
#
# Author : $Author: maroy $
# Version : $Revision: 1.8 $
# Version : $Revision: 1.9 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/etc/Makefile.in,v $
#
# @configure_input@
@ -43,6 +43,7 @@ BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen
COVERAGE_DIR = ${DOC_DIR}/coverage
BIN_DIR = ${BASE_DIR}/bin
ETC_DIR = ${BASE_DIR}/etc
INCLUDE_DIR = ${BASE_DIR}/include
LIB_DIR = ${BASE_DIR}/lib
@ -73,9 +74,9 @@ TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl
DB_LIB = livesupport_db
DB_LIB_FILE = ${LIB_DIR}/lib${DB_LIB}.a
TEST_RUNNER = ${TMP_DIR}/testRunner
DB_LIB = livesupport_db
DB_LIB_FILE = ${LIB_DIR}/lib${DB_LIB}.a
TEST_RUNNER = ${TMP_DIR}/testRunner
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
@ -108,9 +109,9 @@ LDFLAGS = @LDFLAGS@ -pthread \
DB_LIB_OBJS = ${TMP_DIR}/SimpleConnectionManager.o \
${TMP_DIR}/ConnectionManagerFactory.o \
${TMP_DIR}/Conversion.o
TEST_RUNNER_OBJS = ${TMP_DIR}/SimpleConnectionManagerTest.o \
${TMP_DIR}/ConnectionManagerFactoryTest.o \
${TMP_DIR}/TestRunner.o
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
${TMP_DIR}/SimpleConnectionManagerTest.o \
${TMP_DIR}/ConnectionManagerFactoryTest.o
TEST_RUNNER_LIBS = -l${DB_LIB} -l${CORE_LIB} -lcppunit -ldl

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE connectionManagerFactory [
<!ELEMENT connectionManagerFactory (simpleConnectionManager) >
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<connectionManagerFactory>
<simpleConnectionManager dsn = "ls_database"
userName = "ls_dbuser"
password = "ls_dbpassword"
/>
</connectionManagerFactory>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE simpleConnectionManager [
<!ELEMENT simpleConnectionManager EMPTY >
<!ATTLIST simpleConnectionManager dsn CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager userName CDATA #REQUIRED >
<!ATTLIST simpleConnectionManager password CDATA #REQUIRED >
]>
<simpleConnectionManager dsn = "ls_database"
userName = "ls_dbuser"
password = "ls_dbpassword"
/>

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/ConnectionManagerFactoryTest.cxx,v $
------------------------------------------------------------------------------*/
@ -61,7 +61,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ConnectionManagerFactoryTest);
/**
* The name of the configuration file for the connection manager factory.
*/
static const std::string configFileName = "etc/connectionManagerFactory.xml";
static const std::string configFileName = "connectionManagerFactory.xml";
/* =============================================== local function prototypes */
@ -95,9 +95,9 @@ ConnectionManagerFactoryTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
try {
Ptr<xmlpp::DomParser>::Ref parser(
new xmlpp::DomParser(configFileName, true));
const xmlpp::Document * document = parser->get_document();
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
Ptr<ConnectionManagerFactory>::Ref cmf =
ConnectionManagerFactory::getInstance();
@ -118,7 +118,9 @@ ConnectionManagerFactoryTest :: firstTest(void)
CPPUNIT_ASSERT(rs->getInt(1) == 1);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
CPPUNIT_FAIL(e.what());
} catch (std::runtime_error &e) {
CPPUNIT_FAIL(e.what());
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL(e.what());
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/ConnectionManagerFactoryTest.h,v $
------------------------------------------------------------------------------*/
@ -42,10 +42,15 @@
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport::Core;
/* ================================================================ constants */
@ -58,10 +63,10 @@ namespace Db {
* Unit test for the ConnectionManagerFactory class.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see ConnectionManagerFactory
*/
class ConnectionManagerFactoryTest : public CPPUNIT_NS::TestFixture
class ConnectionManagerFactoryTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(ConnectionManagerFactoryTest);
CPPUNIT_TEST(firstTest);

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManager.cxx,v $
------------------------------------------------------------------------------*/
@ -120,7 +120,6 @@ SimpleConnectionManager :: getConnection(void)
throw (std::runtime_error)
{
odbc::Connection * conn;
try {
conn = odbc::DriverManager::getConnection(dsn, userName, password);
} catch (std::exception &e) {
@ -128,7 +127,7 @@ SimpleConnectionManager :: getConnection(void)
}
if (!conn) {
std::string eMsg = "unable to option ODBC connection for DSN ";
std::string eMsg = "unable to open ODBC connection for DSN ";
eMsg += dsn;
throw std::runtime_error(eMsg);
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManagerTest.cxx,v $
------------------------------------------------------------------------------*/
@ -61,7 +61,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(SimpleConnectionManagerTest);
/**
* The name of the configuration file for the connection manager.
*/
static const std::string configFileName = "etc/simpleConnectionManager.xml";
static const std::string configFileName = "simpleConnectionManager.xml";
/* =============================================== local function prototypes */
@ -95,9 +95,9 @@ SimpleConnectionManagerTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
try {
Ptr<xmlpp::DomParser>::Ref parser(
new xmlpp::DomParser(configFileName, true));
const xmlpp::Document * document = parser->get_document();
xmlpp::DomParser parser;
const xmlpp::Document * document = getConfigDocument(parser,
configFileName);
const xmlpp::Element * root = document->get_root_node();
Ptr<SimpleConnectionManager>::Ref scm(new SimpleConnectionManager());
@ -114,7 +114,9 @@ SimpleConnectionManagerTest :: firstTest(void)
CPPUNIT_ASSERT(rs->getInt(1) == 1);
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file");
CPPUNIT_FAIL(e.what());
} catch (std::runtime_error &e) {
CPPUNIT_FAIL(e.what());
} catch (xmlpp::exception &e) {
CPPUNIT_FAIL(e.what());
}

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManagerTest.h,v $
------------------------------------------------------------------------------*/
@ -42,10 +42,15 @@
#include <cppunit/extensions/HelperMacros.h>
#include "LiveSupport/Core/BaseTestMethod.h"
namespace LiveSupport {
namespace Db {
using namespace LiveSupport::Core;
/* ================================================================ constants */
@ -58,10 +63,10 @@ namespace Db {
* Unit test for the SimpleConnectionManager class.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see SimpleConnectionManager
*/
class SimpleConnectionManagerTest : public CPPUNIT_NS::TestFixture
class SimpleConnectionManagerTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(SimpleConnectionManagerTest);
CPPUNIT_TEST(firstTest);