/**
 * @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.
 */
TVerdict CT_LbsAGPSHAIValidateStep_RootCenRepReset::doTestStepL()
	{
	// Test step used to start the location manager.
	TESTLOG(ELogP1, ">> CT_LbsAGPSHAIValidateStep_RootCenRepReset::doTestStepL()");

	if (TestStepResult() == EPass)
		{
	    CRepository* rep;
	    rep = CRepository::NewL(KLbsCenRepUid); 
	    if(!rep)
	    	{
	    	TESTLOG(ELogP2, "FAILED: No cre file for lbsroot found!");
	    	INFO_PRINTF1(_L("<font><b>FAILED: No cre file for lbsroot found!</b></font>"));
	    	SetTestStepResult(EFail);
	    	}
		else
			{
			CleanupStack::PushL(rep);
						
			// reset the lbsroot cenrep file to how it was at boot:
			User::LeaveIfError(rep->Reset());
			
		    CleanupStack::PopAndDestroy(rep);
			}
		}
		
	TESTLOG(ELogP1, "<< CT_LbsAGPSHAIValidateStep_RootCenRepReset::doTestStepL()");

	return TestStepResult();
	}
Esempio n. 2
0
void CBmOomTester::ResetRepositoryL ( TUid aUid )
	{
	CRepository* repository = CRepository::NewL ( aUid );
	CleanupStack::PushL ( repository );
	User::LeaveIfError ( repository->Reset() );	
	CleanupStack::PopAndDestroy ( repository );
	}
/**
Method called just before a TEF Unit Test is executed.
@see	CActiveTestFixture::SetupL
*/
void CTestAsyncSuplLbsApi::SetupL()
	{
 	//Wipe the CenRep
	CRepository* rep = CRepository::NewL(KLbsHostSettingsSuplStoreId);
	CleanupStack::PushL(rep);
	User::LeaveIfError(rep->Reset());
	CleanupStack::PopAndDestroy(rep);
 	}
Esempio n. 4
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CSpsBackupHelperPerformer::ResetToFactorySettingsL()
    {
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ResetToFactorySettingsL IN" );
    // Ok if leave ( No service provider settings )
    CRepository* cenrep = CRepository::NewLC( KCRUidSPSettings );
    User::LeaveIfError( cenrep->Reset() );
    CleanupStack::PopAndDestroy( cenrep );
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ResetToFactorySettingsL OUT" );
    }
void T_CGlxSettingsModel::Teardown()
    {
    // reset default values
    const TUid KCRUidGallery = { 0x2000A7B7 };
	CRepository* repository = CRepository::NewL(KCRUidGallery);
    CleanupStack::PushL(repository);
	User::LeaveIfError(repository->Reset());
	CleanupStack::PopAndDestroy(repository);
	repository = NULL;
    }
void T_NATFWTraversalAdapter::StoreL(  )
    {
    // Central Repository for NAT-FW Traversal settings
    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols );
    rep->Reset();
    
    _LIT( KFileName, "c:\\data\\NATFW_AP_BOOTSTRAP_2.wbxml" );
    
    EUNIT_ASSERT_NO_LEAVE( SaveDocumentL( KFileName() ) );

    CleanupStack::PopAndDestroy( rep );
    }
// NB: this test suite needs each test run to start with keyspaces with values from
// the initialization files in ROM dir. The best way to archive this is to send the
// EGetSetParameters IPC to centrep server to flush cache and then delete
// the .cre files. This option requires the CENTREP_SERVER_CACHETEST macro
// which is not available in release ONB.  The second choice is to wait enough
// time for centrep server to flush out cache, then delete the .cre files from
// persists dir. This approach does not work well on the emulator because centrep
// server's cache timer sometimes is late by as much as a few seconds.
// Hence instead of wait and delete the .cre files, this RTest uses the ResetAll
// API. This trick works for the use case of this RTest but may not work in other
// situations. E.g., in this RTest centrep server always open repositories
// from cache. This changes the timing pattern and does not exercise the
// cache eviction code path.
LOCAL_C void ResetModifiedRepsL()
	{
	for (TInt i = RepsToReset.Count() - 1; i >= 0; i--)
		{
		CRepository* rep;
		User::LeaveIfNull( rep = CRepository::NewL(RepsToReset[i]) );
		rep->Reset();
		delete rep;

		RepsToReset.Remove(i);
		}
	}
Esempio n. 8
0
TVerdict CEtel1Step::doTestStepPostambleL()
	{
	LBSLOG(ELogP1,"CEtel1Step::doTestStepPostambleL - Start");
	
	
	//Clear the repository that keeps the host settings
	CRepository* rep = CRepository::NewL(KLbsHostSettingsSuplStoreId);
	rep->Reset();
	delete rep;
	
	delete iModule;
	iModule=0;	
	
	delete iTimer;
	iTimer=0;
		
	delete iSchedulerWait;
	iSchedulerWait = 0;	
	
	CTe_suplprotocolSuiteStepBase::doTestStepPostambleL();
	LBSLOG(ELogP1,"CEtel1Step::doTestStepPostambleL - End");
	return TestStepResult();
	}
