コード例 #1
0
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertClassPropertyL
// Converts CLASS property to a PIM Event item.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertClassPropertyL(
    const CPIMParserProperty& aProperty, CPIMEventItem& aItem)
{
    JELOG2(EPim);
    CParserPropertyValueHBufC* propertyValue =
        static_cast<CParserPropertyValueHBufC*>(aProperty.Value());

    const TPtrC classStringPtr = propertyValue->Value();
    TInt classInt = KErrCorrupt;

    if (classStringPtr.CompareF(KPIMClassStringPublic) == 0)
    {
        classInt = EPIMEventClassPublic;
    }
    else if (classStringPtr.CompareF(KPIMClassStringPrivate) == 0)
    {
        classInt = EPIMEventClassPrivate;
    }
    else if (classStringPtr.CompareF(KPIMClassStringConfidential) == 0)
    {
        classInt = EPIMEventClassConfidential;
    }
    // else the class value in the originating vCalendar is flawed - ignore

    if (classInt != KErrCorrupt)
    {
        aItem.addInt(EPIMEventClass, KPIMAttrNone, classInt);
    }
}
コード例 #2
0
/**
Calls a function in SysUtil.dll which sets up one or more Publish and Subscribe values. 
The function called is determined by the flags passed to sysutilsetup.exe when it is run. 
The valid flags can be found in sysutilsetup.h.
*/
TInt MainL()
	{
	TBuf<16> flags;
	User::CommandLine( flags );
	TLex lex( flags );
	
	for ( TPtrC token = lex.NextToken(); token.Length() != 0; token.Set( lex.NextToken() ) )
		{
		if ( token.CompareF(KSetVersionPropertiesFlag) == 0 )
			{
			__SYSUTIL_TRACE("Calling SetVersionPropertiesL().");
			SetVersionPropertiesL();
			__SYSUTIL_TRACE("Called SetVersionPropertiesL().");
			}
		else if ( token.CompareF(KSetDeviceTypeInfoPropertyFlag) == 0 )
			{
			__SYSUTIL_TRACE("Calling SetDeviceTypeInfoPropertyL().");
			SetDeviceTypeInfoPropertyL();
			__SYSUTIL_TRACE("Called SetDeviceTypeInfoPropertyL().");
			}
		else if ( token.CompareF(KDeletePropertiesFlag) == 0 )
			{
			DeletePSPropertiesL();
			break;
			}
		else
			{
			return KErrArgument;
			}
		}
	
	return KErrNone;
	}
コード例 #3
0
TInt CCmdConnect::ParseCmdArgs( const TDesC& aCommand, TPtrC& aFramework, TPtrC& aConName ) 
	{
	aFramework.Set(NULL, 0);
	aConName.Set(NULL, 0);
	TInt error = KErrNone;

	//	get the command into a local string
	TPtrC param;
	TRAP(error, param.Set(ParamsL(aCommand)));
	if (error != KErrNone)
		return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

	//	check its' valid
	TLex parse(param);
	if (!parse.Eos() && !parse.Peek().IsSpace())
		return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

	//	remove any spaces and see if its got params
	parse.SkipSpace();
	if ( parse.Eos() )	// no params
		return error;
	
	//	Get framework name, must not exceed 16 characters.
	//	should be http or wsp (currently)

	TRAP(error, aFramework.Set(TfrLex::GetL(parse)));
	if ( error != KErrNone) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &aFramework);

	//	check is valid length
	aFramework.Set(TfrLex::Peel(aFramework));
	if ( aFramework.Length() > 16 ) 
		return Error(KErrArgument, THA_KErrParameterLong, &aFramework);

	//	check aFramework type valid (HTTP or WSP)
	//	Param shall be HTTP (True) or WSP (False)
	aFramework.Set( TfrLex::TrimAndPeel(aFramework) );
	TBool value = (aFramework.CompareF(THA_KTxtFrameworkHTTP) == 0);
	
	if ( !value && (aFramework.CompareF(THA_KTxtFrameworkWSP) != 0))
		return Error(KErrArgument, THA_KErrFrameworkErr, &aFramework);

	// Get connection/session name value.

	TRAP(error,aConName.Set(TfrLex::GetL(parse)));
	if ( error != KErrNone) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &aConName);

	// There shall not be anything more.
	TPtrC remainder = TfrLex::Trim(parse.Remainder());
	if ( remainder.Length() > 0 ) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &remainder);

	if (aConName.Length() <= 0)
		return Error(KErrArgument, THA_KErrInvalidConnect, &Keyphrase());

	aConName.Set(TfrLex::Peel(aConName));
	return (KErrNone);
	}
コード例 #4
0
/*
* Load the plugin based on incoming message (XML or WBXML plugin)
*/
void CMessageComposer::LoadPluginL ()
	{
	TPtrC contentType;
	iPushMessage.GetContentType ( contentType );
	iParser = CParser::NewL ( ( contentType.CompareF ( KDRMTextContentType ) ) ?
				KWbxmlParserDataType() : KXmlParserDataType(), *this );		
	}
コード例 #5
0
TMsvId CTestImapSyncManager::FindFolderL(const TDesC& aName, TBool aCaseSensitive)
	{
	TMsvId remoteId = KErrNotFound;
	iEntry->SetEntry(iServiceId);
	CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection;
	iEntry->GetChildren(*msvEntrySelection);
	TPtrC iEntryName = aName;
	TInt count = msvEntrySelection->Count();
	for (TInt i=0; i<count; i++) 
		{	
		iEntry->SetEntry((*msvEntrySelection)[i]);
		
		if (aCaseSensitive)
			{
			if (iEntryName.Compare(iEntry->Entry().iDetails ) == 0)
				{
				remoteId = (*msvEntrySelection)[i];
				break;
				}
			}
		else if ((iEntryName.CompareF(iEntry->Entry().iDetails) == 0))
			{
			remoteId = (*msvEntrySelection)[i];
			break;
			}
		}
		delete msvEntrySelection;
	return remoteId;	
	}
コード例 #6
0
void CTorrentRecognizer::DoRecognizeL(const TDesC &aName, const TDesC8 &/*aBuffer*/)
{
	iConfidence = ECertain;
	TParse parse;
    parse.Set(aName, NULL, NULL);
    TPtrC ext = parse.Ext();
    if (ext.CompareF(KTorrentExtension) == 0)
    {
        iConfidence = ECertain;
        iDataType = TDataType(KTorrentType);
    }
    else
    {
    	iConfidence = ENotRecognized;
    	iDataType = TDataType();
    }

	/*TFileName name=aName;
	name.LowerCase();

	if (name.Right(KTorrentExtension().Length()) == KTorrentExtension)
	{ 		
		iDataType = TDataType(KTorrentType);
		
		return; 
	}*/
}
コード例 #7
0
TUpsDecision CUpsClientStep::StringToTUpsDecision(const TPtrC& aString)
	{
	if(aString.CompareF(_L("Yes"))==0)
		{
		return TUpsDecision(EUpsDecYes);
		}
	else if(aString.CompareF(_L("No"))==0)
		{
		return TUpsDecision(EUpsDecNo);
		}
	else if(aString.CompareF(_L("SessionYes"))==0)
		{
		return TUpsDecision(EUpsDecSessionYes);
		}
	else
		{
		return TUpsDecision(EUpsDecSessionNo);
		}	
	} // End of function.
コード例 #8
0
void CScrGetGlobalIdListStep::ImplTestStepL()
	{
	CGlobalComponentId *globalId = GetGlobalComponentIdLC();
	
	TBool noVerification = EFalse;
	GetBoolFromConfig(ConfigSection(), _L("NoVerification"), noVerification);
	RPointerArray<CVersionedComponentId> expectedVerCompIdList;
	CleanupResetAndDestroyPushL(expectedVerCompIdList);
	if(!noVerification)
		{
		GetExpectedVersionedComponentIdListL(expectedVerCompIdList);
		}
	
	RPointerArray<CVersionedComponentId> retrievedVerCompIdList;
	CleanupResetAndDestroyPushL(retrievedVerCompIdList);
	
	TPtrC globalIdType;
	if (!GetStringFromConfig(ConfigSection(), KGlobalIdType, globalIdType))
		PrintErrorL(_L("Global Id Type was not found!"), KErrNotFound);

	// Start timer just before invocation of SCR API
    StartTimer();
	
	if(!globalIdType.CompareF(_L("Dependant")))
		iScrSession.GetSupplierComponentsL(*globalId, retrievedVerCompIdList);
	else if (!globalIdType.CompareF(_L("Supplier")))
		iScrSession.GetDependantComponentsL(*globalId, retrievedVerCompIdList);
	else {
		 ERR_PRINTF1(_L("The global Id type couldn't be identified."));
		 SetTestStepResult(EFail);
		 }
	
	if (!noVerification && !CompareVersionedComponentIdsL(retrievedVerCompIdList, expectedVerCompIdList))
		{
		ERR_PRINTF1(_L("The retrieved global Ids are different from the expected ones."));
		SetTestStepResult(EFail);
		}

	CleanupStack::PopAndDestroy(3, globalId); // depGlobalId, expectedGlobalIdList, retrievedGlobalIdList
	}
