コード例 #1
0
/**
* Function Name		:	TestFtw4
* Description		: 	ftw for invalid path
* Return Value		: 	ftw returns ENOTDIR
*/
TInt CTestftw::TestFtw4()
    {
    char parm[PATH_MAX];
	int result; 
	int ret;
	
	int fd=open("c:\\validfile.txt", O_WRONLY|O_CREAT);
	if(fd==-1)
		{
		INFO_PRINTF2(_L("file open fails with error No: %d"), errno);
		return KErrGeneral;
		}
	
	memset(&parm[0], 0, PATH_MAX);    
   	ReadStringParam(parm);
	ret=ftw(parm, &action, 10);
   	GetIntFromConfig(ConfigSection(), _L("Expected"), result);
   	if(ret==-1 && errno==result)
   		{
   		close(fd);
   		INFO_PRINTF2(_L("ftw returns error no: %d"), errno);
		unlink("c:\\validfile.txt");
   		return KErrNone;
   		}
   	INFO_PRINTF2(_L("ftw fails with error No: %d"), errno);
   	close(fd);
   	unlink("c:\\validfile.txt");
   	return KErrGeneral;	
    }
コード例 #2
0
/**
doTestStepL()
Reads the expected count from the ini file.
Obtains the count of the POP accounts created and compares against the expected number.

@return
Returns the test step result.
*/
TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count"));
	TInt expectedCount = -1;
	if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0)
		{
		ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0"));
		SetTestStepResult(EFail);
		}
	else
		{
		CEmailAccounts *account = CEmailAccounts::NewLC();	
		RArray<TPopAccount> arrayPopAccounts;
		account->GetPopAccountsL(arrayPopAccounts);
		TInt count = arrayPopAccounts.Count();
		
		CleanupStack::PopAndDestroy(account);
		arrayPopAccounts.Reset();
		
		if (count != expectedCount)
			{
			ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"), 
									  expectedCount, count);
			SetTestStepResult(EFail);
			}
		else
			{
			INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount);	
			}			
		}
	return TestStepResult();
	}
コード例 #3
0
/**
  * 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);
	}
コード例 #4
0
TVerdict CAddDriveStep::runTestStepL(TBool /*aOomTest*/)
    {
    TPtrC str;
    TInt drive(0);
    if (!GetStringFromConfig(ConfigSection(), _L("drive"), str))
        {
        ERR_PRINTF1(_L("Missing drive setting"));
        SetTestStepResult(EFail);
        }
    else
        {
        RFs fs;
        fs.Connect();
        
        User::LeaveIfError(fs.CharToDrive(str[0], drive));
        //iDriveChar = str[0];
        fs.Close();
        }
    RSisRegistryWritableSession registrySession;
            
    User::LeaveIfError(registrySession.Connect());
    CleanupClosePushL(registrySession);
    registrySession.AddDriveL(drive);

    CleanupStack::PopAndDestroy(&registrySession);    

    return EPass;
    }
コード例 #5
0
/**
 * Deleting the 1000 contact item
 * with all new fields
 * @return - void
 */
void CTestContactPerformanceStep::DeletePerformanceL()
{
    // delete multiple contact item field
    CContactItem *readItem = NULL;

    //Get the number of contact item from ini file
    GetIntFromConfig(ConfigSection(), KNoOfContactItem, iNoOfCI);

    for(TInt readContact=0; readContact<iNoOfCI; readContact++)
    {
        readItem = dBase->ReadContactLC(idArray[readContact]);
        CContactItemFieldSet& ContactFieldSet = readItem->CardFields();
        for(TInt del=0; del<7; del++)
        {
            TInt pos = ContactFieldSet.Find(iFieldUid[del], iVcardUid[del]);
            if(pos != KErrNotFound)
            {
                ContactFieldSet.Remove(pos);
                SetTestStepResult(EPass);
            }
            else
            {
                ERR_PRINTF1(_L("field not deleted"));
                SetTestStepResult(EFail);
            }
        }
        CleanupStack::PopAndDestroy(readItem);
    }
    INFO_PRINTF1(_L("Fields deleted successfully"));
}
コード例 #6
0
/** Retrieves numeric id for various time zones
*/
void CTestTZServer::TimeZoneNumericIdL()
	{
	iField.Zero();
	iField.Append(KNumericIds);
	GetIntFromConfig(ConfigSection(),iField,iIntNumericId); //gets expected numeric id
	
	RTz tz;
	CleanupClosePushL(tz);
	User::LeaveIfError(tz.Connect());
	
	CTzId* tzId = NULL;

	TRAPD(err,tzId = tz.GetTimeZoneIdL());
		
	TESTL(err == KErrNone);
	
	CleanupStack::PushL(tzId);
	 
	TUint tzNumericId = tzId->TimeZoneNumericID();
	
	INFO_PRINTF2(_L("actual : %d"),tzNumericId);
	
	TESTL(tzNumericId == iIntNumericId);
	
	CleanupStack::PopAndDestroy(tzId);
	CleanupStack::PopAndDestroy(&tz);
	}
