TVerdict CCTSYIntegrationTestSMSPStore0001::doTestStepL() /** * @SYMTestCaseID BA-CTSY-INT-SMSP-0001 * @SYMFssID BA/CTSY/SMSP-0001 * @SYMTestCaseDesc Store and retrieve a SMSP list. * @SYMTestPriority High * @SYMTestActions RMobileSmsMessaging::StoreSmspListL, CRetrieveMobilePhoneSmspList::Start, CMobilePhoneSmspList::NewL, CRetrieveMobilePhoneSmspList::NewL, CMobilePhoneSmspList::AddEntryL, RMobileSmsMessaging::NotifySmspListChange * @SYMTestExpectedResults Pass - SMSP list stored and retrieved correctly. * @SYMTestType CIT * @SYMTestCaseDependencies live/automatic * * Reason for test: Verify list can be stored and retrieved list contains correct entries. * * @return - TVerdict code */ { // // SET UP // // Get the RMobileSmsMessaging subsession RMobileSmsMessaging& smsMessaging = iEtelSessionMgr.GetSmsMessagingL(KMainServer,KMainPhone,KMainSmsMessaging); // Ensure RMobileSmsMessaging::GetCaps returns aCaps.iSmsControl caps in set of KCapsSetSmspList | KCapsGetSmspList RMobileSmsMessaging::TMobileSmsCapsV1 smsCaps; RMobileSmsMessaging::TMobileSmsCapsV1Pckg smsCapsPckg(smsCaps); CHECK_EQUALS_L(smsMessaging.GetCaps(smsCapsPckg),KErrNone, _L("RMobileSmsMessaging::GetCaps returned returned with an error")); TUint32 expectedCaps= RMobileSmsMessaging::KCapsSetSmspList | RMobileSmsMessaging::KCapsGetSmspList; CHECK_BITS_SET_L(smsCaps.iSmsControl, expectedCaps, KNoUnwantedBits, _L("RMobileSmsMessaging::GetCaps returned with unexpected caps")); // Take the backup of the SMSP list. TInt listCountAtStart; TBackupList backup(*this,smsMessaging); CHECK_TRUE_L(backup.BackupL(listCountAtStart), _L("TBackupList::Backup could not backup")); CleanupStack::PushL (backup); // // SET UP END // StartTest(); // // TEST START // // === Store SMSP list === // Create a CMobilePhoneSmspList with CMobilePhoneSmspList::NewL CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); CleanupStack::PushL(smspList); // Create a RMobileSmsMessaging::TMobileSmspEntryV1 entry with the following parameters: RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry; smspEntry.iText = _L("VODAFONE"); smspEntry.iValidParams = RMobileSmsMessaging::KSCAIncluded | RMobileSmsMessaging::KProtocolIdIncluded | RMobileSmsMessaging::KDcsIncluded | RMobileSmsMessaging::KValidityPeriodIncluded; smspEntry.iDestination.iTelNumber = _L(""); smspEntry.iDestination.iNumberPlan = RMobilePhone::EUnknownNumberingPlan; smspEntry.iDestination.iTypeOfNumber = RMobilePhone::EUnknownNumber; smspEntry.iValidityPeriod = 183; smspEntry.iServiceCentre.iTelNumber = _L("+441632960000"); smspEntry.iServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry.iServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry.iProtocolId = 0; smspEntry.iDcs = 0; smspEntry.iIndex = 1; // Add the entry to the CMobilePhoneSmspList list with CMobilePhoneSmspList::AddEntryL smspList->AddEntryL(smspEntry); // Post notification for RMobileSmsMessaging::NotifySmspListChange TExtEtelRequestStatus notifySmspListChangeStatus(smsMessaging, EMobileSmsMessagingNotifySmspListChange); CleanupStack::PushL(notifySmspListChangeStatus); smsMessaging.NotifySmspListChange(notifySmspListChangeStatus); // This is deliberate action to open a session because the API in Etelmm allocates memory // The Session Manager should be used in all other places. RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone); RMobileSmsMessaging smsMessagingStore; User::LeaveIfError(smsMessagingStore.Open(phone)); // Store the empty SMSP list with RMobileSmsMessaging::StoreSmspListL TExtEtelRequestStatus storeSmspListStatus(smsMessaging, EMobileSmsMessagingStoreSmspList); CleanupStack::PushL(storeSmspListStatus); smsMessagingStore.StoreSmspListL(storeSmspListStatus,smspList); ASSERT_EQUALS(WaitForRequestWithTimeOut(storeSmspListStatus, ETimeMedium),KErrNone, _L("RMobileSmsMessaging::StoreSmspListL timed out")); ASSERT_EQUALS(storeSmspListStatus.Int(), KErrNone, _L("RMobileSmsMessaging::StoreSmspListL returned with an error")); smsMessagingStore.Close(); // Check RMobileSmsMessaging::NotifySmspListChange completes with KErrNone TInt expectedStatus = KErrNone; iSmsMessagingTestHelper.WaitForMobileSmsMessagingNotifySmspListChange(notifySmspListChangeStatus,expectedStatus); // === Retrieve list and check it is the same as the stored list === // Use the helper class for CRetrieveMobilePhoneSmspList to retrieve the SMSP list. TInt err=0; CRetrieveMobilePhoneSmspListExec* smspListExec = CRetrieveMobilePhoneSmspListHelper::NewL(smsMessaging); CleanupStack::PushL(smspListExec); CMobilePhoneSmspList* mobileSmspList = smspListExec->DoGetList(err); ASSERT_EQUALS(err, KErrNone, _L("CRetrieveMobilePhoneSmspList::Start returned with an error")); // Check CRetrieveMobilePhoneSmspList::Enumerate returns 1 using the helper class function TInt listEntries=mobileSmspList->Enumerate(); if(listCountAtStart==0) { ASSERT_EQUALS(listEntries, 1, _L("CRetrieveMobilePhoneSmspList::Enumerate did not return one entry as expected")); } else { ASSERT_EQUALS(listCountAtStart,listEntries, _L("CRetrieveMobilePhoneSmspList::Enumerate did not return number of entries as expected")); } // Check the entry in the CMobilePhoneSmspList is the same the entry stored RMobileSmsMessaging::TMobileSmspEntryV1 item; item=mobileSmspList->GetEntryL(0); // zero is the first index in retrieval list ASSERT_TRUE(CompareEntries(item,smspEntry),_L("Comparison of stroed enteries failed")); // // TEST END // StartCleanup(); // Pop : // backup // smspList // notifySmspListChangeStatus // storeSmspListStatus // smspListExec; CleanupStack::PopAndDestroy(5, &backup); return TestStepResult(); }
TVerdict CCTSYIntegrationTestSMSPStore0002::doTestStepL() /** * @SYMTestCaseID BA-CTSY-INT-SMSP-0002 * @SYMFssID BA/CTSY/SMSP-0002 * @SYMTestCaseDesc Store an SMSP list with multiple entries. * @SYMTestPriority High * @SYMTestActions This requires an O2 SIM or anyother, which can store multiple entries in SMSP List RMobileSmsMessaging::StoreSmspListL, CRetrieveMobilePhoneSmspList::RetrieveListL * @SYMTestExpectedResults Pass - SMSP list stored. * @SYMTestType CIT * @SYMTestCaseDependencies live/manual * * Reason for test: Verify list can be stored and retrieved list contains correct entries. * * @return - TVerdict code */ { // // SET UP // // Get the RMobileSmsMessaging subsession RMobileSmsMessaging& smsMessaging = iEtelSessionMgr.GetSmsMessagingL(KMainServer,KMainPhone,KMainSmsMessaging); // Ensure RMobileSmsMessaging::GetCaps returns aCaps.iSmsControl caps in set of KCapsSetSmspList | KCapsGetSmspList RMobileSmsMessaging::TMobileSmsCapsV1 smsCaps; RMobileSmsMessaging::TMobileSmsCapsV1Pckg smsCapsPckg(smsCaps); CHECK_EQUALS_L(smsMessaging.GetCaps(smsCapsPckg),KErrNone, _L("RMobileSmsMessaging::GetCaps returned returned with an error")); TUint32 expectedCaps= RMobileSmsMessaging::KCapsSetSmspList | RMobileSmsMessaging::KCapsGetSmspList; CHECK_BITS_SET_L(smsCaps.iSmsControl, expectedCaps, KNoUnwantedBits, _L("RMobileSmsMessaging::GetCaps returned with unexpected caps")); // Take the backup of SMSP list. TInt listCountAtStart; TBackupList backup(*this,smsMessaging); CHECK_TRUE_L(backup.BackupL(listCountAtStart), _L("TBackupList::Backup could not backup")); CleanupStack::PushL (backup); // // SET UP END // StartTest(); // // TEST START // TBuf<130> prompt(_L("You need to insert an O2 SIM before running that test, because O2 SIM can store multiple(3) entries in the list")); DisplayUserInteractionPromptL(prompt); // 30 seconds // === Store SMSP list === // Create a CMobilePhoneSmspList with CMobilePhoneSmspList::NewL CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); CleanupStack::PushL(smspList); // Create a RMobileSmsMessaging::TMobileSmspEntryV1 entry with the following parameters: RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry; smspEntry.iText = _L("ABCD"); smspEntry.iValidParams = RMobileSmsMessaging::KDestinationIncluded | RMobileSmsMessaging::KSCAIncluded | RMobileSmsMessaging::KProtocolIdIncluded | RMobileSmsMessaging::KDcsIncluded | RMobileSmsMessaging::KValidityPeriodIncluded; smspEntry.iDestination.iTelNumber = _L("+1234567890"); smspEntry.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry.iValidityPeriod = 0; smspEntry.iServiceCentre.iTelNumber = _L("+123"); smspEntry.iServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry.iServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry.iProtocolId = 2; smspEntry.iDcs = 4; smspEntry.iIndex = 1; // Add the entry to the CMobilePhoneSmspList list with CMobilePhoneSmspList::AddEntryL smspList->AddEntryL(smspEntry); // Create another RMobileSmsMessaging::TMobileSmspEntryV1 entry with the following parameters: RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry2; smspEntry2.iText = _L("EFGH"); smspEntry2.iValidParams = RMobileSmsMessaging::KDestinationIncluded | RMobileSmsMessaging::KSCAIncluded | RMobileSmsMessaging::KProtocolIdIncluded | RMobileSmsMessaging::KDcsIncluded | RMobileSmsMessaging::KValidityPeriodIncluded; smspEntry2.iDestination.iTelNumber = _L("+987654"); smspEntry2.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry2.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry2.iValidityPeriod = 0; smspEntry2.iServiceCentre.iTypeOfNumber=RMobilePhone::EInternationalNumber; smspEntry2.iServiceCentre.iNumberPlan=RMobilePhone:: EIsdnNumberPlan; smspEntry2.iServiceCentre.iTelNumber=_L("+456"); smspEntry2.iProtocolId = 2; smspEntry2.iDcs = 4; smspEntry2.iIndex = 2; // Add the entry to the CMobilePhoneSmspList list with CMobilePhoneSmspList::AddEntryL smspList->AddEntryL(smspEntry2); // Create another RMobileSmsMessaging::TMobileSmspEntryV1 entry with the following parameters: RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry3; smspEntry3.iText = _L("IJKL"); smspEntry3.iValidParams = RMobileSmsMessaging::KDestinationIncluded | RMobileSmsMessaging::KSCAIncluded | RMobileSmsMessaging::KProtocolIdIncluded | RMobileSmsMessaging::KDcsIncluded | RMobileSmsMessaging::KValidityPeriodIncluded; smspEntry3.iDestination.iTelNumber = _L("+12456"); smspEntry3.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry3.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry3.iValidityPeriod = 0; smspEntry3.iServiceCentre.iTelNumber = _L("+789"); smspEntry3.iServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan; smspEntry3.iServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber; smspEntry3.iProtocolId = 2; smspEntry3.iDcs = 4; smspEntry3.iIndex = 3; // Add the entry to the CMobilePhoneSmspList list with CMobilePhoneSmspList::AddEntryL smspList->AddEntryL(smspEntry3); // Post notification for RMobileSmsMessaging::NotifySmspListChange TExtEtelRequestStatus notifySmspListChangeStatus(smsMessaging, EMobileSmsMessagingNotifySmspListChange); CleanupStack::PushL(notifySmspListChangeStatus); smsMessaging.NotifySmspListChange(notifySmspListChangeStatus); // Store the empty SMSP list with RMobileSmsMessaging::StoreSmspListL TExtEtelRequestStatus storeSmspListStatus(smsMessaging, EMobileSmsMessagingStoreSmspList); CleanupStack::PushL(storeSmspListStatus); smsMessaging.StoreSmspListL(storeSmspListStatus,smspList); ASSERT_EQUALS(WaitForRequestWithTimeOut(storeSmspListStatus, ETimeMedium),KErrNone, _L("RMobileSmsMessaging::StoreSmspListL timed out")); ASSERT_EQUALS(storeSmspListStatus.Int(), KErrNone, _L("RMobileSmsMessaging::StoreSmspListL returned with an error")); // Check RMobileSmsMessaging::NotifySmspListChange completes with KErrNone TInt expectedStatus = KErrNone; iSmsMessagingTestHelper.WaitForMobileSmsMessagingNotifySmspListChange(notifySmspListChangeStatus,expectedStatus); // === Retrieve list and check it is the same as the stored list === // Use the helper class for CRetrieveMobilePhoneSmspList to retrieve the SMSP list. TInt err=0; CRetrieveMobilePhoneSmspListExec* smspListExec = CRetrieveMobilePhoneSmspListHelper::NewL(smsMessaging); CleanupStack::PushL(smspListExec); CMobilePhoneSmspList* mobileSmspList = smspListExec->DoGetList(err); ASSERT_EQUALS(err, KErrNone, _L("CRetrieveMobilePhoneSmspList::Start returned with an error")); // Check CRetrieveMobilePhoneSmspList::Enumerate returns 3 using the helper class TInt listEnteries=mobileSmspList->Enumerate(); ASSERT_EQUALS(listEnteries, 3, _L("CRetrieveMobilePhoneSmspList::Enumerate did not return the correct number of enteries")); // Check the entry in the CMobilePhoneSmspList is the same the entry stored RMobileSmsMessaging::TMobileSmspEntryV1 item; RMobileSmsMessaging::TMobileSmspEntryV1 tempSmspEntry; for(TInt i=0;i<listEnteries;i++) { item=mobileSmspList->GetEntryL(i); if(i==0) tempSmspEntry=smspEntry; else if(i==1) tempSmspEntry=smspEntry2; else tempSmspEntry=smspEntry3; ASSERT_TRUE(CompareEntries(tempSmspEntry,item),_L("Comparison of stroed enteries failed")); } // // TEST END // StartCleanup(); // Pop: // backup // smspListExec; // storeSmspListStatus // notifySmspListChangeStatus); // smspList CleanupStack::PopAndDestroy(5, &backup); return TestStepResult(); }
void CCompareResultsDlg::DoAllFunctions(const int ifunction) { // Shouldn't ever get here if original is R-O if (m_bOriginalDBReadOnly) return; CGeneralMsgBox gmb; CString cs_msg; const CString cs_originaldb(MAKEINTRESOURCE(IDS_ORIGINALDB)); const CString cs_comparisondb(MAKEINTRESOURCE(IDS_COMPARISONDB)); cs_msg.Format(ifunction == COPYALL_TO_ORIGINALDB ? IDS_COPYALL : IDS_SYNCHRONIZEALL, cs_comparisondb, cs_originaldb); // Check if any records have unknown fields POSITION pos = m_LCResults.GetFirstSelectedItemPosition(); while (pos) { int irow = m_LCResults.GetNextSelectedItem(pos); CString cs_text = m_LCResults.GetItemText(irow, 1); if (cs_text.Right(1) == L"*") { cs_msg += CString(MAKEINTRESOURCE(IDS_COPYUNKNOWNFIELDS)); break; } } if (gmb.AfxMessageBox(cs_msg, NULL, MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES) return; // Get vector of all the data pos = m_LCResults.GetFirstSelectedItemPosition(); std::vector<st_CompareData *> vpst_data; while (pos) { int irow = m_LCResults.GetNextSelectedItem(pos); DWORD_PTR dwItemData = m_LCResults.GetItemData(irow); st_CompareData *pst_data = GetCompareData(dwItemData); ASSERT(pst_data != NULL); vpst_data.push_back(pst_data); } // Do it LRESULT lres = ProcessAllFunction(ifunction, vpst_data); if (lres != TRUE) return; size_t index = 0; pos = m_LCResults.GetFirstSelectedItemPosition(); while (pos) { const int irow = m_LCResults.GetNextSelectedItem(pos); ASSERT(index < vpst_data.size()); st_CompareData *pst_data = vpst_data[index]; bool bNowEqual = true; // Must be if copied, now check if synch'd if (ifunction == SYNCHALL) bNowEqual = CompareEntries(pst_data); if (bNowEqual) { // Update Compare results if (pst_data->unknflds0) m_LCResults.SetItemText(irow, CURRENT, L"=*"); else m_LCResults.SetItemText(irow, CURRENT, L"="); if (pst_data->unknflds1) m_LCResults.SetItemText(irow, COMPARE, L"=*"); else m_LCResults.SetItemText(irow, COMPARE, L"="); for (int i = 0; i < m_nCols - 5; i++) m_LCResults.SetItemText(irow, USER + 1 + i, L"-"); st_CompareData st_newdata; st_newdata = *pst_data; st_newdata.bsDiffs.reset(); const int id = pst_data->id; CompareData::iterator cd_iter; switch (pst_data->indatabase) { case BOTH: m_numConflicts--; cd_iter = std::find_if(m_Conflicts.begin(), m_Conflicts.end(), std::bind2nd(std::equal_to<int>(), id)); if (cd_iter != m_Conflicts.end()) m_Conflicts.erase(cd_iter); break; case COMPARE: m_numOnlyInComp--; cd_iter = std::find_if(m_OnlyInComp.begin(), m_OnlyInComp.end(), std::bind2nd(std::equal_to<int>(), id)); if (cd_iter != m_OnlyInComp.end()) m_OnlyInComp.erase(cd_iter); break; case CURRENT: case IDENTICAL: default: ASSERT(0); } m_numIdentical++; st_newdata.id = static_cast<int>(m_numIdentical); st_newdata.indatabase = IDENTICAL; m_Identical.push_back(st_newdata); m_LCResults.SetItemData(m_LCResults.GetRow(), MAKELONG(IDENTICAL, st_newdata.id)); } index++; } UpdateStatusBar(); m_OriginalDBChanged = true; }