コード例 #1
0
/**
 Begin the start-up test case. Opening the database is synchcronous as is the first
 part of creating the remote view. The second part (where the view is populated
 with contacts) is asynchronous and finishes when CStartUp::HandleContactViewEvent
 is called. CStartUp::RunL then just cleans up once the test case is finished.
*/
void CStartUp::DoTestL(const TDesC& aDbName, TViewType aViewType, TInt& aNumMsToGet20ItemsFromView)
	{
	iViewType = aViewType;
	iNumMsToGet20ItemsFromViewPtr = &aNumMsToGet20ItemsFromView;
	_LIT(KRemoteContactViewText, "\n[Remote Contacts view]\n");
	_LIT(KRemoteGroupViewText,   "\n[Remote Groups view]\n");
	TBuf<32> buf;
	if (iViewType == ERemoteContactsView)
		{
		buf.Append(KRemoteContactViewText);
		}
	else
		{
		buf.Append(KRemoteGroupViewText); 
		}

	iTest.Printf(buf);

	// open database
	OpenDatabaseL(aDbName);
	
	// create view
	CreateRemoteViewL();
	CActiveScheduler::Start();
	}
コード例 #2
0
void CConcurrentDatabaseAccessBase::RunTestL()
	{
	// set's up an active scheduler for the thread
	// and calls the RunTesImplementation function to actually
	// preform the tests. This function should be implemented in the
	// child class.
	CTestActiveScheduler*  scheduler = NULL;

	scheduler = new (ELeave) CTestActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	CActiveScheduler::Add( this );

	OpenDatabaseL();

	CallRunLAgain();
	CActiveScheduler::Start();

	CloseDatabase();

	CleanupStack::PopAndDestroy( scheduler );

	// propagate error
	User::LeaveIfError(iTestError);
	}
コード例 #3
0
/**
 * Second level CContactViews constructors
 * Obtains handle to the global semaphore used for synchronizations with main thread
 * Obtains handle to the Global chunk used for exchanging data across threads
 * Allocates CContactUtilitiesCollection object used for contact views operations
 * Allocates CContactViewCollection used for holding the newly constructed contact views
 */
void CContactViews::ConstructL()
	{
	iSemaphore.OpenGlobal(KSemaphoreName);
	SetupChunk();
	OpenDatabaseL();
	iContactViewCollection = CContactViewCollection::NewL();
	iContactUtility = CContactUtilitiesCollection::NewL(iTestStep, DatabaseReference(), ViewCollectionReference());
    iContactUtility->ConstructViewsL();
	ReadDataFromIniAndConstructValidationObjectsL();
    SetViewOfInterest();    
	}
コード例 #4
0
// Each test step must supply a implementation for doTestStepL
enum TVerdict CTestAgendaAddAppt::doTestStepL( void )
	{
	// Printing to the console and log file
	INFO_PRINTF1(_L("TEST-> ADDING APPOINTMENT ENTRIES"));

	OpenDatabaseL();
	if ( TestStepResult() == EPass )
		{
		TRAPD(r, AddEntriesL());
		if (r!=KErrNone)
			SetTestStepResult(EFail);
		}
	CleanupDatabase();

	// test steps return a result
	return TestStepResult();
	}
コード例 #5
0
// -----------------------------------------------------------------------------
// CDcfRepSrv::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CDcfRepSrv::ConstructL()
{
#ifdef _DRM_TESTING
    CreateLogL();
    WriteL(_L8("ConstructL"));
#endif
    StartL(KDcfRepSrvName);
    User::LeaveIfError(iFs.Connect());
    iScan = CFileScan::NewL(iFs);
    OpenDatabaseL();

    User::RenameThread(KDcfRepSrvName);

    iProcWatcher = CProcWatcher::NewL( *this, _L( "*RightsServer*" ), _L( "RightsServer" ) );
    iProcWatcher->StartWatching();
    iArmed = ETrue;
}
コード例 #6
0
/*!
 * The leaving function that queries the SQL database
 * 
 * \a id database id of the contact
 * \return the list of matched contact names
 */
void CntSymbianSrvConnection::readContactsToBufferL(const TDesC& sqlQuery, QueryType aQueryType)
{
    // Initialize connection if it is not initialized yet.
    if (!m_isInitialized) {
        ConnectSrvL();
        OpenDatabaseL();
        m_isInitialized = true;
    }

    TIpcArgs args;
    args.Set(0, &GetReceivingBufferL());
    args.Set(1, &sqlQuery);
    TInt newBuffSize = SendReceive(aQueryType, args);
    User::LeaveIfError(newBuffSize);
    if (newBuffSize > 0) {
        args.Set(0, &GetReceivingBufferL(newBuffSize));
        args.Set(1, &sqlQuery);
        User::LeaveIfError(SendReceive(aQueryType, args));
    }
}
コード例 #7
0
ファイル: t_big.cpp プロジェクト: cdaffara/symbiandump-os2
/**
@SYMTestCaseID          SYSLIB-DBMS-CT-1317
@SYMTestCaseDesc        Deleting a table from the database 
@SYMTestPriority        Medium
@SYMTestActions        	Delete the rows from the rowset.Check for empty rows in the rowset.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void DeleteTable()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1317 "));
	const TInt KTenthRecords=KRecords/10;

	test (TheTable.Open(TheDatabase,KTableName)==KErrNone);
	TheDatabase.Begin();
	TInt ii;
	for (ii=0;ii<15;++ii)
		{
		TheTable.NextL();
		TheTable.DeleteL();
		}
	TheTable.NextL();
	TDbBookmark mark=TheTable.Bookmark();
	TheTable.Close();
	TheDatabase.Commit();
	CloseDatabaseL();
	OpenDatabaseL();
#ifndef __TOOLS2__
	TheTimer.Start(_L("delete table"));
#endif
	test (TheTable.Open(TheDatabase,KTableName)==KErrNone);
	TheDatabase.Begin();
	TheTable.GotoL(mark);
	TheTable.DeleteL();
	for (ii=0;ii<KTenthRecords*2-16;++ii)
		{
		TheTable.NextL();
		TheTable.DeleteL();
		}
	TheTable.EndL();
	for (ii=0;ii<KTenthRecords*2;++ii)
		{
		TheTable.PreviousL();
		TheTable.DeleteL();
		}
	TheTable.BeginningL();
	for (ii=0;ii<KTenthRecords*3;++ii)
		TheTable.NextL();
	for (ii=0;ii<KTenthRecords*2;++ii)
		{
		TheTable.NextL();
		TheTable.DeleteL();
		}
	for (ii=0;ii<KTenthRecords*2;++ii)
		{
		TheTable.PreviousL();
		TheTable.DeleteL();
		}
	for (ii=0;ii<KTenthRecords;++ii)
		{
		TheTable.NextL();
		TheTable.DeleteL();
		}
	for (ii=0;ii<KTenthRecords;++ii)
		{
		TheTable.PreviousL();
		TheTable.DeleteL();
		}
	test (TheTable.CountL()==0);
	test (!TheTable.NextL());
	test (!TheTable.PreviousL());
	test (TheDatabase.Commit()==KErrNone);
	TheTable.Close();
#ifndef __TOOLS2__
	TheTimer.Stop();
#endif
	}