コード例 #9
0
TInt CUpsClientStep::ButtonToInt(const TPtrC& aButton)
	{
	if(aButton.CompareF(_L("Yes"))==0)
		{
		return KYes;
		}
	else if(aButton.CompareF(_L("No"))==0)
		{
		return KNo;
		}
	else if(aButton.CompareF(_L("Always"))==0)
		{
		return KAlways;
		}
	else if(aButton.CompareF(_L("SessionYes"))==0)
		{
		return KSessionYes;
		}
	else if(aButton.CompareF(_L("SessionNo"))==0)
		{
		return KSessionNo;
		}
	else if(aButton.CompareF(_L("Never"))==0)
		{
		return KNever;
		}
	else return KNone;
				
	}  // End of function.
コード例 #10
0
ファイル: t_vshook.cpp プロジェクト: kuailexs/symbiandump-os1
/**
@internalComponent
*/
TInt CTestVirusHook::VsReadFileSection(TFsPluginRequest& aRequest)
	{

	// The t_virus test uses a filename clean.txt, a read length of 8 and a read position of 0.
	TFileName fileName;
	TInt len;
	TInt pos;

	// test getting name on read file section intercept
	TInt err = GetName(&aRequest, fileName);
	if(err != KErrNone)
		{
		return(err);
		}
	TParse parse;
	parse.Set(fileName,NULL,NULL);
	TPtrC name = parse.Name();
	if(name.CompareF(_L("clean"))!=0)
		{
		return(KErrGeneral);
		}
	TPtrC ext = parse.Ext();
	if(ext.CompareF(_L(".txt"))!=0)
		{
		return(KErrGeneral);
		}

	// test getting read length and required file position on read file section intercept
	err = GetFileAccessInfo(&aRequest, len, pos);
	if(err != KErrNone)
		{
		return(err);
		}
	if ((len != 8) || (pos != 0))
		{
		return(KErrGeneral);
		}
	
	return KErrNone;
	}
コード例 #11
0
TInt CRtaServer::CheckPermittedFileName(const TDesC& aFileName)
	{
	_LIT(KContentExtension,".content");
	TInt err = KErrNone;
	if(aFileName.Length() >= KRightsDatabaseFileName().Length())
		{
		TPtrC rightsDb = aFileName.Right(KRightsDatabaseFileName().Length());
		if(rightsDb.CompareF(KRightsDatabaseFileName()) == 0)
			{
			err = KErrPermissionDenied;	
			}
		}
	if(err == KErrNone && aFileName.Length() >= KContentExtension().Length())
		{
		TPtrC ext = aFileName.Right(KContentExtension().Length());
		if(ext.CompareF(KContentExtension()) != 0)
			{
			err = KErrNotSupported;	
			}
		}	
	return err;
	}
コード例 #12
0
TInt CCmdCheckMode::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD( error, param.Set( ParamsL( aCommand )) );
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

TLex parse( param );
if ( !parse.Peek().IsSpace() )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// Param shall On or Off?
param.Set( TfrLex::TrimAndPeel( param ) );
TBool value = (param.CompareF(TFR_KTxtTermOn) == 0);
if ( !value && param.CompareF(TFR_KTxtTermOff) != 0 )
	return Error( KErrArgument, TFR_KFmtErrBadCmd, &Keyphrase() );

// Set Check Mode (ParseOnly) On/Off.
Family()->SetSwitch(CCmdFamily::EParseOnly, value);
return error;
}
コード例 #13
0
TBool CCmdTransaction::checkConnectionExists(TPtrC &aName)
	{
	CObjCatalogue *sessions = Machine()->Domains();
	for (TInt i = 0; i < sessions->Count(); ++i)
		{
		CAnyObject *obj = (CAnyObject *)sessions->At(i);
		if (obj->Tag() == THA_KHTTP_Connect)
			{
			TPtrC sessname = obj->Name();
			if (sessname.CompareF(aName) == 0)
				return ETrue;
			}
		}

	return EFalse;
	}
コード例 #14
0
// ---------------------------------------------------------------------------
// Fixes single quote query issues
// ---------------------------------------------------------------------------
// 
void CMPXHarvesterDatabaseTable::FindAndReplaceSingleQuote(const TDesC& aSrc,
                                                           TDes& aTrg)
    {

    TPtrC ch;

    TInt srcLen = aSrc.Length();
    
    for (TInt i = 0; i < srcLen; ++i)
        {
        ch.Set(&aSrc[i], 1);
        aTrg.Append(ch);
        if ( ch.CompareF(_L("'")) == 0)
            {
            aTrg.Append(ch);
            }
        }
    }
コード例 #15
0
TBool CSyntaxTest::CheckResult(const TDesC &aFilename, const TInt &aError)
	{
	CSyntaxResult *syntaxResult;
	TPtrC filename;

	iConsole.Printf(aFilename);
	iOut.writeString(aFilename);

	for(TInt element = 0; element < iExpectedResults->Count(); element++)
		{
		syntaxResult = (*iExpectedResults)[element];
	
		syntaxResult->GetFilename(filename);
		if(filename.CompareF(aFilename)==0)
			{
			
			if(syntaxResult->Result() != aError)
				{	
				iConsole.Printf(_L(" FAILED. Expecting "));
				iOut.writeString(_L(" FAILED. Expecting "));
				PrintError(syntaxResult->Result());
				iConsole.Printf(_L("  Recieved "));
				iOut.writeString(_L(" Recieved "));
				PrintError(aError);
				iConsole.Printf(_L("\n"));
				iOut.writeNewLine();
				return(EFalse);
				}
			else
				{
				iConsole.Printf(_L(" Success\n"));
				iOut.writeString(_L(" Success "));
				iOut.writeNewLine();
				return(ETrue);
				}
			}
		}

	iConsole.Printf(_L(" FAILED to find expected result\n"));
	iOut.writeString(_L(" FAILED to find expected result"));
	iOut.writeNewLine();
	return(EFalse);
	};
コード例 #16
0
void CHttpTestSingleTrans::OpenTestSessionL()
	{
	iSession.OpenL();
	CleanupClosePushL ( iSession );
	SetProxyL(0); // 0 is the start item to look for it in the param list for the test in the ini file
	SetMaxRedirectsL(0);
	MHTTPAuthenticationCallback::InstallAuthenticationL(iSession);
	iMyStrP = iSession.StringPool();
	TPtrC testName = CHttpTestTransactions::TestName();
	if (testName.CompareF(_L("SSL9"))==0)
		{
		RHTTPConnectionInfo	connInfo = iSession.ConnectionInfo();
		connInfo.SetPropertyL( 
							 iMyStrP.StringF(HTTP::ESecureDialog, RHTTPSession::GetTable() ),
							 iMyStrP.StringF(HTTP::EDialogNoPrompt, RHTTPSession::GetTable() )
							 );
		iEngine->Utils().LogIt(_L("Secure Dialog session property set\n"));
		}
	CreateSingleTransactionL();
	CleanupStack::Pop (&iSession);
	}
コード例 #17
0
ファイル: IACP.CPP プロジェクト: cdaffara/symbiandump-mw2
TBool CIacSettingsParser::IsSmsExtendedIAP()
	{
	TInt count = iParsedFieldArray->Count();
	for(TInt loop = 0; loop < count; loop++)
		{
		TPtrC fieldName = (*iParsedFieldArray)[loop]->FieldName();
		if(fieldName.Length()==4)
			{
			if(fieldName.CompareF(SMS_PROXY_EXCEPTIONS)   == 0 || fieldName.CompareF(SMS_PROXY_PORT_NUMBER)   == 0 ||
				fieldName.CompareF(SMS_PROXY_SERVER_NAME) == 0 || fieldName.CompareF(SMS_LOGIN_CUSTOMISATION) == 0 ||
				fieldName.CompareF(SMS_ENABLE_SW_COMP)       == 0 || fieldName.CompareF(SMS_SECURE_PROXY)        == 0 ||
				fieldName.CompareF(SMS_SECURE_PORT) == 0 )
					{
					return ETrue;
					}
			}
		}
	return EFalse;
	}
コード例 #18
0
TBool CCmdTransaction::checkMethodExists(TPtrC &aName)
	{
	if (aName.CompareF(THA_TxtCmdTransactionGET) == 0) 
		{
		eStrIndex = HTTP::EGET;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionPOST) == 0) 
		{
		eStrIndex = HTTP::EPOST;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionPUT) == 0) 
		{
		eStrIndex = HTTP::EPUT;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionHEAD) == 0) 
		{
		eStrIndex = HTTP::EHEAD;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionDELETE) == 0) 
		{
		eStrIndex = HTTP::EDELETE;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionOPTIONS) == 0) 
		{
		eStrIndex = HTTP::EOPTIONS;
		return ETrue;
		}
	else if (aName.CompareF(THA_TxtCmdTransactionTRACE) == 0) 
		{
		eStrIndex = HTTP::ETRACE;
		return ETrue;
		}

	return EFalse;
	}
