Esempio n. 1
0
// -----------------------------------------------------------------------------
// CWPMessage::PrepareEntry
// -----------------------------------------------------------------------------
//
void CWPMessage::PrepareEntryLC( TMsvEntry& aEntry )
    {
    FLOG( _L( "CWPMessage::PrepareEntryLC" ) );
    
    // Current time
    TTime time;

	// Get Universal time
	time.UniversalTime();

	FLOG( _L( "CWPMessage::PrepareEntryLC create an invisible blank entry" ) );	
    // create an invisible blank entry 
    aEntry.iType = KUidMsvMessageEntry;
    aEntry.SetVisible(EFalse);
    aEntry.SetInPreparation(ETrue);
    aEntry.SetReadOnly(EFalse);
    aEntry.SetUnread(ETrue);
    aEntry.iDate = time;
    aEntry.iServiceId = KMsvLocalServiceIndexEntryId;
    aEntry.iError = KErrNone;
    // iMtmData1 is been used/reserved for count, please don't use for any other purpose.
    aEntry.SetMtmData1(3);
    FLOG( _L( "CWPMessage::PrepareEntryLC create an invisible blank entry done" ) );
    // Look up the details
    HBufC* details = NULL;
    if( iMessage->Authenticated() )
        {
        FLOG( _L( "CWPMessage::PrepareEntryLC iMessage->Authenticated() true" ) );
        details = LoadStringLC( R_FROM_SERVICEPROVIDER );
        FLOG( _L( "CWPMessage::PrepareEntryLC LoadString done" ) );
        }
    else
        {
        FLOG( _L( "CWPMessage::PrepareEntryLC iMessage->Authenticated() false" ) );
        if( iSender )
            {
            FLOG( _L( "CWPMessage::PrepareEntryLC iSender true" ) );
            details = HBufC::NewLC( iSender->Length() );
            details->Des().Copy( *iSender );
            }
        else
            {
            FLOG( _L( "CWPMessage::PrepareEntryLC iSender false" ) );
            details = KNullDesC().AllocLC();
            }
        }
    FLOG( _L( "CWPMessage::PrepareEntryLC iDetails.Set" ) );
    aEntry.iDetails.Set( *details );
    FLOG( _L( "CWPMessage::PrepareEntryLC Done" ) );
    }
void CTestSearchSortDeltaCache::TestChangeEntry()
	{
	_LIT(KFunction, "TestChangeEntry");
	INFO_PRINTF1(KFunction);
	TSecureId aOwnerId = 0x999;
	sampleTMsvEntry.iDate.UniversalTime();
	sampleTMsvEntry.SetParent(4096);
	sampleTMsvEntry.iType = KUidMsvMessageEntry;
	sampleTMsvEntry.SetId(10);
	iIndexAdapter->AddEntry(sampleTMsvEntry, aOwnerId, ETrue);

	TInt32 mtm1 = 35;
	TInt32 mtm2 = 45;
	
	sampleTMsvEntry.SetMtmData1(mtm1);
	sampleTMsvEntry.SetMtmData2(mtm2);
	iIndexAdapter->ChangeEntry(sampleTMsvEntry, 0x999, ETrue);
	ASSERT_TRUE(iSearchSortDeltaCache->iUpdateEntry.Count() == 0 );
	}
Esempio n. 3
0
LOCAL_C void doMainL()
	{
	Init();
	testUtils->FileSession().SetSessionPath(_L("c:\\"));

//	smtpService = testUtils->CreateSmtpServiceL();
	
	// Create the POP3 service and set the settings for this test.
	pop3Service = testUtils->CreatePopServiceL();

	CImPop3Settings* settings = new(ELeave) CImPop3Settings();
	CleanupStack::PushL(settings);
	settings->Reset();
	_LIT(KPopServer, "internet-test.plc.psion.com");
	settings->SetServerAddressL(KPopServer);
	settings->SetLoginNameL(testUtils->MachineName());
	settings->SetPasswordL(testUtils->MachineName());
	settings->SetPort(110);
	
 	// Saving POP settings
	CEmailAccounts* accounts = CEmailAccounts::NewLC();
 	TPopAccount popAccount;
 	accounts->GetPopAccountL(pop3Service, popAccount);						
 	accounts->SavePopSettingsL(popAccount, *settings);
	CleanupStack::PopAndDestroy(2, settings); // accounts/store, settings

	// Set the IAP to Demon (even though we're not going to dial up as such.)
	User::LeaveIfError(testUtils->iServerEntry->SetEntry(pop3Service));
	TMsvEntry entry = testUtils->iServerEntry->Entry();
	entry.SetMtmData1(3);
	User::LeaveIfError(testUtils->iServerEntry->ChangeEntry(entry));

	test.Printf(_L("\nPerforming Tests\n"));

	CTestActive* activeObjectTester = new (ELeave) CTestActive;
	CleanupStack::PushL(activeObjectTester);
	
	// Get server MTM.
	testUtils->InstantiatePopServerMtmL();
	CBaseServerMtm* pop3ServerMtm = testUtils->iPopServerMtm;

	// Get the POP3 server MTM to connect.
	log->AppendComment(_L8("Connect to POP3 server"));
	CMsvEntrySelection* serviceId = new (ELeave) CMsvEntrySelection;
	CleanupStack::PushL(serviceId);
	serviceId->AppendL(pop3Service);
	TBuf8<1> parameters;
	activeObjectTester->StartL();
	User::LeaveIfError(testUtils->iServerEntry->SetEntry(pop3Service));

	pop3ServerMtm->StartCommandL(*serviceId, KPOP3MTMConnect, parameters, activeObjectTester->iStatus);
	CActiveScheduler::Start();

	// Get the progress
	TPop3Progress prog;	
	TPckgC<TPop3Progress> paramPack(prog);
	paramPack.Set(pop3ServerMtm->Progress());
	TPop3Progress progress=paramPack();

	// Check that the reported progress is EPopConnecting
	test(progress.iPop3Progress == TPop3Progress::EPopConnecting);

	CleanupStack::PopAndDestroy(); // serviceId

	// Cleanup
	CleanupStack::PopAndDestroy(); // activeObjectTester

	Closedown();
	}