コード例 #7
0
/* In this section, we edit the desired number of groups in the database
 * Set label for them and associate them with desired number of groups
 * With this database updation, group views can be constructed and accessed
 */
void CTestContactViewDatabaseUtilitiesStep::IterateThroAllGroupSectionsAndUpdateL()
	{
	_LIT(KListOfGroupsSectionsString, "listofgroupsections");
	TPtrC listOfGroupsSectionsString;
	GetStringFromConfig(ConfigSection(), KListOfGroupsSectionsString, listOfGroupsSectionsString);

	RArray<TPtrC>	listOfGroupsSections;
	CleanupClosePushL(listOfGroupsSections);
	ViewUtilityReference().TokenizeStringL(listOfGroupsSectionsString, listOfGroupsSections);

	CCntFilter* filter = CCntFilter::NewL();
	CleanupStack::PushL(filter);
	filter->SetContactFilterTypeGroup(ETrue);
	DatabaseReference().FilterDatabaseL(*filter);

	for ( TInt i = 0; i < listOfGroupsSections.Count(); ++i )
		{
		CContactIdArray* idArray = filter->iIds;
		TContactItemId groupId = (*idArray)[i];
		CContactItem* group = DatabaseReference().OpenContactL(groupId);
		CleanupStack::PushL(group);
		CContactGroup* newGroup = static_cast<CContactGroup*>(group);
		UpdateGroupsL(listOfGroupsSections[i], *newGroup);
		DatabaseReference().CommitContactL(*group);
		DatabaseReference().CloseContactL(groupId);
		CleanupStack::PopAndDestroy(group);
		}

	CleanupStack::PopAndDestroy(2, &listOfGroupsSections);
	}
コード例 #8
0
			EXPORT_C enum TVerdict CPerformOCSPStep::doTestStepPreambleL()
				{
				TInt result = KErrNone;
				TBool found = GetIntFromConfig(ConfigSection(), KExpectedValidationResultKey, result);
				User::LeaveIfError(iExpectedResults.Append(result));
			
				if (!found)
					{				
					WARN_PRINTF1(_L("Missing Expected result defaulting to KErrNone"));	
					}		
				else
					{
					TBuf<128> mymsg;
					
					mymsg.Format(_L("Expected result: (%d)"), iExpectedResults[0]);

					INFO_PRINTF1(mymsg);
					}
					
				if (CActiveScheduler::Current() == NULL)
				    {
				    INFO_PRINTF1(_L("Installing scheduler"));
				    iSched = new(ELeave) CActiveScheduler;
				    CActiveScheduler::Install (iSched);
				    }	
				    			    				    
				return TestStepResult();		
				}
/**
 * Reads data specified in the ini file and constructs all view validation objects
 */
void CTestContactViewUnderlyingViewUpdateStep::ReadIniAndConstructViewValidationObjectsL()
	{
	_LIT(KListOfViewsToBeValidated, "ListOfViewsToBeValidated");
	TPtrC listOfViewsToBeRemoved;
	TESTL(GetStringFromConfig(ConfigSection(), KListOfViewsToBeValidated, listOfViewsToBeRemoved));

	RArray<TPtrC>	sections;
	CleanupClosePushL(sections);
	ViewUtilityReference().TokenizeStringL(listOfViewsToBeRemoved, sections);

	for ( TInt i = 0; i < sections.Count(); ++i )
		{
		TViewValidationData ViewValidationData;

		_LIT(KContactViewType, "ViewType");
		TPtrC contactViewTypeString;
		GetStringFromConfig(sections[i], KContactViewType, contactViewTypeString);
		ViewValidationData.SetViewType(contactViewTypeString);

		_LIT(KContactViewIndex, "ViewIndex");
		TInt contactViewIndex;
		GetIntFromConfig(sections[i], KContactViewIndex, contactViewIndex);
		ViewValidationData.SetViewIndex(contactViewIndex);

		_LIT(KUpdatedViewCount, "UpdatedViewCount");
		TInt updatedViewCount = 0;
		GetIntFromConfig(sections[i], KUpdatedViewCount, updatedViewCount);
		ViewValidationData.SetExpectedViewCount(updatedViewCount);

		iViewValidationArray.AppendL(ViewValidationData);
		}

	CleanupStack::PopAndDestroy(&sections); 
	}