コード例 #19
0
TVerdict CUPSDbManagementStep::doTestStepPreambleL()
/**
 * @return - TVerdict code
 * Override of base class virtual
 */
	{
 	__UHEAP_MARK;
 	
 	INFO_PRINTF2(_L("START CELLS: %d"), User::CountAllocCells());
 	
 	// reads client name and SID
	TParse clientFullName;
	RThread client;
	clientFullName.Set(client.FullName(),NULL, NULL);
	iTEFServerName=clientFullName.Name();
	iExpectedClientSid = client.SecureId() ;
	client.Close();
 	
    // Read how many times the test step needs to be repeated.
    TName fStepRepeat(_L("StepRepeat"));
    TInt  repeats;
    
    if(GetIntFromConfig(ConfigSection(),fStepRepeat,repeats))
    	{
    	iStepRepeat=repeats;
    	}
	else
		{	
		iStepRepeat=1;		
		}
    
    // Read values for test sequence from INI file. (ARRAY of values)
	TInt index=0;
	TName fOperation;
	fOperation.Format(_L("Operation_%d"), index);
	TName fClientSid;
	fClientSid.Format(_L("ClientSid_%d"),index);
	TName fEvaluatorId;
	fEvaluatorId.Format(_L("EvaluatorId_%d"),index);
	TName fServiceId;
	fServiceId.Format(_L("ServiceId_%d"),index);
	TName fServerSid;
	fServerSid.Format(_L("ServerSid_%d"),index);
	TName fFingerprint;
	fFingerprint.Format(_L("Fingerprint_%d"),index);
	TName fClientEntity;
	fClientEntity.Format(_L("ClientEntity_%d"),index);
	TName fDescription;
	fDescription.Format(_L("Description_%d"),index);
	TName fDecisionResult;
	fDecisionResult.Format(_L("DecisionResult_%d"),index);
	TName fMajorPolicyVersion;
	fMajorPolicyVersion.Format(_L("MajorPolicyVersion_%d"),index);
	TName fRecordId;
	fRecordId.Format(_L("RecordId_%d"),index);
	TName fEvaluatorInfo;
	fEvaluatorInfo.Format(_L("EvaluatorInfo_%d"),index);
	TName fExpectedDecisionCount;
	fExpectedDecisionCount.Format(_L("ExpectedDecisionCount_%d"),index);
	
	TPtrC 	operation;
	TInt	clientSid;
	TInt	evaluatorId;
	TInt	serviceId;
	TInt	serverSid;
	TPtrC	fingerprint;
	TPtrC	clientEntity;
	TPtrC	description;
	TPtrC	decisionResult;
	TInt	majorPolicyVersion;
	TInt 	recordId;
	TInt	evaluatorInfo;
	TInt 	expectedDecisionCount;
	
	while (GetStringFromConfig(ConfigSection(),fOperation,operation))
		{
		
		// Create an instance of a new request
		CUpsDbRequest* newRequest = CUpsDbRequest::NewL();
		CleanupStack::PushL(newRequest);
		
		// Set the operation to be performed
	    newRequest->iOperation = operation;
	    
	    if(GetHexFromConfig(ConfigSection(),fClientSid,clientSid))
		    {
		    newRequest->iClientSid = clientSid;
		  	newRequest->iDecisionFilter->SetClientSid(TSecureId(clientSid),EEqual);
		    }
	    
		if(GetHexFromConfig(ConfigSection(),fEvaluatorId,evaluatorId))
			{
			newRequest->iEvaluatorId = evaluatorId;	
			newRequest->iDecisionFilter->SetEvaluatorId(TUid::Uid(evaluatorId),EEqual);
			}
		
		if(GetHexFromConfig(ConfigSection(),fServiceId,serviceId))
			{
			newRequest->iServiceId = serviceId;	
			newRequest->iDecisionFilter->SetServiceId(TUid::Uid(serviceId),EEqual);
			}
	
		if(GetHexFromConfig(ConfigSection(),fServerSid,serverSid))
			{
			newRequest->iServerSid = serverSid;	
			newRequest->iDecisionFilter->SetServerSid(TSecureId(serverSid),EEqual);
			}
			
		if(GetStringFromConfig(ConfigSection(),fFingerprint,fingerprint))
			{
			HBufC8* fingerprintConverter = HBufC8::NewLC(fingerprint.Length());
			TPtr8 fingerprintPtr = fingerprintConverter->Des();
			fingerprintPtr.Copy(fingerprint); 	
             
	       	newRequest->iFingerprint = fingerprintPtr;
	       	
	       	HBufC8* binaryFingerprint = StringToBinaryLC(fingerprintPtr);
	       	
	      	newRequest->iDecisionFilter->SetFingerprintL(*binaryFingerprint,EEqual);	
	       	CleanupStack::PopAndDestroy(binaryFingerprint);
	       	CleanupStack::PopAndDestroy(fingerprintConverter); 
			}

		if(GetStringFromConfig(ConfigSection(),fClientEntity,clientEntity))
			{
			HBufC8* clientEntityConverter = HBufC8::NewLC(clientEntity.Length());
			TPtr8 clientEntityPtr = clientEntityConverter->Des();
			clientEntityPtr.Copy(clientEntity); 	
             
	       	newRequest->iClientEntity = clientEntityPtr;
	       	newRequest->iDecisionFilter->SetClientEntityL(clientEntityPtr,EEqual);		
	       	CleanupStack::PopAndDestroy(clientEntityConverter); 
			}
			
		if(GetStringFromConfig(ConfigSection(),fDescription,description))
			{
		    newRequest->iDescription = description;
			}
			
		if(GetStringFromConfig(ConfigSection(),fDecisionResult,decisionResult))
			{
			if(decisionResult.CompareF(_L("Yes"))==0 || decisionResult.CompareF(_L("No"))==0 || decisionResult.CompareF(_L(""))==0 )
				{
				newRequest->iDecisionResult = decisionResult;	
				}
			else 
				{
				ERR_PRINTF3(_L("%S: Unexpected Decision Result - %S"),&iTEFServerName, &decisionResult);
				}
			}

		if(GetIntFromConfig(ConfigSection(),fMajorPolicyVersion,majorPolicyVersion)) 
			{
			newRequest->iMajorPolicyVersion = majorPolicyVersion;
			newRequest->iDecisionFilter->SetMajorPolicyVersion(majorPolicyVersion,EEqual);		
			}
		
		if(GetIntFromConfig(ConfigSection(),fRecordId,recordId))
			{
			newRequest->iRecordId = recordId;
			newRequest->iDecisionFilter->SetRecordId(recordId,EEqual);		
			}
			
		if(GetIntFromConfig(ConfigSection(),fEvaluatorInfo,evaluatorInfo))
			{
			newRequest->iEvaluatorInfo = evaluatorInfo;		
			}
			
		if(GetIntFromConfig(ConfigSection(),fExpectedDecisionCount,expectedDecisionCount))
			{
			newRequest->iExpectedDecisionCount = expectedDecisionCount;		
			}
	    
	    // Add the new service to be requested to array.
	    iArraySersToRequest.AppendL(newRequest);
	    
	    CleanupStack::Pop(newRequest);
	       
	    index++;
	    fOperation.Format(_L("Operation_%d"), index);
	    fClientSid.Format(_L("ClientSid_%d"),index);
		fEvaluatorId.Format(_L("EvaluatorId_%d"),index);
		fServiceId.Format(_L("ServiceId_%d"),index);
		fServerSid.Format(_L("ServerSid_%d"),index);
		fFingerprint.Format(_L("Fingerprint_%d"),index);
		fClientEntity.Format(_L("ClientEntity_%d"),index);
		fDescription.Format(_L("Description_%d"),index);
		fDecisionResult.Format(_L("DecisionResult_%d"),index);
		fMajorPolicyVersion.Format(_L("MajorPolicyVersion_%d"),index);
		fRecordId.Format(_L("RecordId_%d"),index);
		fEvaluatorInfo.Format(_L("EvaluatorInfo_%d"),index);
		fExpectedDecisionCount.Format(_L("ExpectedDecisionCount_%d"),index);
		}
	
	SetTestStepResult(EPass);
	return TestStepResult();
	}
