/** * Copy the exported file attachments from ROM to RAM drive */ void CTestCalInterimApiSuiteStepBase::CopyImportFileToWritableDriveL() { CFileMan* fileCopier = CFileMan::NewL(iFsSession); CleanupStack::PushL(fileCopier); TPtrC file; GetStringFromConfig(ConfigSection(), KInitialLocationOfFile, file); RArray<TPtrC> fileList; CleanupClosePushL(fileList); TokenizeStringL(file, fileList); // Iterate through the file list and copy them from z drive to c drive for ( TInt i = 0; i < fileList.Count(); i++ ) { TFileName initialLocationOfFile = fileList[i]; initialLocationOfFile.Insert(0, KOriginalDrive()); // get current time TTime now; now.HomeTime(); // clear any read only attribute if the file is present such we avoid errors at copy time fileCopier->Attribs(fileList[i], 0, KEntryAttReadOnly, now); User::LeaveIfError(fileCopier->Copy(initialLocationOfFile, fileList[i], CFileMan::EOverWrite|CFileMan::ERecurse)); // clear any read only attribute such we avoid errors at open time (true on real hardware) User::LeaveIfError(fileCopier->Attribs(fileList[i], 0, KEntryAttReadOnly, now)); } CleanupStack::PopAndDestroy(&fileList); CleanupStack::PopAndDestroy(fileCopier); }
/** Check the updated categories extended name @param aCalEntry Pointer to CCalEntry @param aCategories Expected category name */ void CTestCalInterimApiFetchEntryAndCheckData::CheckCategoriesL(CCalEntry* aCalEntry, const TDesC& aCategories) { RArray<TPtrC> categoryList; TokenizeStringL(aCategories, categoryList); RPointerArray<CCalCategory> entryCatList; CleanupStack::PushL(TCleanupItem(ResetAndDestroyCategoryArray, &entryCatList)); entryCatList = aCalEntry->CategoryListL(); for(TInt ii = 0; ii < categoryList.Count(); ++ii) { TInt jj = 0; for(; jj < entryCatList.Count(); ++jj) { if(entryCatList[jj]->ExtendedCategoryName() == categoryList[ii]) { INFO_PRINTF2(KInfoCategoryExists, &(categoryList[ii])); break; // break jj } } // jj if(jj >= entryCatList.Count()) { ERR_PRINTF2(KErrCategoryNotExists, &(categoryList[ii])); SetTestStepResult(EFail); } }// ii CleanupStack::PopAndDestroy(&entryCatList); }
/* This function performs operations based on sequence specified in the ini file @param None @return None */ void CTestRControlChannel::SequenceOperationsL() { _LIT(KInfoLogFile, "CTestRControlChannel::SequenceOperationsL().... \n"); INFO_PRINTF1(KInfoLogFile); RArray<TPtrC> sequenceList; CleanupClosePushL(sequenceList); TPtrC listOfSequences; _LIT(KListOfSequences, "listofsequences"); GetStringFromConfig(ConfigSection(), KListOfSequences, listOfSequences); TokenizeStringL(listOfSequences, sequenceList); TInt numOperations = sequenceList.Count(); for(TInt i(0); i < numOperations; i++) { // SetCurrentSection(sequenceList[i]); PerformDesiredOperationsL(sequenceList[i]); } CleanupStack::PopAndDestroy(); _LIT(KInfoLogFile1, "CTestRControlChannel::SequenceOperationsL() End.... \n"); INFO_PRINTF1(KInfoLogFile1); }
/** Definition for the callback function from the interface @param aContactId The Contact item id, supplied by the production code @param aPropertyList The array of intra-properties to be added to the exported vCard */ void CContactsPBAPExportUtilityClass::AddIntraContactPropertiesL(const TContactItemId& /*aContactId*/, CArrayPtr<CParserProperty>* aPropertyList) { TPtrC intraPropName; TPtrC intraPropParamName; TPtrC intraPropDatatype; BaseTestStepReference().GetStringFromConfig(BaseTestStepReference().ConfigSection(), KIntraPropName, intraPropName); BaseTestStepReference().GetStringFromConfig(BaseTestStepReference().ConfigSection(), KIntraPropDatatype, intraPropDatatype); BaseTestStepReference().GetStringFromConfig(BaseTestStepReference().ConfigSection(), KIntraPropParName, intraPropParamName); RArray<TPtrC> intraPropNameList; CleanupClosePushL(intraPropNameList); TokenizeStringL(intraPropName, intraPropNameList); RArray<TPtrC> intraPropDatatypeList; CleanupClosePushL(intraPropDatatypeList); TokenizeStringL(intraPropDatatype, intraPropDatatypeList); RArray<TPtrC> intraPropParamNameList; CleanupClosePushL(intraPropParamNameList); TokenizeStringL(intraPropParamName, intraPropParamNameList); const TInt dataTypeCount = intraPropDatatypeList.Count(); CParserPropertyValue* propertyValue = NULL; for(TInt i=0; i < dataTypeCount; i++) { if(intraPropDatatypeList[i].Compare(KCDesCArray) == 0) { propertyValue = CreateCDesCArrayL(); } if(intraPropDatatypeList[i].Compare(KDATETIME) == 0) { TTime date(KDateTimeVal); propertyValue = CreateDatePropertyL(date); } if(intraPropDatatypeList[i].Compare(KHBufC) == 0) { propertyValue = CParserPropertyValueHBufC::NewL(KEmailVal); } if(intraPropDatatypeList[i].Compare(KBinary) == 0) { propertyValue = CParserPropertyValueBinary::NewL(KPhotoVal); } if(intraPropDatatypeList[i].Compare(KInt) == 0) { CParserPropertyValueInt* intVal = new(ELeave) CParserPropertyValueInt(143); propertyValue = intVal; } CParserParam* propParameter = CreateParameterL(intraPropParamNameList[i]); CleanupStack::PushL(propertyValue); AddPropertyL(intraPropNameList[i], propertyValue, propParameter, aPropertyList); CleanupStack::Pop(); // propertyValue } TBool leave = EFalse; BaseTestStepReference().GetBoolFromConfig(BaseTestStepReference().ConfigSection(), KLeave, leave); if(leave) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(3, &intraPropNameList); }
/** Retrives offsets for various numeric ids in OOM conditions */ void CTestTZServer::OOMGetOffsetTZIdsL() { RArray<TPtrC> numericIdsList; CleanupClosePushL(numericIdsList); TPtrC numericids; GetStringFromConfig(ConfigSection(), KNumericIds, numericids); TokenizeStringL(numericids, numericIdsList); //retrieve numeric ids to obtain their offsets RArray<TInt> tzIds; CleanupClosePushL(tzIds); for (TInt i = 0; i < numericIdsList.Count(); i++) { TLex lex(numericIdsList[i]); TInt numericId; User::LeaveIfError(lex.Val(numericId)); tzIds.Append(numericId); } RTz tz; CleanupClosePushL(tz); User::LeaveIfError(tz.Connect()); tz.SetAutoUpdateBehaviorL(RTz::ETZAutoDSTUpdateOn); RArray<TInt> offsets; CleanupClosePushL(offsets); iFailAt = 1; for ( ;; ) { StartHeapCheck(iFailAt); offsets.Reset(); TRAPD(err,tz.GetOffsetsForTimeZoneIdsL(tzIds,offsets)); if ( err == KErrNone ) { __UHEAP_RESET; INFO_PRINTF1(_L("OOM testing of GetOffsetsForTimeZoneIdsL Api is done")); break; } if ( ErrorProcess(err) ) { EndHeapCheck(); } else { break; } } RArray<TPtrC> expectedOffsetList; CleanupClosePushL(expectedOffsetList); TPtrC expectedOffsets; GetStringFromConfig(ConfigSection(), KOffset, expectedOffsets); TokenizeStringL(expectedOffsets, expectedOffsetList); //gets the expected offsets for the specified numeric ids RArray<TInt> expectedOffsetsList; CleanupClosePushL(expectedOffsetsList); for (TInt i = 0; i < expectedOffsetList.Count(); i++) { TLex lex(expectedOffsetList[i]); TInt offset; User::LeaveIfError(lex.Val(offset)); expectedOffsetsList.Append(offset); } //compares the expected offsets for the numeric ids with the actual retrieved offsets TESTL(expectedOffsetsList.Count() == offsets.Count()); for (TInt x = 0; x < expectedOffsetsList.Count(); x++) { INFO_PRINTF2(_L("tzid : %d"),tzIds[x]); } for (TInt x = 0; x < expectedOffsetsList.Count(); x++) { INFO_PRINTF2(_L("actual : %d"),offsets[x]); } for (TInt x = 0; x < expectedOffsetsList.Count(); x++) { TESTL(expectedOffsetsList[x] == offsets[x]); } CleanupStack::PopAndDestroy(&expectedOffsetsList); CleanupStack::PopAndDestroy(&expectedOffsetList); CleanupStack::PopAndDestroy(&offsets); CleanupStack::PopAndDestroy(&tz); CleanupStack::PopAndDestroy(&tzIds); CleanupStack::PopAndDestroy(&numericIdsList); }