authenticationservices/authenticationserver/test/tAuthSvr/src/tAuthSvrStep.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef T_AUTHSVR_STEP_H
       
    21 #define T_AUTHSVR_STEP_H
       
    22 
       
    23 #include <test/testexecutestepbase.h>
       
    24 #include <ecom/ecom.h>
       
    25 
       
    26 #include "authserver_client.h"
       
    27 #include <authserver/authplugininterface.h>
       
    28 #include <pinplugindialogdefs.h>
       
    29 
       
    30 #include "authserver_impl.h"
       
    31 #include "authserver/authclient.h"
       
    32 #include "authserver/authmgrclient.h"
       
    33 
       
    34 #include "tAuthSvrServer.h"
       
    35 #include "tauthdbstep.h"
       
    36 
       
    37 // these tests use some information which is normally
       
    38 // only visible to the server, or to the client DLL.
       
    39 
       
    40 #include "authdb.h"
       
    41 #include "authserveripc.h"
       
    42 #include "transientkey.h"
       
    43 #include "transientkeyinfo.h"
       
    44 #include "testutilclient.h"
       
    45 using namespace AuthServer;
       
    46 
       
    47 
       
    48 _LIT(KInputFile, 	"C:\\t_pinplugindlg_in.dat");
       
    49 _LIT(KOutputFile, "C:\\t_pinplugindlg_out.dat");
       
    50 _LIT(KEmptyString, "");
       
    51 
       
    52 // Used when creating the initial db
       
    53 //#define KNumPlugins 8	//Defined in tauthdbstep.h
       
    54 
       
    55 class CTAuthSvrStepBase : public CTestStep
       
    56 	{
       
    57 protected:
       
    58 	CTAuthSvrStepBase();
       
    59 	~CTAuthSvrStepBase();
       
    60 	virtual TVerdict doTestStepPreambleL()	
       
    61 		{
       
    62 
       
    63 		iFs.Connect();	
       
    64 	   	return TestStepResult();
       
    65 		}
       
    66 	virtual TVerdict doTestStepPostambleL()
       
    67 	    {
       
    68 		iFs.Close();
       
    69 		return TestStepResult();
       
    70 		
       
    71 		}
       
    72 	void SetDefaultPluginIdL(TInt aDefault);
       
    73 
       
    74 	HBufC* GetNameLC(TInt i);
       
    75 
       
    76 	void PluginData(AuthServer::TIdentityId aId, AuthServer::TPluginId aPlugin,	TPtr8 aDes) 
       
    77 		{
       
    78 		aDes.Fill(aId*aPlugin);
       
    79 		}
       
    80 
       
    81 //Needed because of the use of Step_CreateDb
       
    82 	inline void CreatePlugins();
       
    83 	inline void CreateKeyInfo();
       
    84 		
       
    85 	//Utility functions allowing text INI file parsing abilities
       
    86 	TInt writeToNamedConfig(CIniData* aFile, const TDesC &aSectName,const TDesC &aKeyName, const TPtrC &aResult);
       
    87 	//Section name unspecified
       
    88 	TInt writeToNamedConfig(CIniData* aFile, const TDesC &aKeyName,const TPtrC &aResult);
       
    89 	TInt readFromNamedConfigL(const TDesC &aFileName, const TDesC &aSectName,const TDesC &aKeyName, HBufC*& aResult);
       
    90 	//Section name unspecified
       
    91 	TInt readFromNamedConfigL(const TDesC &aFileName, const TDesC &aKeyName, HBufC*& aResult);
       
    92 	//Read data from testexecute ini file that will be used to initialise the Authentication Server
       
    93 	TInt InitAuthServerFromFileL();
       
    94 	
       
    95 	//Read plugin input train or plugin input id data from testexecute ini file 
       
    96 	//that will be used to initialise the Authentication Server, based on  
       
    97 	//aInitTrainInput.If set, this method reads plugin input train, else
       
    98 	//reads plugin input id.
       
    99 	TInt InitPluginDataFromFileL(TBool aInitTrainInput);
       
   100 	
       
   101 	// Wait for the server to shut down and so release the authentication database.
       
   102 	void WaitForServerToReleaseDb();
       
   103 	// 	Remove any existing database file.
       
   104 	void RemoveExistingDbL();
       
   105 	// 	Utility function coverting HexString to Integer
       
   106 	TInt HexString2Num(const TDesC8& aStr);
       
   107 	// Utility function for removing a specified Identity from the global Identity array
       
   108 	TInt RemoveIdFromGlobalDbL(TUint32 aId);
       
   109 	// Utility clean up function used when working with locally declared arrays
       
   110 	//void CleanupEComArray(TAny* aArrayOfPlugins);	
       
   111 	
       
   112 	//Utility function to read and set the username of a given identity
       
   113 	TVerdict checkAndSetUserNameL(AuthServer::RAuthClient& ac, TInt idPosition);	
       
   114 	// Utility function for checking the status of a pluginId that is specified
       
   115 	// in the ini file.
       
   116 	void CheckSpecifiedPluginStatusL();
       
   117 	// Version of above function that avoids a call to the 'Connect()' function
       
   118 	void CheckSpecifiedPluginStatusConnectedL(AuthServer::RAuthClient& ac);
       
   119 	
       
   120 	// Checks that the status of each plugin is as expected.
       
   121 	// based on the number of identities trained for that plugin, and the number of identities 
       
   122 	// present in the Authentication server.
       
   123 	TBool CheckPluginStatusAllL (AuthServer::RAuthClient& ac);
       
   124 	
       
   125 	// Reads the number of identities that have been trained with the plugin that 
       
   126 	// has its database in the named file
       
   127 	TInt GetNumIdsFromPluginDbL(const TDesC &aFileName);
       
   128 	
       
   129 	// Utility function for retrieving the last authenticated id from a file
       
   130 	AuthServer::TIdentityId getLastAuthId();
       
   131 	
       
   132     AuthServer::CAuthExpression* CreateAuthExprLC(const TDesC& aString);
       
   133     
       
   134     void CreatePinPluginInputFileL(TPinPluginDialogOperation aOperation, TPinValue aPinValue);
       
   135     
       
   136     TPinValue GetPinFromOutputFileL();
       
   137     
       
   138     void ClientMessage(TBool aIsMessage, const TDesC& aDisplayString);
       
   139     
       
   140 protected:
       
   141 	RFs iFs;	
       
   142 	
       
   143 	// Used when creating the initial db
       
   144 	AuthServer::CPluginDesc*       iPlugins[KNumPlugins];
       
   145 	AuthServer::CTransientKeyInfo* iId1Keys[KNumPlugins];
       
   146 	AuthServer::CTransientKeyInfo* iId2Keys[KNumPlugins];
       
   147 	AuthServer::CTransientKeyInfo* iId3Keys[KNumPlugins];
       
   148 
       
   149 	};
       
   150 	
       
   151 // Utility clean up function used when working with locally declared arrays
       
   152 	void CleanupEComArray(TAny* aArrayOfPlugins);	
       
   153 
       
   154 inline CTAuthSvrStepBase::~CTAuthSvrStepBase() 
       
   155     {
       
   156     for (TInt i = 0 ; i < KNumPlugins ; ++i)
       
   157         {
       
   158         delete iPlugins[i];
       
   159         delete iId1Keys[i];
       
   160         delete iId2Keys[i];
       
   161         delete iId3Keys[i];
       
   162         }
       
   163     }
       
   164 
       
   165 inline HBufC* CTAuthSvrStepBase::GetNameLC(TInt id)
       
   166     {
       
   167     _LIT(nameTmpl, "Plugin_%d");
       
   168 	HBufC* name = HBufC::NewLC(15);
       
   169 	name->Des().Format(nameTmpl, id);
       
   170 	return name;
       
   171     }
       
   172     
       
   173 inline void CTAuthSvrStepBase::CreatePlugins()
       
   174 	{
       
   175 	using namespace AuthServer;
       
   176 	
       
   177 	const TAuthPluginType   types[KNumPlugins]
       
   178 		= { EAuthBiometric, EAuthToken, EAuthKnowledge,
       
   179 			EAuthBiometric, EAuthToken, EAuthKnowledge,
       
   180 			EAuthToken, EAuthKnowledge
       
   181 		};
       
   182 	const TAuthTrainingStatus   training[KNumPlugins]
       
   183 		= { EAuthUntrained, EAuthTrained, EAuthFullyTrained,
       
   184 			EAuthUntrained, EAuthTrained, EAuthFullyTrained,
       
   185 			EAuthTrained, EAuthFullyTrained
       
   186 		  };
       
   187 
       
   188 
       
   189 	for (TInt i = 0 ; i < KNumPlugins ; ++i)
       
   190 		{
       
   191 			HBufC* name = GetNameLC(i);
       
   192 			
       
   193 			iPlugins[i] = CPluginDesc::NewL(i, *name, types[i],
       
   194 											training[i], i*10000, i, i*4);
       
   195 		    CleanupStack::PopAndDestroy(name);									
       
   196 		}
       
   197 	}
       
   198 
       
   199 inline void CTAuthSvrStepBase::CreateKeyInfo()
       
   200 	{
       
   201 	using namespace AuthServer;
       
   202 
       
   203 	CProtectionKey* protKey1 = CProtectionKey::NewLC(8);
       
   204 	CProtectionKey* protKey2 = CProtectionKey::NewLC(8);
       
   205 	CProtectionKey* protKey3 = CProtectionKey::NewLC(8);
       
   206 
       
   207 	HBufC8* data = HBufC8::NewLC(4);
       
   208 	
       
   209 	for (TInt plugin = 0 ; plugin < KNumPlugins ; ++plugin)
       
   210 		{
       
   211 			CTransientKey* transient = 0;
       
   212 			// id 1
       
   213 			iId1Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   214 			PluginData(1, plugin, data->Des());
       
   215 			transient = iId1Keys[plugin]->CreateTransientKeyL(data->Des());
       
   216 			CEncryptedProtectionKey* epKey1 =
       
   217 				transient->EncryptL(*protKey1);
       
   218 			delete transient;
       
   219 			iId1Keys[plugin]->SetEncryptedProtectionKeyL(epKey1);
       
   220 			// id 2
       
   221 			PluginData(2, plugin, data->Des());
       
   222 			iId2Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   223 			transient = iId2Keys[plugin]->CreateTransientKeyL(data->Des());
       
   224 			CEncryptedProtectionKey* epKey2 =
       
   225 				transient->EncryptL(*protKey2);
       
   226 			delete transient;
       
   227 			iId2Keys[plugin]->SetEncryptedProtectionKeyL(epKey2);
       
   228 			// id 3
       
   229 			PluginData(3, plugin, data->Des());
       
   230 			iId3Keys[plugin] = CTransientKeyInfo::NewL(plugin);
       
   231 			transient = iId3Keys[plugin]->CreateTransientKeyL(data->Des());
       
   232 			CEncryptedProtectionKey* epKey3 =
       
   233 				transient->EncryptL(*protKey3);
       
   234 			delete transient;
       
   235 			iId3Keys[plugin]->SetEncryptedProtectionKeyL(epKey3);
       
   236 		}
       
   237 	CleanupStack::Pop(4, protKey1);
       
   238 	}
       
   239 
       
   240 
       
   241 /**
       
   242 	This abstract subclass of CTAuthcliservStepBase
       
   243 	overrides the doTestStep(Pre|Post)ambleL functions
       
   244 	from CTestBase to allocate and free an active
       
   245 	scheduler.
       
   246 	
       
   247 	The scheduler is stored in the protected iActSchd
       
   248 	variable.  This class does not start or stop the
       
   249 	scheduler.
       
   250  */
       
   251 
       
   252 class CTStepActSch : public CTAuthSvrStepBase
       
   253 	{
       
   254 protected:
       
   255 	// override CTestStep
       
   256 	virtual TVerdict doTestStepPreambleL();
       
   257 	virtual TVerdict doTestStepPostambleL();
       
   258 		
       
   259 protected:
       
   260 	/** The active scheduler which subclasses can use. */
       
   261 	CActiveScheduler* iActSchd;
       
   262 	};
       
   263     
       
   264 
       
   265 class CTFirstStart : public CTAuthSvrStepBase
       
   266 	{
       
   267 public:
       
   268 	CTFirstStart();	
       
   269 	//~CTFirstStart();
       
   270 	virtual TVerdict doTestStepPreambleL();
       
   271 	virtual TVerdict doTestStepL();
       
   272 	//virtual TVerdict doTestStepPostambleL();
       
   273 	};
       
   274 	
       
   275 class CTAuthSvrCheck: public CTAuthSvrStepBase
       
   276 	{
       
   277 public:
       
   278 	CTAuthSvrCheck();
       
   279 	//~CTAuthSvrCheck();
       
   280 	//virtual TVerdict doTestStepPreambleL();
       
   281 	virtual TVerdict doTestStepL();
       
   282 	//virtual TVerdict doTestStepPostambleL();
       
   283 	};
       
   284 	
       
   285 class CTRegIdentity: public CTStepActSch
       
   286 	{
       
   287 public:
       
   288 	CTRegIdentity(CTAuthSvrServer& aParent);
       
   289 	~CTRegIdentity();
       
   290 	virtual TVerdict doTestStepPreambleL();
       
   291 	virtual TVerdict doTestStepPostambleL();
       
   292 	virtual TVerdict doTestStepL();
       
   293 	
       
   294 private:
       
   295 	void ListPluginsL(AuthServer::RAuthMgrClient& aAuthMgrClient );
       
   296 	void SetPinPluginStateL();
       
   297 	void RemovePinPluginFileL();
       
   298 	
       
   299 private:
       
   300 	CTAuthSvrServer& iParent;
       
   301 	};
       
   302 	
       
   303 class CTEnumIdentities: public CTAuthSvrStepBase
       
   304 	{
       
   305 public:
       
   306 	CTEnumIdentities(CTAuthSvrServer& aParent);
       
   307 	virtual TVerdict doTestStepL();	
       
   308 private:
       
   309 	CTAuthSvrServer& iParent;
       
   310 	};
       
   311 	
       
   312 class CTIdentifyMultiple: public CTAuthSvrStepBase
       
   313 	{
       
   314 public:
       
   315 	//CTIdentifyMultiple(CTAuthSvrServer& aParent);
       
   316 	CTIdentifyMultiple();
       
   317 	~CTIdentifyMultiple();
       
   318 	virtual TVerdict doTestStepPreambleL();	
       
   319 	virtual TVerdict doTestStepL();	
       
   320 private:
       
   321 	//CTAuthSvrServer& iParent;
       
   322 	RArray<TUid> iPluginIds;
       
   323 	};
       
   324 	
       
   325 class CTRetrainPlugin: public CTStepActSch
       
   326 	{
       
   327 public:	
       
   328 	//CTRetrainPlugin();
       
   329 	CTRetrainPlugin(CTAuthSvrServer& aParent);
       
   330 	~CTRetrainPlugin();
       
   331 	virtual TVerdict doTestStepPreambleL();
       
   332 	virtual TVerdict doTestStepPostambleL();	
       
   333 	virtual TVerdict doTestStepL();	
       
   334 	// Utility function that calls 'Train' for a specified plugin	
       
   335 	void RetrainPlugin (AuthServer::RAuthMgrClient& mgc);
       
   336 private:
       
   337 	CTAuthSvrServer& iParent;
       
   338 	};
       
   339 
       
   340 class CTRemoveAuthMethod: public CTStepActSch
       
   341 	{
       
   342 public:	
       
   343 	//CTRetrainPlugin();
       
   344 	CTRemoveAuthMethod(CTAuthSvrServer& aParent);
       
   345 	~CTRemoveAuthMethod();
       
   346 	virtual TVerdict doTestStepPreambleL();
       
   347 	virtual TVerdict doTestStepPostambleL();	
       
   348 	virtual TVerdict doTestStepL();	
       
   349 	void RemoveAuthMethodL (AuthServer::RAuthMgrClient& mgc);
       
   350 private:
       
   351 	CTAuthSvrServer& iParent;
       
   352 	};
       
   353 
       
   354 class CTRemoveDbs: public CTStepActSch
       
   355 	{
       
   356 public:	
       
   357 	CTRemoveDbs();
       
   358 	~CTRemoveDbs();
       
   359 	virtual TVerdict doTestStepPreambleL();
       
   360 	virtual TVerdict doTestStepPostambleL();	
       
   361 	virtual TVerdict doTestStepL();	
       
   362 private:
       
   363 	
       
   364 	};
       
   365 	
       
   366 class CTRemoveIdentity: public CTStepActSch
       
   367 	{
       
   368 public:	
       
   369 	CTRemoveIdentity(CTAuthSvrServer& aParent);
       
   370 	~CTRemoveIdentity();
       
   371 	virtual TVerdict doTestStepPreambleL();
       
   372 	virtual TVerdict doTestStepPostambleL();	
       
   373 	virtual TVerdict doTestStepL();		
       
   374 	// Utility function that calls 'authenticate, then removeIdentity', with a specified plugin	
       
   375 	void doRemoveIdentityL (AuthServer::RAuthMgrClient& mgc);	
       
   376 private:
       
   377 	CTAuthSvrServer& iParent;
       
   378 	};
       
   379 
       
   380 class CTAuthenticate: public CTStepActSch
       
   381 	{
       
   382 public:
       
   383 	CTAuthenticate(CTAuthSvrServer& aParent);
       
   384 	~CTAuthenticate();
       
   385 	virtual TVerdict doTestStepPreambleL();
       
   386 	virtual TVerdict doTestStepPostambleL();	
       
   387 	virtual TVerdict doTestStepL();
       
   388 	//Utility function that stores the most recently authenticated identity in the GlobalDb file
       
   389 	//This should only be called by the Authenticate test step
       
   390 	void setLastAuthIdL(AuthServer::TIdentityId idToStore);
       
   391 	
       
   392 	/**
       
   393   	This method calls the synchronous version of AuthenticateL method.
       
   394   
       
   395    	@param aAuthMgrClient		authMgrClient object.
       
   396    	@param aInputString			descriptor containing either the alias string or auth expression
       
   397    								string as read from the ini file.
       
   398    	@param aFreshness			time period which serves as a check to determine if an authentication 
       
   399    								has previously been performed within this period.This value is read from 
       
   400    								the ini file.If not present,the default value is used.
       
   401  
       
   402   	@param aClientSpecificKey 	this value when true represents the key returned by 
       
   403   								auth server will be unique to the calling client.This value is read from the 
       
   404   								ini file.By default this is set to false.
       
   405  
       
   406   	@param isAlias 				this value when true specifies that the authentication is performed via alias.
       
   407   								This value is read from the ini file.By default it is set to false.
       
   408  
       
   409  	
       
   410   	*/
       
   411  
       
   412   	void CallSyncAuthenticateL(AuthServer::RAuthMgrClient& aAuthMgrClient, const TDesC& aInputString, TInt aFreshness, TBool aClientSpecificKey, TBool isAlias, TBool isDefault, const TDesC& aClientMessage);
       
   413 	
       
   414 	/**
       
   415   	This method calls the asynchronous version of AuthenticateL method.
       
   416   
       
   417    	@param aAuthMgrClient		authMgrClient object.
       
   418    	@param aInputString			descriptor containing either the alias string or auth expression
       
   419    								string as read from the ini file.
       
   420    	@param aFreshness			time period which serves as a check to determine if an authentication 
       
   421    								has previously been performed within this period.This value is read from 
       
   422    								the ini file.If not present,the default value is used.
       
   423  
       
   424   	@param aClientSpecificKey 	this value when true represents the key returned by 
       
   425   								auth server will be unique to the calling client.This value is read from the 
       
   426   								ini file.By default this is set to false.
       
   427  
       
   428   	@param isAlias 				this value when true specifies that the authentication is performed via alias.
       
   429   								This value is read from the ini file.By default it is set to false.
       
   430  
       
   431  	
       
   432   	*/
       
   433 	void CallAsyncAuthenticateL(AuthServer::RAuthMgrClient& aAuthMgrClient, TDesC& aInputString, TInt aFreshness, TBool aClientSpecificKey, TBool isAlias, TBool isDefault, const TDesC& aClientMessage);
       
   434 	
       
   435 private:
       
   436 	CTAuthSvrServer& iParent;
       
   437 	};
       
   438 		
       
   439 class CTSetAuthPrefs: public CTStepActSch
       
   440 	{
       
   441 public:
       
   442 	CTSetAuthPrefs(CTAuthSvrServer& aParent);
       
   443 	~CTSetAuthPrefs();
       
   444 	virtual TVerdict doTestStepPreambleL();
       
   445 	virtual TVerdict doTestStepPostambleL();	
       
   446 	virtual TVerdict doTestStepL();
       
   447 	void SetAuthPrefsL(AuthServer::RAuthMgrClient& aAuthMgrClient, AuthServer::RAuthClient& aAuthClient);
       
   448 
       
   449 private:
       
   450 	CTAuthSvrServer& iParent;
       
   451 	};
       
   452 
       
   453 class CTResetIdentity: public CTStepActSch
       
   454 	{
       
   455 public:	
       
   456 	CTResetIdentity(CTAuthSvrServer& aParent);
       
   457 	~CTResetIdentity();
       
   458 	virtual TVerdict doTestStepPreambleL();
       
   459 	virtual TVerdict doTestStepPostambleL();	
       
   460 	virtual TVerdict doTestStepL();		
       
   461 	// Utility function that calls 'resetIdentity', with a specified plugin
       
   462 	void doResetIdentityL();
       
   463 private:
       
   464 	CTAuthSvrServer& iParent;
       
   465 	};
       
   466 
       
   467 /**
       
   468 	This class initializes the aliases in the authserver's central repository file 
       
   469 	with different values as specified in the ini file.
       
   470   */
       
   471 
       
   472 class CTInitCenRep: public CTStepActSch
       
   473 	{
       
   474 public:
       
   475 	CTInitCenRep(CTAuthSvrServer& aParent);
       
   476 	~CTInitCenRep();
       
   477 	virtual TVerdict doTestStepPreambleL();
       
   478 	virtual TVerdict doTestStepPostambleL();	
       
   479 	virtual TVerdict doTestStepL();
       
   480 private:
       
   481 	CTAuthSvrServer& iParent;
       
   482 	};
       
   483 
       
   484 class CResultAvailability: public CTStepActSch
       
   485 	{
       
   486 public:
       
   487 	CResultAvailability(CTAuthSvrServer& aParent);
       
   488 	~CResultAvailability();
       
   489 	virtual TVerdict doTestStepPreambleL();
       
   490 	virtual TVerdict doTestStepPostambleL();
       
   491 	virtual TVerdict doTestStepL();
       
   492 	
       
   493 private:
       
   494 	CTAuthSvrServer& iParent;
       
   495 	};
       
   496 
       
   497 class CAuthSvrOom: public CTStepActSch
       
   498 	{
       
   499 public:
       
   500 	CAuthSvrOom(CTAuthSvrServer& aParent);
       
   501 	~CAuthSvrOom();
       
   502 	virtual TVerdict doTestStepPreambleL();
       
   503 	virtual TVerdict doTestStepPostambleL();
       
   504 	virtual TVerdict doTestStepL();
       
   505 	TVerdict doClientOOMTestL();
       
   506 	TVerdict doServerOOMTestL();
       
   507 	TVerdict doPerformanceTestL();
       
   508 	void ReadTestConfigurationL();
       
   509 	TVerdict doTestL(AuthServer::RAuthMgrClient& ac);
       
   510 	void doStartupTestL();
       
   511 	void doRegOOMTestL(AuthServer::RAuthMgrClient &ac);
       
   512 	void doSyncAuthOOMTestL(AuthServer::RAuthMgrClient& ac);
       
   513 	void doAsyncAuthOOMTestL(AuthServer::RAuthMgrClient& ac);
       
   514 	void doSetPreferredTypeL(AuthServer::RAuthMgrClient& ac);
       
   515 	void doRemoveIdentityL(AuthServer::RAuthMgrClient& ac);
       
   516 	void doForgetPluginL(AuthServer::RAuthMgrClient& ac);
       
   517 	void doRetrainPluginL(AuthServer::RAuthMgrClient& ac);
       
   518 	void doListPluginsL(AuthServer::RAuthMgrClient& ac);
       
   519 	void doListActivePluginsL(AuthServer::RAuthMgrClient& ac);
       
   520 	void doListPluginsOfTypeL(AuthServer::RAuthMgrClient& ac);
       
   521 	void doListPluginsWithTrainingStatusL(AuthServer::RAuthMgrClient& ac);
       
   522 	void doListAuthStrengthAliasesL(AuthServer::RAuthMgrClient& ac);
       
   523 	void doResetAll(AuthServer::RAuthMgrClient& ac);
       
   524 	void doResetType(AuthServer::RAuthMgrClient& ac);
       
   525 	void doResetList(AuthServer::RAuthMgrClient& ac);
       
   526 // performance tests.
       
   527 	void StartTimer();
       
   528 	void StopTimerAndPrintResultL();
       
   529 	void PrintPerformanceLog(TTime aTime);
       
   530 	
       
   531 
       
   532 private:
       
   533 	CTAuthSvrServer& iParent;
       
   534 	TInt iFreshnessVal;
       
   535 	TPtrC iExprString;
       
   536 	TBool iClientSpecificKeyVal;
       
   537 	TBool iDefaultpluginusage;
       
   538 	TBuf<100> iMessage;
       
   539 	TTime iStartTime;
       
   540 	TInt iIterationCount;
       
   541 
       
   542 	};
       
   543 
       
   544 class CResultPropertyWatch:CActive
       
   545 	{
       
   546 	enum {EPriority=0};
       
   547 	public:
       
   548 	static CResultPropertyWatch* NewLC();
       
   549 	~CResultPropertyWatch();
       
   550 	void DoCancel();
       
   551 	private:
       
   552 	CResultPropertyWatch();
       
   553 	void ConstructL();
       
   554 	
       
   555 	void RunL();
       
   556 	
       
   557 	private:
       
   558 	RProperty iProperty;
       
   559 	public:	
       
   560 	TBool iNotified;
       
   561 	};
       
   562 
       
   563 class CResultChangeNotify: public CTStepActSch
       
   564 	{
       
   565 public:
       
   566 	CResultChangeNotify(CTAuthSvrServer& aParent);
       
   567 	~CResultChangeNotify();
       
   568 	virtual TVerdict doTestStepPreambleL();
       
   569 	virtual TVerdict doTestStepPostambleL();
       
   570 	virtual TVerdict doTestStepL();
       
   571 	
       
   572 private:
       
   573 	void SetPinPluginStateL();
       
   574 	void RemovePinPluginFileL();
       
   575 private:
       
   576 	CTAuthSvrServer& iParent;
       
   577 	CResultPropertyWatch* watch;
       
   578 
       
   579 	};
       
   580 
       
   581 
       
   582 class CTPostMarketPlugin: public CTAuthSvrStepBase
       
   583 	{
       
   584 public:
       
   585 
       
   586 	CTPostMarketPlugin();
       
   587 	~CTPostMarketPlugin();
       
   588 	virtual TVerdict doTestStepPreambleL();
       
   589 	virtual TVerdict doTestStepL();
       
   590 	
       
   591 private:
       
   592 
       
   593 	/**
       
   594   	This method simulates plugin installation.In case of upgrades to ROM, it verifies 
       
   595   	that the right plugin is loaded (depending on the ROM_Only field in the plugin registration file),
       
   596   	and that the plugin count increments when the macro to enable post market plugins is set to one,
       
   597   	and remains the same when the macro is disabled.
       
   598   
       
   599    	*/
       
   600 	
       
   601 	TBool TestPluginInstallL(AuthServer::RAuthMgrClient& aAuthMgrClient, RTestUtilSession& aUtilSession);
       
   602 
       
   603  	/**
       
   604   	This method simulates plugin uninstallation.In case of upgrades to ROM, it verifies 
       
   605   	that the ROM plugin is loaded, and that the plugin count decrements when the macro to enable 
       
   606 	post market plugins is set to one, 	and remains the same when the macro is disabled.
       
   607   
       
   608    	*/
       
   609 	
       
   610 	TBool TestPluginUninstallL(AuthServer::RAuthMgrClient& aAuthMgrClient, RTestUtilSession& aUtilSession);
       
   611 	
       
   612 	/**
       
   613   	This method lists the available plugin implementations and tests whether
       
   614   	it matches with the expected plugin count.This method also takes plugin name 
       
   615   	as a default argument,which assists in testing whether the right plugin has 
       
   616   	been loaded during ROM upgrade operat
       
   617   
       
   618   	@param aAuthMgrClient	authMgrClient object.
       
   619    	@param aExpectedCount	expected plugin count.
       
   620    	@param aPluginName		expected plugin name.Default argument.
       
   621    	@return 				true, when the actual plugin count equals the expected one.
       
   622    							When the plugin name is specified, returns true, if
       
   623    							the plugin name matches the expected one.
       
   624    
       
   625    	*/
       
   626 	TBool VerifyObtainedResultsWithExpectedL(AuthServer::RAuthMgrClient& aAuthMgrClient, TInt aExpectedCount, const TDesC& aPluginName = KEmptyString);
       
   627 	
       
   628 private:
       
   629 	
       
   630 	TPtrC iSrcPlugin;
       
   631 	TPtrC iTargetPlugin;
       
   632 	TPtrC iSrcRscFile;
       
   633 	TPtrC iTargetRscFile;
       
   634   	};
       
   635   	
       
   636  class CTStepClientSidSupport : public CTStepActSch
       
   637 	{
       
   638 public:
       
   639 	CTStepClientSidSupport(CTAuthSvrServer& aParent);
       
   640 	
       
   641 	~CTStepClientSidSupport();
       
   642 	virtual TVerdict doTestStepPreambleL();
       
   643 	virtual TVerdict doTestStepL();
       
   644 	
       
   645 private:
       
   646 	TBool VerifyObtainedResultsWithExpectedL();
       
   647 	
       
   648 private:
       
   649 	CTAuthSvrServer& iParent;
       
   650 	TUid iClientSid;
       
   651 	TBool iClientSpecificKey;
       
   652 	TBool iWithString;
       
   653 	TInt iPluginId;
       
   654 	AuthServer::CIdentity* iIdentity;
       
   655 	AuthServer::CIdentity* iIdentityAfterRetrain;
       
   656 	};
       
   657 	
       
   658 class CTInstallPluginStep: public CTAuthSvrStepBase
       
   659 	{
       
   660 public:
       
   661 
       
   662 	CTInstallPluginStep();
       
   663 	~CTInstallPluginStep();
       
   664 	virtual TVerdict doTestStepPreambleL();
       
   665 	virtual TVerdict doTestStepL();
       
   666 	
       
   667 private:
       
   668 	
       
   669 	TPtrC iSrcPlugin;
       
   670 	TPtrC iTargetPlugin;
       
   671 	TPtrC iSrcRscFile;
       
   672 	TPtrC iTargetRscFile;
       
   673   	};
       
   674   	
       
   675 class CTUninstallPluginStep: public CTAuthSvrStepBase
       
   676 	{
       
   677 public:
       
   678 
       
   679 	CTUninstallPluginStep();
       
   680 	~CTUninstallPluginStep();
       
   681 	virtual TVerdict doTestStepPreambleL();
       
   682 	virtual TVerdict doTestStepL();
       
   683 	
       
   684 private:
       
   685 	
       
   686 	TPtrC iSrcPlugin;
       
   687 	TPtrC iTargetPlugin;
       
   688 	TPtrC iSrcRscFile;
       
   689 	TPtrC iTargetRscFile;
       
   690   	};  	
       
   691   	
       
   692 
       
   693 class CTSysTimeUpdate: public CTStepActSch
       
   694 	{
       
   695 public:
       
   696  	CTSysTimeUpdate(CTAuthSvrServer& aParent);
       
   697  	~CTSysTimeUpdate();
       
   698  	virtual TVerdict doTestStepPreambleL();
       
   699  	virtual TVerdict doTestStepPostambleL();	
       
   700  	virtual TVerdict doTestStepL();
       
   701 private:
       
   702  	CTAuthSvrServer& iParent;
       
   703  	};
       
   704    		
       
   705 //Parameters class.For now, used only to get the result.
       
   706 class TThreadParams
       
   707     {
       
   708 public:
       
   709     TInt result;
       
   710     };
       
   711 
       
   712 
       
   713 class CTMultiThreaded: public CTStepActSch
       
   714     {
       
   715 public:
       
   716     CTMultiThreaded(CTAuthSvrServer& aParent);
       
   717     ~CTMultiThreaded();
       
   718     virtual TVerdict doTestStepPreambleL();
       
   719     virtual TVerdict doTestStepPostambleL();    
       
   720     virtual TVerdict doTestStepL();
       
   721     static void runMultiThreadedTest(TThreadParams* aParams);
       
   722     static void doRegisterL(TThreadParams& aParams);
       
   723 private:
       
   724     CTAuthSvrServer& iParent;
       
   725     };
       
   726 
       
   727 // Strings for the server create test step code
       
   728 _LIT(KTFirstStart,					"FIRST_START");
       
   729 _LIT(KTAuthSvrCheck,				"AUTHSVR_CHECK");
       
   730 _LIT(KTRegIdentity,					"REG_IDENTITY");
       
   731 _LIT(KTEnumIdentities, 				"ENUM_IDENTITIES");
       
   732 _LIT(KTIdentifyMultiple, 			"IDENTIFY_MULTIPLE");
       
   733 _LIT(KTRetrainPlugin,				"RETRAIN_PLUGIN");
       
   734 _LIT(KTForgetPlugin,				"FORGET_PLUGIN");
       
   735 _LIT(KTRemoveDbs,					"REMOVE_DBS");
       
   736 _LIT(KTRemoveIdentity,				"REMOVE_IDENTITY");
       
   737 _LIT(KTAuthenticate,				"AUTHENTICATE");
       
   738 _LIT(KTSetPrefs, 			    	"SET_PREFS");
       
   739 _LIT(KTInitCenRep,					"INIT_CENREP");
       
   740 _LIT(KTResultAvailability, 			"RESULT_AVAILABILITY");
       
   741 _LIT(KTResultChangeNotify, 			"RESULT_NOTIFICATION");
       
   742 _LIT(KTPostMarketPlugin,			"POST_MARKET_PLUGIN");
       
   743 _LIT(KTStepClientSidSupportCheck, 	"CLIENT_SID_CHECK");
       
   744 _LIT(KTInstallPluginStep, 			"INSTALL_PLUGIN");
       
   745 _LIT(KTUninstallPluginStep, 		"UNINSTALL_PLUGIN");
       
   746 _LIT(KTAuthServerOom,	 			"OOM_TEST");
       
   747 _LIT(KTResetIdentity,				"RESET_IDENTITY");
       
   748 _LIT(KTUpdateSysTime,				"UPDATE_SYSTIME");
       
   749 _LIT(KTMultiThreadedTest,           "MULTI_THREADED");
       
   750 
       
   751 // Performance related names
       
   752 _LIT(KMaxDurationName, 				"MaxDuration");
       
   753 _LIT(KMaxTestCaseDuration, 			"TEST_CASE_MAXIMUM_ALLOWED_DURATION");
       
   754 _LIT(KActualTestCaseDuration, 		"TEST_CASE_ACTUAL_DURATION");
       
   755 _LIT(KPerformanceTestInfo, 			"PERFORMANCE_LOG_INFORMATION");
       
   756 // String used to store the filename that contains the initialisation data used by the PinAuthPlugin, etc
       
   757 
       
   758 _LIT(KPluginIniFile, 			"\\tAuth\\tAuthSvr\\testdata\\initialisation_Info.ini");
       
   759 _LIT(KPluginIniSection,			"SectionOne");
       
   760 _LIT(KAuthSvrPolicyFile, 		"\\tAuth\\tAuthSvr\\testdata\\AuthSvrPolicy.ini");
       
   761 _LIT(KDefaultPluginTag, 		"DefaultPlugin");
       
   762 _LIT(KIdEnteredPinTag, 			"IdEnteredPinValue");
       
   763 _LIT(KTrainEnteredPinTag, 		"TrainEnteredPinValue");
       
   764 _LIT(KSupportsDefaultTag,		"iSupportsDefaultData");	//used to specify whether the individual plugins support default data 
       
   765 _LIT(KActiveStateTag,			"activeState");	//used to specify whether the individual plugins are active
       
   766 _LIT(KPinDbTag,					"Identity&PinValues");
       
   767 _LIT(KTotalDbTag,				"AllUserID&PinValues");
       
   768 _LIT(KDisplayMessage,			"DisplayMessage");
       
   769 _LIT(KLastAuthIdTag,			"LastAuthId");
       
   770 _LIT(KDefauthPrefsTag,			"DefaultPref");
       
   771 _LIT(KKnowledgePrefsTag,		"KnowledgePref");
       
   772 _LIT(KBiometricPrefsTag,		"BiometricPref");
       
   773 _LIT(KTokenPrefsTag,			"TokenPref");
       
   774 
       
   775 _LIT(KInitPinDatabaseValue,		",");
       
   776 _LIT(KDefaultInput,				"0000");
       
   777 
       
   778 // Strings used to store the filenames for the pluginDb files
       
   779 _LIT(KPlugin3100File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113100Db.ini");
       
   780 _LIT(KPlugin3101File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113101Db.ini");
       
   781 _LIT(KPlugin3102File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113102Db.ini");
       
   782 _LIT(KPlugin3103File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113103Db.ini");
       
   783 _LIT(KPlugin3104File,		"\\tAuth\\tAuthSvr\\testdata\\Pin11113104Db.ini");
       
   784 _LIT(KPlugin4100File,		"\\tAuth\\tAuthSvr\\testdata\\Pin10234100Db.ini");
       
   785 
       
   786 #endif	/* T_AUTHSVR_STEP_H */