コード例 #20
0
ファイル: IACP.CPP プロジェクト: cdaffara/symbiandump-mw2
//
// append sms data field/value to array,
// set iSmsType to EBasicMail orEBasicIAP
//
void CIacSettingsParser::DoParseL()
	{
	TBuf<256> tempBuf;
	// Set extraction mark at first character
    iSms.SkipSpaceAndMark();
	// might or might not have header?
	if(iSms.Peek() == KCharSlash)
		{
		// Check first line is <header>
		iSms.SkipCharacters();
		if (iSms.MarkedToken() != KSmsHeader)
			{
			User::Leave(KBspInvalidMessage);
			}
       
		tempBuf=iSms.MarkedToken(); //save a copy of header field
		//appending header field to array
		CParsedField* headerField= new (ELeave) CParsedField;
		CleanupStack::PushL(headerField);
		SetDataFieldsL(*headerField, SMS_HEADER,tempBuf,ETrue);
		iParsedFieldArray->AppendL(headerField);
		iSms.Inc();
		CleanupStack::Pop();//headerField (No need to delete the CParsedField object, since it's now owned by the array)
		}

	// might or might not have password?
	// if line does not contain ':' then we consider it as password
	// if line contains ':' then we check the left token for any valid field names,
	// a line with valid field name is not considered as password.
    TBool PwdWithColumn=EFalse;
	iSms.SkipSpaceAndMark();
	while ( iSms.Peek()!= '\n'  && !iSms.Eos())
		iSms.Inc();
	
	TLex lex(iSms.MarkedToken());
	while (lex.Peek() != ':' && lex.Peek() != '\n' && !lex.Eos())
		lex.Inc();
	
	if(lex.Peek() == ':')
		{
		TPtrC LeftToken = lex.MarkedToken(); // extract left token
		if(!IsValidToken(LeftToken))
			PwdWithColumn=ETrue;//we consider it as password containing ':'
		else
			iSms.Inc(-iSms.MarkedToken().Length());	//reset pos. (password is not included in SMS message)
		}


	if(lex.Peek() != ':' || PwdWithColumn )
		{
		if (iSms.TokenLength() >255)
			User::Leave(KErrOverflow); //leave if there is a ridiculously long password even though Nokia Smart Messaging Spec 3 allows password of length 0-infinity
		tempBuf = iSms.MarkedToken(); //save a copy of password field 
		//appending password field to array
		CParsedField* passwordField = new (ELeave) CParsedField();
		CleanupStack::PushL(passwordField);
		SetDataFieldsL(*passwordField, SMS_PASSWORD,tempBuf,ETrue);
		iParsedFieldArray->AppendL(passwordField);
		CleanupStack::Pop();//passwordField
		}

	//start parsing body of message
	while (!iSms.Eos())
		{
		iSms.SkipSpaceAndMark();
		while (iSms.Peek() != '\n'  && !iSms.Eos())
			iSms.Inc();
		
		TLex lex(iSms.MarkedToken());
		// extract Line i.e "LeftToken:RightToken<LF>", then asign to TLex object
		while (lex.Peek() != ':' && lex.Peek() != '\n' && !lex.Eos())
			lex.Inc();
		
		//we are only interested in lines containing a colon delimeter ':'
		// other text lines are ignored i.e "Welcome !<LF>"
		if(lex.Peek() == ':')
			{
			if (lex.TokenLength() > 0 ) // if valid potential token
				{
				TPtrC LeftToken = lex.MarkedToken() ;        // extract left token
				if(IsValidToken(LeftToken))
					{					 
					tempBuf= LeftToken; //save of copy of left token
					// get the right token
					lex.Inc();  // go past the ':'
					
					//Check if we have a case of script message, then deal with it.
					//--start script data parsing...
					TInt TokenLength=0; 
					TInt pos=0;
					TBool FoundScriptData=EFalse;
					
					if(LeftToken.CompareF(SMS_SCRIPT_DATA) ==0)
						{
						TokenLength= SMS_SCRIPT_DATA_LEN;
						
						if(KErrNotFound ==(pos=iSmsBuf->Find(SMS_SCRIPT_DATA)))
							User::Leave(KIacpMandatoryDataNotSet);
						
						FoundScriptData=ETrue;
						}
					else if(LeftToken.CompareF(SMS_SCRIPT_ADD) ==0)
						{
						TokenLength= SMS_SCRIPT_ADD_LEN;
						
						if(KErrNotFound ==(pos=iSmsBuf->Find(SMS_SCRIPT_ADD)))
							User::Leave(KIacpMandatoryDataNotSet);

						FoundScriptData=ETrue;
						}

					//if found script data extract and append the data to the array then exit the while loop
					if(FoundScriptData)
						{
						TPtrC PtrScript= iSmsBuf->Right(iSmsBuf->Length()-(pos+TokenLength+1));//add 1 for ':'

						CParsedField* parsedField = new (ELeave) CParsedField();						
						CleanupStack::PushL(parsedField);
						SetDataFieldsL(*parsedField, tempBuf, PtrScript,isMandatoryData(tempBuf));
						iParsedFieldArray->AppendL(parsedField);
						CleanupStack::Pop();//parsedField
						break;
						}
					//--...end script data parsing

					lex.SkipSpaceAndMark();
					while (lex.Peek() != '\n' && !lex.Eos())
						lex.Inc();
					
					//appending parsedField to array
					CParsedField* parsedField = new (ELeave) CParsedField();
					CleanupStack::PushL(parsedField);
					SetDataFieldsL(*parsedField, tempBuf, lex.MarkedToken(),isMandatoryData(tempBuf));
					iParsedFieldArray->AppendL(parsedField);
					CleanupStack::Pop();//parsedField
					}
				}
			}

		iSms.Inc();
		}
	PopulateFieldCollectionsL();
	}
コード例 #21
0
void CScriptFile::ParseScriptSectionsL(const TDesC& aScript, TInt aInsertIndex)
	{
	iLastSection = NULL;

	CScriptSection* section = NULL;
	CScriptSectionItem* currentItem = NULL;
	TInt currentItemStart = 0;
	CScriptSection* sectionAll = NULL;
	RArray<TInt> sectionIndexArray;
	CleanupClosePushL(sectionIndexArray);
	TInt indexIncrement = 0;		
	HBufC* scriptContents = ReadFileLC(aScript);

	TLex input(*scriptContents);

	while (!input.Eos())
		{
	    input.SkipSpaceAndMark();

		input.SkipCharacters();
		if ( input.TokenLength() == 0 )    // if valid potential token
			{
			break;
			}

		TPtrC token = input.MarkedToken();

		if (token.CompareF(_L("endscript")) == 0)
			{
			break;
			}
		else if (token.FindF(KScriptSectionStart) == 0 && token.Length() > 2)
			{
			ParseAndSetItemValueL(*scriptContents, input, currentItemStart, currentItem);

			TInt mid = 1;
			TInt len = token.Length() - 2;

			if (sectionAll)
				section = CScriptSection::NewLC(token.Mid(mid, len), *sectionAll);
			else
				section = CScriptSection::NewLC(token.Mid(mid, len));

			if (!sectionAll && section->SectionName().CompareF(_L("All")) == 0)
				sectionAll = section;
			
			// We have a Scripts section, store its index as we need to track where
			// it occured so that the scripts can be added in the same location
			// after the current file has parsed
			if (section->SectionName().CompareF(KScriptsSection) == 0)
				{
				if(aInsertIndex==KErrNotFound)
					{
					// Not an embedded script, simple store its index
					TInt currectSectionsCount = iSections->Count();
					sectionIndexArray.Append(currectSectionsCount);
					}
				else
					{
					// An embedded script, calculate the index it should be inserted at
					TInt currectSectionsCount = indexIncrement+aInsertIndex;
					sectionIndexArray.Append(currectSectionsCount);
					}
				}
			
			// Check if the section needs to be inserted at a particular location
			if(aInsertIndex==KErrNotFound)
				iSections->AppendL(section);
			else
				iSections->InsertL(aInsertIndex + indexIncrement++, section);
				
			CleanupStack::Pop(section);
			}
		else if (section)
			{
			TPtrC itemEnd(KScriptItemEnd);

			if (itemEnd.Length() < token.Length() && token.Right(itemEnd.Length()).CompareF(itemEnd) == 0)
				{
				FoundNewItemL(*scriptContents, input, currentItemStart, *section, currentItem);
				}
			}
		}

	ParseAndSetItemValueL(*scriptContents, input, currentItemStart, currentItem);
	CleanupStack::PopAndDestroy(scriptContents);
	
	// We have been tracking where the script sections have been inserted so we
	// want to load the sections from the embedded script file and insert them
	// at the same point. This must be done in reverse order so that the index
	// values of script sections before the current one is maintained.
	TInt scriptSectionsCount = sectionIndexArray.Count();
	for( TInt ii=scriptSectionsCount-1; ii>=0; --ii)
		{
		TInt indexOfScriptSection = sectionIndexArray[ii];
		ParseEmbeddedScriptsL(*(iSections->At(indexOfScriptSection)), indexOfScriptSection);
		}
	CleanupStack::PopAndDestroy(&sectionIndexArray);
	}
コード例 #22
0
/**
 Function : ParentIdForSearchSortL
 Description : Find the parent TMsvId to be considered for search/sort operation
 @return : TMsvId Index entry ID
 */
TMsvId CT_MsgCreatePerfSearchSortQuery::ParentIdForSearchSortL()
	{
	TMsvId parentId = KMsvNullIndexEntryIdValue;
	CMsvEntry* entry = CMsvEntry::NewL(*iSharedDataCommon.iSession,KMsvRootIndexEntryId,TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone, ETrue));
	CleanupStack::PushL(entry);
	TPtrC serviceName;
	TMsvId serviceId;
	GetStringFromConfig(ConfigSection(), KServiceName, serviceName);
	TPtrC folderName;
	GetStringFromConfig(ConfigSection(), KFolderName, folderName);
	TMsvId folderId;
	// if service name is null string consider entry ID of Root entry
	if(serviceName.CompareF(_L("")) == 0)
		{
		parentId = KMsvRootIndexEntryId;
		INFO_PRINTF1(_L("<font color=660099><b>SearchSort would be performed on messages under \"KMsvRootIndexEntryId\" </b></font>"));
		}
 	// service name is not null string and folder name is not null string
	else if(folderName.CompareF(_L("")) != 0)
		{
		TRAPD(error, serviceId = CT_MsgUtils::FindEntryByNameL(entry,serviceName, EFalse));
		if(error)
			{
			ERR_PRINTF2(_L("No such service/account with name: \"%S\" does exist"), &serviceName);
			SetTestStepResult (EFail);
			}
		else
			{
			entry->SetEntryL(serviceId);
			
			if((KMsvNullIndexEntryId != serviceId) && (TUid::Uid(KUidMsvServiceEntryValue) == entry->Entry().iType))
				{
				INFO_PRINTF3(_L("<font color=660099><b>Service ID for \"%S\" = %d</b></font>"), &serviceName, serviceId);
				TRAP(error, folderId = CT_MsgUtils::FindEntryByNameL(entry,folderName, EFalse));
				if(error)
					{
					ERR_PRINTF2(_L("No such folder with name: \"%S\" does exist"), &folderName);
					SetTestStepResult (EFail);
					}
				else
					{
					entry->SetEntryL(folderId);
					if ((KMsvNullIndexEntryId != folderId) && (TUid::Uid(KUidMsvFolderEntryValue) == entry->Entry().iType))
						{
						INFO_PRINTF3(_L("<font color=660099><b>Folder ID for \"%S\" = %d</b></font>"),&folderName, folderId);
						// Specify the folder to be cosidered for search/sort operation.
						parentId = folderId;
						}
					}
				}
			}
		}
	else	// if service entry name is not null and folder name is null search/sort messages under the service entry
		{
		TRAPD(error, serviceId = CT_MsgUtils::FindEntryByNameL(entry,serviceName, EFalse));
		if(error)
			{
			ERR_PRINTF2(_L("No such service/account with name: \"%S\" does exist"), &serviceName);
			SetTestStepResult (EFail);
			}
		else
			{
			parentId = serviceId;
			INFO_PRINTF2(_L("<font color=660099><b>SearchSort would be performed on messages under Service ID \"%d\" </b></font>"), serviceId);
			}
		}
	CleanupStack::PopAndDestroy(entry);
	return parentId;
	}
