예제 #1
0
void CTransactionsStep::FullTransactionPerformanceTestL(const TBool aDelete)
	{
	TReal diffsecondsMin = 0;
	TReal commitsecondsMin = 0;
	TReal diffsecondsMid = 0;
	TReal commitsecondsMid = 0;
	TReal diffsecondsMan = 0;
	TReal commitsecondsMan = 0;
	TReal diffsecondsMax = 0;
#ifdef __WINSCW__
	TReal commitsecondsMax = 0;
#endif
	
	ALLPRINT(KMinContactsPrint); 
	TransactionPerformanceL(aDelete, EFull, KMinContacts, diffsecondsMin, commitsecondsMin);
	ALLPRINT(KMidContactsPrint); 
	TransactionPerformanceL(aDelete, EFull, KMidContacts, diffsecondsMid, commitsecondsMid);
	ALLPRINT(KManyContactsPrint); 
	TransactionPerformanceL(aDelete, EFull, KManyContacts, diffsecondsMan, commitsecondsMan);
	//is too slow on hardware, also takes up too much disk space
	#ifdef __WINSCW__
	ALLPRINT(KMaxContactsPrint); 
	TransactionPerformanceL(aDelete, EFull, KMaxContacts, diffsecondsMax, commitsecondsMax);
	#endif
	
	TESTPRINT( diffsecondsMax < KMaxTimeAllowed );
	}
예제 #2
0
/**
create local view with sortorder containing all (existing) uids,
database contains 10 contacts with a fieldset containing no fields.
*/
void CContactViewTest::EmptyFieldsetTestL()
	{
	ALLPRINT(KTest5);
	ClosePersistanceL(EFalse);
	ResetDatabaseL();
	TInt i;
	for(i = 0; i < iContacts; ++i)
		{
		const TContactItemId cid = iIterate->NextL();
		OpenL(cid, *iViewAll);
		iFields->Reset();
		CommitL();
		}


	TInt length = iExistingUidsArray->Count();
	ResetSortL();
	for(i = 0 ; i < length ; ++i)
		{
		iSortOrder->AppendL( TUid::Uid( (*iExistingUidsArray)[i] ) );
		}

	OpenPersistanceL();
	iObserver->SetView( CreateViewL() );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doEmptyFieldsetTestL;
	}
예제 #3
0
/**
create local view with empty sortorder,
database is contains ten empty contacts
*/
void CContactViewTest::AllEmptyTestL()
	{
	ALLPRINT(KTest1);
	ResetSortL();
	iObserver->SetView( CreateViewL() );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doAllEmptyTestL;
	}
/**
Start active compress
*/
void CPerformanceFunctionalityBase::StartCompressL()
	{
	iActiveRecoverObserver.iCompressOrRecoverError = KErrNone;
	_LIT(KStartCompress, "StartCompress");
	ALLPRINT(KStartCompress);
	iCompress = iContactsDatabase->CreateCompressorLC();
	iCompress->SetObserver( &iActiveRecoverObserver );
	CleanupStack::Pop( iCompress );
	}
예제 #5
0
void CTransactionsStep::EmptyTransactionPerformanceTestL(const TBool aDelete)
	{
	TReal diffsecondsMax = 0;
	TReal commitsecondsMax = 0;
	
	_LIT(KMaxContactsPrint,"$Max contacts$");
	ALLPRINT(KMaxContactsPrint); 
	TransactionPerformanceL(aDelete, EEmpty, KMaxContacts, diffsecondsMax, commitsecondsMax);
	
	TESTPRINT( diffsecondsMax < KMaxTimeAllowed );
	}
예제 #6
0
void CTransactionsStep::MediumTransactionPerformanceTestL(const TBool aDelete)
	{
	TReal diffsecondsMin = 0;
	TReal commitsecondsMin = 0;
	TReal diffsecondsMid = 0;
	TReal commitsecondsMid = 0;
	TReal diffsecondsMan = 0;
	TReal commitsecondsMan = 0;
	TReal diffsecondsMax = 0;
	TReal commitsecondsMax = 0;
		
	ALLPRINT(KMinContactsPrint); 
	TransactionPerformanceL(aDelete, EMedium, KMinContacts, diffsecondsMin, commitsecondsMin);
	ALLPRINT(KMidContactsPrint); 
	TransactionPerformanceL(aDelete, EMedium, KMidContacts, diffsecondsMid, commitsecondsMid);
	ALLPRINT(KManyContactsPrint); 
	TransactionPerformanceL(aDelete, EMedium, KManyContacts, diffsecondsMan, commitsecondsMan);
	ALLPRINT(KMaxContactsPrint); 
	TransactionPerformanceL(aDelete, EMedium, KMaxContacts, diffsecondsMax, commitsecondsMax);


	TESTPRINT( diffsecondsMax < KMaxTimeAllowed );
	}