コード例 #10
0
void CTPKCS7OOMTest::doTestOOML()
	{
	TInt OOMTest;
	GetIntFromConfig(ConfigSection(),_L("OOMTestNo"),OOMTest);
	__UHEAP_MARK;
			
	if (OOMTest == 1)
		{
		CPKCS7ContentInfo* theTest = NULL;
		theTest = CPKCS7ContentInfo::NewL(iRawData->Des());
		delete theTest;
		}
	// Digest Info
	else if (OOMTest == 2)
		{
		CPKCS7DigestInfo* theTest0 = NULL;
		theTest0 = CPKCS7DigestInfo::NewL(iRawData->Des());
		delete theTest0;
		}
	// Encrypted Data
	else if (OOMTest == 3)
		{
		CPKCS7ContentInfo* theTest1 = NULL;
		theTest1 = CPKCS7ContentInfo::NewL(iRawData->Des());
			
		CleanupStack::PushL(theTest1);
		CPKCS7EncryptedDataObject* theTest2 = NULL;
		theTest2 = CPKCS7EncryptedDataObject::NewL(*theTest1);
				
		CleanupStack::PopAndDestroy(theTest1);
		delete theTest2;
		}
	
	__UHEAP_MARKEND;
}
コード例 #11
0
//	Step 4	Certificate
TVerdict CTPKCS7CertificateTest::doTestStepL()
	{
	if (TestStepResult() != EPass)
		{
		return TestStepResult();
		}

	TBool checkCount;
	TInt expectedCount;

	checkCount = GetIntFromConfig (ConfigSection(),_L("CertificateCount"), expectedCount);
	
	TInt err;
	

	CPKCS7ContentInfo * contentInfo = NULL;
	TRAP (err, contentInfo = CPKCS7ContentInfo::NewL(iRawData->Des()));
    
	if(err == KErrNone)
		{
		CPKCS7SignedObject * p7 = NULL;
		if( contentInfo->ContentType() == 2)
			{
			TRAP (err, p7 = CPKCS7SignedObject::NewL(*contentInfo));
			
			if (err != KErrNone)
				{
				SetTestStepResult(EFail);
				INFO_PRINTF2(_L("Got %d building PKCS7 object"), err);
				}
			else
				{
				CleanupStack::PushL (p7);
				const RPointerArray<CPKCS7ExtendedCertificateOrCertificate>& certificates = p7->Certificates();
				if (checkCount)
					{
					if (certificates.Count() != expectedCount)
						{
						SetTestStepResult(EFail);
						INFO_PRINTF3(_L("Expected %d certificates, got %d"), expectedCount, certificates.Count());
						}
					}
				CleanupStack::PopAndDestroy (p7);
				}

			}
		}
	else
		{
		SetTestStepResult(EFail);
		}
		
	if (!checkCount && (TestStepResult()==EPass))
		{
		SetTestStepResult(EInconclusive);
		INFO_PRINTF1(_L("No test performed in this step"));
		}

	return TestStepResult();
	}
コード例 #12
0
/**
 * Retrieves the desired contact view observer and listens for contact view notifications
 * @param aEvent - A TContactViewEvent object that will be updated with the notification received
 * @return TBool - An indication whether notification was received or not
 */
TBool CTestContactViewDatabaseUtilitiesStep::ListenForViewEventsL(TContactViewEvent& aEvent)
	{
	const TInt KNotificationTimeout = 10; // ms
	TInt desiredViewIndex = 0;
	_LIT(KDesiredViewIndex, "DesiredViewIndex");
	GetIntFromConfig(ConfigSection(), KDesiredViewIndex, desiredViewIndex);

	TPtrC desiredViewType;
	_LIT(KDesiredViewType, "DesiredViewType");
	GetStringFromConfig(ConfigSection(), KDesiredViewType, desiredViewType);

	CContactViewEventQueue&	contactViewObserver =
		ViewCollectionReference().GetDesiredViewObserver(desiredViewType, desiredViewIndex);

    return (contactViewObserver.ListenForEvent(KNotificationTimeout,aEvent));
	}
コード例 #13
0
TVerdict CVerifyServerCertStep::doTestStepL()
	{
	INFO_PRINTF1(_L("Calling TLS Provider Verify Certificate."));
	
	CX509Certificate* cert = NULL;
	TInt err = VerifyServerCertificateL(cert);
	delete cert; // don't really need the cert
	
	TInt expectedResult;
	
	if (!GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult))
		{
		// failed to get expected result from config file... using KErrNone.
		expectedResult = KErrNone;
		}
	
	if (err != expectedResult)
		{
		INFO_PRINTF3(_L("Failed! TLS Provider returned error code %d, expecting %d."),
			err, expectedResult);
		SetTestStepResult(EFail);
		return EFail;
		}
	else
		{
		INFO_PRINTF1(_L("Test passed."));
		SetTestStepResult(EPass);
		}
	return TestStepResult();
	}
コード例 #14
0
/**
 Function : RetriveSearchSortResultL
 Description : Retrieves the search/sort result
 @return : none
 */