コード例 #23
0
TVerdict CImportDrmArchive::doTestStepL()
	{
	// SetTestStepResult(EInconclusive) is a bad idea.
	// It makes the TEST macroes unusable.

	TPtrC source;
	TPtrC target;
	TPtrC importerMode;

	GetStringFromConfig(ConfigSection(),_L("source"),source);
	GetStringFromConfig(ConfigSection(),_L("target"),target);

	// importerMode is optional in ini file. If the token exist and its
	// value == ClientCreateFiles, then RTAUtils will hide the output
	// filename from CImportFile and handle opening the output file
	// and receipt files itself.
	GetStringFromConfig(ConfigSection(),_L("importerMode"),importerMode);
	
	_LIT(KClientCreateFiles, "ClientCreateFiles");
	TBool doFileCreate = (importerMode.CompareF(KClientCreateFiles) == 0);

	INFO_PRINTF2(_L("Importing DRM archive : %S "), &source);
	INFO_PRINTF2(_L("Writing output archive: %S "), &target);

	TPtrC outputPath;
	TPtrC suggestedOutFileName;

	TParsePtrC parser(target);
	outputPath.Set( parser.DriveAndPath() );
	suggestedOutFileName.Set( parser.NameAndExt() );

	__UHEAP_MARK;	
	TInt numpushed(0);

	// create a supplier session
	CSupplier *mySupplier = CSupplier::NewLC();
	numpushed++;

	mySupplier->SetOutputDirectoryL(outputPath);

	// fill in a metadata array with just the mime type
	CMetaDataArray *metaDataArray = CMetaDataArray::NewL();
	CleanupStack::PushL(metaDataArray);
	numpushed++;

	_LIT8(KContentType,"content-type");
	metaDataArray->AddL(KContentType(), KRtaMimeRights);
	metaDataArray->AddL(KContentType(), KRtaMimeContentRights);

	CImportFile* import = NULL;
	if (doFileCreate)
		{
		import = mySupplier->ImportFileL(KRtaMimeContentRights, *metaDataArray);
		}
	else
		{
		import = mySupplier->ImportFileL(KRtaMimeContentRights, *metaDataArray, suggestedOutFileName);
		}

	CleanupStack::PopAndDestroy(metaDataArray);  // numpushed--
	CleanupStack::PushL(import);  // numpushed++, so cancel with line above

	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
	numpushed++;
	
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API 
	RFile64 sourcefile;
#else
	RFile sourcefile;
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
	
	User::LeaveIfError(sourcefile.Open(fs, source, EFileRead | EFileStream | EFileShareReadersOnly));
	CleanupClosePushL(sourcefile);
	numpushed++;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API 
	RFile64 targetfile;
#else
	RFile targetfile;
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
	
	TBool targetFileOpen = EFalse;
	TInt err(KErrNone);
	TFileName fn;

	const TInt KMyBufSize = 1024;
	TBuf8 <KMyBufSize> buffer;
	TInt length = KMyBufSize;
	while(length > 0)
		{
		User::LeaveIfError(sourcefile.Read(buffer, buffer.MaxLength()));
		length = buffer.Length();
		err = import->WriteData(buffer);
		
		if(err != KErrNone)
			{
			if(err == KErrCANewFileHandleRequired)
				{
				TESTL(doFileCreate);
				TESTL(!targetFileOpen);

				import->GetSuggestedOutputFileName(fn);
				fn.Insert(0, outputPath);

				INFO_PRINTF3(_L("Agent suggested name is %S, target is %S."), &fn, &target);

				User::LeaveIfError(targetfile.Create(fs, target, EFileStream | EFileWrite | EFileShareAny));
				CleanupClosePushL(targetfile);
				numpushed++;
				targetFileOpen = ETrue;
				User::LeaveIfError(import->ContinueWithNewOutputFile(targetfile, fn));
				}
			else
				{					
				INFO_PRINTF2(_L("Error writing data, Error code is: %d"),err);
				User::LeaveIfError(err);
				}
			}
		}

	if(targetFileOpen)
		{
		CleanupStack::PopAndDestroy(&targetfile);	
		numpushed--;
		}

	// process the rights that were received alongside the content
	err = import->WriteDataComplete();
	while(err == KErrCANewFileHandleRequired)
		{
		TEST(doFileCreate);

		import->GetSuggestedOutputFileName(fn);
		fn.Insert(0, outputPath);
		
		INFO_PRINTF2(_L("Creating Receipt File: %S "), &fn);								
		RFile receiptFile;
		User::LeaveIfError(receiptFile.Replace(fs, fn, EFileStream | EFileWrite | EFileShareAny));
		CleanupClosePushL(receiptFile);
		err = import->ContinueWithNewOutputFile(receiptFile, fn);
		CleanupStack::PopAndDestroy(&receiptFile);	
		}

	User::LeaveIfError(err);

	TPtrC importOutFileName;
	TPtrC contentOutputName(KNullDesC);
	for (TInt i = 0; i < import->OutputFileCountL(); i++)
		{
		importOutFileName.Set( import->OutputFileL(i).FileName() );

		if (import->OutputFileL(i).OutputType() == EContent)
			{
			contentOutputName.Set(importOutFileName);
			}
		else
			{
			// delete the receipt we just created
			// they only get in the way when importing files using the utility
			INFO_PRINTF2(_L("Receipt files %S deleted (not important) when using ImportDrmArchive step"), &importOutFileName);										
			fs.Delete(importOutFileName); // ignore return code
			}
		}

	/**
	 * Added doFileCreate check while fixing DEF132876. On using
	 * importerMode=ClientCreateFiles if target is not set as 
	 * "RTATest001.content" in the ini file, the comparison below
	 * succeeds and "fs.Rename(contentOutputName, target)" fails,
	 * causing test case to fail.
	 * In all other case, contentOutputName and target are always
	 * same and the if condition is not entered.
	 */
	if (!doFileCreate && contentOutputName.CompareF(target) != 0)
		{
		// This must be the case that RTA automatically create
		// output file. See the line targetfile.Create(fs, target, ...).

		// Before DEF088475, users of RTAUtils test harness can
		// specify whatever extension for the output file. The 
		// defect fix changed the importer from CRefTestAgentImport
		// (unit test) to CImportFile (end-to-end test). CImportFile
		// converts non-standard ext to .content. To maintain backward
		// compatibility, we need to rename the generated output.

		fs.Delete(target); // ignore return code
		TEST(fs.Rename(contentOutputName, target) == 0);
		}
	
	CleanupStack::PopAndDestroy(numpushed);

	__UHEAP_MARKEND;
	
	return TestStepResult();
	}
