From 0a7ca4196c10ea0d0eab64bb0c9a443d9af13d00 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 24 Nov 2004 11:42:49 +0000 Subject: [PATCH] fixed the authenitication client factory to produce test clients, too --- .../etc/authenticationClient.xml | 13 ++++++++++- .../src/AuthenticationClientFactory.cxx | 23 ++++++++++++++----- .../storage/etc/authenticationClient.xml | 13 ++++++++++- .../scheduler/etc/authenticationClient.xml | 13 ++++++++++- 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/livesupport/modules/authentication/etc/authenticationClient.xml b/livesupport/modules/authentication/etc/authenticationClient.xml index f0f8fe0bc..ac5d17096 100644 --- a/livesupport/modules/authentication/etc/authenticationClient.xml +++ b/livesupport/modules/authentication/etc/authenticationClient.xml @@ -1,7 +1,14 @@ + + + + + + + @@ -9,8 +16,12 @@ + ]> + + + diff --git a/livesupport/modules/authentication/src/AuthenticationClientFactory.cxx b/livesupport/modules/authentication/src/AuthenticationClientFactory.cxx index f6399cac9..466ef3317 100644 --- a/livesupport/modules/authentication/src/AuthenticationClientFactory.cxx +++ b/livesupport/modules/authentication/src/AuthenticationClientFactory.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/AuthenticationClientFactory.cxx,v $ ------------------------------------------------------------------------------*/ @@ -34,6 +34,7 @@ #endif #include "LiveSupport/Authentication/AuthenticationClientFactory.h" +#include "TestAuthenticationClient.h" #include "LiveSupport/Authentication/WebAuthenticationClient.h" using namespace LiveSupport::Core; @@ -92,8 +93,20 @@ AuthenticationClientFactory :: configure(const xmlpp::Element & element) authenticationClient.reset(); - // try to look for an WebAuthenticationClient configuration element + // try to look for a TestAuthenticationClient configuration element xmlpp::Node::NodeList nodes = + element.get_children(TestAuthenticationClient::getConfigElementName()); + if (nodes.size() >= 1) { + const xmlpp::Element * configElement = + dynamic_cast (*(nodes.begin())); + Ptr::Ref tac(new TestAuthenticationClient()); + tac->configure(*configElement); + authenticationClient = tac; + return; + } + + // try to look for a WebAuthenticationClient configuration element + nodes = element.get_children(WebAuthenticationClient::getConfigElementName()); if (nodes.size() >= 1) { const xmlpp::Element * configElement = @@ -101,11 +114,9 @@ AuthenticationClientFactory :: configure(const xmlpp::Element & element) Ptr::Ref wac(new WebAuthenticationClient()); wac->configure(*configElement); authenticationClient = wac; + return; } - if (!authenticationClient) { - throw std::invalid_argument("no authentication client factories " - "to configure"); - } + throw std::invalid_argument("no authentication client configuration found"); } diff --git a/livesupport/modules/storage/etc/authenticationClient.xml b/livesupport/modules/storage/etc/authenticationClient.xml index f0f8fe0bc..ac5d17096 100644 --- a/livesupport/modules/storage/etc/authenticationClient.xml +++ b/livesupport/modules/storage/etc/authenticationClient.xml @@ -1,7 +1,14 @@ + + + + + + + @@ -9,8 +16,12 @@ + ]> + + + diff --git a/livesupport/products/scheduler/etc/authenticationClient.xml b/livesupport/products/scheduler/etc/authenticationClient.xml index f0f8fe0bc..ac5d17096 100644 --- a/livesupport/products/scheduler/etc/authenticationClient.xml +++ b/livesupport/products/scheduler/etc/authenticationClient.xml @@ -1,7 +1,14 @@ + + + + + + + @@ -9,8 +16,12 @@ + ]> + + +