/**
if iCompleteSteps, complete active compress and cancel
otherwise just cancel
*/
void CPerformanceFunctionalityBase::EndCompressL()
	{
	_LIT(KEndCompress, "EndCompress");

	if( iCompress )
		{
        	ALLPRINT(KEndCompress);
		if(iCompleteSteps)
			{
			while(iCompress->Step()){}
			}
		iCompress->Cancel();
		iCompress = NULL;
		}
	}
/**
if iCompleteSteps, complete active recovery and cancel
otherwise just cancel
*/
void CPerformanceFunctionalityBase::EndRecoverL()
	{
	_LIT(KEndRecover, "EndRecover");

	if( iRecover )
		{
        	ALLPRINT(KEndRecover);
		if(iCompleteSteps)
			{
			while(iRecover->Step()){}
			}
		iRecover->Cancel();
		iRecover = NULL;
		}
	}
예제 #9
0
/**
Set all fields of all contacts to contain their own label string
use empty sort order
*/
void CContactViewTest::MissingFieldTestL()
	{
	ALLPRINT(KTest7);
	ClosePersistanceL(EFalse);
	ResetDatabaseL();
	for(TInt i = 0; i < iContacts; ++i)
		{
		const TContactItemId cid = iIterate->NextL();
		OpenL(cid, *iViewAll);
		SetContactL();
		CommitL();
		}
	ResetSortL();
	OpenPersistanceL();
	iObserver->SetView( CreateViewL() );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doMissingFieldTestL;
	}
예제 #10
0
/**
create local view with sortorder containing all (existing) uids,
database contains 10 empty contacts
*/
void CContactViewTest::ContactEmptyTestL()
	{
	ALLPRINT(KTest3);
	ClosePersistanceL(EFalse);
	ResetDatabaseL();
	ResetSortL();

	TInt length = iExistingUidsArray->Count();
	TInt i = 0;
	for( ; i < length ; ++i)
		{
		iSortOrder->AppendL( TUid::Uid( (*iExistingUidsArray)[i] ) );
		}
	OpenPersistanceL();
	iObserver->SetView( CreateViewL() );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doContactEmptyTestL;
	}
/**
Damage database and start active recovery
*/
void CPerformanceFunctionalityBase::StartRecoverL()
	{
	iActiveRecoverObserver.iCompressOrRecoverError = KErrNone;
	_LIT(KStartRecover, "StartRecover");
	ALLPRINT(KStartRecover);

	#ifdef _DEBUG
		#ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__
			if( !iContactsDatabase->IsDamaged() )
				{
				iContactsDatabase->DamageDatabaseL(0x666);//will give us consistent behaviour on debug builds
				}
		#endif
	#endif

	iRecover = iContactsDatabase->CreateRecoverLC();
	iRecover->SetObserver( &iActiveRecoverObserver );
	CleanupStack::Pop( iRecover );
	}
예제 #12
0
/**
Delete all fields from all contacts
*/
void CContactViewTest::EmptyFieldsetSortTestL()
	{
	ALLPRINT(KTest6);
	ClosePersistanceL(EFalse);
	ResetDatabaseL();
	TInt i;
	for(i = 0; i < iContacts; ++i)
		{
		const TContactItemId cid = iIterate->NextL();
		OpenL(cid, *iViewAll);
		//deletes all fields
		iFields->Reset();
		CommitL();
		}

	ResetSortL();
	OpenPersistanceL();
	iObserver->SetView( CreateViewL() );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doEmptyFieldsetSortTestL;
	}
