sl@0: /* sl@0: * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Implements basic database test functions. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: */ sl@0: sl@0: #include "tupsdbstep.h" sl@0: #include sl@0: sl@0: using namespace UserPromptService; sl@0: sl@0: sl@0: // sl@0: //CUpsDbBaseStep sl@0: // sl@0: sl@0: CUpsDbBaseStep::CUpsDbBaseStep() sl@0: /** sl@0: onstructor Code sl@0: */ sl@0: { sl@0: sl@0: } sl@0: sl@0: CUpsDbBaseStep::~CUpsDbBaseStep() sl@0: /** sl@0: Destructor Code sl@0: */ sl@0: { sl@0: sl@0: } sl@0: sl@0: sl@0: CDecisionFilter *CUpsDbBaseStep::CreateFilterL(TInt aFlag, TInt aClientSid, TInt aEvaluatorId, TInt aServiceId, TInt aServerSid, TDesC8 &aFingerprint, TDesC8& aClientEntity,TInt aMajorPolicyVersion, TInt aRecordId, TDesC& aDescription, TInt aResult, TInt aEvaluatorInfo, TComparisonOp aComparisonOp) sl@0: /** sl@0: Creates an empty filter object and then passes it to SetFilterFiledsL to get assigned all filter keys separately. sl@0: This function is used to test NewL method of CDecisionFilter sl@0: sl@0: @param aFlag Shows which filter keys have been set sl@0: @param aClientSid Secure Id of client application sl@0: @param aEvaluatorId UID for the policy evaluator DLL sl@0: @param aServiceId UID for service sl@0: @param aServerSid UID for the system server sl@0: @param aFingerprint Hash of the destination and/or opaque data. sl@0: @param aClientEntity The name of the entity within the client that requested the service. sl@0: @param aMajorPolicyVersion The major version of the policy file. sl@0: @param aRecordId An auto-incrementing record number. sl@0: @param aDescription A copy of description and/or opaque sl@0: @param aResult Whether the request should be approved sl@0: @param aEvaluatorInfo Policy evaluator specific data sl@0: @param aComparisonOp Comparison Operator (=,!=,<,> etc.) sl@0: sl@0: @return A pointer to the newly allocated filter object. sl@0: */ sl@0: { sl@0: //Create an empty filter sl@0: CDecisionFilter *filter = CDecisionFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: SetFilterFiledsL(*filter, aFlag, aClientSid, aEvaluatorId, aServiceId, aServerSid,aFingerprint, aClientEntity, aMajorPolicyVersion, aRecordId, aDescription, aResult, aEvaluatorInfo, aComparisonOp); sl@0: sl@0: CleanupStack::Pop(filter); sl@0: return filter; sl@0: } sl@0: sl@0: sl@0: CDecisionFilter *CUpsDbBaseStep::CreateFilterLC(TInt aFlag, TInt aClientSid, TInt aEvaluatorId, TInt aServiceId, TInt aServerSid, TDesC8 &aFingerprint, TDesC8& aClientEntity,TInt aMajorPolicyVersion, TInt aRecordId, TDesC& aDescription, TInt aResult, TInt aEvaluatorInfo, TComparisonOp aComparisonOp) sl@0: /** sl@0: Creates an empty filter object and then calls SetFilterFiledsL to get assigned all filter keys separately. sl@0: This function is used to test NewLC method of CDecisionFilter sl@0: sl@0: @see CUpsDbBaseStep::CreateFilterL sl@0: sl@0: @return A pointer to the newly allocated filter object. The pointer is also put onto the cleanup stack. sl@0: */ sl@0: { sl@0: //Create an empty filter sl@0: CDecisionFilter *filter = CDecisionFilter::NewLC(); sl@0: sl@0: SetFilterFiledsL(*filter, aFlag, aClientSid, aEvaluatorId, aServiceId, aServerSid,aFingerprint, aClientEntity, aMajorPolicyVersion, aRecordId, aDescription, aResult, aEvaluatorInfo, aComparisonOp); sl@0: sl@0: return filter; sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::SetFilterFiledsL(CDecisionFilter &aFilter, TInt aFlag, TInt aClientSid, TInt aEvaluatorId, TInt aServiceId, TInt aServerSid, TDesC8 &aFingerprint, TDesC8& aClientEntity, TInt aMajorPolicyVersion, TInt aRecordId, TDesC& aDescription, TInt aResult, TInt aEvaluatorInfo, TComparisonOp aComparisonOp) sl@0: /** sl@0: This method assigns all the fields of a provided filter object with the supplied parameters. sl@0: The method is called by CreateFilterL and CreateFilterLC methods. sl@0: sl@0: @see CUpsDbBaseStep::CreateFilterL sl@0: @param aFilter Empty decision filter object sl@0: */ sl@0: { sl@0: //Sets the variables using aFlag sl@0: if(aFlag & KSetClientSid) sl@0: { sl@0: aFilter.SetClientSid(TSecureId(aClientSid), aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetEvaluatorId) sl@0: { sl@0: aFilter.SetEvaluatorId(TUid::Uid(aEvaluatorId),aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetServiceId) sl@0: { sl@0: aFilter.SetServiceId(TUid::Uid(aServiceId),aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetServerSid) sl@0: { sl@0: aFilter.SetServerSid(TSecureId(aServerSid),aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetFingerprint) sl@0: { sl@0: aFilter.SetFingerprintL(aFingerprint,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetClientEntity) sl@0: { sl@0: aFilter.SetClientEntityL(aClientEntity,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetMajorPolicyVersion) sl@0: { sl@0: aFilter.SetMajorPolicyVersion(aMajorPolicyVersion,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetRecordId) sl@0: { sl@0: aFilter.SetRecordId(aRecordId,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetDescription) sl@0: { sl@0: aFilter.SetDescriptionL(aDescription,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetResult) sl@0: { sl@0: aFilter.SetResult(aResult,aComparisonOp); sl@0: } sl@0: sl@0: if(aFlag & KSetEvaluatorInfo) sl@0: { sl@0: aFilter.SetEvaluatorInfo(aEvaluatorInfo,aComparisonOp); sl@0: } sl@0: } sl@0: sl@0: sl@0: CDecisionRecord *CUpsDbBaseStep::CreateRecordL(TInt aClientSid, TInt aEvaluatorId, TInt aServiceId, TInt aServerSid, TDesC8 &aFingerprint, TDesC8 &aClientEntity, sl@0: TDesC &aDecription, TInt aResult, TInt aMajorPolicyVersion, TInt aEvaluatorInfo, TInt aRecordId) sl@0: /** sl@0: Creates a decision record from provided parameters. sl@0: sl@0: @param aClientSid Secure Id of client application sl@0: @param aEvaluatorId UID for the policy evaluator DLL sl@0: @param aServiceId UID for service e.g. sms, mms, telephony, gprs sl@0: @param aServerSid UID for the system server that the decision applies to sl@0: @param aFingerprint Hash of the destination and/or opaque data. Maximum length is 32 bytes. sl@0: @param aClientEntity The name of the entity within the client that requested the service. Maximum length is 32 bytes. sl@0: @param aDescription A copy of description and/or opaque. sl@0: @param aResult Whether the request should be approved (=1) or denied (=0) sl@0: @param aMajorPolicyVersion The major version of the policy file. sl@0: @param aEvaluatorInfo Policy evaluator specific data sl@0: @param aRecordId An auto-incrementing record number. sl@0: sl@0: @return A pointer to the newly allocated decision record object, if creation is successful. sl@0: sl@0: */ sl@0: { sl@0: CDecisionRecord *newRecord; sl@0: sl@0: newRecord = CDecisionRecord::NewL(TSecureId(aClientSid),TUid::Uid(aEvaluatorId),TUid::Uid(aServiceId),TSecureId(aServerSid),aFingerprint,aClientEntity,aDecription,aResult,aMajorPolicyVersion,aEvaluatorInfo, aRecordId); sl@0: sl@0: return newRecord; sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::StartTimer(TTime &aTime) sl@0: /** sl@0: Assigns current time to the provided parameter sl@0: @param aTime Keeps the current time sl@0: */ sl@0: { sl@0: aTime.HomeTime(); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::StopTimer(TTime &aStartTime, TInt64 &aElapsedTime) sl@0: /** sl@0: Substracts the provided time from current time and returns the elapsed time. sl@0: @param aStartTime First measured time sl@0: @param aElapsedTime The elapsed time from the first measurement sl@0: */ sl@0: { sl@0: TTime endTime; sl@0: endTime.HomeTime(); sl@0: sl@0: TTimeIntervalMicroSeconds timeDiff = endTime.MicroSecondsFrom(aStartTime); sl@0: aElapsedTime = timeDiff.Int64(); sl@0: sl@0: if(iLog) sl@0: { sl@0: _LIT8(KMessage,"%Ld"); sl@0: iBuffer.AppendFormat(KMessage,aElapsedTime); sl@0: iFile.Write(iBuffer); sl@0: iFile.Write(_L8(";")); sl@0: iBuffer.Zero(); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::FillTableL(CDecisionDbW &aUpsDb, TInt aRecordNum, TInt aClientNum, TInt aServiceNum, TInt aServerNum, TInt aEvaluatorNum) sl@0: /** sl@0: Fill the decision table with a specified number of decision records. sl@0: The parameteres are used as seeds to create sample decision records. sl@0: sl@0: @param aUpsDb Handle to the database sl@0: @param aRecordNum Number of records which will be inserted into the database sl@0: @param aClientNum Number of different clients sl@0: @param aServiceNum Number of different services provided by each server sl@0: @param aServerNum Number of different servers sl@0: @param aEvaluatorNum Number of different policy evaluator DLLs sl@0: */ sl@0: { sl@0: TSecureId clientId = TSecureId(0); sl@0: TSecureId serverId = TSecureId(0); sl@0: TUid serviceId =TUid::Null(); sl@0: TUid evaluatorId =TUid::Null(); sl@0: sl@0: TUint8 result = 0; sl@0: TUint16 policyMajorVersion = 2; sl@0: sl@0: TBuf8 bufFP; sl@0: TBuf8 bufCE; sl@0: TBuf bufD; sl@0: sl@0: CDecisionRecord* newRecord = NULL; sl@0: sl@0: for(TInt i=0; iHash(bufFP),md5CE->Hash(bufCE),bufD, result,policyMajorVersion, 0); sl@0: sl@0: aUpsDb.CreateDecisionL(*newRecord); sl@0: sl@0: CleanupStack::PopAndDestroy(newRecord); sl@0: CleanupStack::PopAndDestroy(2); //md5FP and md5CE sl@0: sl@0: bufFP.Zero(); sl@0: bufCE.Zero(); sl@0: bufD.Zero(); sl@0: } sl@0: } sl@0: sl@0: sl@0: CDecisionDbW *CUpsDbBaseStep::CreateDatabaseLC(TDesC& aDbLocation, RFs& aFs) sl@0: /** sl@0: Create a writable decision database object. Prints the consumed time to perform this operation. sl@0: sl@0: @param aDbLocation Where the database will be created sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: //Database is created sl@0: CDecisionDbW *upsDb = CDecisionDbW::NewLC(aDbLocation, aFs); sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: INFO_PRINTF2(_L("Decision database created in %Ld microseconds."), elapsedTime); sl@0: sl@0: return upsDb; sl@0: } sl@0: sl@0: sl@0: CDecisionRecord *CUpsDbBaseStep::GetDecisionLC(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter) sl@0: /** sl@0: Get a decision record from the database. This function uses single record lookup method (RDbTable). sl@0: Prints the consumed time to perform this operation. sl@0: sl@0: @param aUpsDb Handle to the database sl@0: @param aFilter Filter sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: CDecisionRecord *retRecord = NULL; sl@0: retRecord = aUpsDb.GetDecisionL(aFilter); sl@0: if(retRecord) sl@0: { sl@0: CleanupStack::PushL(retRecord); sl@0: } sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: if(retRecord) sl@0: { sl@0: INFO_PRINTF2(_L("A single record retrieved in %Ld microseconds."), elapsedTime); sl@0: } sl@0: sl@0: return retRecord; sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::GetDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter, TBool aCancel, RPointerArray& aRecordList) sl@0: /** sl@0: Get a set of decision records from the database. Uses multiple records lookup method (RDbView). sl@0: Prints the consumed time to perform this operation. sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: CDecisionView *dbView = aUpsDb.CreateViewL(aFilter); sl@0: CleanupStack::PushL(dbView); sl@0: sl@0: dbView->EvaluateView(iWaiter->iStatus); sl@0: TInt num = 0; sl@0: if(aCancel) sl@0: { sl@0: dbView->Cancel(); sl@0: iWaiter->WaitActiveL(KErrCancel); sl@0: } sl@0: else sl@0: { sl@0: iWaiter->WaitActiveL(KErrNone); sl@0: CDecisionRecord *record = NULL; sl@0: sl@0: while((record = dbView->NextDecisionL()) != NULL) sl@0: { sl@0: CleanupStack::PushL(record); sl@0: num++; sl@0: aRecordList.AppendL(record); sl@0: CleanupStack::Pop(record); sl@0: } sl@0: } sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: INFO_PRINTF3(_L("%d records retrieved in %Ld microseconds."), num, elapsedTime); sl@0: CleanupStack::PopAndDestroy(dbView); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::RemoveDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter) sl@0: /** sl@0: Delete a set of records. Prints the consumed time to perform this operation. sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: aUpsDb.RemoveDecisionsL(aFilter); sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: INFO_PRINTF2(_L("A set of records deleted in %Ld microseconds."), elapsedTime); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::RemoveAllDecisionsL(CDecisionDbW &aUpsDb, RFs& aFs) sl@0: /** sl@0: Deletes all records in the database. Actually delete all database. sl@0: Prints the consumed time to perform this operation. sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: aUpsDb.DeleteDatabaseL(aFs); sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: INFO_PRINTF2(_L("All records deleted in %Ld microseconds."), elapsedTime); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::InsertRecordL(CDecisionDbW &aUpsDb, CDecisionRecord &aRecord) sl@0: /** sl@0: Inserts the provided record into the decision database. Prints the consumed time to perform this operation. sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: aUpsDb.CreateDecisionL(aRecord); sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: INFO_PRINTF2(_L("A record inserted in %Ld microseconds."), elapsedTime); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::ReadConfigurationFile(TDes &aKeyNotFound) sl@0: /** sl@0: Reads the key fileds from the ini file which are used to fill table with a specified number of sl@0: sample records. sl@0: @param aKeyNotFound The appended list of the key names which have not been found sl@0: */ sl@0: { sl@0: sl@0: if(EFalse == GetIntFromConfig(ConfigSection(),KRecordNum, iRecordNum)) sl@0: { sl@0: aKeyNotFound.Append(KRecordNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: else if(EFalse == GetIntFromConfig(ConfigSection(),KServerNum, iServerNum)) sl@0: { sl@0: aKeyNotFound.Append(KServerNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: else if(EFalse == GetIntFromConfig(ConfigSection(),KServiceNum, iServiceNum)) sl@0: { sl@0: aKeyNotFound.Append(KServiceNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: else if(EFalse == GetIntFromConfig(ConfigSection(),KClientNum, iClientNum)) sl@0: { sl@0: aKeyNotFound.Append(KClientNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: else if(EFalse == GetIntFromConfig(ConfigSection(),KEvaluatorNum, iEvaluatorNum)) sl@0: { sl@0: aKeyNotFound.Append(KEvaluatorNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: else if(EFalse == GetIntFromConfig(ConfigSection(),KRetrieveNum, iRetrieveNum)) sl@0: { sl@0: aKeyNotFound.Append(KRetrieveNum); sl@0: aKeyNotFound.Append(_L(" ")); sl@0: } sl@0: } sl@0: sl@0: sl@0: TInt CUpsDbBaseStep::ConvertNumber(TDesC& aError) sl@0: /** sl@0: Converts error string to number sl@0: @param aError Error string sl@0: */ sl@0: { sl@0: TInt error = KErrNotFound; sl@0: sl@0: if(!aError.CompareF(KStrErrNone)) sl@0: { sl@0: error = KErrNone; sl@0: } sl@0: else if(!aError.CompareF(KStrErrUpsBadFingerprintLength)) sl@0: { sl@0: error = KErrUpsBadFingerprintLength; sl@0: } sl@0: else if(!aError.CompareF(KStrErrUpsMissingArgument)) sl@0: { sl@0: error = KErrUpsMissingArgument; sl@0: } sl@0: else if(!aError.CompareF(KStrErrUpsBadClientEntityLength)) sl@0: { sl@0: error = KErrUpsBadClientEntityLength; sl@0: } sl@0: sl@0: return error; sl@0: } sl@0: sl@0: static void PopulateFingerPrint(TDes8& aBuf, TInt aStart) sl@0: { sl@0: TUint8 *ptr = (TUint8 *)aBuf.Ptr(); sl@0: sl@0: TInt pos; sl@0: TInt value; sl@0: sl@0: for(pos = 0, value = aStart; pos < KUpsMaxFingerprintLength; ++pos, ++value ) sl@0: { sl@0: ptr[pos] = value; sl@0: } sl@0: aBuf.SetLength(pos); sl@0: } sl@0: sl@0: void CUpsDbBaseStep::TestFingerprintValuesL(CDecisionDbW& aUpsDb) sl@0: /** sl@0: Creates a number of decision records by using all characters sl@0: between 0x01 and 0xFF in Fingerprint value. sl@0: */ sl@0: sl@0: { sl@0: TInt clientId = 1; sl@0: TInt serverId = 2; sl@0: TInt serviceId = 3; sl@0: TInt evaluatorId = 4; sl@0: TInt evaluatorInfo = 5; sl@0: TInt result = 0; sl@0: TInt policyVersion = 9; sl@0: TInt recordId = 0; sl@0: sl@0: CDecisionRecord *record = NULL; sl@0: CDecisionFilter *filter = NULL; sl@0: RPointerArray recordList; sl@0: TBuf8 bufFp; sl@0: TBuf8 bufCe; sl@0: TBuf bufDes; sl@0: bufFp.SetLength(KUpsMaxFingerprintLength); sl@0: bufCe.SetLength(KUpsMaxClientEntityLength); sl@0: TInt flag = KSetClientSid|KSetEvaluatorId|KSetServiceId|KSetServerSid|KSetFingerprint|KSetClientEntity; sl@0: TInt pos = 0; sl@0: sl@0: for(pos=0; pos <= KUpsDescriptionLength+1; pos+= KUpsMaxFingerprintLength) sl@0: { sl@0: PopulateFingerPrint(bufFp, pos); sl@0: record = CreateRecordL(++clientId,++evaluatorId,++serviceId,++serverId, bufFp, bufCe, bufDes, result, policyVersion, evaluatorInfo, recordId); sl@0: CleanupStack::PushL(record); sl@0: InsertRecordL(aUpsDb,*record); sl@0: sl@0: filter = CreateFilterLC(flag,clientId,evaluatorId,serviceId,serverId,bufFp,bufCe,policyVersion,recordId,bufDes,result,evaluatorInfo,EEqual); sl@0: CleanupResetAndDestroyPushL(recordList); sl@0: GetDecisionsL(aUpsDb, *filter, EFalse, recordList); sl@0: if(recordList.Count() != 1) sl@0: { sl@0: SetTestStepResult(EFail); sl@0: CleanupStack::PopAndDestroy(3, record); sl@0: break; sl@0: } sl@0: CleanupStack::PopAndDestroy(3, record); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::CompactDatabaseL(CDecisionDbW& aUpsDb, TBool aCancel) sl@0: /** sl@0: Compacts the decision database. sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: CDecisionDbCompactor *dbCompact = aUpsDb.PrepareCompactionLC(); sl@0: dbCompact->Compact(iWaiter->iStatus); sl@0: sl@0: if(aCancel) sl@0: { sl@0: dbCompact->Cancel(); sl@0: iWaiter->WaitActiveL(KErrCancel); sl@0: } sl@0: else sl@0: { sl@0: iWaiter->WaitActiveL(KErrNone); sl@0: } sl@0: sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: sl@0: if(iWaiter->iStatus == 0) sl@0: { sl@0: INFO_PRINTF2(_L("Compaction has been achieved in %Ld microseconds."), elapsedTime); sl@0: } sl@0: else sl@0: { sl@0: if(!aCancel && iWaiter->iStatus!=KErrCancel) sl@0: { sl@0: ERR_PRINTF1(_L("Failed to compact database!")); sl@0: SetTestStepResult(EFail); sl@0: } sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(dbCompact); sl@0: } sl@0: sl@0: sl@0: void CUpsDbBaseStep::UpdateRecordL(CDecisionDbW& aUpsDb, CDecisionFilter& aFilter, CDecisionRecord& aRecord) sl@0: /** sl@0: Updates a decision record from the decision database. sl@0: sl@0: @param aUpsDb A pointer to the decision database object sl@0: @param aFilter Filter used to find the record which will be updated sl@0: @param aRecord New record containing the values which will be updated sl@0: */ sl@0: { sl@0: TTime startTime; sl@0: //Timer is started sl@0: StartTimer(startTime); sl@0: sl@0: if(EFalse == aUpsDb.UpdateDecisionL(aFilter,aRecord)) sl@0: { sl@0: SetTestStepResult(EFail); sl@0: User::Leave(KErrNotFound); sl@0: } sl@0: else sl@0: { sl@0: //Timer is stopped sl@0: TInt64 elapsedTime = 0; sl@0: StopTimer(startTime,elapsedTime); sl@0: INFO_PRINTF2(_L("The record was updated in %Ld microseconds."), elapsedTime); sl@0: } sl@0: sl@0: }