void CT_MsgSearchSortByQueryObject::RetriveSearchSortResultL(const TInt aIterationLimit, TMsvSearchSortResultType aResultType)
	{
	// Get the number of messages satisfying the search/sort request
	TInt resultCount = iSharedDataCommon.iSearchSortOperation->GetResultCountL();
	WriteIntToConfig(ConfigSection(), KCountOfResult, resultCount); 
	
	// Get the search/sort result according to user preference
	TMsvId messageId, serviceId;
	TMsvEntry messageEntry;
	iSharedDataCommon.iSearchSortResultArray.Reset(); // Flush out the existing search/sort result
	if (aIterationLimit > 0 && aResultType == EMsvResultAsTMsvId) // Iteration limit is one and result type is TMsvId
		{
		for(TInt index = 0; index < resultCount; ++index)
			{
			iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageId);
			 // Get the corresponding index entry and append the same to array of entries.
			iSharedDataCommon.iSession->GetEntry(messageId, serviceId, messageEntry);
			iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
			}
		}
	else if(aIterationLimit > 0 && aResultType == EMsvResultAsTMsvEntry) // Iteration limit is one and result type is TMsvEntry
		{
		for(TInt index = 0; index < resultCount; ++index)
			{
			iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageEntry);
			iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
			}
		}
	else if (aIterationLimit == 0 && aResultType == EMsvResultAsTMsvId) // No iteration and result type is TMsvId
		{
		RArray<TMsvId> idArray;
		TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(idArray));
		if(error == KErrNone)
			{
			// Get the corresponding index entries and create an array of entries.
			for(TInt index = 0; index < idArray.Count(); ++index)
				{
				iSharedDataCommon.iSession->GetEntry(idArray[index], serviceId, messageEntry);
				iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
				}
			}
		else
			{
			SetTestStepError(error);
			}
		}
	else // No iteration and result type is TMsvEntry
		{
//		RArray<TMsvEntry> entryArray;
		TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(iSharedDataCommon.iSearchSortResultArray));
		SetTestStepError(error);
		}
	// Ensure Number of Entries in iSharedDataCommon.iSearchSortResultArray is same as the result count
	if(iSharedDataCommon.iSearchSortResultArray.Count() != resultCount)
		{
		ERR_PRINTF1(_L("MisMatch in Result count and Entries retrieved"));
		ERR_PRINTF3(_L("Search-sort result count= %d Entries retrieved= %d"), resultCount, iSharedDataCommon.iSearchSortResultArray.Count());
		SetTestStepResult(EFail);
		}
	}
コード例 #15
0
HBufC8* CTPKCS7StepBase::readFileL (TPtrC tag)
{
    TPtrC fileName;
    if (GetStringFromConfig(ConfigSection(), tag, fileName) == EFalse)
    {
        return NULL;
    }

    RFile file;
    if (file.Open(iFs, fileName, EFileRead) != KErrNone)
    {
        INFO_PRINTF2(_L("Cannot open file %S for reading"), &fileName);
        return NULL;
    }
    CleanupClosePushL(file);

    TInt fileSize = 0;
    User::LeaveIfError(file.Size(fileSize));

    HBufC8* result = HBufC8::NewL(fileSize);
    result->Des().SetLength(fileSize);

    TPtr8 rawDataPtr(result->Des());
    rawDataPtr.SetLength(fileSize);
    file.Read (rawDataPtr);

    CleanupStack::PopAndDestroy (&file);

    INFO_PRINTF3(_L("Read %d octets from %S"), result->Size(), &fileName);

    return result;
}
コード例 #16
0
/**
@SYMTestCaseID			PIM-APP-ENGINES-CALINTERIMAPI-CIT-0005-HP
@SYMTestType			CIT
@SYMTestPriority		Medium
@SYMPREQ				1098
@SYMFssID				3.2.1 005
@SYMTestCaseDesc		delete the opened file
@SYMTestActions			deletes the opened file
@SYMTestExpectedResults	Aganda file is and deleted
*/
void CTestCalInterimApiSuiteStepBase::DeleteCalenderFileL()
	{
	INFO_PRINTF1(_L("Deleting calender file"));

	TRAPD(err, iSession->DeleteCalFileL(iCalenderFileName));
	if( err == KErrNone )
		{
		TBool reCreateCalFile = ETrue;
	    if (!GetBoolFromConfig(ConfigSection(), KReCreateCalFile, reCreateCalFile))
	        {
	    	reCreateCalFile = ETrue;
	        }

	    if (reCreateCalFile)
	        {
	    	INFO_PRINTF1(_L("Trying to create the file after deletion"));
		    TRAPD(err, iSession->CreateCalFileL(iCalenderFileName));
		    if( err != KErrNone )
			    {
			    ERR_PRINTF2(KErrInDeleteCalFileL, err);
			    SetTestStepResult(EFail);
			    }
	        }
		}
	else
		{
		ERR_PRINTF2(KErrDeletingCalenderFile, err);
		SetTestStepResult(EFail);
		}
	}
