void CConcurrentNotifierStep::SpeedDialTestL() { INFO_PRINTF1(KTest8); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); TContactItemId cid = iIterate->PreviousL();//start at last contact, so that other tests are not corrupted OpenL( cid ); TInt fieldId=iFields->Find(KUidContactFieldPhoneNumber); iSpeedPosition = 1; iContactsDatabase->SetFieldAsSpeedDialL(*iContactItem, fieldId, iSpeedPosition); CloseL( EFalse ); OpenL( cid ); iSpeedPosition2 = 2; iContactsDatabase->SetFieldAsSpeedDialL(*iContactItem, fieldId, iSpeedPosition2); CloseL( EFalse ); AddEventL( EContactDbObserverEventSpeedDialsChanged ); AddContactL( cid ); AddEventL( EContactDbObserverEventSpeedDialsChanged ); AddContactL( cid ); AddEventL( EContactDbObserverEventSpeedDialsChanged ); AddContactL( cid ); SetMessageCountL(); iStart.UniversalTime(); }
/** if in revert mode rollback transaction, otherwise commit, tell listner to expect an notifications that may be generated */ void CConcurrentNotifierStep::EndTransactionL( ) { if(iRevert) { iRevert = EFalse; iContactsDatabase->DatabaseRollback(); AddEventL( EContactDbObserverEventRollback ); AddContactL( KNullContactId ); CleanupStack::Pop(); TBool damaged = iContactsDatabase->IsDamaged(); #ifdef _DEBUG #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__ //It maybe necessary to explicitly damage the database more than once //for it to be registered as damaged while( !iContactsDatabase->IsDamaged() ) { //will give consistent behaviour on debug builds iContactsDatabase->DamageDatabaseL(0x666); } if( !damaged ) { AddEventL( EContactDbObserverEventRollback ); AddContactL( KNullContactId ); } #endif #endif if( iContactsDatabase->IsDamaged() ) { iContactsDatabase->RecoverL(); AddEventL( EContactDbObserverEventRecover ); AddContactL( 0 ); if( !damaged ) { AddEventL( EContactDbObserverEventTablesClosed ); AddContactL( 0 ); } AddEventL( EContactDbObserverEventTablesOpened ); AddContactL( 0 ); } iRevert = ETrue; } else { iContactsDatabase->DatabaseCommitLP(EFalse); } iRevert = !iRevert; }
void CConcurrentNotifierStep::MultipleChangeTransactionTestL() { if( iRevert ) { INFO_PRINTF1(KTest112); } else { INFO_PRINTF1(KTest11); } SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; TContactItemId cid = iIterate->NextL(); iContactsDatabase->DatabaseBeginLC(EFalse); OpenL( cid ); CommitL( ETrue ); AddEventL(EContactDbObserverEventContactChanged); AddContactL( cid ); cid = iIterate->NextL(); ReadL( cid ); iContactsDatabase->UpdateContactLC( cid, iContactItem); CleanupStack::PopAndDestroy(); CloseL( ETrue ); AddEventL(EContactDbObserverEventContactChanged); AddContactL( cid ); CContactCard* contact = CContactCard::NewLC(iTemplate); cid = iContactsDatabase->doAddNewContactL(*contact, EFalse, ETrue); if(!iRevert) { iIterate->AddL( cid ); } CleanupStack::PopAndDestroy(contact); AddEventL(EContactDbObserverEventContactAdded); AddContactL( cid ); cid = iIterate->NextL(); DeleteContactL( cid, ETrue ); AddEventL(EContactDbObserverEventContactDeleted); AddContactL( cid ); EndTransactionL(); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::OwnCardTestL() { INFO_PRINTF1(KTest7); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); CContactItem *item = iContactsDatabase->CreateOwnCardLC(); iIterate->AddL( item->Id() ); AddEventL( EContactDbObserverEventContactAdded ); AddContactL( item->Id() ); AddEventL( EContactDbObserverEventOwnCardChanged ); AddContactL( item->Id() ); CleanupStack::PopAndDestroy( item ); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::DeleteSpeedDialTestL() { INFO_PRINTF1(KTest15); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); TBuf<200> ptr; TContactItemId cid = iContactsDatabase->GetSpeedDialFieldL(iSpeedPosition, ptr); DeleteContactL( cid, EFalse ); AddEventL( EContactDbObserverEventSpeedDialsChanged ); AddContactL( cid ); AddEventL( EContactDbObserverEventContactDeleted ); AddContactL( cid); SetMessageCountL(); iStart.UniversalTime(); }
// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void CPosModulesSettings::ComparePropertiesL( TPositionModuleId aModuleId, TPosModuleAttributes aOne, TPosModuleAttributes aAnother, RArray<TPosModulesEvent>& aEvents ) const { if ( aOne.iVisible != aAnother.iVisible ) { AddEventL( aModuleId, EPosModulesEventVisibilityChanged, aEvents ); } if ( aOne.iCost != aAnother.iCost ) { AddEventL( aModuleId, EPosModulesEventCostChanged, aEvents ); } if ( aOne.iAvailable != aAnother.iAvailable ) { AddEventL( aModuleId, EPosModulesEventAvailabilityChanged, aEvents ); } }
void CNotificationStep::UnkownChangeTestL() { INFO_PRINTF1(KTest1); TContactItemId cid = iIterate->NextL(); TInt i = 0; for( ; i < KMaxNumberOfEventsInEventQueue + 10; ++i ) { OpenL( cid ); CommitL( EFalse ); } AddEventL( EContactDbObserverEventContactChanged ); AddContactL( cid ); AddEventL( EContactDbObserverEventUnknownChanges ); AddContactL( -1 ); iMyActive->iCheck = &CNotificationStep::UnkownChangeCheck; iMyActive->Activate(); iStart.UniversalTime(); CActiveScheduler::Start(); }
void CNotificationStep::PlusTransactionUnkownChangeTestL(const TBool aRevert) { INFO_PRINTF1(KTest3); TContactItemId cid = iIterate->NextL(); TInt i = 0; for( ; i < KPlusContacts; ++i ) { OpenL( cid ); CommitL( EFalse ); } TInt many = aRevert ? KPlusContacts : 1; for( i = 0; i < many; ++i ) { AddEventL( EContactDbObserverEventContactChanged ); AddContactL( cid ); } cid = iIterate->NextL(); iContactsDatabase->DatabaseBeginLC(EFalse); for( i = 0; i < KMaxNumberOfEventsInEventQueue + 1; ++i ) { OpenL( cid ); CommitL( ETrue ); } EndTransactionL( aRevert ); if( !aRevert ) { AddEventL( EContactDbObserverEventUnknownChanges ); AddContactL( -1 ); iMyActive->iCheck = &CNotificationStep::UnkownChangeCheck; } else { iMyActive->iCheck = &CNotificationStep::TransactionUnkownChangeCheck; } iMyActive->Activate(); iStart.UniversalTime(); CActiveScheduler::Start(); }
void CConcurrentNotifierStep::DeleteTestL() { INFO_PRINTF1(KTest4); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; TContactItemId cid = iIterate->NextL(); DeleteContactL( cid, EFalse ); AddEventL(EContactDbObserverEventContactDeleted); AddContactL( cid ); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::CloseTablesTestL() { INFO_PRINTF1(KTest6); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); iContactsDatabase->CloseTables(); AddEventL( EContactDbObserverEventTablesClosed ); AddContactL( 0 ); SetMessageCountL(); iStart.UniversalTime(); }
// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void CPosModulesSettings::SearchNewOldOrChangedL( const CPosModulesSettings& aOldSettings, RArray<TPosModulesEvent>& aEvents ) const { CPosModuleIdList* currentList = GetInstalledListLC(); CPosModuleIdList* oldList = aOldSettings.GetInstalledListLC(); // Search removed for ( TInt i = 0; i < oldList->Count(); i++ ) { TPositionModuleId id = (*oldList)[i]; if ( currentList->Find( id ) == KErrNotFound ) { AddEventL( id, EPosModulesEventModuleRemoved, aEvents ); } } // Search installed or changed for ( TInt i = 0; i < currentList->Count(); i++ ) { TPositionModuleId id = (*currentList)[i]; TPosModuleAttributes current; GetAttributes( id, current ); TPosModuleAttributes old; if ( aOldSettings.GetAttributes( id, old ) == KErrNotFound ) { AddEventL( id, EPosModulesEventModuleInstalled, aEvents ); } else { ComparePropertiesL( id, current, old, aEvents ); } } CleanupStack::PopAndDestroy( oldList ); CleanupStack::PopAndDestroy( currentList ); }
/** commit or rollback transaction as necessary, recover database if damage by rollback */ void CNotificationStep::EndTransactionL(const TBool aRevert) { if(aRevert) { iContactsDatabase->DatabaseRollback(); AddEventL( EContactDbObserverEventRollback ); AddContactL( KNullContactId ); CleanupStack::Pop(); if( iContactsDatabase->IsDamaged() ) { iContactsDatabase->RecoverL(); AddEventL( EContactDbObserverEventTablesClosed ); AddContactL( 0 ); AddEventL( EContactDbObserverEventTablesOpened ); AddContactL( 0 ); } } else { iContactsDatabase->DatabaseCommitLP(EFalse); } }
void CConcurrentNotifierStep::AddTestL() { INFO_PRINTF1(KTest3); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; CContactCard* contact = CContactCard::NewLC(iTemplate); TContactItemId cid = iContactsDatabase->AddNewContactL(*contact); iIterate->AddL( cid ); CleanupStack::PopAndDestroy(contact); AddEventL(EContactDbObserverEventContactAdded); AddContactL( cid ); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::UpdateTestL() { INFO_PRINTF1(KTest1); SetSharedTextL(KSharedNextTest,KSingleCharacter , ETrue); iWaiting = ETrue; TContactItemId cid = iIterate->NextL(); ReadL( cid ); iContactsDatabase->UpdateContactLC( cid, iContactItem); CleanupStack::PopAndDestroy(); CloseL( ETrue ); AddEventL(EContactDbObserverEventContactChanged); AddContactL( cid ); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::ChangeOwnCardTestL() { INFO_PRINTF1(KTest14); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); TContactItemId cid = iIterate->NextL(); OpenL( cid ); iContactsDatabase->SetOwnCardL(*iContactItem); CloseL( ETrue ); AddEventL( EContactDbObserverEventOwnCardChanged ); AddContactL( cid ); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::OwnCardDeleteTestL() { INFO_PRINTF1(KTest9); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); TContactItemId cid = iContactsDatabase->OwnCardId(); ReadL( cid ); CloseL( EFalse ); DeleteContactL( cid, EFalse ); AddEventL( EContactDbObserverEventOwnCardDeleted ); AddContactL( cid); SetMessageCountL(); iStart.UniversalTime(); }
static TInt DoTaskL(THelperOp aOperation) { TInt rc = KErrNone; switch(aOperation) { case EDeleteDatabase1: DeleteDatabaseL(ETrue); break; case EDeleteDatabase2: DeleteDatabaseL(EFalse); break; case EIsDatabaseOpen: rc = DatabaseIsOpenL(); break; case EDatabaseSize: rc = DatabaseSizeL(); break; case ECopyCorruptDbFile: CopyDatabaseL(KOldCorruptDatabase); break; case ECopyCorruptDamagedDbFile: CopyDatabaseL(KOldCorruptDamagedDatabase); break; case ECopyOldDbFile: CopyDatabaseL(KOldFormatDatabase); break; case EAddEvent: rc = AddEventL(); break; case EAddTestEvents: AddTestEventsL(); break; case EAddEventType: AddEventTypeL(); break; case EInvalidSchema: TestInvalidSchemaL(); break; case EIsMatchingEnabled: rc = MatchingEnabledL(); break; default: rc = KErrNone; // go away quietly break; } LEAVE_IF_ERROR(rc); return rc; }
// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void CPosModulesSettings::SearchPriorityChangeL( const CPosModulesSettings& aOldSettings, RArray<TPosModulesEvent>& aEvents ) const { if ( iPriorityList.Count() != aOldSettings.iPriorityList.Count() ) { return; } for ( TInt i = 0; i < iPriorityList.Count(); i++ ) { // do UIDs match? if ( iPriorityList[i].iUid != aOldSettings.iPriorityList[i].iUid ) { AddEventL( KNullUid, EPosModulesEventPrioritiesChanged, aEvents ); return; } } }
void CConcurrentNotifierStep::UnkownChangeTestL() { INFO_PRINTF1(KTest13); SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iMyActive->Activate(); TContactItemId cid = iIterate->NextL(); TInt i = 0; iContactsDatabase->DatabaseBeginLC(EFalse); for( ; i < KMaxNumberOfEventsInEventQueue + 1; ++i ) { OpenL( cid ); CommitL( EFalse ); } AddEventL( EContactDbObserverEventUnknownChanges ); AddContactL( -1 ); EndTransactionL(); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::EmptyTransactionTestL() { if( iRevert ) { INFO_PRINTF1(KTest122); } else { INFO_PRINTF1(KTest12); } SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; iContactsDatabase->DatabaseBeginLC(EFalse); AddEventL(KNullEvent); AddContactL( KNullEvent ); EndTransactionL(); SetMessageCountL(); iStart.UniversalTime(); }
void CConcurrentNotifierStep::SingleCommitTransactionTestL() { if( iRevert ) { INFO_PRINTF1(KTest102); } else { INFO_PRINTF1(KTest10); } SetSharedTextL(KSharedNextTest, KSingleCharacter, ETrue); iWaiting = ETrue; TContactItemId cid = iIterate->NextL(); iContactsDatabase->DatabaseBeginLC(EFalse); OpenL( cid ); CommitL( ETrue ); AddEventL(EContactDbObserverEventContactChanged); AddContactL( cid ); EndTransactionL(); SetMessageCountL(); iStart.UniversalTime(); }