コード例 #24
0
/**
doTestStepL()
Reads the Pop account name and config file name from the ini file
Compares the settings of the Imap account.
  
@return
Returns the test step result
*/
TVerdict CT_MsgComparePopSettings::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step : ComparePopSettings"));
	// Read the POP account name from the ini file
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("PopAccount Name is not specified"));
		SetTestStepResult(EFail);
		}
	else
		{
		// Retrieving the Pop service Id for the given Pop account
		TMsvId popServiceId = KMsvNullIndexEntryId;
		TRAPD(err,popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName));
		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);
		
		TBool matchExpected = ETrue;
		GetBoolFromConfig(ConfigSection(), KMatchExpected, matchExpected);
		
		TVerdict result = EPass;
		TPtrC configFileName;
		
		if(popServiceId == KMsvNullIndexEntryId)
			{
			INFO_PRINTF1(_L("Invalid POP account name is specified"));
			result = EFail;	
			}
		else
			{
			if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
				{
				ERR_PRINTF1(_L("Configuration file path is not specified"));
				SetTestStepResult(EFail);
				}
			else
				{
				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();

				// Creating the first set of settings objects
				CImPop3Settings* popSettings1 = new(ELeave) CImPop3Settings();
				CleanupStack::PushL(popSettings1);
				
				CImIAPPreferences* popIapPrefs1 = CImIAPPreferences::NewLC();
				
				CImSmtpSettings* smtpSettings1 = new(ELeave) CImSmtpSettings();
				CleanupStack::PushL(smtpSettings1);

				CImIAPPreferences* smtpIapPrefs1 = CImIAPPreferences::NewLC();
				
				// Creating the second set of settings objects	
				CImPop3Settings* popSettings2= new(ELeave) CImPop3Settings();
				CleanupStack::PushL(popSettings2);
				
				CImIAPPreferences* popIapPrefs2 = CImIAPPreferences::NewLC();
				
				CImSmtpSettings* smtpSettings2 = new(ELeave) CImSmtpSettings();
				CleanupStack::PushL(smtpSettings2);

				CImIAPPreferences* smtpIapPrefs2 = CImIAPPreferences::NewLC();
					
				emailAccounts->PopulateDefaultPopSettingsL(*popSettings2, *popIapPrefs2);
				emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings2, *smtpIapPrefs2);
					
				TPopAccount popAccount;
				emailAccounts->	GetPopAccountL(popServiceId, popAccount);
					
				TRAPD(error1, LoadAccountSettingsL(*emailAccounts,popAccount,
					*popSettings1,*popIapPrefs1,*smtpSettings1,*smtpIapPrefs1));
				
				if(error1 != KErrNone)
					{
					ERR_PRINTF2(_L("LoadPOPPSettingsL Failed with error code %d"), error1);
					result = EFail;
					SetTestStepResult(EFail);
					}
				else
					{
					if(configFileName.CompareF(_L("none")) != 0)
						{
						TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings2, *popIapPrefs2));
						if(err)
							{	
							ERR_PRINTF2(_L("Failure while setting the Pop setting parameters, failed with error %d"), err);
							SetTestStepResult(EFail);															  
							}
						else
							{
							TRAPD(error, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(configFileName, *smtpSettings2, *smtpIapPrefs2));
							if(error)
								{
								ERR_PRINTF2(_L("Failure while setting the SMTP setting parameters, failed with error %d"), error);
								SetTestStepResult(EFail);															  
								}							
							}							
						}
					if(TestStepResult() == EPass)
						{
						result = CompareSettings(*popSettings1 , *popSettings2 ,
											*smtpSettings1,*smtpSettings2,
											*popIapPrefs1,*popIapPrefs2,
											*smtpIapPrefs1,*smtpIapPrefs2);
						}
					}
				CleanupStack::PopAndDestroy(9,emailAccounts);
					
				}				
			}

		// if the parameters did not match and we expected them to then fail the test
		if(result == EPass && matchExpected)
			{
			INFO_PRINTF1(_L("*********Passed As Expected*******"));
			SetTestStepResult(EPass);
			}
		else if(result == EFail && !matchExpected)
			{
			INFO_PRINTF1(_L("*******Failed as Expected********"));
			SetTestStepResult(EPass); // This is required as some checks where it will fail, at that pt teststep might have been set to fail
			}
		else
			{
			ERR_PRINTF1(_L("Pop settings Comparison Failed"));
			SetTestStepResult(EFail);					
			}
		INFO_PRINTF1(_L("ComparePopSettings completed"));
		}
	return TestStepResult();
	}
コード例 #25
0
ファイル: ws_eng.cpp プロジェクト: cdaffara/symbiandump-os2
void CWebServerEnv::ParseConfigLineL(const RFs& aFs, const TDesC& aLine)
// Function which parse the config file and set the configuration
{

	TLex lex(aLine);
	TPtrC value;
	TParse parse;

	lex.SkipSpaceAndMark();

	// SkipCharacters until we find a '='
	while ((!lex.Eos()) && (lex.Peek() != '='))
		lex.Inc();
	

	TPtrC variable = lex.MarkedToken();
	
	
	if (!lex.Eos())
	{
		//Skip the '=' character.
		lex.Inc();
		lex.SkipSpaceAndMark();
		lex.SkipCharacters();
		value.Set(lex.MarkedToken());
	}
	else
		value.Set(_L(""));

	if (variable.Compare(_L("SERVER_PATH")) == 0)
	{
		User::LeaveIfError(parse.Set(value,NULL,NULL));
		User::LeaveIfError(aFs.Parse(value,parse));
		delete iServerPath;
		iServerPath = value.AllocL();
	
	}
	else if (variable.Compare(_L("CGI_PATH")) == 0)
	{
		User::LeaveIfError(parse.Set(value,NULL,NULL));	
		User::LeaveIfError(aFs.Parse(value,parse));
		delete iCgiPath;
		iCgiPath = value.AllocL();
	}
	else if (variable.Compare(_L("ERROR_PATH")) == 0)
	{
		User::LeaveIfError(parse.Set(value,NULL,NULL));	
		User::LeaveIfError(aFs.Parse(value,parse));
		delete iErrorPath;
		iErrorPath = value.AllocL();
	}
	else if (variable.Compare(_L("BACKUP_PATH")) == 0)
	{
		User::LeaveIfError(parse.Set(value,NULL,NULL));	
		User::LeaveIfError(aFs.Parse(value,parse));
		delete iBackupPath;
		iBackupPath = value.AllocL();
	}
	else if (variable.Compare(_L("DEFAULT_RESOURCE")) == 0)
	{
		delete iDefaultResource;
		iDefaultResource = value.AllocL();
	}
	else if (variable.Compare(_L("PORT")) == 0)
	{
		lex.UnGetToMark();
		User::LeaveIfError(lex.Val(iPort));
	}
	else if (variable.Compare(_L("DELETE_METHOD")) == 0)
	{
		if (value.CompareF(_L("Yes")) == 0)
			iDeleteMethod = TRUE;
		else
			iDeleteMethod = FALSE;
	}
	else if (variable.Compare(_L("PUT_METHOD")) == 0)
	{
		if (value.CompareF(_L("Yes")) == 0)
			iPutMethod = TRUE;
		else
			iPutMethod = FALSE;
	}
	else if (variable.Compare(_L("HTTP_REQ")) == 0)
	{
		if (value.CompareF(_L("Yes")) == 0)
			iHttpReq = TRUE;
		else
			iHttpReq= FALSE;
	}
	else if (variable.Compare(_L("HTTP_RESP")) == 0)
	{
		if (value.CompareF(_L("Yes")) == 0)
			iHttpResp = TRUE;
		else
			iHttpResp= FALSE;
	}
	else if (variable.Compare(_L("MISC_DATA")) == 0)
	{
		if (value.CompareF(_L("Yes")) == 0)
			iMiscData = TRUE;
		else
			iMiscData = FALSE;
	}
	
	else
	{
		User::Leave(KErrCorrupt);
	}

}
コード例 #26
0
ファイル: ENP.CPP プロジェクト: cdaffara/symbiandump-mw2
//
//  ParseMessageL()
//
//  Simple Notification:
//      Looks for number of messages and "From:" field
//      writes numMsg into the parsed field array, sets
//      entry.iDetails to the "From:" 
//  Complicated Notification:
//      does the above and writes everything else into
//      the array....
//
void CEmailNotificationParser::ParseMessageL()
    {
    TBool isSimpleNotification = EFalse; 
    TLex  tokenLex;
    TPtrC fieldName;
    TPtrC fieldValue;

	// reset parsedfield array
	for(TInt i = iParsedFieldArray->Count();--i>=0;)
		(*iParsedFieldArray)[i]->SetFieldValueL(_L(""));

    // Set extraction mark at first character
    iSms.SkipSpaceAndMark();
	if(iSms.Peek() == KCharSlash)
		{
		// Check first line is <header>
		iSms.SkipCharacters();

		if (iSms.MarkedToken() != KEmailHeader)
			{
			User::Leave(KBspInvalidMessage);
			}
		// Get <new-amount> from second line and check for terminating linefeed
		iSms.SkipSpaceAndMark();
		}

    // Val() seeks forward from next char position, looking for valid
    // digits and incrementing next char as it goes.
    if (!(iSms.Val(iMessageCount) == KErrNone  &&  iMessageCount >= 0))     // If marked token is not a valid positive integer
        {
        iMessageCount = 0;
        User::Leave(KBspInvalidMessage);
        }
    else
        {
        fieldValue.Set(iSms.MarkedToken());                            //  The message count..
        AddParsedFieldL(KHeaderNumberMessages, fieldValue, ETrue);
        }

    // Next character may now be at newline or space after integer.
    // If at space, advance to newline.
    while (iSms.Peek() != KCharLineFeed && !iSms.Eos())
        iSms.Inc();

    iSms.SkipSpaceAndMark();

    // Now parse the rest of the fields, if any.
    while (!iSms.Eos())
        {
        while (iSms.Peek() != KCharLineFeed  &&  !iSms.Eos())
            iSms.Inc();     //  Skip to next delimiter

        if (iSms.Eos())
            break;          //  we've finished break out of the function

        if (iSms.TokenLength() == 0)
            User::Leave(KBspSmartMessageInvalidToken);

        //  Parsing....
        tokenLex.Assign(iSms.MarkedToken());        // Assign token to a new TLex
        while (tokenLex.Peek() != KCharColon  &&  !tokenLex.Eos())
            tokenLex.Inc();     //  Advance to a ':'

        if (tokenLex.Eos()  ||  tokenLex.TokenLength() == 0)
            User::Leave(KBspSmartMessageInvalidToken);


        fieldName.Set(tokenLex.MarkedToken());      // Store (pointer to) field name
        tokenLex.Inc();

		//fix for DEF017686
		LeaveIfEmptyFieldsL(fieldName,tokenLex);
		
        
        tokenLex.SkipSpaceAndMark();                // Step past optional spaces

		//fix for DEF017686
        LeaveIfEmptyFieldsL(fieldName,tokenLex);
	
		// if it's the server id field try to extract the id value
		// and match to an existing email service
		if(fieldName.CompareF(KHeaderServerId)==KErrNone)
			{
			TInt valErr = tokenLex.Val(iServerId);
			if(valErr != KErrNone)
				iServerId = 0;
			else
				GetEmailServicesL();

			tokenLex.UnGetToMark();
			}	
		fieldValue.Set(tokenLex.Remainder());       // Store (pointer to) field value

        if(!isSimpleNotification)
            {
            AddParsedFieldL(fieldName, fieldValue, EFalse);
            }		

        // Successfully parsed a token. Move iSms's next character past the
        // (linefeed) delimiter, set the extraction mark and reiterate to
        // look for next token.
        iSms.SkipSpaceAndMark();
        }
    }
