Ejemplo n.º 1
0
LOCAL_C void OverwriteSmtpSettingsL(TBool aRequestReceipt)
	{
	testUtils->iMsvEntry->SetEntryL(smtpService);
	//overwrite the setings with test code one.  Don't want the default settings.
	CEmailAccounts* accounts = CEmailAccounts::NewLC();

	CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
	CleanupStack::PushL(settings);
	settings->Reset();
	_LIT(KSmtpServer, "msg6"); 
	// globel address for msg6 is fe80::2c0:4fff:fe84:61f7
	// link local address fe80::1111:1111:dead:beef
	settings->SetServerAddressL(KSmtpServer);
	settings->SetEmailAliasL(_L("SMTP_IPV6 Test"));
	_LIT(KSmtpEmailAddress, "<kashifn@msg4>");
	settings->SetEmailAddressL(KSmtpEmailAddress);
	settings->SetReplyToAddressL(KSmtpEmailAddress);
	settings->SetBodyEncoding(EMsgOutboxMIME);
	settings->SetReceiptAddressL(KSmtpEmailAddress);
	settings->SetRequestReceipts(aRequestReceipt);
	settings->SetPort(25);
	
	TSmtpAccount smtpAccountId;
	accounts->GetSmtpAccountL(smtpService, smtpAccountId);
	accounts->SaveSmtpSettingsL(smtpAccountId, *settings);
	CleanupStack::PopAndDestroy(2); //settings, store/account

	CTestTimer* timer = CTestTimer::NewL();
	timer->After(5000000);
	CActiveScheduler::Start();
	delete timer;
	}
Ejemplo n.º 2
0
LOCAL_C void TestWaitL()
	{
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(0x00B00000); // has to be longer than KMsvDelayTime
	CActiveScheduler::Start();
	delete timer;
	}
Ejemplo n.º 3
0
EXPORT_C void CMsvTestUtils::GoServerSideL()
	{
	Reset();
	
	_LIT(KMsvServerPattern, "!MsvServer*");
	TFindProcess findprocess(KMsvServerPattern);
	TFullName name;

	// wait for the server to close before trying to start
	// one within this process.
	for(;;)
		{	
		TFindServer find(KMsvServerPattern);
		if (find.Next(name) != KErrNone)
			break;
		User::After(100000);
		}

	iMsvServer = CMsvServer::NewL();
	
	// wait a couple of seconds
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(5000000);
	CActiveScheduler::Start();
	delete timer;

	iServerEntry = CMsvServerEntry::NewL(*iMsvServer, KMsvRootIndexEntryId);
	iClientServer = EServerSide;
	}
CGlxMediaListsTestCollectionPlugin::CTestTimer* CGlxMediaListsTestCollectionPlugin::CTestTimer::NewL(CMPXCollectionPlugin* aPlugin)
	{
	CTestTimer* self = new (ELeave) CTestTimer(aPlugin);
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(self);
	return self;
	}
Ejemplo n.º 5
0
EXPORT_C CTestTimer* CTestTimer::NewL()
	{
	CTestTimer* self = new(ELeave) CTestTimer();
	CleanupStack::PushL(self);
	self->ConstructL(); // CTimer
	CActiveScheduler::Add(self);
	CleanupStack::Pop();
	return self;
	}
Ejemplo n.º 6
0
LOCAL_C void TestInstallL(TInt aDrive)
	{
	// Clear the BIF folders
	theUtils->ClearBifFoldersL();

	// Create BIF database
	CBIODatabase* db = CBIODatabase::NewLC(theUtils->FileSession());

	// Create observer
	CBifObserver* obs = new(ELeave)CBifObserver;
	CleanupStack::PushL(obs);

	CBifChangeObserver* change = CBifChangeObserver::NewL(*obs, theUtils->FileSession());
	CleanupStack::PushL(change);
	change->Start();

	// Check the test BIO isn't installed
	test(!theUtils->BifInstalledL(*db, KTestBif));
	test(!obs->iFlag);

	// Short delay to check that the observer isn't fired
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(10000000);
	CActiveScheduler::Start();
	delete timer;

	// Check the test BIO still isn't installed
	test(!theUtils->BifInstalledL(*db, KTestBif));
	test(!obs->iFlag);

	// Get the name of the drive
	TDriveUnit unit(aDrive);
	TPtrC drive(unit.Name());

	TParse src;
	TParse dst;

	// Copy the bif file
	theUtils->FindFileL(src, KTestDir, KTestBif1Src);
	User::LeaveIfError(dst.Set(drive, &KBifDir, &KTestBifDst));
	theUtils->FileSession().MkDirAll(dst.FullName());
	User::LeaveIfError(BaflUtils::CopyFile(theUtils->FileSession(), src.FullName(), dst.FullName()));

	// Copy the Mbm file
	theUtils->FindFileL(src, KTestDir, KTestMbm1Src);
	User::LeaveIfError(dst.Set(drive, &KBifDir, &KTestMbmDst));
	theUtils->FileSession().MkDirAll(dst.FullName());
	User::LeaveIfError(BaflUtils::CopyFile(theUtils->FileSession(), src.FullName(), dst.FullName()));

	// Wait for the notification to come through
	CActiveScheduler::Start();
	test(obs->iFlag);
	test(obs->iBioUid == KTestBif);
	test(obs->iEvent == MBifChangeObserver::EBifAdded);

	CleanupStack::PopAndDestroy(3); // change, obs, db
	}