コード例 #17
0
TInt CTestSysunistd::nice_less_than_lowest( )
    {
	_LIT( KPassed, "Passed" );
    _LIT( KFailed, "Failed" );

    _LIT( KSetpriority, "In setpriority" );

    INFO_PRINTF1( KSetpriority );
	int retVal = 0, i;
	TInt retrn;
	errno = 0;
	TInt prio_low_end;
	TInt prio_low_start;
	
	_LIT( Kprio_low_start, "Parameter1" );
	TBool res = GetIntFromConfig(ConfigSection(), Kprio_low_start, prio_low_start);
	if(!res)
		{
	 	_LIT(Kerr , "Failed to read first parameter from ini file") ;
	 	INFO_PRINTF1(Kerr) ;
	 	return KErrGeneral ;
		}
	 _LIT( Kprio_low_end, "Parameter2" );
	 res = GetIntFromConfig(ConfigSection(), Kprio_low_end, prio_low_end);
	 if(!res)
		{
	 	_LIT(Kerr , "Failed to read second parameter from ini file") ;
	 	INFO_PRINTF1(Kerr) ;
	 	return KErrGeneral ;
		}
	errno = 0;
	for (i = prio_low_start; i >= prio_low_end; i--)
		{
		retVal = nice(i);
		if((retVal == -1)&&(errno))
			{
			INFO_PRINTF1( KFailed );
			retrn = KErrGeneral;
			}
		else
			{
	    	INFO_PRINTF1( KPassed );
		    }
		}
	retrn = KErrNone;
	return retrn ;
    }
コード例 #18
0
void CTestRControlChannel::SavePreviousLogFileL()
	{
	_LIT(KInfoLogFile, "Saving Previous logs If any.... \n");
	INFO_PRINTF1(KInfoLogFile);
	RFs fileserv;
	TInt error = fileserv.Connect();
	if(!error)
		{
		_LIT(KlogFile, "C:\\logs\\log.txt");
		_LIT(KPrefixLog, "C:\\logs\\");
		_LIT(KSuffix, "_UDEB");
		_LIT(KExtn, ".txt");
		
		CFileMan* fMan = NULL;
		TRAP_IGNORE(fMan = CFileMan::NewL(fileserv));
		if(fMan != NULL)
			{
			CleanupStack::PushL(fMan);
			RBuf newFileName;
			const TInt KTwenty = 20;
			newFileName.Create(ConfigSection().Length() + KTwenty );
			newFileName.Copy(KPrefixLog);
			//Script file name
			iScriptName.Copy(ConfigSection());
			newFileName.Append(iScriptName);
			newFileName.Append(KSuffix);
			newFileName.Append(KExtn);
			
			TInt error = fMan->Rename(KlogFile, newFileName);
			if (error != KErrNone)
				{
				_LIT(KErrInfo, "Unable to Save Previous logs...May be NO Previous logs exist \n");
				ERR_PRINTF1(KErrInfo);
				}
			else
				{
				_LIT(KSavingInfo, "Saved Previous logs with File Name: %S \n");
				INFO_PRINTF2(KSavingInfo, &newFileName);
				}
			CleanupStack::PopAndDestroy(fMan);
			newFileName.Close();
			}
		}
	fileserv.Close();
	_LIT(KInfoLogFile1, "Saving Previous logs End.... \n");
	INFO_PRINTF1(KInfoLogFile1);
	}
コード例 #19
0
/**
  Function : doTestStepL
  Description : Reads the Imap account name, folder name ,the entry name from the ini file.
				It the then searches for the given entry under the specified folder.
				The test passes if the entry is found else it fail.
  @return : TVerdict - Test step result
*/
TVerdict CT_MsgFindEntryByName::doTestStepL()
	{
	INFO_PRINTF1(_L(" TestStep :  FindEntryByName"));
	/* Reads the IMAP account name from the ini file */
	TPtrC imapAccountName;
	if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName))
		{
		ERR_PRINTF1(_L("Imap Account Name is not specified"));
		SetTestStepResult(EFail);
		}
	else
		{
		/* Retrieves the IMAP service Id for the given IMAP account */
		TMsvId imapServiceId = CT_MsgUtilsCentralRepository::GetImapServiceIdL((TDes&)imapAccountName);
		INFO_PRINTF2(_L("Imap service id is %d"),imapServiceId);

		/* Reads the name of the remote folder from the ini file */
		TPtrC folderName;
		if(!GetStringFromConfig( ConfigSection(), KFolderName, folderName))
			{
			ERR_PRINTF1(_L("Remote Parent Folder name is not specified"));
			SetTestStepResult(EFail);
			}
		else
			{
			/* Reads the entry name that is to be verified from the ini file */
			TPtrC entryName;
			if(!GetStringFromConfig( ConfigSection(), KEntryName, entryName))
				{
				ERR_PRINTF1(_L("Entry name to search is not specified"));
				SetTestStepResult(EFail);
				}
			else
				{
				TBool caseSensitive = EFalse;
				GetBoolFromConfig(ConfigSection(), KCaseSensitive, caseSensitive);

				/* Gets the Id of the given entry to be searched */
				TMsvId  entryId;
				TRAPD(err,entryId = CT_MsgUtils::GetRemoteFolderIdByNameL(iSharedDataIMAP.iSession,imapAccountName,entryName,folderName,caseSensitive));
				INFO_PRINTF2(_L(" The entry Id is %d"),entryId);
				SetTestStepError(err);
				}
			}
		}		
	return TestStepResult();
	}