예제 #13
0
/**
populate database with full, medium or empty contacts
*/
void CContactViewTest::PerformanceTestL()
	{
	ClosePersistanceL( EFalse );
	ResetDatabaseL(iPerformanceContacts);

	//populate contacts
	if( EMedium == iFullness )
		{
		if( EFew == iPerformanceContacts )
			{
			ALLPRINT(KTest81);
			}
		TInt i = 0;
		for(; i < iContacts; ++i)
			{
			const TContactItemId cid = iIterate->NextL();
			OpenL(cid, *iViewAll);
			SetMediumL();
			CommitL();
			}
		}
	else if( EFull == iFullness )
		{
		if( EFew == iPerformanceContacts )
			{
			ALLPRINT(KTest82);
			}
		TInt i = 0;
		for(; i < iContacts; ++i)
			{
			const TContactItemId cid = iIterate->NextL();
			OpenL(cid, *iViewAll);
			SetFullL();
			CommitL();
			}
		}
	else
		{
		if( EFew == iPerformanceContacts )
			{
			ALLPRINT(KTest8);
			}
		}

	/**
	Print the number of contacts used for this test
	*/
	switch( iPerformanceContacts )
		{
		case EFew:
			{
			_LIT(KFewContacts,"Few contacts");
			ALLPRINT( KFewContacts );
			iPerformanceContacts = EMid;
			break;
			}
		case EMid:
			{
			_LIT(KMidContacts,"Mid contacts");
			ALLPRINT( KMidContacts );
			iPerformanceContacts = EMany;
			break;
			}
		case EMany:
			{
			_LIT(KManyContacts,"Many contacts");
			ALLPRINT( KManyContacts );
			iPerformanceContacts = EMax;
			break;
			}
		case EMax:
			{
			_LIT(KMaxContacts,"Max contacts");
			ALLPRINT( KMaxContacts );
			iPerformanceContacts = EDone;
			break;
			}
		default:
			{
			_LIT(KInvalidContacts,"bad performance contacts");
			User::Panic(KInvalidContacts, 333 );
			break;
			}
		}

	_LIT(KStartCompact,"Start Compact");
	ALLPRINT( KStartCompact );
	iContactsDatabase->CompactL();//to make sure that the server is not busy doing automatic compaction
	_LIT(KEndCompact,"End Compact");
	ALLPRINT( KEndCompact );


	//Create sortorder with typical uids
	ResetSortL();
	iSortOrder->AppendL(KUidContactFieldGivenName);
	iSortOrder->AppendL(KUidContactFieldAdditionalName);
	iSortOrder->AppendL(KUidContactFieldFamilyName);
	iSortOrder->AppendL(KUidContactFieldPhoneNumber);

	OpenPersistanceL();
	_LIT(KStartView,"Start view creation");
	ALLPRINT( KStartView );
	//note time view is created
	iStartC.UniversalTime();
	iObserver->SetView( CreateViewL() );
	//note time vie creat is completed
	iStartP.UniversalTime();
	_LIT(KEndView,"End view creation, wait for view to be populated");
	ALLPRINT( KEndView );
	iObserver->iMainFunc = NULL;
	iObserver->iDoFunc = &CContactViewTest::doPerformanceTestL;
	}