Ejemplo n.º 7
0
CTestGCEHarness::CTestTimer*
CTestGCEHarness::CTestTimer::NewL(CTestGCEHarness& aContainer, TInt aBufferId, TRendererEvent aEvent)
	{
	CTestTimer* self = new(ELeave)CTestTimer(aContainer, aBufferId, aEvent);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop();
 	return self;
 	}
Ejemplo n.º 8
0
LOCAL_C void TestAccessViolationL()
	{
	// Make sure the server is closed
	CMsgsTestUtils::WaitForServerClose();

	CMsvServer* server = CMsvServer::NewL();
	CleanupStack::PushL(server);

	// Wait a bit
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(15000000);
	CActiveScheduler::Start();
	delete timer;

	CleanupStack::PopAndDestroy(); // server
	}
Ejemplo n.º 9
0
LOCAL_C void doMainL()
	{
	CActiveScheduler* scheduler;
	scheduler = new (ELeave) CActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	// Load the serial comms device drivers.  If this is not done,
	// connecting via NT-RAS returns KErrNotFound (-1).
	TInt driverErr;
	driverErr=User::LoadPhysicalDevice(PDD_NAME);
	if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists)
		User::Leave(driverErr);
	driverErr=User::LoadLogicalDevice(LDD_NAME);
	if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists)
		User::Leave(driverErr);


	CEmailTestUtils* testUtils = CEmailTestUtils::NewLC(test);

	testUtils->FileSession().Delete(POPS_SCRIPT_FILE_NAME);
	
	CPopsTestHarness* popsTestHarness = CPopsTestHarness::NewLC(*testUtils);

//	popsTestHarness->SetUpPopServiceL();

	testUtils->FileSession().Delete(_L("c:\\logs\\email\\imsk110.scr"));

// RUN THE TESTS 

	popsTestHarness->ResetL();
	popsTestHarness->StartTestL(1, *(popsTestHarness->iConnectAndPopulateAll));
	popsTestHarness->EndTestL();

	// Wait a bit
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(10000000);
	CActiveScheduler::Start();
	delete timer;


	popsTestHarness->EndTestHarnessL();
	CSecureSocketLibraryLoader::Unload();

	CleanupStack::PopAndDestroy(3); // popsTestHarness, testUtils, scheduler
	}
Ejemplo n.º 10
0
LOCAL_C void doMainL()
	{
	InitL();

	test.Printf(_L("\nPerforming Tests\n"));
	testUtils->iMsvEntry->SetEntryL(smtpService);

	CTestTimer* timer = CTestTimer::NewL();
	timer->After(5000000);
	CActiveScheduler::Start();
	delete timer;

	// store service as default service
	CEmailAccounts* accounts = CEmailAccounts::NewLC();
	TSmtpAccount smtpAccountId;
	accounts->GetSmtpAccountL(smtpService, smtpAccountId);
	accounts->SetDefaultSmtpAccountL(smtpAccountId);
	CleanupStack::PopAndDestroy(accounts);

	OverwriteSmtpSettingsL(EFalse);
	CreateMessageL();

	// Create a message that will request a receipt
	OverwriteSmtpSettingsL(ETrue);
	CreateMessageL();

	testUtils->InstantiateSmtpClientMtmL();

	timer = CTestTimer::NewL();
	timer->After(5000000);
	CActiveScheduler::Start();
	delete timer;

	testUtils->TestStart(testNo++);
	TestSendingMessagesL();
	testUtils->TestFinish(testNo-1);

	testUtils->TestStart(testNo++);
	TestCapabilityL();
	testUtils->TestFinish(testNo-1);

	testUtils->TestHarnessCompleted();
	Closedown();
	}