コード例 #27
0
TVerdict CEntryStatusStep::doTestStepPreambleL()
	{
	InitializeL();
	SetTestStepResult(EPass);

	_LIT(KRequestChangeNotify, "requestchangenotify");
	_LIT(KCertEntryState, "state");
	_LIT(KNewEntryString, "ENewEntry");
	_LIT(KEntryAwaitingApprovalString, "EEntryAwaitingApproval");
	_LIT(KEntryDeniedString, "EEntryDenied");
	_LIT(KEntryApprovedString, "EEntryApproved");
	_LIT(KCancelPoint, "cancelpoint");
	_LIT(KOpen, "Open");	
	_LIT(KGetState, "GetStateL");
	_LIT(KChangeNotify, "ChangeNotify");

	TPtrC cancelPoint;
	if (!GetStringFromConfig(ConfigSection(), KCancelPoint, cancelPoint))
		{
		iCancelPoint = ENoCancel;
		}
	else if (cancelPoint.CompareF(KOpen) == 0)
		{
		iCancelPoint = EAfterOpen;
		INFO_PRINTF2(_L("This test step will call Cancel() on the cert cache session after %S()"),&KOpen);
		}
	else if (cancelPoint.CompareF(KGetState) == 0)
		{
		iCancelPoint = EAfterGetState;
		INFO_PRINTF2(_L("This test step will call Cancel() on the cert cache session after %S()"),&KGetState);
		}
	else if (cancelPoint.CompareF(KChangeNotify) == 0)
		{
		iCancelPoint = EAfterChangeNotify;
		INFO_PRINTF2(_L("This test step will call Cancel() on the cert cache session after %S()"),&KChangeNotify);
		}
	
	// Check if this step should wait for change notification.
	if (!GetBoolFromConfig(ConfigSection(), KRequestChangeNotify, iRequestChangeNotify))
		{
		iRequestChangeNotify = EFalse;
		}
	else if (iRequestChangeNotify)
		{
		if (iCancelPoint == ENoCancel)
			{
			INFO_PRINTF1(_L("This test step will wait for change notification."));
			}
		else if (iCancelPoint != EAfterChangeNotify)
			{
			INFO_PRINTF1(_L("Invalid test config, requesting notification but cancelling earlier."));
			SetTestStepResult(EAbort);
			return EAbort;
			}

		_LIT(KRequirePendingApproval, "requirependingapproval");
		if (!GetBoolFromConfig(ConfigSection(), KRequirePendingApproval, iRequirePendingApproval))
			{
			iRequirePendingApproval = ETrue;
			}
		if (iRequirePendingApproval)
			{
			INFO_PRINTF1(_L("This step will fail if the state is not initially EEntryAwaitingApproval."));
			}
		else
			{
			INFO_PRINTF1(_L("Notification will be requested even if the state is not initially EEntryAwaitingApproval."));
			}
		}

	TPtrC expectedState;

	if (!GetStringFromConfig(ConfigSection(), KCertEntryState, expectedState))
		{
		INFO_PRINTF1(_L("Could not read expected certificate approval state from INI, abort."));
		SetTestStepResult(EAbort);
		}
	else
		{
		if (expectedState.CompareF(KNewEntryString) == 0)
			{
			iExpectedState = ENewEntry;
			INFO_PRINTF2(_L("Certificate state is expected to be %S."),&KNewEntryString);
		 	}
		else if (expectedState.CompareF(KEntryAwaitingApprovalString) == 0)
			{
			iExpectedState = EEntryAwaitingApproval;
			INFO_PRINTF2(_L("Certificate state is expected to be %S."),&KEntryAwaitingApprovalString);
			}
		else if (expectedState.CompareF(KEntryApprovedString) == 0)
			{
			iExpectedState = EEntryApproved;
			INFO_PRINTF2(_L("Certificate state is expected to be %S."),&KEntryApprovedString);
			}
		else if (expectedState.CompareF(KEntryDeniedString) == 0)
			{
			iExpectedState = EEntryDenied;
			INFO_PRINTF2(_L("Certificate state is expected to be %S."),&KEntryDeniedString);
			}
		else
			{
			INFO_PRINTF1(_L("Invalid expected certificate state, abort."));
			SetTestStepResult(EAbort);
			}
		}
	return TestStepResult();
	}
コード例 #28
0
void CExtensionTest::ConstructL(const TTestActionSpec& aTestActionSpec)
	{
	CTestAction::ConstructL(aTestActionSpec);
	TInt startPos = 0;
	TInt err = 0;
	
	HBufC* aBody = HBufC::NewLC(aTestActionSpec.iActionBody.Length());	
	aBody->Des().Copy(aTestActionSpec.iActionBody);
	
	// Filename of the certificate file
	TPtrC fileNameStart = Input::ParseElement(*aBody, KFileNameStart);
	iCertFileName.Copy(fileNameStart);

	// Whether we expect at least on of the extensions to be corrupt
	TPtrC corruptStart = Input::ParseElement(*aBody, KCorrupt);	
	if (corruptStart.CompareF(_L("True")) == 0)
		{
		iExpectedCorrupt = ETrue;
		}				
		
	// We expect the certificate to match the constraints
	TPtrC matchStart = Input::ParseElement(*aBody, KMatch);	
	if (matchStart.CompareF(_L("True")) == 0)
		{
		iExpectedMatch = ETrue;
		}						

	// Extract the lists of constraints that are expected to be present 		
	startPos = 0;
	TPtrC deviceListStart = Input::ParseElement(*aBody, KExpectedDeviceIdList, startPos, err);
	if (err >= 0)
		{
		BuildStringListL(iExpectedDeviceIdList, deviceListStart, KExpectedDevice);
		iDeviceIdsPresent = ETrue;		
		}

	startPos = 0;
	TPtrC sidListStart = Input::ParseElement(*aBody, KExpectedSidList, startPos, err);
	if (err >= 0)
		{
		BuildIntList(iExpectedSidList, sidListStart, KExpectedSid);
		iSidsPresent = ETrue;
		}	

	startPos = 0;
	TPtrC vidListStart = Input::ParseElement(*aBody, KExpectedVidList, startPos, err);
	if (err >= 0)
		{
		BuildIntList(iExpectedVidList, vidListStart, KExpectedVid);
		iVidsPresent = ETrue;
		}	
		
	startPos = 0;
	TPtrC capabilities = Input::ParseElement(*aBody, KExpectedCapabilities, startPos, err);
	if (err >= 0)
		{
		BuildCapabilitySet(iExpectedCapabilities, capabilities);
		iCapabilitiesPresent = ETrue;
		}	
	
	CleanupStack::PopAndDestroy(aBody);
	}	
