added a test authentication client, and (temporarily) removed the
'make -C modules/storageServer' lines from the makefiles
This commit is contained in:
parent
1013c9b913
commit
06a2fcd2a0
|
@ -20,8 +20,8 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.3 $
|
# Version : $Revision: 1.4 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -96,9 +96,11 @@ LDFLAGS = @LDFLAGS@ -pthread -L${USR_LIB_DIR} -L${CORE_LIB_DIR} -L${LIB_DIR}
|
||||||
# Dependencies
|
# Dependencies
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
AUTHENTICATION_LIB_OBJS = ${TMP_DIR}/AuthenticationClientFactory.o \
|
AUTHENTICATION_LIB_OBJS = ${TMP_DIR}/AuthenticationClientFactory.o \
|
||||||
|
${TMP_DIR}/TestAuthenticationClient.o \
|
||||||
${TMP_DIR}/WebAuthenticationClient.o
|
${TMP_DIR}/WebAuthenticationClient.o
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${TMP_DIR}/WebAuthenticationClientTest.o \
|
TEST_RUNNER_OBJS = ${TMP_DIR}/WebAuthenticationClientTest.o \
|
||||||
|
${TMP_DIR}/TestAuthenticationClientTest.o \
|
||||||
${TMP_DIR}/TestRunner.o
|
${TMP_DIR}/TestRunner.o
|
||||||
|
|
||||||
TEST_RUNNER_LIBS = -l${AUTHENTICATION_LIB} -l${CORE_LIB} -lxml++-1.0 \
|
TEST_RUNNER_LIBS = -l${AUTHENTICATION_LIB} -l${CORE_LIB} -lxml++-1.0 \
|
||||||
|
@ -133,7 +135,7 @@ distclean: clean docclean
|
||||||
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
||||||
|
|
||||||
check: all ${TEST_RUNNER}
|
check: all ${TEST_RUNNER}
|
||||||
${MAKE} -C ${STORAGE_SERVER_DIR}
|
# ${MAKE} -C ${STORAGE_SERVER_DIR}
|
||||||
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \
|
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \
|
||||||
-o ${TEST_RESULTS} -s ${TEST_XSLT}
|
-o ${TEST_RESULTS} -s ${TEST_XSLT}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/include/LiveSupport/Authentication/Attic/WebAuthenticationClient.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/include/LiveSupport/Authentication/Attic/WebAuthenticationClient.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -69,7 +69,7 @@ using namespace LiveSupport::Core;
|
||||||
* called webAuthentication. This element contains a child element
|
* called webAuthentication. This element contains a child element
|
||||||
* specifying the location of the authentication server.
|
* specifying the location of the authentication server.
|
||||||
*
|
*
|
||||||
* A authenticationClientFactory configuration element may look like the following:
|
* A webAuthentication configuration element may look like the following:
|
||||||
*
|
*
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
* <webAuthentication>
|
* <webAuthentication>
|
||||||
|
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
class WebAuthenticationClient :
|
class WebAuthenticationClient :
|
||||||
virtual public Configurable,
|
virtual public Configurable,
|
||||||
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#error "Need unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream> // for testing only, REMOVE THIS later
|
||||||
|
#include <fstream>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
#include <XmlRpcClient.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "TestAuthenticationClient.h"
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
using namespace XmlRpc;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Authentication;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ configuration file constants */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element for this class
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string TestAuthenticationClient::configElementNameStr
|
||||||
|
= "testAuthentication";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config child element for the login and password
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string userConfigElementName = "user";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element attribute for the login
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string userLoginAttrName = "login";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element attribute for the password
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string userPasswordAttrName = "password";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The dummy sessionId string returned by this authentication client
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string dummySessionIdString = "dummySessionId";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Configure the test storage client.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestAuthenticationClient :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error)
|
||||||
|
{
|
||||||
|
if (element.get_name() != configElementNameStr) {
|
||||||
|
std::string eMsg = "Bad configuration element ";
|
||||||
|
eMsg += element.get_name();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute * attribute;
|
||||||
|
|
||||||
|
// read the user data
|
||||||
|
xmlpp::Node::NodeList childNodes
|
||||||
|
= element.get_children(userConfigElementName);
|
||||||
|
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
||||||
|
|
||||||
|
if (it == childNodes.end()) {
|
||||||
|
std::string eMsg = "missing ";
|
||||||
|
eMsg += userConfigElementName;
|
||||||
|
eMsg += " XML element";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Element * userConfigElement
|
||||||
|
= dynamic_cast<const xmlpp::Element*> (*it);
|
||||||
|
if (!(attribute = userConfigElement
|
||||||
|
->get_attribute(userLoginAttrName))) {
|
||||||
|
std::string eMsg = "Missing attribute ";
|
||||||
|
eMsg += userLoginAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
userLogin = attribute->get_value();
|
||||||
|
|
||||||
|
if (!(attribute = userConfigElement
|
||||||
|
->get_attribute(userPasswordAttrName))) {
|
||||||
|
std::string eMsg = "Missing attribute ";
|
||||||
|
eMsg += userPasswordAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
userPassword = attribute->get_value();
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
std::string eMsg = "more than one ";
|
||||||
|
eMsg += userConfigElementName;
|
||||||
|
eMsg += " XML element";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionIdList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Login to the storage server.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<SessionId>::Ref
|
||||||
|
TestAuthenticationClient :: login(const std::string & login,
|
||||||
|
const std::string & password)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<SessionId>::Ref sessionId; // initialized to 0
|
||||||
|
|
||||||
|
if (login == userLogin && password == userPassword) {
|
||||||
|
std::stringstream sessionIdStream;
|
||||||
|
sessionIdStream << dummySessionIdString;
|
||||||
|
sessionIdStream << rand();
|
||||||
|
sessionIdList.insert(sessionIdStream.str());
|
||||||
|
sessionId.reset(new SessionId(sessionIdStream.str()));
|
||||||
|
}
|
||||||
|
return sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Logout from the storage server.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const bool
|
||||||
|
TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
if (sessionIdList.erase(sessionId->getId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,202 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef TestAuthenticationClient_h
|
||||||
|
#define TestAuthenticationClient_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
#include "LiveSupport/Core/AuthenticationClientInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Authentication {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dummy authentication client.
|
||||||
|
*
|
||||||
|
* This object has to be configured with an XML configuration element
|
||||||
|
* called testAuthentication. This element contains a child element
|
||||||
|
* specifying the login and password.
|
||||||
|
*
|
||||||
|
* A testAuthentication configuration element may look like the following:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <testAuthentication>
|
||||||
|
* <user
|
||||||
|
* login="root"
|
||||||
|
* password="q"
|
||||||
|
* />
|
||||||
|
* </testAuthentication>
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* The DTD for the above element is:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <!ELEMENT testAuthentication (user) >
|
||||||
|
* <!ELEMENT user EMPTY >
|
||||||
|
* <!ATTLIST user login CDATA #REQUIRED >
|
||||||
|
* <!ATTLIST user password CDATA #REQUIRED >
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class TestAuthenticationClient :
|
||||||
|
virtual public Configurable,
|
||||||
|
virtual public AuthenticationClientInterface
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of the configuration XML elmenent used by
|
||||||
|
* TestAuthenticationClient
|
||||||
|
*/
|
||||||
|
static const std::string configElementNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the storage server, e.g. "myserver.mycompany.com".
|
||||||
|
*/
|
||||||
|
std::string userLogin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the storage server php page.
|
||||||
|
*/
|
||||||
|
std::string userPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type for the list of sessionId's.
|
||||||
|
*/
|
||||||
|
typedef std::set<std::string>
|
||||||
|
sessionIdListType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the sessionId's we have issued.
|
||||||
|
*/
|
||||||
|
sessionIdListType sessionIdList;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~TestAuthenticationClient(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return configElementNameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the object based on the XML element supplied.
|
||||||
|
*
|
||||||
|
* @param element the XML element to configure the object from.
|
||||||
|
* @exception std::invalid_argument if the supplied XML element
|
||||||
|
* contains bad configuraiton information
|
||||||
|
* @exception std::logic_error if the scheduler daemon has already
|
||||||
|
* been configured, and can not be reconfigured.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login to the storage server, using the data read from the
|
||||||
|
* configuration file.
|
||||||
|
* Returns a new session ID; in case of an error, returns a
|
||||||
|
* null pointer.
|
||||||
|
*
|
||||||
|
* For testing, use the login "root" with the password "q".
|
||||||
|
*
|
||||||
|
* @return the new session ID
|
||||||
|
*/
|
||||||
|
virtual Ptr<SessionId>::Ref
|
||||||
|
login(const std::string &login, const std::string &password)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logout from the storage server.
|
||||||
|
*
|
||||||
|
* @param sessionId the ID of the session to end
|
||||||
|
* @return true if logged out successfully, false if not
|
||||||
|
*/
|
||||||
|
virtual const bool
|
||||||
|
logout(Ptr<SessionId>::Ref sessionId)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Authentication
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // TestAuthenticationClient_h
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#error "Need unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/SessionId.h"
|
||||||
|
#include "TestAuthenticationClientTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Authentication;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(TestAuthenticationClientTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the authentication client factory daemon.
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/testAuthentication.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestAuthenticationClientTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Ptr<xmlpp::DomParser>::Ref parser(
|
||||||
|
new xmlpp::DomParser(configFileName, true));
|
||||||
|
const xmlpp::Document * document = parser->get_document();
|
||||||
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
|
|
||||||
|
tac.reset(new TestAuthenticationClient());
|
||||||
|
tac->configure(*root);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
CPPUNIT_FAIL("error parsing configuration file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestAuthenticationClientTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
tac.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test to see if we can log on and off
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestAuthenticationClientTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(!(sessionId = tac->login("Piszkos Fred", "malnaszor")));
|
||||||
|
|
||||||
|
sessionId.reset(new SessionId("ceci n'est pas un session ID"));
|
||||||
|
CPPUNIT_ASSERT(!tac->logout(sessionId));
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT( sessionId = tac->login("root", "q"));
|
||||||
|
CPPUNIT_ASSERT( tac->logout(sessionId));
|
||||||
|
CPPUNIT_ASSERT(!tac->logout(sessionId));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef TestAuthenticationClientTest_h
|
||||||
|
#define TestAuthenticationClientTest_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
#include "TestAuthenticationClient.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Authentication {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the TestAuthenticationClient class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see TestAuthenticationClient
|
||||||
|
*/
|
||||||
|
class TestAuthenticationClientTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(TestAuthenticationClientTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The TestAuthenticationClient instance to test.
|
||||||
|
*/
|
||||||
|
Ptr<TestAuthenticationClient>::Ref tac;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the environment for the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setUp(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up the environment after the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tearDown(void) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Authentication
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // TestAuthenticationClientTest_h
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.25 $
|
# Version : $Revision: 1.26 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -273,7 +273,7 @@ uninstall: ${SCHEDULER_EXE}
|
||||||
uninstall
|
uninstall
|
||||||
|
|
||||||
storage_server_init:
|
storage_server_init:
|
||||||
${MAKE} -C ${STORAGE_SERVER_DIR}
|
# ${MAKE} -C ${STORAGE_SERVER_DIR}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue