added getVersion() functions to AuthenticationClientInterface and

StorageClientInterface
added checking for auth and storage availability on gLiveSupport startup
as a result of the new XML-RPC getVersion function in PHP auth and storage
see http://bugs.campware.org/view.php?id=826
This commit is contained in:
maroy 2005-04-18 10:36:43 +00:00
parent 49ae0015da
commit e8adb2ad08
21 changed files with 446 additions and 54 deletions

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -68,13 +68,24 @@ using namespace LiveSupport::Core;
/** /**
* An interface for authentication clients. * An interface for authentication clients.
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.8 $ * @version $Revision: 1.9 $
*/ */
class AuthenticationClientInterface class AuthenticationClientInterface
{ {
public: public:
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException)
= 0;
/** /**
* Login to the authentication server. * Login to the authentication server.
* Returns a new session ID; in case of an error, throws * Returns a new session ID; in case of an error, throws

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -85,6 +85,11 @@ static const std::string userPasswordAttrName = "password";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string dummySessionIdString = "dummySessionId"; static const std::string dummySessionIdString = "dummySessionId";
/*------------------------------------------------------------------------------
* The version string, returned by getVersion
*----------------------------------------------------------------------------*/
static const std::string versionStr = "TestAuthentication";
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */
@ -144,11 +149,24 @@ TestAuthenticationClient :: configure(const xmlpp::Element & element)
throw std::invalid_argument(eMsg); throw std::invalid_argument(eMsg);
} }
versionString.reset(new Glib::ustring(versionStr));
sessionIdList.clear(); sessionIdList.clear();
sessionCounter = 0; sessionCounter = 0;
} }
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
TestAuthenticationClient :: getVersion(void)
throw (Core::XmlRpcException)
{
return versionString;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Login to the authentication server. * Login to the authentication server.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -94,8 +94,8 @@ using namespace LiveSupport::Core;
* &lt;!ATTLIST user password CDATA #REQUIRED &gt; * &lt;!ATTLIST user password CDATA #REQUIRED &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class TestAuthenticationClient : class TestAuthenticationClient :
virtual public Configurable, virtual public Configurable,
@ -108,6 +108,11 @@ class TestAuthenticationClient :
*/ */
static const std::string configElementNameStr; static const std::string configElementNameStr;
/**
* The version string of the test storage client.
*/
Ptr<const Glib::ustring>::Ref versionString;
/** /**
* The login name of the (one) authorized test user. * The login name of the (one) authorized test user.
*/ */
@ -180,6 +185,16 @@ class TestAuthenticationClient :
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument); throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/** /**
* 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.

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -145,6 +145,26 @@ TestAuthenticationClientTest :: firstTest(void)
} }
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
TestAuthenticationClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = tac->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
CPPUNIT_ASSERT(*version == "TestAuthentication");
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Test to see if we can save and load user preferences. * Test to see if we can save and load user preferences.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -63,13 +63,14 @@ using namespace LiveSupport::Core;
* Unit test for the TestAuthenticationClient class. * Unit test for the TestAuthenticationClient class.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
* @see TestAuthenticationClient * @see TestAuthenticationClient
*/ */
class TestAuthenticationClientTest : public BaseTestMethod class TestAuthenticationClientTest : public BaseTestMethod
{ {
CPPUNIT_TEST_SUITE(TestAuthenticationClientTest); CPPUNIT_TEST_SUITE(TestAuthenticationClientTest);
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest); CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
@ -89,6 +90,14 @@ class TestAuthenticationClientTest : public BaseTestMethod
void void
firstTest(void) throw (CPPUNIT_NS::Exception); firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test the gerVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/** /**
* Test saving and load of user preferences. * Test saving and load of user preferences.
* *

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -88,6 +88,16 @@ static const std::string locationPathAttrName = "path";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ authentication server constants: login */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ authentication server constants: login */
/*------------------------------------------------------------------------------
* The name of the get version method on the storage server
*----------------------------------------------------------------------------*/
static const std::string getVersionMethodName = "locstor.getVersion";
/*------------------------------------------------------------------------------
* The name of version return parameter for getVersion
*----------------------------------------------------------------------------*/
static const std::string getVersionResultParamName = "version";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the login method on the server * The name of the login method on the server
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -252,6 +262,63 @@ WebAuthenticationClient :: configure(const xmlpp::Element & element)
} }
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
WebAuthenticationClient :: getVersion(void)
throw (Core::XmlRpcException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
// add a dummy parameter, as this is the only way to enforce parameters
// to be of XML-RPC type struct
parameters["dummy"] = 0;
result.clear();
if (!xmlRpcClient.execute(getVersionMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getVersionMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned error message:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (!result.hasMember(getVersionResultParamName)
|| result[getVersionResultParamName].getType()
!= XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
Ptr<Glib::ustring>::Ref version(new Glib::ustring(
result[getVersionResultParamName]));
xmlRpcClient.close();
return version;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Login to the authentication server. * Login to the authentication server.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -92,8 +92,8 @@ using namespace LiveSupport::Core;
* &lt;!ATTLIST location path CDATA #REQUIRED &gt; * &lt;!ATTLIST location path CDATA #REQUIRED &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class WebAuthenticationClient : class WebAuthenticationClient :
virtual public Configurable, virtual public Configurable,
@ -158,6 +158,16 @@ class WebAuthenticationClient :
configure(const xmlpp::Element & element) configure(const xmlpp::Element & element)
throw (std::invalid_argument); throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/** /**
* 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.

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -144,6 +144,25 @@ WebAuthenticationClientTest :: firstTest(void)
} }
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
WebAuthenticationClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = wac->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Test to see if we can save and load user preferences. * Test to see if we can save and load user preferences.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClientTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClientTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -63,13 +63,14 @@ using namespace LiveSupport::Core;
* Unit test for the WebAuthenticationClient class. * Unit test for the WebAuthenticationClient class.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
* @see WebAuthenticationClient * @see WebAuthenticationClient
*/ */
class WebAuthenticationClientTest : public BaseTestMethod class WebAuthenticationClientTest : public BaseTestMethod
{ {
CPPUNIT_TEST_SUITE(WebAuthenticationClientTest); CPPUNIT_TEST_SUITE(WebAuthenticationClientTest);
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest); CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
@ -89,6 +90,14 @@ class WebAuthenticationClientTest : public BaseTestMethod
void void
firstTest(void) throw (CPPUNIT_NS::Exception); firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test the getVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/** /**
* Test saving and load of user preferences. * Test saving and load of user preferences.
* *

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -66,12 +66,23 @@ using namespace Core;
/** /**
* An interface for storage clients. * An interface for storage clients.
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.10 $ * @version $Revision: 1.11 $
*/ */
class StorageClientInterface class StorageClientInterface
{ {
public: public:
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException)
= 0;
/** /**
* Create a new, empty, playlist. Does not automatically open the * Create a new, empty, playlist. Does not automatically open the
* playlist for editing; for that, use editPlaylist() and * playlist for editing; for that, use editPlaylist() and

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.36 $ Version : $Revision: 1.37 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -128,6 +128,11 @@ static const std::string smilPlaylistNodeName = "audio";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string smilPlaylistUriAttrName = "src"; static const std::string smilPlaylistUriAttrName = "src";
/*------------------------------------------------------------------------------
* The version string, returned by getVersion
*----------------------------------------------------------------------------*/
static const std::string versionStr = "TestStorage";
/* =============================================== local function prototypes */ /* =============================================== local function prototypes */
@ -146,7 +151,9 @@ TestStorageClient :: configure(const xmlpp::Element & element)
eMsg += element.get_name(); eMsg += element.get_name();
throw std::invalid_argument(eMsg); throw std::invalid_argument(eMsg);
} }
versionString.reset(new Glib::ustring(versionStr));
savedConfigurationElement.reset(new xmlpp::Document); savedConfigurationElement.reset(new xmlpp::Document);
savedConfigurationElement->create_root_node_by_import(&element, true); savedConfigurationElement->create_root_node_by_import(&element, true);
// true == recursive // true == recursive
@ -154,6 +161,22 @@ TestStorageClient :: configure(const xmlpp::Element & element)
} }
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
TestStorageClient :: getVersion(void)
throw (Core::XmlRpcException)
{
if (!savedConfigurationElement) {
throw Core::XmlRpcInvalidArgumentException("storage has not been"
" configured yet");
}
return versionString;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Reset the storage to its initial state. * Reset the storage to its initial state.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.30 $ Version : $Revision: 1.31 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -85,8 +85,8 @@ using namespace LiveSupport::Core;
* &lt;!ATTLIST testStorage tempFiles CDATA #REQUIRED &gt; * &lt;!ATTLIST testStorage tempFiles CDATA #REQUIRED &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.30 $ * @version $Revision: 1.31 $
*/ */
class TestStorageClient : class TestStorageClient :
virtual public Configurable, virtual public Configurable,
@ -98,6 +98,11 @@ class TestStorageClient :
*/ */
static const std::string configElementNameStr; static const std::string configElementNameStr;
/**
* The version string of the test storage client.
*/
Ptr<const Glib::ustring>::Ref versionString;
/** /**
* A copy of the configuration element stored to be used by reset() * A copy of the configuration element stored to be used by reset()
*/ */
@ -214,6 +219,17 @@ class TestStorageClient :
throw (std::invalid_argument); throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/** /**
* Create a new, empty, playlist. Does not automatically open the * Create a new, empty, playlist. Does not automatically open the
* playlist for editing; for that, use editPlaylist() and * playlist for editing; for that, use editPlaylist() and

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.25 $ Version : $Revision: 1.26 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -105,14 +105,14 @@ TestStorageClientTest :: tearDown(void) throw ()
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Test to see if the singleton Hello object is accessible * Some very simple smoke tests
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
TestStorageClientTest :: firstTest(void) TestStorageClientTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<UniqueId>::Ref id1(new UniqueId(1)); Ptr<UniqueId>::Ref id1(new UniqueId(1));
Ptr<UniqueId>::Ref id2(new UniqueId(77)); Ptr<UniqueId>::Ref id2(new UniqueId(77));
try { try {
CPPUNIT_ASSERT(tsc->existsPlaylist(dummySessionId, id1)); CPPUNIT_ASSERT(tsc->existsPlaylist(dummySessionId, id1));
@ -137,6 +137,26 @@ TestStorageClientTest :: firstTest(void)
} }
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
TestStorageClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = tsc->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
CPPUNIT_ASSERT(*version == "TestStorage");
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Testing the deletePlaylist method * Testing the deletePlaylist method
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.10 $ Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -57,14 +57,15 @@ namespace Storage {
/** /**
* Unit test for the UploadPlaylistMetohd class. * Unit test for the UploadPlaylistMetohd class.
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.10 $ * @version $Revision: 1.11 $
* @see TestStorageClient * @see TestStorageClient
*/ */
class TestStorageClientTest : public CPPUNIT_NS::TestFixture class TestStorageClientTest : public CPPUNIT_NS::TestFixture
{ {
CPPUNIT_TEST_SUITE(TestStorageClientTest); CPPUNIT_TEST_SUITE(TestStorageClientTest);
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(resetTest); CPPUNIT_TEST(resetTest);
CPPUNIT_TEST(deletePlaylistTest); CPPUNIT_TEST(deletePlaylistTest);
CPPUNIT_TEST(createPlaylistTest); CPPUNIT_TEST(createPlaylistTest);
@ -96,6 +97,14 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture
void void
firstTest(void) throw (CPPUNIT_NS::Exception); firstTest(void) throw (CPPUNIT_NS::Exception);
/*
* Test the getVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/** /**
* Testing deletePlaylist(). * Testing deletePlaylist().
* *

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.37 $ Version : $Revision: 1.38 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -180,6 +180,16 @@ static const std::string errorMessageParamName = "faultString";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: resetStorage */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: resetStorage */
/*------------------------------------------------------------------------------
* The name of the get version method on the storage server
*----------------------------------------------------------------------------*/
static const std::string getVersionMethodName = "locstor.getVersion";
/*------------------------------------------------------------------------------
* The name of version return parameter for getVersion
*----------------------------------------------------------------------------*/
static const std::string getVersionResultParamName = "version";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the reset storage method on the storage server * The name of the reset storage method on the storage server
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -668,6 +678,63 @@ WebStorageClient :: configure(const xmlpp::Element & element)
} }
/*------------------------------------------------------------------------------
* Return the version string of the test storage.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
WebStorageClient :: getVersion(void)
throw (Core::XmlRpcException)
{
XmlRpcValue parameters;
XmlRpcValue result;
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
storageServerPath.c_str(), false);
parameters.clear();
// add a dummy parameter, as this is the only way to enforce parameters
// to be of XML-RPC type struct
parameters["dummy"] = 0;
result.clear();
if (!xmlRpcClient.execute(getVersionMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getVersionMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned error message:\n"
<< result;
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (!result.hasMember(getVersionResultParamName)
|| result[getVersionResultParamName].getType()
!= XmlRpcValue::TypeString) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< getVersionMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
}
Ptr<Glib::ustring>::Ref version(new Glib::ustring(
result[getVersionResultParamName]));
xmlRpcClient.close();
return version;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Create a new playlist. * Create a new playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.24 $ Version : $Revision: 1.25 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -95,8 +95,8 @@ using namespace LiveSupport::Core;
* &lt;!ATTLIST location path CDATA #REQUIRED &gt; * &lt;!ATTLIST location path CDATA #REQUIRED &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.24 $ * @version $Revision: 1.25 $
*/ */
class WebStorageClient : class WebStorageClient :
virtual public Configurable, virtual public Configurable,
@ -206,6 +206,17 @@ class WebStorageClient :
throw (std::invalid_argument); throw (std::invalid_argument);
/**
* Return the version string from the storage.
*
* @return the version string of the storage.
* @exception XmlRpcException if there is a problem with the XML-RPC
* call.
*/
virtual Ptr<const Glib::ustring>::Ref
getVersion(void) throw (XmlRpcException);
/** /**
* Create a new, empty, playlist. Does not automatically open the * Create a new, empty, playlist. Does not automatically open the
* playlist for editing; for that, use editPlaylist() and * playlist for editing; for that, use editPlaylist() and

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.39 $ Version : $Revision: 1.40 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -175,6 +175,25 @@ WebStorageClientTest :: firstTest(void)
} }
/*------------------------------------------------------------------------------
* Test the getVersion function
*----------------------------------------------------------------------------*/
void
WebStorageClientTest :: getVersionTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<const Glib::ustring>::Ref version;
try {
version = wsc->getVersion();
} catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(version.get());
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Testing the playlist operations * Testing the playlist operations
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -64,13 +64,14 @@ using namespace LiveSupport::Authentication;
* Unit test for the UploadPlaylistMetohd class. * Unit test for the UploadPlaylistMetohd class.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
* @see WebStorageClient * @see WebStorageClient
*/ */
class WebStorageClientTest : public BaseTestMethod class WebStorageClientTest : public BaseTestMethod
{ {
CPPUNIT_TEST_SUITE(WebStorageClientTest); CPPUNIT_TEST_SUITE(WebStorageClientTest);
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(simplePlaylistTest); CPPUNIT_TEST(simplePlaylistTest);
CPPUNIT_TEST(playlistTest); CPPUNIT_TEST(playlistTest);
CPPUNIT_TEST(audioClipTest); CPPUNIT_TEST(audioClipTest);
@ -99,6 +100,14 @@ class WebStorageClientTest : public BaseTestMethod
void void
firstTest(void) throw (CPPUNIT_NS::Exception); firstTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test the getVersion() function.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
getVersionTest(void) throw (CPPUNIT_NS::Exception);
/** /**
* Testing the audio clip operations. * Testing the audio clip operations.
* *

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.28 $ Version : $Revision: 1.29 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -99,6 +99,17 @@ static const std::string scratchpadContentsKey = "scratchpadContents";
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static const std::string schedulerNotReachableKey = "schedulerNotReachableMsg"; static const std::string schedulerNotReachableKey = "schedulerNotReachableMsg";
/*------------------------------------------------------------------------------
* Static constant for the key of the storage not available key
*----------------------------------------------------------------------------*/
static const std::string storageNotReachableKey = "storageNotReachableMsg";
/*------------------------------------------------------------------------------
* Static constant for the key of the authentication not available key
*----------------------------------------------------------------------------*/
static const std::string authenticationNotReachableKey =
"authenticationNotReachableMsg";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Static constant for the key of the locale not available key * Static constant for the key of the locale not available key
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -258,9 +269,22 @@ GLiveSupport :: checkConfiguration(void) throw ()
return false; return false;
} }
// TODO: check if the authentication server is available // check if the authentication server is available
try {
authentication->getVersion();
} catch (XmlRpcException &e) {
displayMessageWindow(getResourceUstring(authenticationNotReachableKey));
return false;
}
// TODO: check if the storage server is available
// check if the storage server is available
try {
storage->getVersion();
} catch (XmlRpcException &e) {
displayMessageWindow(getResourceUstring(storageNotReachableKey));
return false;
}
// no need to check the widget factory // no need to check the widget factory

View file

@ -12,6 +12,8 @@ hu:table
localeNotAvailableMsg:string { "A {0} nyelv nem elérhető" } localeNotAvailableMsg:string { "A {0} nyelv nem elérhető" }
schedulerNotReachableMsg:string { "Az időzitő szerver nem elérhető" } schedulerNotReachableMsg:string { "Az időzitő szerver nem elérhető" }
storageNotReachableMsg:string { "Az tároló szerver nem elérhető" }
authenticationNotReachableMsg:string { "A beléptető szerver nem elérhető" }
loginWindow:table loginWindow:table
{ {

View file

@ -12,6 +12,9 @@ root:table
localeNotAvailableMsg:string { "Locale {0} not available" } localeNotAvailableMsg:string { "Locale {0} not available" }
schedulerNotReachableMsg:string { "Scheduler server not available" } schedulerNotReachableMsg:string { "Scheduler server not available" }
storageNotReachableMsg:string { "Storage server not available" }
authenticationNotReachableMsg:string
{ "Authentication server not available" }
loginWindow:table loginWindow:table
{ {