コード例 #20
0
TVerdict CTestCompareCntFiles::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 */
	{
	// connect to file system
	User::LeaveIfError(iFsSession.Connect());

	TESTL(TestStepResult() == EPass);
	INFO_PRINTF1(_L("CTestCompareCntFiles::doTestStepL() start"));

	TESTL(GetStringFromConfig(ConfigSection(), KExportFile, iExportFilePath));
	
	GetStringFromConfig(ConfigSection(), KExpectedExportFile, iExpectedExportFilePath);
	GetStringFromConfig(ConfigSection(), KFieldToVerify, iFieldToVerify);
	GetStringFromConfig(ConfigSection(), KNoField, iNoField);
	
	// Create Utility class object, to use TokenizeStringL
	CTestStep* self = static_cast<CTestStep*>(this);
	iExportObj = new(ELeave) CContactsPBAPExportUtilityClass(self);
	
	TokenizeAndCompareL();
	TokenizeAndCheckNoFieldL();
	
	// Comparing two files
	TBool compareFile = EFalse;
	GetBoolFromConfig(ConfigSection(), KCompareFile, compareFile);
	
	if(compareFile)
		{
		TBool fileCompare = EFalse;
		// Call CompareWholeFileL to use the normal comparison of two files, ignoring the REV property
		fileCompare = CompareWholeFileL(iExpectedExportFilePath, iExportFilePath);
		if(!fileCompare)
			{
			SetTestStepResult(EFail);
			}
		}
	
	iFsSession.Close();
    
	INFO_PRINTF1(_L("CTestCompareCntFiles::doTestStepL() finish"));
	
	return TestStepResult();
	
	}
コード例 #21
0
void CEtelMMLbsTestStepBase::ValidateMCRefLocParams()
	{
	TInt expectedRefLocLatSign ;
	GetIntFromConfig(ConfigSection(), _L("expectedRefLocLatSign"), expectedRefLocLatSign );

	TInt expectedRefLocLongSign ;
	GetIntFromConfig(ConfigSection(), _L("expectedRefLocLongSign"), expectedRefLocLongSign );

	TBool expectedRefLocRequest;
	GetBoolFromConfig(ConfigSection(), _L("expectedRefLocRequest"), expectedRefLocRequest);
	
	// Reference Location data populated and status is false
	TEST(iMeasurementControl.iMeasurementCommand.iSetup.iUePosGpsAssistanceData.iReferenceLocation.iLatitudeSign == DMMTSY_PHONE_LCS_MC_GPS_REFLOC_LATSIGN1);
	TEST(iMeasurementControl.iMeasurementCommand.iSetup.iUePosGpsAssistanceData.iReferenceLocation.iLatitude == expectedRefLocLatSign);
	TEST(iMeasurementControl.iMeasurementCommand.iSetup.iUePosGpsAssistanceData.iReferenceLocation.iLongitude == expectedRefLocLongSign) ;
	TEST(iMeasurementControl.iMeasurementCommand.iSetup.iUePosGpsAssistanceData.iGpsAddlDataStatus.iReferenceLocationRequest == expectedRefLocRequest);
	}
コード例 #22
0
void CContactViewTest::PreTestL()
	{
	iSemaphore.CreateLocal( 0 );
	iSemaphore2.CreateLocal( 0 );
	const TDesC &KSection = ConfigSection();
	iPLView = ( KSection.Find( KPLView ) == 0 ); // section has to start with plview
	iRecoverFlag = ( KSection.Find( KRecover ) == 0 );
	}
コード例 #23
0
/**
 * Adds contact fields to the contact, as per the desired contact view filter
 */
void CTestContactViewCRUDOperationsStep::AddFieldsSpecificToFilterL(CContactItem& aContact)
	{
	_LIT(KDesiredFilterString, "desiredFilter");
	TPtrC desiredFilterString;
	GetStringFromConfig(ConfigSection(), KDesiredFilterString, desiredFilterString);
	CContactDatabase::TContactViewFilter	viewFilter = ViewUtilityReference().GetContactViewFilterL(desiredFilterString);
	AddFilterBasedFieldsL(aContact, viewFilter);
	}