void CTestImapMailStorePlainBodyData::TestInitialiseBodyDataL()
	{
	//read body text form a file
	TBuf<KMaxFilePathLength>emailbodyfile(KEmail40kBodyFile);
	RFs fsSession;
	RFile infile; 
		
	User::LeaveIfError(fsSession.Connect()); 
 	User::LeaveIfError(infile.Open(fsSession, emailbodyfile, EFileRead));
	TInt size;
	infile.Size(size);
 
 	//read the 8 bit data from the file
	HBufC8* filebuf1 = HBufC8::NewLC(size+KTestStringLength);  
	TPtr8 ptr1=filebuf1->Des();	  
	infile.Read(ptr1);
	CleanupStack::Pop(filebuf1);
	
	//read the 2nd chunk
	HBufC8* filebuf2 = HBufC8::NewLC(size+KTestStringLength);  
	TPtr8 ptr2=filebuf2->Des();	  
	ptr2.Copy(ptr1);
	CleanupStack::Pop(filebuf2);
	
	//read the 3rd chunk
	HBufC8* filebuf3 = HBufC8::NewLC(size+KTestStringLength);  
	TPtr8 ptr3=filebuf3->Des();	  
	ptr3.Copy(ptr1);
	CleanupStack::Pop(filebuf3);
	
	//we dont need to read from the file anymore
	infile.Close();
	fsSession.Close();
	
	//append test strings to identify each chunk
	ptr1.Append(KTestTextString1);
	ptr2.Append(KTestTextString2);	
	ptr3.Append(KTestTextString3);		

	
	iImapMailStore->InitialiseStorePlainBodyTextL(3,*iSettings,*iInfo,KLogId,*this,*this,iBinaryCap);
	
	INFO_PRINTF1(KStoringChunk1);
	
	iImapMailStore->StorePlainBodyTextL(filebuf2, iBodyMessageEntry, 1);
	
	//this is to exercise CBodyQueueEntry16 where not all data is available when first activated. 
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(K2Seconds);
	CActiveScheduler::Start();
	delete timer;
	

	
	INFO_PRINTF1(KStoringChunk2);
	iImapMailStore->StorePlainBodyTextL(filebuf3 ,iBodyMessageEntry, 2);
	
	INFO_PRINTF1(KStoringChunk0);
	iImapMailStore->StorePlainBodyTextL(filebuf1, iBodyMessageEntry, 0);

	++iRequestCount;
	CActiveScheduler::Start();
		
	}
void CTestImapFetchBody::SetupL()
	{	
	ASSERT(iInputStream == NULL);
	ASSERT(iOutputStream == NULL);
	ASSERT(iActiveWaiter == NULL);
	ASSERT(iImapSession == NULL);
	ASSERT(iMsvServer == NULL);
	
	//clear the messaging folder
	CEmailTestUtils* testUtils;
	testUtils = CEmailTestUtils::NewL(test);
	CleanupStack::PushL(testUtils);
	testUtils->FileSession().SetSessionPath(KCDrive);
	
// TODO: How to clean the message folders or close the messaging server without a PANIC ????
//	testUtils->CleanMessageFolderL();
	
	testUtils->ClearEmailAccountsL();
	
	testUtils->CreateAllTestDirectories( );
	testUtils->FileSession( ).SetSessionPath( _L( "C:\\" ) );

	CleanupStack::PopAndDestroy(testUtils);

	iMsvServer = CMsvServer::NewL();

	// wait a couple of seconds
	CTestTimer* timer = CTestTimer::NewL();
	timer->After(5000000);
	CActiveScheduler::Start();
	delete timer;
	iServerEntry = CMsvServerEntry::NewL(*iMsvServer, KMsvRootIndexEntryId);
	CImapUtils::CreateL();
	iImapMailStore = CImapMailStore::NewL(*iServerEntry);	 
	iImapSettings = CImapSettings::NewL(*iServerEntry);

	iInputStream = CFakeInputStream::NewL(Logger());
	iOutputStream = CFakeOutputStream::NewL(Logger());
	iActiveWaiter = new(ELeave)CActiveWaiter(Logger());
	iImapSession = CImapSession::NewL(*iImapSettings,*iImapMailStore,*iInputStream, *iOutputStream);
	
	//create the test environment 
	CreateMessageStructureL(KMsvGlobalOutBoxIndexEntryIdValue);	

	
	INFO_PRINTF1(_L("Setup: ServerGreeting"));
	iInputStream->ResetInputStrings();
	iInputStream->AppendInputStringL(_L8("* OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 (lon-cn-exchng2k.msexchange2k.closedtest.intra) ready.\r\n"));
	
	ASSERT_EQUALS(CImapSession::EServerStateNone, iImapSession->ServerState());
	
	iImapSession->ReadServerGreetingL(iActiveWaiter->iStatus);
	iActiveWaiter->WaitActive();
	
	INFO_PRINTF1(_L("...Login"));
	iInputStream->ResetInputStrings();
	iInputStream->AppendInputStringL(_L8("1 OK LOGIN completed\r\n"));
			
	iImapSession->LoginL(iActiveWaiter->iStatus, _L8("username"), _L8("password"));
	iActiveWaiter->WaitActive();

	ASSERT_EQUALS(CImapSession::EServerStateAuthenticated, iImapSession->ServerState());


	INFO_PRINTF1(_L("...Select inbox"));
	iInputStream->ResetInputStrings();
	iInputStream->AppendInputStringL(_L8("2 OK [READ-WRITE] SELECT completed\r\n"));
		
	CImapFolderInfo* folderInfo = CImapFolderInfo::NewL();
	CleanupStack::PushL(folderInfo);
	
	folderInfo->SetNameL(_L16("inbox"));	
	CleanupStack::Pop();//folderInfo
	iImapSession->SelectL(iActiveWaiter->iStatus, folderInfo);
	iActiveWaiter->WaitActive();

	ASSERT_EQUALS(CImapSession::EServerStateSelected, iImapSession->ServerState());
	ASSERT_EQUALS(folderInfo, iImapSession->SelectedFolderInfo());
	
	
	INFO_PRINTF1(_L("Setup: Complete"));
	}