예제 #14
0
TVerdict CContactViewTest::doTestStepL()
	{

	void (CContactViewTest::*mainFunc)() = NULL;

	const TDesC &run = ConfigSection();

	if( run.Find( KRun1 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::AllEmptyTestL;
		}
	else if( run.Find( KRun2 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ViewEmptyTestL;
		}
	else if( run.Find( KRun3 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ContactEmptyTestL;
		}
	else if( run.Find( KRun4 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::AllFullTestL;
		}
	else if( run.Find( KRun5 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::EmptyFieldsetTestL;
		}
	else if( run.Find( KRun6 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::EmptyFieldsetSortTestL;
		}
	else if( run.Find( KRun7 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::MissingFieldTestL;
		}
	else if( run.Find( KRun8 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::PerformanceTestL;
		}
	else if( run.Find( KRun9 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::RecoverCompressTestL; // this test does not apply to the SQLite version of contacts
		}
	else if( run.Find( KRun10 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ConcurrentRecoverCompressTestL; // this test does not apply to the SQLite version of contacts
		}
	else
		{
		MissngTestPanic();
		}

	__UHEAP_MARK;

	iRemote = EFalse;
	ALLPRINT(KStars);
	if( iPLView )
		{
		_LIT(KPersistance,"Initialising LocalView on Persistence Layers tests");
		ALLPRINT(KPersistance);
		}
	else
		{
		_LIT(KLocalViewCS,"Initialising LocalView on Client/Server tests");
		ALLPRINT(KLocalViewCS);
		}
	ALLPRINT(KStars);
	InitializeL();
	iObserver->iMainFunc = mainFunc;
	CActiveScheduler::Start();

	if( !iPLView )
		{
		ALLPRINT(KStars);
		_LIT(KRemoteViewCS,"Initialising RemoteView on Client/Server tests");
		ALLPRINT(KRemoteViewCS);
		ALLPRINT(KStars);
		iRemote = ETrue;
        // Ensure that the recover is deleted before another one is created.
        EndRecoverL();
		ResetDatabaseL(10);
		iObserver->iMainFunc = mainFunc;// test to run
		iObserver->iDoFunc = NULL;
		iObserver->CleanView();
		iObserver->Activate();
		CActiveScheduler::Start();
		}

	if( !iPLView )
		{
		ALLPRINT(KStars);
		_LIT(KRemoteViewCS,"Initialising RemoteView on Client/Server tests");
		ALLPRINT(KRemoteViewCS);
		ALLPRINT(KStars);
		iRemote = ETrue;
		ResetDatabaseL(10);
		iObserver->iMainFunc = mainFunc;// test to run
		iObserver->iDoFunc = NULL;
		iObserver->CleanView();
		iObserver->Activate();
		CActiveScheduler::Start();
		}

		CleanupL();
		__UHEAP_MARKEND;

	return TestStepResult();
	}
예제 #15
0
TVerdict CTransactionsStep::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{	
	__UHEAP_MARK;
	InitializeL();
	_LIT(KStartTest,"CTransactionsStep::doTestStepL()");
	ALLPRINT(KStartTest);  //Block start 
	iIterate->Reset();
	
	const TDesC &run = ConfigSection();
	
	if( run == KRun1 )
		{
		ALLPRINT(KTest1);
		NestedTransactionTestL();
		}
	else if( run == KRun2 )
		{
		ALLPRINT(KTest2);
		EmptyCommitTransactionTestL(EFalse);
		}
	else if( run == KRun3 )
		{
		ALLPRINT(KTest3);
		EmptyCommitTransactionTestL(ETrue);
		}
	else if( run == KRun4 )
		{
		ALLPRINT(KTest4);
		UpdateCommitTransactionTestL(EFalse);
		}
	else if( run == KRun5 )
		{
		ALLPRINT(KTest5);
		UpdateCommitTransactionTestL(ETrue);
		}
	else if( run == KRun6 )
		{
		ALLPRINT(KTest6);
		CreateCommitTransactionTestL(EFalse);
		}
	else if( run == KRun7 )
		{
		ALLPRINT(KTest7);
		CreateCommitTransactionTestL(ETrue);
		}
	else if( run == KRun8 )
		{
		ALLPRINT(KTest8);
		DeleteCommitTransactionTestL(EFalse);
		}
	else if( run == KRun9 )
		{
		ALLPRINT(KTest9);
		DeleteCommitTransactionTestL(ETrue);
		}
	else if( run == KRun10 )
		{
		ALLPRINT(KTest10);
		ManyUpdateCommitTransactionTestL(EFalse);
		}
	else if( run == KRun11 )
		{
		ALLPRINT(KTest11);
		ManyUpdateCommitTransactionTestL(ETrue);
		}
	else if( run == KRun12 )
		{
		ALLPRINT(KTest12);
		EmptyTransactionPerformanceTestL( EFalse);
		}
	else if( run == KRun13 )
		{
		ALLPRINT(KTest13);
		EmptyTransactionPerformanceTestL( ETrue );
		}
	else if( run == KRun14 )
		{
		ALLPRINT(KTest14);
		MediumTransactionPerformanceTestL( EFalse);
		}
	else if( run == KRun15 )
		{
		ALLPRINT(KTest15);
		MediumTransactionPerformanceTestL( ETrue);
		}
	else if( run == KRun16 )
		{
		ALLPRINT(KTest16);
		FullTransactionPerformanceTestL( EFalse);
		}
	else if( run == KRun17 )
		{
		ALLPRINT(KTest17);
		FullTransactionPerformanceTestL( ETrue);
		}
	else if( run == KRun18 )
		{
		ALLPRINT(KTest18);
		MultipleCommitTestL( EFalse);
		}
	else if( run == KRun19 )
		{
		ALLPRINT(KTest19);
		MultipleCommitTestL( ETrue);
		}
	else
		{
		MissingTestPanic();
		}

	Cleanup();
	__UHEAP_MARKEND;

	return TestStepResult();
	}