コード例 #24
0
TInt CTestSysunistd::getpriority_other( )
    {

    // Print to UI
    _LIT( KPassed, "Passed" );
    _LIT( KFailed, "Failed" );

    _LIT( KGetpriority, "In getpriority" );
    INFO_PRINTF1( KGetpriority );
	
	int retVal = 0;
	TInt retrn;
	errno = 0;
	TInt which;
	TInt who;
	_LIT( Kwhich, "Parameter1" );
	TBool res = GetIntFromConfig(ConfigSection(), Kwhich, which);
	if(!res)
		{
	 	_LIT(Kerr , "Failed to read first parameter from ini file") ;
	 	INFO_PRINTF1(Kerr) ;
	 	return KErrGeneral ;
		}
	_LIT( Kwho, "Parameter2" );
	res = GetIntFromConfig(ConfigSection(), Kwho, who);
	if(!res)
		{
	 	_LIT(Kerr , "Failed to read second parameter from ini file") ;
	 	INFO_PRINTF1(Kerr) ;
	 	return KErrGeneral ;
		}

	retVal = getpriority(which, who);	
	if((retVal == -1) && (errno))
		{
		INFO_PRINTF1( KPassed );
		retrn = KErrNone;
		}
	else
		{
		INFO_PRINTF1( KFailed );
		retrn = KErrGeneral;
		}	
    return retrn ;

    }
コード例 #25
0
TInt CTestSendsignal::TestSigqueue (  )
	{   
	int ret, ret1 = KErrGeneral, status, Signum;
	pid_t pid, pid1;
	union sigval sival;
	char **argv=(char**)malloc(3*sizeof(char*));
	ret = GetIntFromConfig(ConfigSection(), _L("Signum"), Signum);
	if(ret == 0)
		{
		ERR_PRINTF1(_L("Failed to read the signal number")) ;
		goto close;
		}
	ret = setsigenv();
	if( ret == KErrGeneral)
		{
		ERR_PRINTF1(_L("Failed in setting the default enviroment for signal")) ;
		goto close;
		}
	argv[0]=(char*)malloc(34*sizeof(char));
	argv[1]=(char*)malloc(3*sizeof(char));
	argv[2]= 0;
	strcpy(argv[0], "z:\\sys\\bin\\sendsignal.exe");
	sprintf(argv[1], "%d", Signum);	
	ret = posix_spawn(&pid, "z:\\sys\\bin\\sendsignal.exe", NULL, NULL, argv, (char**)NULL);
	if(ret != 0)
		{
		ERR_PRINTF2(_L("Error in posix spawn and errno is set to %d"),errno);
		goto close;
		}
	INFO_PRINTF2( _L("the value of pid returned by posix_spawn is %d"),  pid);
	User::After(50000); // TODO: Remove once the sending issue is fixed
	sival.sival_int = 0;
	ret = sigqueue(pid,Signum,sival);
	if(ret != 0)
		{
		ERR_PRINTF2( _L("Error in sending the signal to the spawned process and errno is set %d"),errno);
		goto close;
		}
	pid1 = waitpid(pid, &status, WUNTRACED);
	if (pid1 != pid)
		{
		ERR_PRINTF1(_L("waitpid failed..."));	
		goto close;
		}
	if(WEXITSTATUS(status) != 0)
		{
		ERR_PRINTF2(_L("sigqueue() failed in the child process for signal %d"),Signum);
		goto close;		
		}
	INFO_PRINTF2(_L("Successfully able to send a signal %d"),Signum);
	ret1 = KErrNone;

	close:
	free((void*)argv[0]);
	free((void*)argv[1]);
	free((void*)argv);
	return ret1;
	}
