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
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Author : $Author: maroy $
Version : $Revision: 1.9 $
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.
*
* @author $Author: fgerlits $
* @version $Revision: 1.8 $
* @author $Author: maroy $
* @version $Revision: 1.9 $
*/
class AuthenticationClientInterface
{
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.
* 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
Author : $Author: fgerlits $
Version : $Revision: 1.6 $
Author : $Author: maroy $
Version : $Revision: 1.7 $
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";
/*------------------------------------------------------------------------------
* The version string, returned by getVersion
*----------------------------------------------------------------------------*/
static const std::string versionStr = "TestAuthentication";
/* =============================================== local function prototypes */
@ -144,11 +149,24 @@ TestAuthenticationClient :: configure(const xmlpp::Element & element)
throw std::invalid_argument(eMsg);
}
versionString.reset(new Glib::ustring(versionStr));
sessionIdList.clear();
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.
*----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.9 $
Author : $Author: maroy $
Version : $Revision: 1.10 $
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;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.9 $
* @author $Author: maroy $
* @version $Revision: 1.10 $
*/
class TestAuthenticationClient :
virtual public Configurable,
@ -108,6 +108,11 @@ class TestAuthenticationClient :
*/
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.
*/
@ -180,6 +185,16 @@ class TestAuthenticationClient :
configure(const xmlpp::Element & element)
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
* configuration file.

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -63,13 +63,14 @@ using namespace LiveSupport::Core;
* Unit test for the TestAuthenticationClient class.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
* @see TestAuthenticationClient
*/
class TestAuthenticationClientTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(TestAuthenticationClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END();
@ -89,6 +90,14 @@ class TestAuthenticationClientTest : public BaseTestMethod
void
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.
*

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Author : $Author: maroy $
Version : $Revision: 1.11 $
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 */
/*------------------------------------------------------------------------------
* 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
*----------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.6 $
Author : $Author: maroy $
Version : $Revision: 1.7 $
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;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
* @author $Author: maroy $
* @version $Revision: 1.7 $
*/
class WebAuthenticationClient :
virtual public Configurable,
@ -158,6 +158,16 @@ class WebAuthenticationClient :
configure(const xmlpp::Element & element)
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
* configuration file.

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -63,13 +63,14 @@ using namespace LiveSupport::Core;
* Unit test for the WebAuthenticationClient class.
*
* @author $Author: maroy $
* @version $Revision: 1.6 $
* @version $Revision: 1.7 $
* @see WebAuthenticationClient
*/
class WebAuthenticationClientTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(WebAuthenticationClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(preferencesTest);
CPPUNIT_TEST_SUITE_END();
@ -89,6 +90,14 @@ class WebAuthenticationClientTest : public BaseTestMethod
void
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.
*

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Author : $Author: maroy $
Version : $Revision: 1.11 $
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.
*
* @author $Author: fgerlits $
* @version $Revision: 1.10 $
* @author $Author: maroy $
* @version $Revision: 1.11 $
*/
class StorageClientInterface
{
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
* 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
Author : $Author: fgerlits $
Version : $Revision: 1.36 $
Author : $Author: maroy $
Version : $Revision: 1.37 $
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";
/*------------------------------------------------------------------------------
* The version string, returned by getVersion
*----------------------------------------------------------------------------*/
static const std::string versionStr = "TestStorage";
/* =============================================== local function prototypes */
@ -146,7 +151,9 @@ TestStorageClient :: configure(const xmlpp::Element & element)
eMsg += element.get_name();
throw std::invalid_argument(eMsg);
}
versionString.reset(new Glib::ustring(versionStr));
savedConfigurationElement.reset(new xmlpp::Document);
savedConfigurationElement->create_root_node_by_import(&element, true);
// 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.
*----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.30 $
Author : $Author: maroy $
Version : $Revision: 1.31 $
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;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.30 $
* @author $Author: maroy $
* @version $Revision: 1.31 $
*/
class TestStorageClient :
virtual public Configurable,
@ -98,6 +98,11 @@ class TestStorageClient :
*/
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()
*/
@ -214,6 +219,17 @@ class TestStorageClient :
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
* 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
Author : $Author: fgerlits $
Version : $Revision: 1.25 $
Author : $Author: maroy $
Version : $Revision: 1.26 $
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
TestStorageClientTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<UniqueId>::Ref id1(new UniqueId(1));
Ptr<UniqueId>::Ref id2(new UniqueId(77));
Ptr<UniqueId>::Ref id1(new UniqueId(1));
Ptr<UniqueId>::Ref id2(new UniqueId(77));
try {
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
*----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.10 $
Author : $Author: maroy $
Version : $Revision: 1.11 $
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.
*
* @author $Author: fgerlits $
* @version $Revision: 1.10 $
* @author $Author: maroy $
* @version $Revision: 1.11 $
* @see TestStorageClient
*/
class TestStorageClientTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(TestStorageClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(resetTest);
CPPUNIT_TEST(deletePlaylistTest);
CPPUNIT_TEST(createPlaylistTest);
@ -96,6 +97,14 @@ class TestStorageClientTest : public CPPUNIT_NS::TestFixture
void
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().
*

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.37 $
Author : $Author: maroy $
Version : $Revision: 1.38 $
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 */
/*------------------------------------------------------------------------------
* 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
*----------------------------------------------------------------------------*/
@ -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.
*----------------------------------------------------------------------------*/

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.24 $
Author : $Author: maroy $
Version : $Revision: 1.25 $
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;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.24 $
* @author $Author: maroy $
* @version $Revision: 1.25 $
*/
class WebStorageClient :
virtual public Configurable,
@ -206,6 +206,17 @@ class WebStorageClient :
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
* playlist for editing; for that, use editPlaylist() and

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -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
*----------------------------------------------------------------------------*/

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -64,13 +64,14 @@ using namespace LiveSupport::Authentication;
* Unit test for the UploadPlaylistMetohd class.
*
* @author $Author: maroy $
* @version $Revision: 1.9 $
* @version $Revision: 1.10 $
* @see WebStorageClient
*/
class WebStorageClientTest : public BaseTestMethod
{
CPPUNIT_TEST_SUITE(WebStorageClientTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(getVersionTest);
CPPUNIT_TEST(simplePlaylistTest);
CPPUNIT_TEST(playlistTest);
CPPUNIT_TEST(audioClipTest);
@ -99,6 +100,14 @@ class WebStorageClientTest : public BaseTestMethod
void
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.
*

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -99,6 +99,17 @@ static const std::string scratchpadContentsKey = "scratchpadContents";
*----------------------------------------------------------------------------*/
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
*----------------------------------------------------------------------------*/
@ -258,9 +269,22 @@ GLiveSupport :: checkConfiguration(void) throw ()
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

View file

@ -12,6 +12,8 @@ hu:table
localeNotAvailableMsg:string { "A {0} nyelv 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
{

View file

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