modified the authentication and storage modules to throw their

own exception classes AuthenticationException and StorageException
instead of invalid_argument and logic_error
This commit is contained in:
fgerlits 2004-12-23 11:37:55 +00:00
parent adf05eaf29
commit de2b5a49a2
61 changed files with 1121 additions and 539 deletions

View File

@ -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/AuthenticationClientInterface.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -44,6 +44,7 @@
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/SessionId.h" #include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Authentication/AuthenticationException.h"
namespace LiveSupport { namespace LiveSupport {
namespace Authentication { namespace Authentication {
@ -63,34 +64,50 @@ using namespace LiveSupport::Core;
* An interface for authentication clients. * An interface for authentication clients.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
class AuthenticationClientInterface class AuthenticationClientInterface
{ {
public: public:
/** /**
* Login to the authentication server. * Login to the authentication server.
* Returns a new session ID; in case of an error, returns a * Returns a new session ID; in case of an error, throws
* null pointer. * AuthenticationException or one of its subclasses.
* *
* @param login the login to the server * @param login the login to the server
* @param password the password to the server * @param password the password to the server
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @exception AuthenticationException other error
* (TestStorageClient only)
* @return the new session ID * @return the new session ID
*/ */
virtual Ptr<SessionId>::Ref virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password) login(const std::string &login, const std::string &password)
throw () throw (AuthenticationException)
= 0; = 0;
/** /**
* Logout from the authentication server. * Logout from the authentication server.
* *
* @param sessionId the ID of the session to end * @param sessionId the ID of the session to end
* @return true if logged out successfully, false if not * @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @exception AuthenticationException other error
* (TestStorageClient only)
*/ */
virtual const bool virtual void
logout(Ptr<SessionId>::Ref sessionId) logout(Ptr<SessionId>::Ref sessionId)
throw () throw (AuthenticationException)
= 0; = 0;
}; };

View File

@ -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/include/LiveSupport/Authentication/Attic/AuthenticationException.h,v $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Authentication_AuthenticationException_h
#define LiveSupport_Authentication_AuthenticationException_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
namespace LiveSupport {
namespace Authentication {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Common parent of exception classes for this module.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
*/
class AuthenticationException : public std::runtime_error
{
public:
AuthenticationException(const std::string &msg)
: std::runtime_error(msg) {
}
};
/**
* XML-RPC communication problem.
*/
class XmlRpcCommunicationException : public AuthenticationException
{
public:
XmlRpcCommunicationException(const std::string &msg)
: AuthenticationException(msg) {
}
};
/**
* XML-RPC fault thrown by the method called.
*/
class XmlRpcMethodFaultException : public AuthenticationException
{
public:
XmlRpcMethodFaultException(const std::string &msg)
: AuthenticationException(msg) {
}
};
/**
* Unexpected response from the XML-RPC method.
*/
class XmlRpcMethodResponseException : public AuthenticationException
{
public:
XmlRpcMethodResponseException(const std::string &msg)
: AuthenticationException(msg) {
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Authentication
} // namespace LiveSupport
#endif // LiveSupport_Authentication_AuthenticationException_h

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -116,8 +116,20 @@ AuthenticationClientFactoryTest :: firstTest(void)
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
sessionId = authentication->login("root", "q"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(sessionId); CPPUNIT_ASSERT(sessionId);
CPPUNIT_ASSERT(authentication->logout(sessionId));
try {
authentication->logout(sessionId);
}
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
} }

View File

@ -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/src/TestAuthenticationClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -96,8 +96,7 @@ static const std::string dummySessionIdString = "dummySessionId";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TestAuthenticationClient :: configure(const xmlpp::Element & element) TestAuthenticationClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument)
std::logic_error)
{ {
if (element.get_name() != configElementNameStr) { if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element "; std::string eMsg = "Bad configuration element ";
@ -155,10 +154,10 @@ TestAuthenticationClient :: configure(const xmlpp::Element & element)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<SessionId>::Ref Ptr<SessionId>::Ref
TestAuthenticationClient :: login(const std::string & login, TestAuthenticationClient :: login(const std::string & login,
const std::string & password) const std::string & password)
throw () throw (AuthenticationException)
{ {
Ptr<SessionId>::Ref sessionId; // initialized to 0 Ptr<SessionId>::Ref sessionId;
if (login == userLogin && password == userPassword) { if (login == userLogin && password == userPassword) {
std::stringstream sessionIdStream; std::stringstream sessionIdStream;
@ -168,24 +167,27 @@ TestAuthenticationClient :: login(const std::string & login,
<< rand(); << rand();
sessionIdList.insert(sessionIdStream.str()); sessionIdList.insert(sessionIdStream.str());
sessionId.reset(new SessionId(sessionIdStream.str())); sessionId.reset(new SessionId(sessionIdStream.str()));
return sessionId;
}
else {
throw AuthenticationException("Incorrect login or password.");
} }
return sessionId;
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Logout from the authentication server. * Logout from the authentication server.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const bool void
TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId) TestAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
throw () throw (AuthenticationException)
{ {
// this returns the number of entries found and erased // this returns the number of entries found and erased
if (sessionIdList.erase(sessionId->getId())) { if (sessionIdList.erase(sessionId->getId())) {
return true; return;
} }
else { else {
return false; throw AuthenticationException("Logout called without previous login.");
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.5 $ * @version $Revision: 1.6 $
*/ */
class TestAuthenticationClient : class TestAuthenticationClient :
virtual public Configurable, virtual public Configurable,
@ -164,8 +164,7 @@ class TestAuthenticationClient :
*/ */
virtual void virtual void
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument);
std::logic_error);
/** /**
* Login to the authentication server, using the data read from the * Login to the authentication server, using the data read from the
@ -174,20 +173,23 @@ class TestAuthenticationClient :
* null pointer. * null pointer.
* *
* @return the new session ID * @return the new session ID
* @exception AuthenticationException login or password is incorrect
* (does not match those given in the configuration file)
*/ */
virtual Ptr<SessionId>::Ref virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password) login(const std::string &login, const std::string &password)
throw (); throw (AuthenticationException);
/** /**
* Logout from the authentication server. * Logout from the authentication server.
* *
* @param sessionId the ID of the session to end * @param sessionId the ID of the session to end
* @return true if logged out successfully, false if not * @exception AuthenticationException the sessionId does not match
* one issued by login()
*/ */
virtual const bool virtual void
logout(Ptr<SessionId>::Ref sessionId) logout(Ptr<SessionId>::Ref sessionId)
throw (); throw (AuthenticationException);
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -111,13 +111,41 @@ TestAuthenticationClientTest :: firstTest(void)
{ {
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
CPPUNIT_ASSERT(!(sessionId = tac->login("Piszkos Fred", "malnaszor"))); try {
sessionId = tac->login("Piszkos Fred", "malnaszor");
CPPUNIT_FAIL("Allowed login with incorrect login and password.");
}
catch (AuthenticationException &e) {
}
// TODO: this call writes some garbage to cerr; it should be told not to
sessionId.reset(new SessionId("ceci n'est pas un session ID")); sessionId.reset(new SessionId("ceci n'est pas un session ID"));
CPPUNIT_ASSERT(!tac->logout(sessionId)); try {
tac->logout(sessionId);
CPPUNIT_FAIL("Allowed logout without previous login.");
}
catch (AuthenticationException &e) {
}
CPPUNIT_ASSERT( sessionId = tac->login("root", "q")); try {
CPPUNIT_ASSERT( tac->logout(sessionId)); sessionId = tac->login("root", "q");
CPPUNIT_ASSERT(!tac->logout(sessionId)); }
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
try {
tac->logout(sessionId);
}
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
try {
tac->logout(sessionId);
CPPUNIT_FAIL("Allowed to logout twice.");
}
catch (AuthenticationException &e) {
}
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,8 +137,7 @@ static const std::string statusParamName = "status";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
WebAuthenticationClient :: configure(const xmlpp::Element & element) WebAuthenticationClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument)
std::logic_error)
{ {
if (element.get_name() != configElementNameStr) { if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element "; std::string eMsg = "Bad configuration element ";
@ -203,28 +202,43 @@ WebAuthenticationClient :: configure(const xmlpp::Element & element)
Ptr<SessionId>::Ref Ptr<SessionId>::Ref
WebAuthenticationClient :: login(const std::string & login, WebAuthenticationClient :: login(const std::string & login,
const std::string & password) const std::string & password)
throw () throw (AuthenticationException)
{ {
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
Ptr<SessionId>::Ref sessionId; // initialized to 0 Ptr<SessionId>::Ref sessionId;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort, XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false); storageServerPath.c_str(), false);
parameters.clear();
parameters[loginParamName] = login.c_str(); parameters[loginParamName] = login.c_str();
parameters[passwordParamName] = password.c_str(); parameters[passwordParamName] = password.c_str();
result.clear();
if (!xmlRpcClient.execute(loginMethodName.c_str(), parameters, result)) { if (!xmlRpcClient.execute(loginMethodName.c_str(), parameters, result)) {
return sessionId; throw Authentication::XmlRpcCommunicationException("Login failed.");
}
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "Login method returned fault response:\n"
<< result;
throw Authentication::XmlRpcMethodFaultException(eMsg.str());
} }
if (! result.hasMember(outputSessionIdParamName)) { if (! result.hasMember(outputSessionIdParamName)) {
return sessionId; std::stringstream eMsg;
eMsg << "Login method returned unexpected response:\n"
<< result;
throw Authentication::XmlRpcMethodResponseException(eMsg.str());
} }
if (result[outputSessionIdParamName].getType() != XmlRpcValue::TypeString) { if (result[outputSessionIdParamName].getType() != XmlRpcValue::TypeString) {
return sessionId; std::stringstream eMsg;
eMsg << "Login method returned unexpected response:\n"
<< result;
throw Authentication::XmlRpcMethodResponseException(eMsg.str());
} }
sessionId.reset(new SessionId(result[outputSessionIdParamName])); sessionId.reset(new SessionId(result[outputSessionIdParamName]));
@ -235,9 +249,9 @@ WebAuthenticationClient :: login(const std::string & login,
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Logout from the authentication server. * Logout from the authentication server.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const bool void
WebAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId) WebAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
throw () throw (AuthenticationException)
{ {
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
@ -245,28 +259,28 @@ WebAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort, XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false); storageServerPath.c_str(), false);
parameters.clear();
parameters[inputSessionIdParamName] = sessionId->getId().c_str(); parameters[inputSessionIdParamName] = sessionId->getId().c_str();
result.clear();
if (!xmlRpcClient.execute(logoutMethodName.c_str(), parameters, result)) { if (!xmlRpcClient.execute(logoutMethodName.c_str(), parameters, result)) {
return false; throw Authentication::XmlRpcCommunicationException("Logout failed.");
} }
if (xmlRpcClient.isFault()) { if (xmlRpcClient.isFault()) {
return false; std::stringstream eMsg;
eMsg << "Logout method returned fault response:\n"
<< result;
throw Authentication::XmlRpcMethodFaultException(eMsg.str());
} }
if (! result.hasMember(statusParamName)) { if (! result.hasMember(statusParamName)
return sessionId; || result[statusParamName].getType() != XmlRpcValue::TypeBoolean
|| ! bool(result[statusParamName])) {
std::stringstream eMsg;
eMsg << "Logout method returned unexpected response:\n"
<< result;
throw Authentication::XmlRpcMethodResponseException(eMsg.str());
} }
if (result[statusParamName].getType() != XmlRpcValue::TypeBoolean) {
return sessionId;
}
if (!(bool(result[statusParamName]))) {
return sessionId;
}
return true;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -46,6 +46,7 @@
#include "LiveSupport/Core/Configurable.h" #include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/SessionId.h" #include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Authentication/AuthenticationClientInterface.h" #include "LiveSupport/Authentication/AuthenticationClientInterface.h"
#include "LiveSupport/Authentication/AuthenticationException.h"
namespace LiveSupport { namespace LiveSupport {
@ -93,7 +94,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.2 $ * @version $Revision: 1.3 $
*/ */
class WebAuthenticationClient : class WebAuthenticationClient :
virtual public Configurable, virtual public Configurable,
@ -156,30 +157,43 @@ class WebAuthenticationClient :
*/ */
virtual void virtual void
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument);
std::logic_error);
/** /**
* Login to the authentication server, using the data read from the * Login to the authentication server, using the data read from the
* configuration file. * configuration file.
* Returns a new session ID; in case of an error, returns a * Returns a new session ID; in case of an error, throws one of three
* null pointer. * types of AuthenticationException.
* *
* @param login the login to the server
* @param password the password to the server
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @return the new session ID * @return the new session ID
*/ */
virtual Ptr<SessionId>::Ref virtual Ptr<SessionId>::Ref
login(const std::string &login, const std::string &password) login(const std::string &login, const std::string &password)
throw (); throw (AuthenticationException);
/** /**
* Logout from the authentication server. * Logout from the authentication server.
* *
* @param sessionId the ID of the session to end * @param sessionId the ID of the session to end
* @exception XmlRpcCommunicationException problem with performing
* XML-RPC call
* @exception XmlRpcMethodFaultException XML-RPC method returned
* fault response
* @exception XmlRpcMethodResponseException response from XML-RPC
* method is incorrect
* @return true if logged out successfully, false if not * @return true if logged out successfully, false if not
*/ */
virtual const bool virtual void
logout(Ptr<SessionId>::Ref sessionId) logout(Ptr<SessionId>::Ref sessionId)
throw (); throw (AuthenticationException);
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -111,15 +111,40 @@ WebAuthenticationClientTest :: firstTest(void)
{ {
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
CPPUNIT_ASSERT(!(sessionId = wac->login("Piszkos Fred", "malnaszor"))); try {
sessionId = wac->login("Piszkos Fred", "malnaszor");
CPPUNIT_FAIL("Allowed login with incorrect login and password.");
}
catch (AuthenticationException &e) {
}
// TODO: this call writes some garbage to cerr; it should be told not to sessionId.reset(new SessionId("bad_session_ID"));
sessionId.reset(new SessionId("ceci n'est pas un session ID")); try {
CPPUNIT_ASSERT(!wac->logout(sessionId)); wac->logout(sessionId);
CPPUNIT_FAIL("Allowed logout without previous login.");
}
catch (AuthenticationException &e) {
}
CPPUNIT_ASSERT( sessionId = wac->login("root", "q")); try {
CPPUNIT_ASSERT( wac->logout(sessionId)); sessionId = wac->login("root", "q");
// this does not work due to a bug in the storage server }
// CPPUNIT_ASSERT(!wac->logout(sessionId)); catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
try {
wac->logout(sessionId);
}
catch (AuthenticationException &e) {
CPPUNIT_FAIL(e.what());
}
try {
wac->logout(sessionId);
CPPUNIT_FAIL("Allowed to logout twice.");
}
catch (AuthenticationException &e) {
}
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/StorageClientInterface.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/StorageClientInterface.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -45,6 +45,7 @@
#include "LiveSupport/Core/UniqueId.h" #include "LiveSupport/Core/UniqueId.h"
#include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/Playlist.h"
#include "LiveSupport/Core/SessionId.h" #include "LiveSupport/Core/SessionId.h"
#include "LiveSupport/Storage/StorageException.h"
namespace LiveSupport { namespace LiveSupport {
@ -64,7 +65,7 @@ using namespace Core;
* An interface for storage clients. * An interface for storage clients.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class StorageClientInterface class StorageClientInterface
{ {
@ -76,11 +77,13 @@ class StorageClientInterface
* @param id the id of the playlist to check for. * @param id the id of the playlist to check for.
* @return true if a playlist with the specified id exists, * @return true if a playlist with the specified id exists,
* false otherwise. * false otherwise.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual const bool virtual const bool
existsPlaylist(Ptr<SessionId>::Ref sessionId, existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -89,13 +92,14 @@ class StorageClientInterface
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
getPlaylist(Ptr<SessionId>::Ref sessionId, getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -104,13 +108,14 @@ class StorageClientInterface
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
editPlaylist(Ptr<SessionId>::Ref sessionId, editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -118,13 +123,14 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to save. * @param playlist the playlist to save.
* @exception std::logic_error if the playlist has not been previously * @exception StorageException if there is a problem with the XML-RPC
* opened by getPlaylist() * call or the playlist has not been
* previously opened by getPlaylist()
*/ */
virtual void virtual void
savePlaylist(Ptr<SessionId>::Ref sessionId, savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -135,13 +141,14 @@ class StorageClientInterface
* @return a new Playlist instance containing a uri field which * @return a new Playlist instance containing a uri field which
* points to an executable (playable) SMIL representation of * points to an executable (playable) SMIL representation of
* the playlist (in the local storage). * the playlist (in the local storage).
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no playlist with the specified
* specified id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
acquirePlaylist(Ptr<SessionId>::Ref sessionId, acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -150,26 +157,28 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to release. * @param playlist the playlist to release.
* @exception std::logic_error if the playlist has no uri field, * @exception StorageException if there is a problem with the XML-RPC
* or the file does not exist, etc. * call or the playlist has no uri field,
* or the file does not exist, etc.
*/ */
virtual void virtual void
releasePlaylist(Ptr<SessionId>::Ref sessionId, releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
* Delete a playlist with the specified id. * Delete a playlist with the specified id.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to be deleted. * @param id the id of the playlist to be deleted.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* id exists.
*/ */
virtual void virtual void
deletePlaylist(Ptr<SessionId>::Ref sessionId, deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -177,10 +186,12 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return a vector containing the playlists. * @return a vector containing the playlists.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
getAllPlaylists(Ptr<SessionId>::Ref sessionId) const getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -188,10 +199,12 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return the newly created playlist. * @return the newly created playlist.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -201,11 +214,13 @@ class StorageClientInterface
* @param id the id of the audio clip to check for. * @param id the id of the audio clip to check for.
* @return true if an audio clip with the specified id exists, * @return true if an audio clip with the specified id exists,
* false otherwise. * false otherwise.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual const bool virtual const bool
existsAudioClip(Ptr<SessionId>::Ref sessionId, existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -214,13 +229,14 @@ class StorageClientInterface
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to return. * @param id the id of the audio clip to return.
* @return the requested audio clip. * @return the requested audio clip.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no audio clip with the
* specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
getAudioClip(Ptr<SessionId>::Ref sessionId, getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -230,12 +246,13 @@ class StorageClientInterface
* @param audioClip the audio clip to store. * @param audioClip the audio clip to store.
* @return true if the operation was successful. * @return true if the operation was successful.
* *
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call or we have not logged in yet.
*/ */
virtual bool virtual bool
storeAudioClip(Ptr<SessionId>::Ref sessionId, storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) Ptr<AudioClip>::Ref audioClip)
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -245,13 +262,14 @@ class StorageClientInterface
* @param id the id of the audio clip to acquire. * @param id the id of the audio clip to acquire.
* @return a new AudioClip instance, containing a uri field which * @return a new AudioClip instance, containing a uri field which
* points to (a way of getting) the sound file. * points to (a way of getting) the sound file.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or if no audio clip with the
* specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
acquireAudioClip(Ptr<SessionId>::Ref sessionId, acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -259,13 +277,14 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param audioClip the id of the audio clip to release. * @param audioClip the id of the audio clip to release.
* @exception std::logic_error if the audio clip has no uri field, * @exception StorageException if there is a problem with the XML-RPC
* or the file does not exist, etc. * call or the audio clip has no uri field,
* or the file does not exist, etc.
*/ */
virtual void virtual void
releaseAudioClip(Ptr<SessionId>::Ref sessionId, releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -273,13 +292,14 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to be deleted. * @param id the id of the audio clip to be deleted.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no audio clip with the
* specified id exists.
*/ */
virtual void virtual void
deleteAudioClip(Ptr<SessionId>::Ref sessionId, deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error) throw (StorageException)
= 0; = 0;
/** /**
@ -287,10 +307,12 @@ class StorageClientInterface
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return a vector containing the playlists. * @return a vector containing the playlists.
* @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
getAllAudioClips(Ptr<SessionId>::Ref sessionId) const getAllAudioClips(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error) throw (StorageException)
= 0; = 0;
}; };

View File

@ -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/storage/include/LiveSupport/Storage/Attic/StorageException.h,v $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Storage_StorageException_h
#define LiveSupport_Storage_StorageException_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include <stdexcept>
namespace LiveSupport {
namespace Storage {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* Common parent of exception classes for this module.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
*/
class StorageException : public std::runtime_error
{
public:
StorageException(const std::string &msg)
: std::runtime_error(msg) {
}
};
/**
* XML-RPC communication problem.
*/
class XmlRpcCommunicationException : public StorageException
{
public:
XmlRpcCommunicationException(const std::string &msg)
: StorageException(msg) {
}
};
/**
* XML-RPC fault thrown by the method called.
*/
class XmlRpcMethodFaultException : public StorageException
{
public:
XmlRpcMethodFaultException(const std::string &msg)
: StorageException(msg) {
}
};
/**
* Unexpected response from the XML-RPC method.
*/
class XmlRpcMethodResponseException : public StorageException
{
public:
XmlRpcMethodResponseException(const std::string &msg)
: StorageException(msg) {
}
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Storage
} // namespace LiveSupport
#endif // LiveSupport_Storage_StorageException_h

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/StorageClientFactoryTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/StorageClientFactoryTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -149,10 +149,32 @@ StorageClientFactoryTest :: firstTest(void)
Ptr<UniqueId>::Ref id01(new UniqueId(1)); Ptr<UniqueId>::Ref id01(new UniqueId(1));
Ptr<UniqueId>::Ref id77(new UniqueId(77)); Ptr<UniqueId>::Ref id77(new UniqueId(77));
CPPUNIT_ASSERT( storage->existsPlaylist(sessionId, id01)); try {
CPPUNIT_ASSERT(!storage->existsPlaylist(sessionId, id77)); CPPUNIT_ASSERT( storage->existsPlaylist(sessionId, id01));
}
catch (StorageException &e) {
std::string eMsg = "existsPlaylist returned error:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId, id01); try {
CPPUNIT_ASSERT(playlist->getId()->getId() == id01->getId()); CPPUNIT_ASSERT(!storage->existsPlaylist(sessionId, id77));
}
catch (StorageException &e) {
std::string eMsg = "existsPlaylist returned error:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
try {
Ptr<Playlist>::Ref playlist = storage->getPlaylist(sessionId, id01);
CPPUNIT_ASSERT(playlist->getId()->getId() == id01->getId());
}
catch (StorageException &e) {
std::string eMsg = "getPlaylist returned error:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.21 $ Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,8 +137,7 @@ static const std::string smilPlaylistUriAttrName = "src";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TestStorageClient :: configure(const xmlpp::Element & element) TestStorageClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument)
std::logic_error)
{ {
if (element.get_name() != configElementNameStr) { if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element "; std::string eMsg = "Bad configuration element ";
@ -206,12 +205,12 @@ TestStorageClient :: existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
TestStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument) throw (StorageException)
{ {
PlaylistMap::const_iterator it = playlistMap.find(id->getId()); PlaylistMap::const_iterator it = playlistMap.find(id->getId());
if (it == playlistMap.end()) { if (it == playlistMap.end()) {
throw std::invalid_argument("no such playlist"); throw StorageException("no such playlist");
} }
return it->second; return it->second;
@ -224,12 +223,12 @@ TestStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
TestStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument) throw (StorageException)
{ {
PlaylistMap::const_iterator it = playlistMap.find(id->getId()); PlaylistMap::const_iterator it = playlistMap.find(id->getId());
if (it == playlistMap.end()) { if (it == playlistMap.end()) {
throw std::invalid_argument("no such playlist"); throw StorageException("no such playlist");
} }
return it->second; return it->second;
@ -242,7 +241,7 @@ TestStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId,
void void
TestStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw ()
{ {
} }
@ -253,12 +252,12 @@ TestStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
PlaylistMap::const_iterator playlistMapIt = playlistMap.find(id->getId()); PlaylistMap::const_iterator playlistMapIt = playlistMap.find(id->getId());
if (playlistMapIt == playlistMap.end()) { if (playlistMapIt == playlistMap.end()) {
throw std::invalid_argument("no such playlist"); throw StorageException("no such playlist");
} }
Ptr<Playlist>::Ref oldPlaylist = playlistMapIt->second; Ptr<Playlist>::Ref oldPlaylist = playlistMapIt->second;
@ -342,16 +341,16 @@ TestStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
void void
TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw (StorageException)
{ {
if (! playlist->getUri()) { if (! playlist->getUri()) {
throw std::logic_error("playlist URI not found"); throw StorageException("playlist URI not found");
} }
std::ifstream ifs(playlist->getUri()->substr(7).c_str()); std::ifstream ifs(playlist->getUri()->substr(7).c_str());
if (!ifs) { if (!ifs) {
ifs.close(); ifs.close();
throw std::logic_error("playlist temp file not found"); throw StorageException("playlist temp file not found");
} }
ifs.close(); ifs.close();
@ -365,7 +364,7 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
try { try {
releaseAudioClip(sessionId, it->second->getAudioClip()); releaseAudioClip(sessionId, it->second->getAudioClip());
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
++badPlaylistElements; ++badPlaylistElements;
} }
++it; ++it;
@ -374,7 +373,7 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
try { try {
releasePlaylist(sessionId, it->second->getPlaylist()); releasePlaylist(sessionId, it->second->getPlaylist());
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
++badPlaylistElements; ++badPlaylistElements;
} }
++it; ++it;
@ -391,7 +390,7 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
std::stringstream eMsg; std::stringstream eMsg;
eMsg << "could not release " << badPlaylistElements eMsg << "could not release " << badPlaylistElements
<< " playlist elements in playlist"; << " playlist elements in playlist";
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
} }
@ -402,11 +401,11 @@ TestStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
void void
TestStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId, TestStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::invalid_argument) throw (StorageException)
{ {
// erase() returns the number of entries found & erased // erase() returns the number of entries found & erased
if (!playlistMap.erase(id->getId())) { if (!playlistMap.erase(id->getId())) {
throw std::invalid_argument("no such playlist"); throw StorageException("no such playlist");
} }
} }
@ -474,12 +473,12 @@ TestStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref Ptr<AudioClip>::Ref
TestStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId, TestStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument) throw (StorageException)
{ {
AudioClipMap::const_iterator it = audioClipMap.find(id->getId()); AudioClipMap::const_iterator it = audioClipMap.find(id->getId());
if (it == audioClipMap.end()) { if (it == audioClipMap.end()) {
throw std::invalid_argument("no such audio clip"); throw StorageException("no such audio clip");
} }
return it->second; return it->second;
@ -492,7 +491,7 @@ TestStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
bool bool
TestStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId, TestStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) Ptr<AudioClip>::Ref audioClip)
throw (std::invalid_argument) throw (StorageException)
{ {
audioClipMap[audioClip->getId()->getId()] = audioClip; audioClipMap[audioClip->getId()->getId()] = audioClip;
return true; return true;
@ -505,18 +504,18 @@ TestStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref Ptr<AudioClip>::Ref
TestStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId, TestStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
AudioClipMap::const_iterator it = audioClipMap.find(id->getId()); AudioClipMap::const_iterator it = audioClipMap.find(id->getId());
if (it == audioClipMap.end()) { if (it == audioClipMap.end()) {
throw std::invalid_argument("no such audio clip"); throw StorageException("no such audio clip");
} }
Ptr<AudioClip>::Ref storedAudioClip = it->second; Ptr<AudioClip>::Ref storedAudioClip = it->second;
if (! storedAudioClip->getUri()) { if (! storedAudioClip->getUri()) {
throw std::logic_error("audio clip URI not found"); throw StorageException("audio clip URI not found");
} }
// cut the "file:" off // cut the "file:" off
std::string audioClipFileName = storedAudioClip->getUri()->substr(5); std::string audioClipFileName = storedAudioClip->getUri()->substr(5);
@ -524,7 +523,7 @@ TestStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
std::ifstream ifs(audioClipFileName.c_str()); std::ifstream ifs(audioClipFileName.c_str());
if (!ifs) { if (!ifs) {
ifs.close(); ifs.close();
throw std::logic_error("could not read audio clip"); throw StorageException("could not read audio clip");
} }
ifs.close(); ifs.close();
@ -546,10 +545,10 @@ TestStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
void void
TestStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId, TestStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error) throw (StorageException)
{ {
if (*(audioClip->getUri()) == "") { if (*(audioClip->getUri()) == "") {
throw std::logic_error("audio clip URI not found"); throw StorageException("audio clip URI not found");
} }
Ptr<std::string>::Ref nullPointer; Ptr<std::string>::Ref nullPointer;
@ -563,11 +562,11 @@ TestStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
void void
TestStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId, TestStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::invalid_argument) throw (StorageException)
{ {
// erase() returns the number of entries found & erased // erase() returns the number of entries found & erased
if (!audioClipMap.erase(id->getId())) { if (!audioClipMap.erase(id->getId())) {
throw std::invalid_argument("no such audio clip"); throw StorageException("no such audio clip");
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.19 $ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -90,7 +90,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.19 $ * @version $Revision: 1.20 $
*/ */
class TestStorageClient : class TestStorageClient :
virtual public Configurable, virtual public Configurable,
@ -157,13 +157,11 @@ class TestStorageClient :
* @param element the XML element to configure the object from. * @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element * @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information * contains bad configuraiton information
* @exception std::logic_error if the scheduler daemon has already
* been configured, and can not be reconfigured.
*/ */
virtual void virtual void
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument);
std::logic_error);
/** /**
* Tell if a playlist with a given id exists. * Tell if a playlist with a given id exists.
@ -174,9 +172,10 @@ class TestStorageClient :
* false otherwise. * false otherwise.
*/ */
virtual const bool virtual const bool
existsPlaylist(Ptr<SessionId>::Ref sessionId, existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (); throw ();
/** /**
* Return a playlist with the specified id, to be displayed. * Return a playlist with the specified id, to be displayed.
@ -184,13 +183,14 @@ class TestStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::invalid_argument if no playlist with the specified * @exception StorageException if no playlist with the specified
* id exists. * id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
getPlaylist(Ptr<SessionId>::Ref sessionId, getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument); throw (StorageException);
/** /**
* Return a playlist with the specified id, to be edited. * Return a playlist with the specified id, to be edited.
@ -198,26 +198,26 @@ class TestStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::invalid_argument if no playlist with the specified * @exception StorageException if no playlist with the specified
* id exists. * id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
editPlaylist(Ptr<SessionId>::Ref sessionId, editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument); throw (StorageException);
/** /**
* Save the playlist after editing. * Save the playlist after editing.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to save. * @param playlist the playlist to save.
* @exception std::logic_error if the playlist has not been previously
* opened by getPlaylist()
*/ */
virtual void virtual void
savePlaylist(Ptr<SessionId>::Ref sessionId, savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error); throw ();
/** /**
* Acquire the resources for the playlist. * Acquire the resources for the playlist.
@ -232,13 +232,14 @@ class TestStorageClient :
* @return a new Playlist instance containing a uri field which * @return a new Playlist instance containing a uri field which
* points to an executable (playable) SMIL representation of * points to an executable (playable) SMIL representation of
* the playlist (in the local storage). * the playlist (in the local storage).
* @exception std::invalid_argument if no playlist with the specified * @exception StorageException if no playlist with the specified
* specified id exists. * specified id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
acquirePlaylist(Ptr<SessionId>::Ref sessionId, acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Release the resources (audio clips, other playlists) used * Release the resources (audio clips, other playlists) used
@ -246,26 +247,27 @@ class TestStorageClient :
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to release. * @param playlist the playlist to release.
* @exception std::logic_error if the playlist has no uri field, * @exception StorageException if the playlist has no uri field,
* or the file does not exist, etc. * or the file does not exist, etc.
*/ */
virtual void virtual void
releasePlaylist(Ptr<SessionId>::Ref sessionId, releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error); throw (StorageException);
/** /**
* Delete the playlist with the specified id. * Delete a playlist with the specified id.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to be deleted. * @param id the id of the playlist to be deleted.
* @exception std::invalid_argument if no playlist with the specified * @exception StorageException if no playlist with the specified
* id exists. * id exists.
*/ */
virtual void virtual void
deletePlaylist(Ptr<SessionId>::Ref sessionId, deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::invalid_argument); throw (StorageException);
/** /**
* Return a list of all playlists in the playlist store. * Return a list of all playlists in the playlist store.
@ -275,7 +277,8 @@ class TestStorageClient :
*/ */
virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
getAllPlaylists(Ptr<SessionId>::Ref sessionId) const getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
throw (); throw ();
/** /**
* Create a new playlist. * Create a new playlist.
@ -285,7 +288,8 @@ class TestStorageClient :
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (); throw ();
/** /**
* Tell if an audio clip with a given id exists. * Tell if an audio clip with a given id exists.
@ -298,7 +302,7 @@ class TestStorageClient :
virtual const bool virtual const bool
existsAudioClip(Ptr<SessionId>::Ref sessionId, existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (); throw ();
/** /**
* Return an audio clip with the specified id. * Return an audio clip with the specified id.
@ -306,13 +310,13 @@ class TestStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to return. * @param id the id of the audio clip to return.
* @return the requested audio clip. * @return the requested audio clip.
* @exception std::invalid_argument if no audio clip with the * @exception StorageException if no audio clip with the
* specified id exists. * specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
getAudioClip(Ptr<SessionId>::Ref sessionId, getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::invalid_argument); throw (StorageException);
/** /**
* Store an audio clip. * Store an audio clip.
@ -320,12 +324,13 @@ class TestStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param audioClip the audio clip to store. * @param audioClip the audio clip to store.
* @return true if the operation was successful. * @return true if the operation was successful.
* @exception std::invalid_argument never in this implementation *
* @exception StorageException if we have not logged in yet.
*/ */
virtual bool virtual bool
storeAudioClip(Ptr<SessionId>::Ref sessionId, storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) Ptr<AudioClip>::Ref audioClip)
throw (std::invalid_argument); throw (StorageException);
/** /**
* Acquire the resources for the audio clip with the specified id. * Acquire the resources for the audio clip with the specified id.
@ -339,50 +344,52 @@ class TestStorageClient :
* @param id the id of the audio clip to acquire. * @param id the id of the audio clip to acquire.
* @return a new AudioClip instance, containing a uri field which * @return a new AudioClip instance, containing a uri field which
* points to (a way of getting) the sound file. * points to (a way of getting) the sound file.
* @exception std::invalid_argument if no audio clip with the * @exception StorageException if no audio clip with the
* specified id exists. * specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
acquireAudioClip(Ptr<SessionId>::Ref sessionId, acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Release the resource (sound file) used by an audio clip. * Release the resource (sound file) used by an audio clip.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param audioClip the audio clip to release. * @param audioClip the id of the audio clip to release.
* @exception std::logic_error if the audio clip has no uri field, * @exception StorageException if the audio clip has no uri field,
* or the file does not exist, etc. * or the file does not exist, etc.
*/ */
virtual void virtual void
releaseAudioClip(Ptr<SessionId>::Ref sessionId, releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error); throw (StorageException);
/** /**
* Delete the audio clip with the specified id. * Delete an audio clip with the specified id.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to be deleted. * @param id the id of the audio clip to be deleted.
* @exception std::invalid_argument if no audio clip with the * @exception StorageException if no audio clip with the
* specified id exists. * specified id exists.
*/ */
virtual void virtual void
deleteAudioClip(Ptr<SessionId>::Ref sessionId, deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::invalid_argument); throw (StorageException);
/** /**
* Return a list of all audio clips in the playlist store. * Return a list of all audio clips in the playlist store.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return a vector containing the audio clips. * @return a vector containing the playlists.
*/ */
virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
getAllAudioClips(Ptr<SessionId>::Ref sessionId) const getAllAudioClips(Ptr<SessionId>::Ref sessionId) const
throw (); throw ();
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.16 $ Version : $Revision: 1.17 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,17 +135,17 @@ TestStorageClientTest :: deletePlaylistTest(void)
try { try {
tsc->deletePlaylist(dummySessionId, id2); tsc->deletePlaylist(dummySessionId, id2);
CPPUNIT_FAIL("allowed to delete non-existent playlist"); CPPUNIT_FAIL("allowed to delete non-existent playlist");
} catch (std::invalid_argument &e) { } catch (StorageException &e) {
} }
try { try {
tsc->deletePlaylist(dummySessionId, id1); tsc->deletePlaylist(dummySessionId, id1);
} catch (std::invalid_argument &e) { } catch (StorageException &e) {
CPPUNIT_FAIL("cannot delete existing playlist"); CPPUNIT_FAIL("cannot delete existing playlist");
} }
try { try {
tsc->deletePlaylist(dummySessionId, id1); tsc->deletePlaylist(dummySessionId, id1);
CPPUNIT_FAIL("allowed to delete non-existent playlist"); CPPUNIT_FAIL("allowed to delete non-existent playlist");
} catch (std::invalid_argument &e) { } catch (StorageException &e) {
} }
} }
@ -227,7 +227,7 @@ TestStorageClientTest :: acquireAudioClipTest(void)
try { try {
audioClip = tsc->acquireAudioClip(dummySessionId, id2); audioClip = tsc->acquireAudioClip(dummySessionId, id2);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
std::string eMsg = "could not acquire audio clip:\n"; std::string eMsg = "could not acquire audio clip:\n";
eMsg += e.what(); eMsg += e.what();
CPPUNIT_FAIL(eMsg); CPPUNIT_FAIL(eMsg);
@ -240,7 +240,7 @@ TestStorageClientTest :: acquireAudioClipTest(void)
try { try {
tsc->releaseAudioClip(dummySessionId, audioClip); tsc->releaseAudioClip(dummySessionId, audioClip);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
std::string eMsg = "could not release audio clip:\n"; std::string eMsg = "could not release audio clip:\n";
eMsg += e.what(); eMsg += e.what();
CPPUNIT_FAIL(eMsg); CPPUNIT_FAIL(eMsg);
@ -250,7 +250,7 @@ TestStorageClientTest :: acquireAudioClipTest(void)
audioClip = tsc->acquireAudioClip(dummySessionId, id77); audioClip = tsc->acquireAudioClip(dummySessionId, id77);
CPPUNIT_FAIL("allowed to acquire non-existent audio clip"); CPPUNIT_FAIL("allowed to acquire non-existent audio clip");
} }
catch (std::logic_error &e) { catch (StorageException &e) {
} }
} }
@ -269,7 +269,7 @@ TestStorageClientTest :: acquirePlaylistTest(void)
try { try {
playlist = tsc->acquirePlaylist(dummySessionId, id1); playlist = tsc->acquirePlaylist(dummySessionId, id1);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
std::string eMsg = "could not acquire playlist:\n"; std::string eMsg = "could not acquire playlist:\n";
eMsg += e.what(); eMsg += e.what();
CPPUNIT_FAIL(eMsg); CPPUNIT_FAIL(eMsg);
@ -288,7 +288,7 @@ TestStorageClientTest :: acquirePlaylistTest(void)
try { try {
tsc->releasePlaylist(dummySessionId, playlist); tsc->releasePlaylist(dummySessionId, playlist);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
std::string eMsg = "could not release playlist:\n"; std::string eMsg = "could not release playlist:\n";
eMsg += e.what(); eMsg += e.what();
CPPUNIT_FAIL(eMsg); CPPUNIT_FAIL(eMsg);
@ -305,6 +305,6 @@ TestStorageClientTest :: acquirePlaylistTest(void)
playlist = tsc->acquirePlaylist(dummySessionId, id77); playlist = tsc->acquirePlaylist(dummySessionId, id77);
CPPUNIT_FAIL("allowed to acquire non-existent playlist"); CPPUNIT_FAIL("allowed to acquire non-existent playlist");
} }
catch (std::logic_error &e) { catch (StorageException &e) {
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -275,8 +275,7 @@ static const std::string storeAudioClipMethodMetadataFileParamName
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
WebStorageClient :: configure(const xmlpp::Element & element) WebStorageClient :: configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument)
std::logic_error)
{ {
if (element.get_name() != configElementNameStr) { if (element.get_name() != configElementNameStr) {
std::string eMsg = "Bad configuration element "; std::string eMsg = "Bad configuration element ";
@ -349,7 +348,7 @@ WebStorageClient :: configure(const xmlpp::Element & element)
const bool const bool
WebStorageClient :: existsPlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
return false; return false;
} }
@ -361,7 +360,7 @@ WebStorageClient :: existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<Playlist>::Ref playlist(new Playlist); Ptr<Playlist>::Ref playlist(new Playlist);
return playlist; return playlist;
@ -374,7 +373,7 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
WebStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<Playlist>::Ref playlist(new Playlist); Ptr<Playlist>::Ref playlist(new Playlist);
return playlist; return playlist;
@ -387,7 +386,7 @@ WebStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId,
void void
WebStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw (StorageException)
{ {
} }
@ -398,7 +397,7 @@ WebStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<Playlist>::Ref playlist(new Playlist); Ptr<Playlist>::Ref playlist(new Playlist);
return playlist; return playlist;
@ -411,7 +410,7 @@ WebStorageClient :: acquirePlaylist(Ptr<SessionId>::Ref sessionId,
void void
WebStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error) throw (StorageException)
{ {
} }
@ -423,7 +422,7 @@ WebStorageClient :: releasePlaylist(Ptr<SessionId>::Ref sessionId,
void void
WebStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId, WebStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error) throw (StorageException)
{ {
} }
@ -434,7 +433,7 @@ WebStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId,
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
WebStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId) const WebStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector( Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector(
new std::vector<Ptr<Playlist>::Ref>); new std::vector<Ptr<Playlist>::Ref>);
@ -447,7 +446,7 @@ WebStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Playlist>::Ref Ptr<Playlist>::Ref
WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId) WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (std::logic_error) throw (StorageException)
{ {
Ptr<Playlist>::Ref playlist(new Playlist); Ptr<Playlist>::Ref playlist(new Playlist);
return playlist; return playlist;
@ -460,7 +459,7 @@ WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
const bool const bool
WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
@ -480,7 +479,7 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
std::string eMsg = "cannot execute XML-RPC method '"; std::string eMsg = "cannot execute XML-RPC method '";
eMsg += existsAudioClipMethodName; eMsg += existsAudioClipMethodName;
eMsg += "'"; eMsg += "'";
throw std::logic_error(eMsg); throw StorageException(eMsg);
} }
if (xmlRpcClient.isFault() if (xmlRpcClient.isFault()
@ -492,7 +491,7 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
<< existsAudioClipMethodName << existsAudioClipMethodName
<< "' returned error message:\n" << "' returned error message:\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
return bool(result[existsAudioClipMethodResultParamName]); return bool(result[existsAudioClipMethodResultParamName]);
@ -505,7 +504,7 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref Ptr<AudioClip>::Ref
WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
@ -525,7 +524,7 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
std::string eMsg = "cannot execute XML-RPC method '"; std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getAudioClipOpenMethodName; eMsg += getAudioClipOpenMethodName;
eMsg += "'"; eMsg += "'";
throw std::logic_error(eMsg); throw StorageException(eMsg);
} }
if (xmlRpcClient.isFault() if (xmlRpcClient.isFault()
@ -540,35 +539,12 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
<< getAudioClipOpenMethodName << getAudioClipOpenMethodName
<< "' returned error message:\n" << "' returned error message:\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
std::string url = result[getAudioClipMethodUrlParamName]; std::string url = result[getAudioClipMethodUrlParamName];
std::string token = result[getAudioClipMethodTokenParamName]; std::string token = result[getAudioClipMethodTokenParamName];
/*
int offset = 353;
std::cout << "\n" << xmlAudioClip.at(offset+0) << "\n";
std::cout << xmlAudioClip.at(offset+1) << "\n";
std::cout << xmlAudioClip.at(offset+2) << "\n";
std::cout << xmlAudioClip.at(offset+3) << "\n";
std::cout << xmlAudioClip.at(offset+4) << "\n";
std::cout << xmlAudioClip.at(offset+5) << "\n";
std::cout << xmlAudioClip.at(offset+6) << "\n";
std::cout << xmlAudioClip.at(offset+7) << "\n";
std::cout << xmlAudioClip.at(offset+8) << "\n";
std::cout << xmlAudioClip.at(offset+9) << "\n";
std::cout << xmlAudioClip.at(offset+10) << "\n";
std::cout << xmlAudioClip.at(offset+11) << "\n";
std::cout << xmlAudioClip.at(offset+12) << "\n";
std::cout << xmlAudioClip.at(offset+13) << "\n";
std::cout << xmlAudioClip.at(offset+14) << "\n";
std::cout << xmlAudioClip.at(offset+15) << "\n";
std::cout << xmlAudioClip.at(offset+16) << "\n";
std::cout << xmlAudioClip.at(offset+17) << "\n";
std::cout << xmlAudioClip.at(offset+18) << "\n";
std::cout << xmlAudioClip.at(offset+19) << "\n";
std::cout << xmlAudioClip.at(offset+20) << "\n";
*/
Ptr<AudioClip>::Ref audioClip(new AudioClip(id)); Ptr<AudioClip>::Ref audioClip(new AudioClip(id));
try { try {
@ -579,9 +555,9 @@ std::cout << xmlAudioClip.at(offset+20) << "\n";
audioClip->configure(*root); audioClip->configure(*root);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
throw std::logic_error("semantic error in audio clip metafile"); throw StorageException("semantic error in audio clip metafile");
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
throw std::logic_error("error parsing audio clip metafile"); throw StorageException("error parsing audio clip metafile");
} }
parameters.clear(); parameters.clear();
@ -596,7 +572,7 @@ std::cout << xmlAudioClip.at(offset+20) << "\n";
std::string eMsg = "cannot execute XML-RPC method '"; std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getAudioClipCloseMethodName; eMsg += getAudioClipCloseMethodName;
eMsg += "'"; eMsg += "'";
throw std::logic_error(eMsg); throw StorageException(eMsg);
} }
if (xmlRpcClient.isFault() if (xmlRpcClient.isFault()
@ -610,7 +586,7 @@ std::cout << xmlAudioClip.at(offset+20) << "\n";
<< getAudioClipCloseMethodName << getAudioClipCloseMethodName
<< "' returned error message:\n" << "' returned error message:\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
return audioClip; return audioClip;
@ -618,22 +594,22 @@ std::cout << xmlAudioClip.at(offset+20) << "\n";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Store an audio clip. * Upload an audio clip to the local storage.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
bool bool
WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) Ptr<AudioClip>::Ref audioClip)
throw (std::logic_error) throw (StorageException)
{ {
if (!audioClip || !audioClip->getUri()) { if (!audioClip || !audioClip->getUri()) {
throw std::logic_error("binary audio clip file not found"); throw StorageException("binary audio clip file not found");
} }
Ptr<xmlpp::Document>::Ref metadata = audioClip->getMetadata(); Ptr<xmlpp::Document>::Ref metadata = audioClip->getMetadata();
std::stringstream metadataFileName; std::stringstream metadataFileName;
metadataFileName << localTempStorage << "-audioClipMetadata-" metadataFileName << localTempStorage << "-audioClipMetadata-"
<< audioClip->getId()->getId() << std::string(*audioClip->getId())
<< "-" << rand() << ".xml"; << "-" << rand() << ".xml";
metadata->write_to_file(metadataFileName.str(), "UTF-8"); metadata->write_to_file(metadataFileName.str(), "UTF-8");
@ -644,7 +620,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
std::ifstream ifs(binaryFileName.c_str()); std::ifstream ifs(binaryFileName.c_str());
if (!ifs) { if (!ifs) {
ifs.close(); ifs.close();
throw std::logic_error("could not read audio clip"); throw StorageException("could not read audio clip");
} }
ifs.close(); ifs.close();
std::string binaryFilePrefix("file://"); std::string binaryFilePrefix("file://");
@ -661,7 +637,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
parameters[storeAudioClipMethodSessionIdParamName] parameters[storeAudioClipMethodSessionIdParamName]
= sessionId->getId(); = sessionId->getId();
parameters[storeAudioClipMethodAudioClipIdParamName] parameters[storeAudioClipMethodAudioClipIdParamName]
= int(audioClip->getId()->getId()); = std::string(*audioClip->getId());
parameters[storeAudioClipMethodBinaryFileParamName] parameters[storeAudioClipMethodBinaryFileParamName]
= binaryFileName; = binaryFileName;
parameters[storeAudioClipMethodMetadataFileParamName] parameters[storeAudioClipMethodMetadataFileParamName]
@ -675,7 +651,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
std::string eMsg = "cannot execute XML-RPC method '"; std::string eMsg = "cannot execute XML-RPC method '";
eMsg += storeAudioClipMethodName; eMsg += storeAudioClipMethodName;
eMsg += "'"; eMsg += "'";
throw std::logic_error(eMsg); throw StorageException(eMsg);
} }
if (xmlRpcClient.isFault() if (xmlRpcClient.isFault()
@ -685,7 +661,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
<< storeAudioClipMethodName << storeAudioClipMethodName
<< "' returned error message:\n" << "' returned error message:\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
return true; return true;
@ -698,7 +674,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref Ptr<AudioClip>::Ref
WebStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<AudioClip>::Ref playlist(new AudioClip); Ptr<AudioClip>::Ref playlist(new AudioClip);
return playlist; return playlist;
@ -712,7 +688,7 @@ WebStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
void void
WebStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error) throw (StorageException)
{ {
} }
@ -724,7 +700,7 @@ WebStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
void void
WebStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId, WebStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error) throw (StorageException)
{ {
} }
@ -736,7 +712,7 @@ WebStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
WebStorageClient :: getAllAudioClips(Ptr<SessionId>::Ref sessionId) WebStorageClient :: getAllAudioClips(Ptr<SessionId>::Ref sessionId)
const const
throw (std::logic_error) throw (StorageException)
{ {
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector( Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector(
new std::vector<Ptr<AudioClip>::Ref>); new std::vector<Ptr<AudioClip>::Ref>);
@ -749,7 +725,7 @@ WebStorageClient :: getAllAudioClips(Ptr<SessionId>::Ref sessionId)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref
WebStorageClient :: reset(void) WebStorageClient :: reset(void)
throw (std::logic_error) throw (StorageException)
{ {
XmlRpcValue parameters; XmlRpcValue parameters;
XmlRpcValue result; XmlRpcValue result;
@ -766,7 +742,7 @@ WebStorageClient :: reset(void)
std::string eMsg = "cannot execute XML-RPC method '"; std::string eMsg = "cannot execute XML-RPC method '";
eMsg += resetStorageMethodName; eMsg += resetStorageMethodName;
eMsg += "'"; eMsg += "'";
throw std::logic_error(eMsg); throw StorageException(eMsg);
} }
if (xmlRpcClient.isFault() if (xmlRpcClient.isFault()
@ -778,7 +754,7 @@ WebStorageClient :: reset(void)
<< resetStorageMethodName << resetStorageMethodName
<< "' returned error message:\n" << "' returned error message:\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
XmlRpcValue uniqueIdArray = result[resetStorageMethodResultParamName]; XmlRpcValue uniqueIdArray = result[resetStorageMethodResultParamName];
@ -792,7 +768,7 @@ WebStorageClient :: reset(void)
<< resetStorageMethodName << resetStorageMethodName
<< "':\n" << "':\n"
<< result; << result;
throw std::logic_error(eMsg.str()); throw StorageException(eMsg.str());
} }
Ptr<UniqueId>::Ref uniqueId(new UniqueId(std::string(uniqueIdArray[i]))); Ptr<UniqueId>::Ref uniqueId(new UniqueId(std::string(uniqueIdArray[i])));
returnValue->push_back(uniqueId); returnValue->push_back(uniqueId);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -99,7 +99,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class WebStorageClient : class WebStorageClient :
virtual public Configurable, virtual public Configurable,
@ -153,19 +153,18 @@ class WebStorageClient :
return configElementNameStr; return configElementNameStr;
} }
/** /**
* Configure the object based on the XML element supplied. * Configure the object based on the XML element supplied.
* *
* @param element the XML element to configure the object from. * @param element the XML element to configure the object from.
* @exception std::invalid_argument if the supplied XML element * @exception std::invalid_argument if the supplied XML element
* contains bad configuraiton information * contains bad configuraiton information
* @exception std::logic_error if the scheduler daemon has already
* been configured, and can not be reconfigured.
*/ */
virtual void virtual void
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument, throw (std::invalid_argument);
std::logic_error);
/** /**
* Tell if a playlist with a given id exists. * Tell if a playlist with a given id exists.
@ -174,12 +173,13 @@ class WebStorageClient :
* @param id the id of the playlist to check for. * @param id the id of the playlist to check for.
* @return true if a playlist with the specified id exists, * @return true if a playlist with the specified id exists,
* false otherwise. * false otherwise.
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual const bool virtual const bool
existsPlaylist(Ptr<SessionId>::Ref sessionId, existsPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Return a playlist with the specified id, to be displayed. * Return a playlist with the specified id, to be displayed.
@ -187,14 +187,15 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* @exception std::logic_error if we have not logged in yet. * id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
getPlaylist(Ptr<SessionId>::Ref sessionId, getPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Return a playlist with the specified id, to be edited. * Return a playlist with the specified id, to be edited.
@ -202,27 +203,29 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to return. * @param id the id of the playlist to return.
* @return the requested playlist. * @return the requested playlist.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* @exception std::logic_error if we have not logged in yet. * id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
editPlaylist(Ptr<SessionId>::Ref sessionId, editPlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Save the playlist after editing. * Save the playlist after editing.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to save. * @param playlist the playlist to save.
* @exception std::logic_error if the playlist has not been previously * @exception StorageException if there is a problem with the XML-RPC
* opened by getPlaylist() * call or the playlist has not been
* previously opened by getPlaylist()
*/ */
virtual void virtual void
savePlaylist(Ptr<SessionId>::Ref sessionId, savePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error); throw (StorageException);
/** /**
* Acquire the resources for the playlist. * Acquire the resources for the playlist.
@ -237,14 +240,14 @@ class WebStorageClient :
* @return a new Playlist instance containing a uri field which * @return a new Playlist instance containing a uri field which
* points to an executable (playable) SMIL representation of * points to an executable (playable) SMIL representation of
* the playlist (in the local storage). * the playlist (in the local storage).
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no playlist with the specified
* @exception std::logic_error if we have not logged in yet. * specified id exists.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
acquirePlaylist(Ptr<SessionId>::Ref sessionId, acquirePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Release the resources (audio clips, other playlists) used * Release the resources (audio clips, other playlists) used
@ -253,50 +256,52 @@ class WebStorageClient :
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param playlist the playlist to release. * @param playlist the playlist to release.
* @exception std::logic_error if the playlist has no uri field, * @exception StorageException if there is a problem with the XML-RPC
* or the file does not exist, etc. * call or the playlist has no uri field,
* @exception std::logic_error if we have not logged in yet. * or the file does not exist, etc.
*/ */
virtual void virtual void
releasePlaylist(Ptr<SessionId>::Ref sessionId, releasePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<Playlist>::Ref playlist) const Ptr<Playlist>::Ref playlist) const
throw (std::logic_error); throw (StorageException);
/** /**
* Delete the playlist with the specified id. * Delete a playlist with the specified id.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the playlist to be deleted. * @param id the id of the playlist to be deleted.
* @exception std::logic_error if no playlist with the specified * @exception StorageException if there is a problem with the XML-RPC
* id exists. * call or no playlist with the specified
* @exception std::logic_error if we have not logged in yet. * id exists.
*/ */
virtual void virtual void
deletePlaylist(Ptr<SessionId>::Ref sessionId, deletePlaylist(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error); throw (StorageException);
/** /**
* Return a list of all playlists in the playlist store. * Return a list of all playlists in the playlist store.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return a vector containing the playlists. * @return a vector containing the playlists.
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref virtual Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref
getAllPlaylists(Ptr<SessionId>::Ref sessionId) const getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error); throw (StorageException);
/** /**
* Create a new playlist. * Create a new playlist.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return the newly created playlist. * @return the newly created playlist.
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<Playlist>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (std::logic_error); throw (StorageException);
/** /**
* Tell if an audio clip with a given id exists. * Tell if an audio clip with a given id exists.
@ -305,12 +310,13 @@ class WebStorageClient :
* @param id the id of the audio clip to check for. * @param id the id of the audio clip to check for.
* @return true if an audio clip with the specified id exists, * @return true if an audio clip with the specified id exists,
* false otherwise. * false otherwise.
* @exception std::logic_error if we have not logged in yet * @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual const bool virtual const bool
existsAudioClip(Ptr<SessionId>::Ref sessionId, existsAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Return an audio clip with the specified id. * Return an audio clip with the specified id.
@ -318,14 +324,14 @@ class WebStorageClient :
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to return. * @param id the id of the audio clip to return.
* @return the requested audio clip. * @return the requested audio clip.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no audio clip with the
* @exception std::logic_error if we have not logged in yet. * specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
getAudioClip(Ptr<SessionId>::Ref sessionId, getAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Store an audio clip. The <code>uri</code> field of the audio clip * Store an audio clip. The <code>uri</code> field of the audio clip
@ -339,12 +345,13 @@ class WebStorageClient :
* @param audioClip the audio clip to store. * @param audioClip the audio clip to store.
* @return true if the operation was successful. * @return true if the operation was successful.
* *
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call or we have not logged in yet.
*/ */
virtual bool virtual bool
storeAudioClip(Ptr<SessionId>::Ref sessionId, storeAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) Ptr<AudioClip>::Ref audioClip)
throw (std::logic_error); throw (StorageException);
/** /**
* Acquire the resources for the audio clip with the specified id. * Acquire the resources for the audio clip with the specified id.
@ -356,14 +363,14 @@ class WebStorageClient :
* @param id the id of the audio clip to acquire. * @param id the id of the audio clip to acquire.
* @return a new AudioClip instance, containing a uri field which * @return a new AudioClip instance, containing a uri field which
* points to (a way of getting) the sound file. * points to (a way of getting) the sound file.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or if no audio clip with the
* @exception std::logic_error if we have not logged in yet. * specified id exists.
*/ */
virtual Ptr<AudioClip>::Ref virtual Ptr<AudioClip>::Ref
acquireAudioClip(Ptr<SessionId>::Ref sessionId, acquireAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) const Ptr<UniqueId>::Ref id) const
throw (std::logic_error); throw (StorageException);
/** /**
* Release the resource (sound file) used by an audio clip. The * Release the resource (sound file) used by an audio clip. The
@ -371,40 +378,42 @@ class WebStorageClient :
* deleted. * deleted.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param audioClip the audio clip to release. * @param audioClip the id of the audio clip to release.
* @exception std::logic_error if the audio clip has no uri field, * @exception StorageException if there is a problem with the XML-RPC
* or the file does not exist, etc. * call or the audio clip has no uri field,
* @exception std::logic_error if we have not logged in yet. * or the file does not exist, etc.
*/ */
virtual void virtual void
releaseAudioClip(Ptr<SessionId>::Ref sessionId, releaseAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<AudioClip>::Ref audioClip) const Ptr<AudioClip>::Ref audioClip) const
throw (std::logic_error); throw (StorageException);
/** /**
* Delete the audio clip with the specified id. * Delete an audio clip with the specified id.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @param id the id of the audio clip to be deleted. * @param id the id of the audio clip to be deleted.
* @exception std::logic_error if no audio clip with the * @exception StorageException if there is a problem with the XML-RPC
* specified id exists. * call or no audio clip with the
* @exception std::logic_error if we have not logged in yet. * specified id exists.
*/ */
virtual void virtual void
deleteAudioClip(Ptr<SessionId>::Ref sessionId, deleteAudioClip(Ptr<SessionId>::Ref sessionId,
Ptr<UniqueId>::Ref id) Ptr<UniqueId>::Ref id)
throw (std::logic_error); throw (StorageException);
/** /**
* Return a list of all audio clips in the playlist store. * Return a list of all audio clips in the playlist store.
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return a vector containing the audio clips. * @return a vector containing the playlists.
* @exception std::logic_error if we have not logged in yet. * @exception StorageException if there is a problem with the XML-RPC
* call.
*/ */
virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref virtual Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref
getAllAudioClips(Ptr<SessionId>::Ref sessionId) const getAllAudioClips(Ptr<SessionId>::Ref sessionId) const
throw (std::logic_error); throw (StorageException);
/** /**
* Reset the storage to its initial state. Used for testing. * Reset the storage to its initial state. Used for testing.
@ -415,7 +424,7 @@ class WebStorageClient :
*/ */
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref
reset(void) reset(void)
throw (std::logic_error); throw (StorageException);
}; };

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,18 +137,37 @@ WebStorageClientTest :: firstTest(void)
{ {
Ptr<SessionId>::Ref sessionId(new SessionId("bad ID")); Ptr<SessionId>::Ref sessionId(new SessionId("bad ID"));
// this does not currently work due to a bug in the storage server try {
// try { authentication->logout(sessionId);
// wsc->logout(sessionId); CPPUNIT_FAIL("allowed logout operation without login");
// CPPUNIT_FAIL("allowed logout operation without login"); }
// } catch (AuthenticationException &e) {
// catch (std::logic_error &e) { }
// }
CPPUNIT_ASSERT(!(sessionId = authentication->login("noSuchUser", try {
"incorrectPassword"))); sessionId = authentication->login("noSuchUser", "incorrectPassword");
CPPUNIT_ASSERT( (sessionId = authentication->login("root", "q"))); CPPUNIT_FAIL("Allowed login with incorrect password.");
CPPUNIT_ASSERT( authentication->logout(sessionId)); }
catch (AuthenticationException &e) {
}
try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "Login failed.";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
try {
authentication->logout(sessionId);
}
catch (AuthenticationException &e) {
std::string eMsg = "Login failed.";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
}
} }
@ -175,7 +194,7 @@ WebStorageClientTest :: audioClipTest(void)
try { try {
exists = wsc->existsAudioClip(sessionId, id01); exists = wsc->existsAudioClip(sessionId, id01);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
CPPUNIT_ASSERT(exists); CPPUNIT_ASSERT(exists);
@ -184,7 +203,7 @@ WebStorageClientTest :: audioClipTest(void)
try { try {
audioClip = wsc->getAudioClip(sessionId, id01); audioClip = wsc->getAudioClip(sessionId, id01);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
@ -192,11 +211,10 @@ WebStorageClientTest :: audioClipTest(void)
try { try {
exists = wsc->existsAudioClip(sessionId, id77); exists = wsc->existsAudioClip(sessionId, id77);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
CPPUNIT_ASSERT(!exists); CPPUNIT_ASSERT(!exists);
/* /*
Ptr<time_duration>::Ref playlength(new time_duration(0,0,11,0)); Ptr<time_duration>::Ref playlength(new time_duration(0,0,11,0));
Ptr<std::string>::Ref uri(new std::string("file:var/test10001.mp3")); Ptr<std::string>::Ref uri(new std::string("file:var/test10001.mp3"));
@ -205,7 +223,7 @@ WebStorageClientTest :: audioClipTest(void)
try { try {
wsc->storeAudioClip(sessionId, audioClip); wsc->storeAudioClip(sessionId, audioClip);
} }
catch (std::logic_error &e) { catch (StorageException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
@ -213,11 +231,16 @@ WebStorageClientTest :: audioClipTest(void)
Ptr<AudioClip>::Ref newAudioClip Ptr<AudioClip>::Ref newAudioClip
= wsc->getAudioClip(sessionId, id01); = wsc->getAudioClip(sessionId, id01);
CPPUNIT_ASSERT(newAudioClip->getId()->getId() == id01->getId()); CPPUNIT_ASSERT(std::string(*newAudioClip->getId()) == std::string(*id01);
CPPUNIT_ASSERT(newAudioClip->getPlaylength()->total_seconds() CPPUNIT_ASSERT(newAudioClip->getPlaylength()->total_seconds()
== audioClip->getPlaylength()->total_seconds()); == audioClip->getPlaylength()->total_seconds());
*/ */
CPPUNIT_ASSERT( authentication->logout(sessionId)); try{
authentication->logout(sessionId);
}
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
/* /*
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector = Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector =
wsc->getAllAudioClips(); wsc->getAllAudioClips();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -111,7 +111,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try{ try{
sessionId = XmlRpcTools::extractSessionId(parameters); sessionId = XmlRpcTools::extractSessionId(parameters);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+20, XmlRpcTools::markError(errorId+20,
"missing session ID argument", "missing session ID argument",
returnValue); returnValue);
@ -122,7 +122,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try{ try{
playlistId = XmlRpcTools::extractPlaylistId(parameters); playlistId = XmlRpcTools::extractPlaylistId(parameters);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+2, "missing playlist ID argument", XmlRpcTools::markError(errorId+2, "missing playlist ID argument",
returnValue); returnValue);
return; return;
@ -132,7 +132,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try{ try{
audioClipId = XmlRpcTools::extractAudioClipId(parameters); audioClipId = XmlRpcTools::extractAudioClipId(parameters);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "missing audio clip ID argument", XmlRpcTools::markError(errorId+3, "missing audio clip ID argument",
returnValue); returnValue);
return; return;
@ -142,7 +142,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try{ try{
relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); relativeOffset = XmlRpcTools::extractRelativeOffset(parameters);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+4, "missing relative offset argument", XmlRpcTools::markError(errorId+4, "missing relative offset argument",
returnValue); returnValue);
return; return;
@ -157,7 +157,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+5, "playlist not found", XmlRpcTools::markError(errorId+5, "playlist not found",
returnValue); returnValue);
return; return;
@ -174,7 +174,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
audioClip = storage->getAudioClip(sessionId, audioClipId); audioClip = storage->getAudioClip(sessionId, audioClipId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+7, "audio clip does not exist", XmlRpcTools::markError(errorId+7, "audio clip does not exist",
returnValue); returnValue);
return; return;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,8 +137,13 @@ AddAudioClipToPlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }
@ -171,6 +176,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
rootParameter.setSize(1); rootParameter.setSize(1);
XmlRpc::XmlRpcValue result; XmlRpc::XmlRpcValue result;
parameters.clear();
parameters["sessionId"] = sessionId->getId(); parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1; parameters["playlistId"] = 1;
parameters["audioClipId"] = 10001; parameters["audioClipId"] = 10001;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -123,10 +123,21 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
scf = StorageClientFactory::getInstance(); scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient(); storage = scf->getStorageClient();
Ptr<Playlist>::Ref playlist = storage->createPlaylist(sessionId); Ptr<Playlist>::Ref playlist;
try {
playlist = storage->createPlaylist(sessionId);
}
catch (StorageException &e) {
std::string eMsg = "could not create playlist:\n";
eMsg += e.what();
XmlRpcTools :: markError(errorId+2,
eMsg,
returnValue);
return;
}
if (!playlist->setLockedForEditing(true)) { // this should never happen if (!playlist->setLockedForEditing(true)) { // this should never happen
XmlRpcTools :: markError(errorId+1, XmlRpcTools :: markError(errorId+3,
"could not open new playlist for editing", "could not open new playlist for editing",
returnValue); returnValue);
return; return;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -88,12 +88,14 @@ using namespace LiveSupport::Core;
* and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The * and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The
* possible errors are: * possible errors are:
* <ul> * <ul>
* <li>201 - could not open new playlist for editing</li> * <li>201 - invalid argument format</li>
* <li>202 - could not create playlist</li>
* <li>203 - could not open new playlist for editing</li>
* <li>220 - missing session ID argument </li> * <li>220 - missing session ID argument </li>
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod class CreatePlaylistMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,8 +137,13 @@ CreatePlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -126,9 +126,10 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }
@ -141,9 +142,10 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
storage->deletePlaylist(sessionId, playlistId); storage->deletePlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+5, "playlist could not be deleted", std::string eMsg = "playlist could not be deleted:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+5, eMsg, returnValue);
return; return;
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -138,8 +138,13 @@ DeletePlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,9 +137,10 @@ DisplayAudioClipMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
audioClip = storage->getAudioClip(sessionId, id); audioClip = storage->getAudioClip(sessionId, id);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "audio clip not found", std::string eMsg = "audio clip not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,8 +135,13 @@ DisplayAudioClipMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -113,8 +113,16 @@ DisplayAudioClipsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
scf = StorageClientFactory::getInstance(); scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient(); storage = scf->getStorageClient();
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector = Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClipVector;
storage->getAllAudioClips(sessionId); try {
audioClipVector = storage->getAllAudioClips(sessionId);
}
catch (StorageException &e) {
std::string eMsg = "getAllAudioClips returned error:\n";
eMsg += e.what();
XmlRpcTools::markError(errorId+2, eMsg, returnValue);
return;
}
XmlRpcTools::audioClipVectorToXmlRpcValue(audioClipVector, returnValue); XmlRpcTools::audioClipVectorToXmlRpcValue(audioClipVector, returnValue);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -93,11 +93,13 @@ using namespace LiveSupport::Core;
* and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The * and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The
* possible errors are: * possible errors are:
* <ul> * <ul>
* <li>1801 - invalid argument format </li>
* <li>1802 - XML-RPC error </li>
* <li>1820 - missing session ID argument </li> * <li>1820 - missing session ID argument </li>
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class DisplayAudioClipsMethod : public XmlRpc::XmlRpcServerMethod class DisplayAudioClipsMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -136,8 +136,13 @@ DisplayAudioClipsMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -137,9 +137,10 @@ DisplayPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,8 +135,13 @@ DisplayPlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -114,8 +114,16 @@ DisplayPlaylistsMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
scf = StorageClientFactory::getInstance(); scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient(); storage = scf->getStorageClient();
Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector = Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlistVector;
storage->getAllPlaylists(sessionId); try {
playlistVector = storage->getAllPlaylists(sessionId);
}
catch (StorageException &e) {
std::string eMsg = "getAllPlaylists() returned error:\n";
eMsg += e.what();
XmlRpcTools::markError(errorId+2, eMsg, returnValue);
return;
}
XmlRpcTools::playlistVectorToXmlRpcValue(playlistVector, returnValue); XmlRpcTools::playlistVectorToXmlRpcValue(playlistVector, returnValue);
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -93,11 +93,13 @@ using namespace LiveSupport::Core;
* and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The * and a {&nbsp;faultCode, faultString&nbsp;} structure is returned. The
* possible errors are: * possible errors are:
* <ul> * <ul>
* <li>1701 - invalid argument format </li>
* <li>1702 - XML-RPC error </li>
* <li>1720 - missing session ID argument </li> * <li>1720 - missing session ID argument </li>
* </ul> * </ul>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod
{ {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -136,8 +136,13 @@ DisplayPlaylistsMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayScheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -122,6 +122,7 @@ DisplayScheduleMethodTest :: configure(
void void
DisplayScheduleMethodTest :: setUp(void) throw () DisplayScheduleMethodTest :: setUp(void) throw ()
{ {
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<StorageClientFactory>::Ref scf Ptr<StorageClientFactory>::Ref scf
= StorageClientFactory::getInstance(); = StorageClientFactory::getInstance();
@ -137,10 +138,8 @@ DisplayScheduleMethodTest :: setUp(void) throw ()
schedule = sf->getSchedule(); schedule = sf->getSchedule();
schedule->install(); schedule->install();
Ptr<AuthenticationClientFactory>::Ref acf = AuthenticationClientFactory::getInstance();
acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfig); configure(acf, authenticationClientConfig);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
CPPUNIT_FAIL("semantic error in configuration file"); CPPUNIT_FAIL("semantic error in configuration file");
@ -150,8 +149,14 @@ DisplayScheduleMethodTest :: setUp(void) throw ()
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
insertEntries(); // this can only be called after sessionId is obtained insertEntries(); // this can only be called after sessionId is obtained

View File

@ -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/products/scheduler/src/GeneratePlayReportMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -152,8 +152,13 @@ GeneratePlayReportMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -138,9 +138,10 @@ OpenPlaylistForEditingMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+4, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -136,8 +136,13 @@ OpenPlaylistForEditingMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -150,9 +150,10 @@ RemoveAudioClipFromPlaylistMethod :: execute(
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+4, "playlist does not exist", std::string eMsg = "playlist does not exist:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -141,8 +141,13 @@ RemoveAudioClipFromPlaylistMethodTest :: setUp(void) thr
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveFromScheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -125,8 +125,13 @@ RemoveFromScheduleMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RescheduleMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -127,8 +127,13 @@ RescheduleMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -133,9 +133,10 @@ RevertEditedPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RevertEditedPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -139,8 +139,13 @@ RevertEditedPlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -154,8 +154,13 @@ RpcAddAudioClipToPlaylistTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -135,8 +135,13 @@ DisplayAudioClipMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -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/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -128,15 +128,15 @@ RpcDisplayPlaylistTest :: setUp(void) throw ()
// daemon->start(); // daemon->start();
// sleep(5); // sleep(5);
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<StorageClientFactory>::Ref scf Ptr<StorageClientFactory>::Ref scf
= StorageClientFactory::getInstance(); = StorageClientFactory::getInstance();
configure(scf, storageClientConfig); configure(scf, storageClientConfig);
Ptr<AuthenticationClientFactory>::Ref acf;
acf = AuthenticationClientFactory::getInstance(); acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfigFileName); configure(acf, authenticationClientConfigFileName);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in authentication configuration file"); CPPUNIT_FAIL("semantic error in authentication configuration file");
@ -145,8 +145,14 @@ RpcDisplayPlaylistTest :: setUp(void) throw ()
CPPUNIT_FAIL("error parsing authentication configuration file"); CPPUNIT_FAIL("error parsing authentication configuration file");
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -136,8 +136,13 @@ DisplayPlaylistsMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -121,11 +121,11 @@ RpcDisplayScheduleTest :: setUp(void) throw ()
// daemon->start(); // daemon->start();
// sleep(5); // sleep(5);
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<AuthenticationClientFactory>::Ref acf;
acf = AuthenticationClientFactory::getInstance(); acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfigFileName); configure(acf, authenticationClientConfigFileName);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in authentication configuration file"); CPPUNIT_FAIL("semantic error in authentication configuration file");
@ -134,8 +134,14 @@ RpcDisplayScheduleTest :: setUp(void) throw ()
CPPUNIT_FAIL("error parsing authentication configuration file"); CPPUNIT_FAIL("error parsing authentication configuration file");
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -121,11 +121,11 @@ RpcRemoveFromScheduleTest :: setUp(void) throw ()
// daemon->start(); // daemon->start();
// sleep(5); // sleep(5);
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<AuthenticationClientFactory>::Ref acf;
acf = AuthenticationClientFactory::getInstance(); acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfigFileName); configure(acf, authenticationClientConfigFileName);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in authentication configuration file"); CPPUNIT_FAIL("semantic error in authentication configuration file");
@ -134,8 +134,14 @@ RpcRemoveFromScheduleTest :: setUp(void) throw ()
CPPUNIT_FAIL("error parsing authentication configuration file"); CPPUNIT_FAIL("error parsing authentication configuration file");
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -120,11 +120,11 @@ RpcRescheduleTest :: setUp(void) throw ()
// daemon->start(); // daemon->start();
// sleep(5); // sleep(5);
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<AuthenticationClientFactory>::Ref acf;
acf = AuthenticationClientFactory::getInstance(); acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfigFileName); configure(acf, authenticationClientConfigFileName);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in authentication configuration file"); CPPUNIT_FAIL("semantic error in authentication configuration file");
@ -133,8 +133,14 @@ RpcRescheduleTest :: setUp(void) throw ()
CPPUNIT_FAIL("error parsing authentication configuration file"); CPPUNIT_FAIL("error parsing authentication configuration file");
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -123,11 +123,11 @@ RpcUploadPlaylistTest :: setUp(void) throw ()
// daemon->start(); // daemon->start();
// sleep(5); // sleep(5);
Ptr<AuthenticationClientFactory>::Ref acf;
try { try {
Ptr<AuthenticationClientFactory>::Ref acf;
acf = AuthenticationClientFactory::getInstance(); acf = AuthenticationClientFactory::getInstance();
configure(acf, authenticationClientConfigFileName); configure(acf, authenticationClientConfigFileName);
authentication = acf->getAuthenticationClient();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
CPPUNIT_FAIL("semantic error in authentication configuration file"); CPPUNIT_FAIL("semantic error in authentication configuration file");
@ -136,8 +136,14 @@ RpcUploadPlaylistTest :: setUp(void) throw ()
CPPUNIT_FAIL("error parsing authentication configuration file"); CPPUNIT_FAIL("error parsing authentication configuration file");
} }
if (!(sessionId = authentication->login("root", "q"))) { authentication = acf->getAuthenticationClient();
CPPUNIT_FAIL("could not log in to authentication server"); try {
sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -133,9 +133,10 @@ SavePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SavePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -136,8 +136,13 @@ SavePlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -174,9 +174,10 @@ UpdateFadeInFadeOutMethod :: execute(
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+6, "playlist does not exist", std::string eMsg = "playlist does not exist:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+6, eMsg, returnValue);
return; return;
} }

View File

@ -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/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -139,8 +139,13 @@ UpdateFadeInFadeOutMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -146,9 +146,10 @@ UploadPlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+4, "playlist not found", std::string eMsg = "playlist not found:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+4, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UploadPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -147,8 +147,13 @@ UploadPlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -138,9 +138,10 @@ ValidatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
try { try {
playlist = storage->getPlaylist(sessionId, playlistId); playlist = storage->getPlaylist(sessionId, playlistId);
} }
catch (std::invalid_argument &e) { catch (StorageException &e) {
XmlRpcTools::markError(errorId+3, "playlist does not exist", std::string eMsg = "playlist does not exist:\n";
returnValue); eMsg += e.what();
XmlRpcTools::markError(errorId+3, eMsg, returnValue);
return; return;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -139,8 +139,13 @@ ValidatePlaylistMethodTest :: setUp(void) throw ()
} }
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
if (!(sessionId = authentication->login("root", "q"))) { try {
CPPUNIT_FAIL("could not log in to authentication server"); sessionId = authentication->login("root", "q");
}
catch (AuthenticationException &e) {
std::string eMsg = "could not log in:\n";
eMsg += e.what();
CPPUNIT_FAIL(eMsg);
} }
} }