コード例 #29
0
void CMtfTestActionUtilsSmsScripts::ReadSmsSettingsFromConfigurationFileL(CMtfTestCase& aTestCase, const TDesC& aSettingsFile, CSmsSettings& aSmsSettings)
	{
	CMtfTestActionUtilsConfigFileParser* scriptFileParser = CMtfTestActionUtilsConfigFileParser::NewL(aSettingsFile);
	CleanupStack::PushL(scriptFileParser);

	TPtrC stringPtr;
	TInt intValue;

	// Service Centre
	if(scriptFileParser->GetFieldAsString(KScriptItemSC, stringPtr) == KErrNone)
		{
		// get the addresses from the config file
		TLex detailsToParse(stringPtr);
		TPtrC scName;
		TPtrC scNumber;
		
		detailsToParse.SkipSpaceAndMark();
		while(!detailsToParse.Eos())
			{
			scName.Set(_L("Unknown")); // default SC name
			
			while(detailsToParse.Peek() != ';' && !detailsToParse.Eos()) // SCs' details separated by semi-colon
				{
				if(detailsToParse.Peek() == ',')  // name and number separated by comma
					{ // has a name specified
					scName.Set(detailsToParse.MarkedToken());
					detailsToParse.Inc();
					detailsToParse.SkipSpaceAndMark();
					}
				else
					detailsToParse.Inc();
				}
			
			scNumber.Set(detailsToParse.MarkedToken());
			
			// add the address to the SCs list
		
			aSmsSettings.AddServiceCenterL(scName, scNumber);
		
		
			detailsToParse.Inc();
			detailsToParse.SkipSpaceAndMark();
			}
		}
	
	// Default Service Centre
	if(scriptFileParser->GetFieldAsInteger(KScriptItemDefaultSC, intValue) == KErrNone)
		{
	
		aSmsSettings.SetDefaultServiceCenter(intValue);
	
		}
		
	// Bearer
	if(scriptFileParser->GetFieldAsString(KScriptItemBearer, stringPtr) == KErrNone)
		{
		CSmsSettings::TMobileSmsBearer smsBearer = ObtainValueParameterL<CSmsSettings::TMobileSmsBearer>(aTestCase, stringPtr);
		aSmsSettings.SetSmsBearer(smsBearer);
		}

	// Encoding
	if(scriptFileParser->GetFieldAsString(KScriptItemEncoding, stringPtr) == KErrNone)
		{
		TSmsDataCodingScheme::TSmsAlphabet characterSet = ObtainValueParameterL<TSmsDataCodingScheme::TSmsAlphabet>(aTestCase, stringPtr);
		aSmsSettings.SetCharacterSet(characterSet);
		}
		
	// Delivery Report
	if(scriptFileParser->GetFieldAsString(KScriptItemDeliveryReport, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetDeliveryReport(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetDeliveryReport(ETrue);
			}
		}
		
	// Reply quoted
	if(scriptFileParser->GetFieldAsString(KScriptItemReplyQuoted, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetReplyQuoted(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetReplyQuoted(ETrue);
			}
		}
	
	// Description length
	if(scriptFileParser->GetFieldAsInteger(KScriptItemDescriptionLength, intValue) == KErrNone)
		{
		aSmsSettings.SetDescriptionLength(intValue);
		}
		
		
	// Can Concatenate
	if(scriptFileParser->GetFieldAsString(KScriptItemCanConcatenate, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetCanConcatenate(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetCanConcatenate(ETrue);
			}
		}
	
	// Reply path
	if(scriptFileParser->GetFieldAsString(KScriptItemReplyPath, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetReplyPath(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetReplyPath(ETrue);
			}
		}
		
	// Reject duplicate
	if(scriptFileParser->GetFieldAsString(KScriptItemRejectDuplicate, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetRejectDuplicate(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetRejectDuplicate(ETrue);
			}
		}
		
	// Validity period, value is read in minutes
	if(scriptFileParser->GetFieldAsInteger(KScriptItemValidityPeriod, intValue) == KErrNone)
		{
		aSmsSettings.SetValidityPeriod(TTimeIntervalMinutes(intValue));
		}
		
	// Delivery
	if(scriptFileParser->GetFieldAsString(KScriptItemDelivery, stringPtr) == KErrNone)
		{
		TSmsDelivery delivery = ObtainValueParameterL<TSmsDelivery>(aTestCase, stringPtr);
		aSmsSettings.SetDelivery(delivery);
		}
	
	// Status Report Handling
	if(scriptFileParser->GetFieldAsString(KScriptItemStatusReportHandling, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsReportHandling statusReportHandling = ObtainValueParameterL<CSmsSettings::TSmsReportHandling>(aTestCase, stringPtr);
		aSmsSettings.SetStatusReportHandling(statusReportHandling);
		}

	// Special Message Handling
	if(scriptFileParser->GetFieldAsString(KScriptItemSpecialMessageHandling, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsReportHandling specialMessageHandling = ObtainValueParameterL<CSmsSettings::TSmsReportHandling>(aTestCase, stringPtr);
		aSmsSettings.SetSpecialMessageHandling(specialMessageHandling);
		}

	// Commdb action
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsCommdbAction, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsSettingsCommDbAction commdbAction = ObtainValueParameterL<CSmsSettings::TSmsSettingsCommDbAction>(aTestCase, stringPtr);
		aSmsSettings.SetCommDbAction(commdbAction);
		}
		
	// Sms Bearer Action
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsBearerAction, stringPtr) == KErrNone)
		{
		CSmsSettings::TSmsSettingsCommDbAction smsBearerAction = ObtainValueParameterL<CSmsSettings::TSmsSettingsCommDbAction>(aTestCase, stringPtr);
		aSmsSettings.SetSmsBearerAction(smsBearerAction);
		}

	// Message Conversion
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsMessageConversion, stringPtr) == KErrNone)
		{
		TSmsPIDConversion messageConversion = ObtainValueParameterL<TSmsPIDConversion>(aTestCase, stringPtr);
		aSmsSettings.SetMessageConversion(messageConversion);
		}
	
	// Vailidity Period Format
	if(scriptFileParser->GetFieldAsString(KScriptItemSmsValidityPeriodFormat, stringPtr) == KErrNone)
		{
		TSmsFirstOctet::TSmsValidityPeriodFormat valPeriodFormat = ObtainValueParameterL<TSmsFirstOctet::TSmsValidityPeriodFormat>(aTestCase, stringPtr);
		aSmsSettings.SetValidityPeriodFormat(valPeriodFormat);
		}
	
	// Class2 Folder
	if(scriptFileParser->GetFieldAsString(KScriptItemClass2Folder, stringPtr) == KErrNone)
		{
		// Try to find a folder with that name
		MDummySessionObserver obser;
		CMsvSession* session = CMsvSession::OpenSyncL(obser);
		CleanupStack::PushL(session);
		
		CMsvEntry* entry = CMsvEntry::NewL(*session, KMsvLocalServiceIndexEntryId, TMsvSelectionOrdering(KMsvGroupByStandardFolders||KMsvGroupByType,EMsvSortByNone));
		CleanupStack::PushL(entry);
		entry->SetEntryL(KMsvLocalServiceIndexEntryId); // Search only the local folders

		TMsvSelectionOrdering order;
		order.SetShowInvisibleEntries(ETrue);
		entry->SetSortTypeL(order);

		CMsvEntrySelection* selection = entry->ChildrenL();
		CleanupStack::PushL(selection);

		TBool found = EFalse;
		TInt count = selection->Count();
		for (TInt i=0; i<count; i++) 
			{	
			entry->SetEntryL((*selection)[i]);
			if ((stringPtr.CompareF(entry->Entry().iDescription) == 0) ||
			    (stringPtr.CompareF(entry->Entry().iDetails) == 0))
				{
				found = ETrue;
				break;
				}
			}

		TMsvId entryId = KMsvGlobalInBoxIndexEntryId;
		if (found)
			entryId = entry->Entry().Id();
		else
			User::Leave(KErrNotFound);

		aSmsSettings.SetClass2Folder(entryId); 
		
		CleanupStack::PopAndDestroy(3, session); // selection, entry, session
		}

	//Last Segment Delivery Report
	if(scriptFileParser->GetFieldAsString(KLastSegmentDeliveryReport, stringPtr) == KErrNone)
		{
		if (stringPtr.CompareF(_L("NO")) == 0)
			{
			aSmsSettings.SetLastSegmentDeliveryReport(EFalse);
			}
		else if (stringPtr.CompareF(_L("YES")) == 0)
			{
			aSmsSettings.SetLastSegmentDeliveryReport(ETrue);
			}
		}
	
	CleanupStack::PopAndDestroy(scriptFileParser);
	}
コード例 #30
0
TVerdict CUpsDbStepUnitTest::doTestStepPreambleL()
/**
	This function is called at the beginning of the test step. First reads the operation type
	and converts it to a proper enumaration value (TUpsDbUnitTest). Then gets the specified 
	database location. The test fails if the database location can not be found, except
	the unit tests of the decision record and filter objects.
 */
	{
	iScheduler = new(ELeave) CActiveScheduler;
	CActiveScheduler::Install(iScheduler);
	iWaiter = new(ELeave)CActiveWaiter(Logger());
	
	iLog = EFalse;
	
	TPtrC opType;

	if(EFalse == GetStringFromConfig(ConfigSection(),KOpType,opType))
		{
		ERR_PRINTF2(_L("Failed to read '%S' key of configuration"),&KOpType);
		SetTestStepResult(EFail);
		}
	
	if(!opType.CompareF(KInsertRecord))
		{
		iOpType = EInsertRecord;
		}
	else if(!opType.CompareF(KDeleteRecord))
		{
		iOpType = EDeleteRecord;
		}
	else if(!opType.CompareF(KSingleLookup))
		{
		iOpType = ESingleLookup;
		}
	else if(!opType.CompareF(KMultipleLookup))
		{
		iOpType = EMultipleLookup;
		}
	else if(!opType.CompareF(KVerifyRecord))
		{
		iOpType = EVerifyRecord;
		}
	else if(!opType.CompareF(KCreateDatabase))
		{
		iOpType = ECreateDatabase;
		}
	else if(!opType.CompareF(KDeleteDatabase))
		{
		iOpType = EDeleteDatabase;
		}
	else if(!opType.CompareF(KCreateFilterSingleCall))
		{
		iOpType = ECreateFilterSingleCall;
		}
	else if(!opType.CompareF(KCreateFilterMultipleCalls))
		{
		iOpType = ECreateFilterMultipleCalls;
		}
	else if(!opType.CompareF(KCreateDecision))
		{
		iOpType = ECreateDecision;
		}
	else if(!opType.CompareF(KFillTable))
		{
		iOpType = EFillTable;
		}
	else if(!opType.CompareF(KAllFingerprints))
		{
		iOpType = EAllFingerprints;
		}
	else if(!opType.CompareF(KCompactDatabase))
		{
		iOpType = ECompact;
		}
	else if(!opType.CompareF(KUpdateRecord))
		{
		iOpType = EUpdate;
		}
	else
		{
		iOpType = ENotSupported;
		}
	
	if(EFalse == GetStringFromConfig(ConfigSection(),KDbLocation,iDbLocation))
		{
		if((iOpType != ECreateFilterSingleCall) && (iOpType != ECreateDecision) && 
		   (iOpType != ECreateFilterMultipleCalls) && (iOpType != ENotSupported))
			{
			ERR_PRINTF2(_L("Failed to read '%S' key of configuration"),&KDbLocation);
			SetTestStepResult(EFail);
			User::Leave(KErrNotFound);
			}
		}
	
	GetBoolFromConfig(ConfigSection(), KOOMCondition,iOOMCondition);
	
	User::LeaveIfError(iFs.Connect());
	User::LeaveIfError(iFs.CreatePrivatePath(EDriveC));			
	return TestStepResult();
	}