コード例 #26
0
/**
  Function : doTestStepL
  Description : Reads the  Imap account name from the ini file.
		        Reads the event type from the ini file.
		        And requests what msgs have been affected by that
		   		event, within the folder that this observer is watching.
  @return : TVerdict - Test step result
*/
TVerdict CT_MsgObserverCkEventNCount::doTestStepL()
	{	
	
	INFO_PRINTF1(_L(" Test Step : Checking event type and total number of msgs effected form observer"));
	TPtrC imapAccountName,event;
	TInt expectedNum;
	
        //retrieve account name from ini
	if(!GetStringFromConfig( ConfigSection(), KAccountName, imapAccountName))
		{
		ERR_PRINTF1(_L("Imap Account Name is not specified"));
		SetTestStepResult(EFail);
		}
	

	if( TestStepResult() != EFail )
		{
	     //retrieve event expected from ini 
	    if(!GetStringFromConfig( ConfigSection(), KEventName, event))
			{
			ERR_PRINTF1(_L("Event type not specified"));
			SetTestStepResult(EFail);
			}
		//ask observer how many entries have been affected by that event
		TInt actualNum=iSharedDataIMAP.iObserver->CheckEventAndCountL((TDesC&)event);
		INFO_PRINTF2(_L(" Total number of msgs effected are: %d"),actualNum);
				
		if(!GetIntFromConfig( ConfigSection(), KNumExpected, expectedNum))
			{
			ERR_PRINTF1(_L("Expected count not specified!"));
			}
			
		if (actualNum!=expectedNum)
			{
			ERR_PRINTF1(_L("Actual number of msgs effected by event does not equal to number expected! "));
			SetTestStepResult(EFail);
			}
		
		}
			
    
		return TestStepResult();	
		
			
}//end function  doTestStepL
コード例 #27
0
TVerdict CUpnpRequestParserTest::doTestStepL()
	{
	TPtrC dataChunk;
		
    if (
    	!GetStringFromConfig(ConfigSection(), KDataChunk1, dataChunk)	||
    	!GetBoolFromConfig(ConfigSection(), KParseExcessData, iNeedToParseExcessData)	||
    	!GetIntFromConfig(ConfigSection(), KExpectedRequests, iExpectedRequests)	||
    	!GetIntFromConfig( ConfigSection(), KDataChunkCount, iDataChunkCount )
    	)
		{
		ERR_PRINTF5(_L("===> Problem in reading values from ini.			\
						\nExpected fields are: \n%S\n%S\n%S\n%S <==="
					  ), &KDataChunk1, &KParseExcessData, &KExpectedRequests, 
					  &KDataChunkCount );
		SetTestStepResult(EFail);
		return TestStepResult();
		}
コード例 #28
0
/**
* Function Name		: TestFtw2
* Description		: ftw with negative 'ndirs'
* Return Value		: ftw returns EINVAL
*/
TInt CTestftw::TestFtw2()
    {
    int ndirs, result;
	int ret;
	
	GetIntFromConfig(ConfigSection(), _L("Param1"), ndirs);
	
   	ret=ftw(".", &action, ndirs);
   	
   	GetIntFromConfig(ConfigSection(), _L("Expected"), result);
   	
   	if(ret==-1 && errno==result)
   		{
   		return KErrNone;
   		}
   	INFO_PRINTF2(_L("ftw fails with error No: %d"), errno);
   	return KErrGeneral;	
    }
コード例 #29
0
/**
  Does the main functionality test.
  Here, reads values from INI file and calls NormaliseAndCompareUriL
  @internalTechnology 
  @param		None
  @return		EPass or EFail indicating the success or failure of the test step
*/
TVerdict CTestNormaliseUriStep::doTestStepL()
	{
	__UHEAP_MARK;
	INFO_PRINTF1(_L("\n"));
	// Get necessary information from INI file

	TPtrC uri;
	TPtrC expUri;
	TInt RetCode;
	
	if(!GetStringFromConfig(ConfigSection(), 	KIniUri, uri) ||
	   !GetStringFromConfig(ConfigSection(), KIniExpectedUri, expUri) ||
	   !GetIntFromConfig(ConfigSection(), KRetCode, RetCode) )
		{
		ERR_PRINTF3(_L("Problem in reading values from ini.			\
						\nExpected fields are: \n%S\n%S\n"),&KIniUri, &KIniExpectedUri);
		SetTestStepResult(EFail);
		}
コード例 #30
0
TVerdict CSampleStep1::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Demonstrates reading configuration parameters fom an ini file section
 */
	{
	INFO_PRINTF1(_L("In Test Step"));

  	TDriveName scriptDrive(ScriptDriveName());
  	INFO_PRINTF2(_L("The Drive where script file is executed from is %S"), &scriptDrive);

	TInt theInt;
	TPtrC val;
	_LIT(tem,"NewData");
	val.Set(tem);
	TBool theBool;
	TBuf<40> buf;
	TPtrC theString;
	TInt changeInt(83);
	TInt changeHex(183);
	TBool changeBool(ETrue);
	_LIT(sectName,"Section3");

	GetHexFromConfig(sectName,_L("TheHex"),changeInt);
	GetIntFromConfig(ConfigSection(),_L("TheInt"),theInt);
	GetBoolFromConfig(ConfigSection(),_L("TheBool"),theBool);
	GetStringFromConfig(ConfigSection(),_L("TheString"),theString);
	buf.Copy(theString);

	WriteBoolToConfig(sectName,_L("TheBool"),changeBool);
	WriteIntToConfig(ConfigSection(),_L("TheInt"),changeInt);
	WriteHexToConfig(sectName,_L("TheHex"),changeHex);

	// Demonstrate panic
	if(buf == _L("PanicMe"))
		{
		const TInt KSampleServerPanic = 1;
		User::Panic(_L("SampleServer"),KSampleServerPanic);
		}
		
	SetTestStepResult(EPass);
	return TestStepResult();
	}