LOCAL_C void ResetTransactionL()
	{
#ifdef PENDING_REMOVAL
    // reset operations are not supported in transactions for now.
    // ResetAll will not ever be: still to decide on individual setting reset
    // Both are very slow.

	TUint32 errorId;
	CRepository* repository;
	User::LeaveIfNull(repository = CRepository::NewLC(KUidPlatsecTestRepository));

	// Remember that this repository need to be reset
	::AddRepositoryToReset(KUidPlatsecTestRepository);

	TInt r = repository->Set(KInt1, KInt1_UpdatedValue);
	TEST2(r, KErrNone);

	TInt x,y;
	r = repository->Get(KInt1, x);
	TEST2(r, KErrNone);

	r = repository->StartTransaction(CRepository::EReadWriteTransaction);
	TEST2(r, KErrNone);

	r = repository->Reset(KInt1);
	TEST2(r, KErrNone);

	r = repository->CommitTransaction(errorId);
	TEST2(r, KErrNone);

	r = repository->Get(KInt1, y);
	TEST2(r, KErrNone);

	// did we get what expected after commit?
	TEST(x!=KInt1_InitialValue);
	TEST(y==KInt1_InitialValue);

	CleanupStack::PopAndDestroy(repository);

	// Repository B
	// lets prepare for reset
	User::LeaveIfNull(repository = CRepository::NewLC(KUidTransactionTestRepository));

	// Remember that this repository need to be reset
	::AddRepositoryToReset(KUidTransactionTestRepository);

	const TInt KNewSettingAlwaysPass = 0x101;

	r = repository->StartTransaction(CRepository::EReadWriteTransaction);
	TEST2(r, KErrNone);

	TInt i = 0;
	for(i=KNewSettingAlwaysPass;i<KNewSettingAlwaysPass+10;i++)
		{
		r = repository->Create(i, i);
		TEST2(r, KErrNone);
		}


	TRequestStatus status = -1;
	r = repository->NotifyRequest(0, 0, status);
	TEST2(r, KErrNone);

	r = repository->CommitTransaction(errorId);
	TEST2(r, KErrNone);

	TInt xArray[10];
	TInt xx=0;
	for(i=0;i<10;i++)
		{
		r = repository->Get(KNewSettingAlwaysPass+i, xArray[i]);
		TEST2(r, KErrNone);
		}

	//and do the reset business now
	r = repository->StartTransaction(CRepository::EReadWriteTransaction);
	TEST2(r, KErrNone);

	r = repository->Reset();
	TEST2(r, KErrNone);

	r = repository->CommitTransaction(errorId);
	TEST2(r, KErrNone);

	// test reset after commit
	TEST(status==KNewSettingAlwaysPass);

	for(i=0;i<10;i++)
		{
		TEST(xArray[i]==(KNewSettingAlwaysPass+i));
		}

	for(i=KNewSettingAlwaysPass;i<KNewSettingAlwaysPass+10;i++)
		{
		r = repository->Get(i, xx);
		TEST2(r, KErrNotFound);
		}

	CleanupStack::PopAndDestroy(repository);
#endif // PENDING_REMOVAL
	}
LOCAL_C void ResetL()
	{
	CRepository* repository;
	User::LeaveIfNull(repository = CRepository::NewLC(KUidPlatsecTestRepository));

	TInt x;
	TInt r = repository->Get(KInt1, x);
	TEST2(r, KErrNone);
	TEST(x!=KInt1_InitialValue);

	r = repository->Reset(KInt1);
	TEST2(r, KErrNone);

	r = repository->Get(KInt1, x);
	TEST2(r, KErrNone);
	TEST(x==KInt1_InitialValue);

	CleanupStack::PopAndDestroy(repository);

	// Repository D
	User::LeaveIfNull(repository = CRepository::NewLC(KUidResetTestRepository));
	// Remember that this repository need to be reset
	::AddRepositoryToReset(KUidResetTestRepository);


	const TInt KNewSetting1 = 5;
	const TInt KNewSetting2 = 6;
	r = repository->Create(KNewSetting1, 0);
	TEST2(r, KErrNone);
	r = repository->Create(KNewSetting2, 0);
	TEST2(r, KErrNone);

	r = repository->Create(65, 1);
	TEST2(r, KErrNone);

	r = repository->Set(70, 1);
	TEST2(r, KErrNone);

	r = repository->Create(80, 1);
	TEST2(r, KErrNone);

	r = repository->Create(90, 1);
	TEST2(r, KErrNone);

	TRequestStatus status = -1;
	r = repository->NotifyRequest(0, 0, status);
	TEST2(r, KErrNone);

	r = repository->Reset();
	TEST2(r, KErrNone);
	TEST(status==KUnspecifiedKey);
	RThread thisThread;
	TEST(thisThread.RequestCount()==1);

	r = repository->Get(10, x);
	TEST2(r, KErrNone);
	TEST(x==10);

	r = repository->Get(40, x);
	TEST2(r, KErrNone);
	TEST(x==0);

	r = repository->Get(50, x);
	TEST2(r, KErrNone);
	TEST(x==0);

	r = repository->Get(60, x);
	TEST2(r, KErrNone);
	TEST(x==0);

	r = repository->Get(70, x);
	TEST2(r, KErrNone);
	TEST(x==0);

	TBuf<10> z;
	r = repository->Get(20, z);
	TEST2(r, KErrNone);
	TEST(z==_L("string"));

	TReal y;
	r = repository->Get(30, y);
	TEST2(r, KErrNone);
	TEST(y==1);

	r = repository->Get(5, x);
	TEST2(r, KErrNotFound);
	r = repository->Get(6, x);
	TEST2(r, KErrNotFound);
	r = repository->Get(65, x);
	TEST2(r, KErrNotFound);
	r = repository->Get(80, x);
	TEST2(r, KErrNotFound);
	r = repository->Get(90, x);
	TEST2(r, KErrNotFound);

	CleanupStack::PopAndDestroy(repository);
	}