fixed ticket #1668:

added a missing reset() method to the authentication client;
now using this reset() method in the unit test to avoid dependence on earlier events
This commit is contained in:
fgerlits 2006-05-09 13:41:46 +00:00
parent d83086efa8
commit 7b4c7f97a4
5 changed files with 49 additions and 2 deletions

View file

@ -203,6 +203,18 @@ class AuthenticationClientInterface
throw (XmlRpcException) throw (XmlRpcException)
= 0; = 0;
/**
* Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
*
* @exception XmlRpcException if the server returns an error.
*/
virtual void
reset(void)
throw (XmlRpcException)
= 0;
/** /**
* A virtual destructor, as this class has virtual functions. * A virtual destructor, as this class has virtual functions.
*/ */

View file

@ -114,6 +114,10 @@ AuthenticationClientFactoryTest :: firstTest(void)
Ptr<AuthenticationClientInterface>::Ref Ptr<AuthenticationClientInterface>::Ref
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
CPPUNIT_ASSERT_NO_THROW(
authentication->reset()
);
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
try { try {
@ -144,6 +148,10 @@ AuthenticationClientFactoryTest :: preferencesTest(void)
Ptr<AuthenticationClientInterface>::Ref Ptr<AuthenticationClientInterface>::Ref
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
CPPUNIT_ASSERT_NO_THROW(
authentication->reset()
);
Ptr<SessionId>::Ref sessionId; Ptr<SessionId>::Ref sessionId;
Ptr<const Glib::ustring>::Ref prefValue; Ptr<const Glib::ustring>::Ref prefValue;

View file

@ -280,3 +280,17 @@ TestAuthenticationClient :: deletePreferencesItem(
preferences.erase(it); preferences.erase(it);
} }
/*------------------------------------------------------------------------------
* Reset the list of preferences to its initial (empty) state.
*----------------------------------------------------------------------------*/
void
TestAuthenticationClient :: reset(void)
throw (XmlRpcException)
{
sessionIdList.clear();
sessionCounter = 0;
preferences.clear();
}

View file

@ -261,6 +261,17 @@ class TestAuthenticationClient :
deletePreferencesItem(Ptr<SessionId>::Ref sessionId, deletePreferencesItem(Ptr<SessionId>::Ref sessionId,
const Glib::ustring & key) const Glib::ustring & key)
throw (XmlRpcException); throw (XmlRpcException);
/**
* Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
*
* @exception XmlRpcException if the server returns an error.
*/
virtual void
reset(void)
throw (XmlRpcException);
}; };

View file

@ -272,11 +272,13 @@ class WebAuthenticationClient :
throw (XmlRpcException); throw (XmlRpcException);
/** /**
* Reset the list of preferences to its initial (empty) state. * Reset the authentication client.
* Invalidates all active session IDs, and resets the list of
* preferences to its initial (empty) state.
* *
* @exception XmlRpcException if the server returns an error. * @exception XmlRpcException if the server returns an error.
*/ */
void virtual void
reset(void) reset(void)
throw (XmlRpcException); throw (XmlRpcException);
}; };