telephonyserverplugins/common_tsy/test/component/src/cctsymailboxnumbersfu.cpp
changeset 19 1f776524b15c
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
--- a/telephonyserverplugins/common_tsy/test/component/src/cctsymailboxnumbersfu.cpp	Tue Feb 02 01:41:59 2010 +0200
+++ b/telephonyserverplugins/common_tsy/test/component/src/cctsymailboxnumbersfu.cpp	Fri Mar 19 09:55:57 2010 +0200
@@ -28,11 +28,16 @@
 #include "tmockltsydata.h"
 #include <ctsy/serviceapi/gsmerror.h>
 
+const TInt KOneSecond=1000000;  // Used in a time out function, 1 second (in microSeconds)
+
 CTestSuite* CCTsyMailboxNumbersFU::CreateSuiteL(const TDesC& aName)
 	{
 	SUB_SUITE;
 
-	ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001L);
+    ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001L);
+    ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001bL);
+    ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001cL);
+    ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001dL);
 	ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0002L);
 	ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0003L);
 	ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0004L);
@@ -63,6 +68,11 @@
 	OpenEtelServerL(EUseExtendedError);
 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
 	OpenPhoneL();
+	
+	RMobilePhoneBookStore bookStore;
+	TName name(KETelIccVoiceMailBox);
+	OpenPhoneBookStoreL(bookStore, name, iPhone);
+	CleanupClosePushL(bookStore);
 
 	RBuf8 data;
 	CleanupClosePushL(data);
@@ -147,10 +157,272 @@
 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
 	AssertMockLtsyStatusL();
 
-	CleanupStack::PopAndDestroy(2, this); // data, this
+	CleanupStack::PopAndDestroy(3, this); // data, bookStore, this
 	
 	}
 
+/**
+@SYMTestCaseID BA-CTSY-MBXN-MGMN-0001b
+@SYMComponent  telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetMailboxNumbers when VMBX storage is not exist
+@SYMTestPriority High
+@SYMTestActions Invokes RMobilePhone::GetMailboxNumbers
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0001bL()
+    {
+	// Since we can not read the mail box number from the SIM if the VMBX storage was not initilized, the 
+	// CTSY must make sure that the VMBX storage was initilize before requesting the mail box number from 
+	// the LTSY. This test test if the CTSY knows to create a new VMBX and wait for the initilization to complete.
+    OpenEtelServerL(EUseExtendedError);
+    CleanupStack::PushL(TCleanupItem(Cleanup,this));
+    OpenPhoneL();
+    
+    RBuf8 data;
+    CleanupClosePushL(data);
+
+    TRequestStatus reqStatus;
+
+    TName name(KETelIccVoiceMailBox);
+    TMockLtsyPhoneBookData0 storeInitData(name);
+    storeInitData.SerialiseL(data);
+    iMockLTSY.ExpectL(EMmTsyPhoneBookStoreInitIPC, data);   
+
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds;
+    voicemailIds.iVoice = 1;
+    voicemailIds.iData = 2;
+    voicemailIds.iFax = 3;
+    voicemailIds.iOther = 4;
+    RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds);
+
+    iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    User::After(KOneSecond);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+
+    CStorageInfoData storageData;
+    SetStorageInfoData(storageData);
+    
+    // only after the book store is ready, and CTSY can send the EMobilePhoneGetMailboxNumbers.
+	TMockLtsyPhoneBookData1< CStorageInfoData > retStoreInitC(name, storageData);
+    data.Close();
+    retStoreInitC.SerialiseL(data);
+    iMockLTSY.CompleteL(EMmTsyPhoneBookStoreInitIPC, KErrNone, data, 0);
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds;
+    expVoicemailIds.iVoice = 1;
+    expVoicemailIds.iData = 2;
+    expVoicemailIds.iFax = 3;
+    expVoicemailIds.iOther = 4;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                                 voicemailIdsData( expVoicemailIds );
+    data.Close();
+    voicemailIdsData.SerialiseL(data);
+    iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data, KErrNone);
+
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    User::After(KOneSecond);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                 completeVoicemailIdsData( completeVoicemailIds );
+    completeVoicemailIds.iVoice = 5;
+    completeVoicemailIds.iData = 6;
+    completeVoicemailIds.iFax = 7;
+    completeVoicemailIds.iOther = 8;
+    data.Close();
+    completeVoicemailIdsData.SerialiseL(data);
+    iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data);
+    
+    User::WaitForRequest(reqStatus);
+    ASSERT_EQUALS(KErrNone, reqStatus.Int());
+    AssertMockLtsyStatusL();
+    ASSERT_EQUALS(completeVoicemailIds.iVoice, voicemailIds.iVoice);
+    ASSERT_EQUALS(completeVoicemailIds.iData,  voicemailIds.iData);
+    ASSERT_EQUALS(completeVoicemailIds.iFax,   voicemailIds.iFax);
+    ASSERT_EQUALS(completeVoicemailIds.iOther, voicemailIds.iOther);
+ 
+    CleanupStack::PopAndDestroy(2, this); // data, this
+    
+    }
+
+/**
+@SYMTestCaseID BA-CTSY-MBXN-MGMN-0001c
+@SYMComponent  telephony_ctsy
+@SYMTestCaseDesc support in CTSY for RMobilePhone::GetMailboxNumbers when VMBX storage is exist but not ready
+@SYMTestPriority High
+@SYMTestActions Invokes RMobilePhone::GetMailboxNumbers
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0001cL()
+    {
+	// Since we can not read the mail box number from the SIM if the VMBX storage was not initilized, the 
+	// CTSY must make sure that the VMBX storage was initilize before requesting the mail box number from 
+	// the LTSY. This test test if the CTSY knows to wait for an previous initilize request to complete 
+	// before requesting to get the mail box number.
+
+    OpenEtelServerL(EUseExtendedError);
+    CleanupStack::PushL(TCleanupItem(Cleanup,this));
+    OpenPhoneL();
+    
+    RBuf8 data;
+    CleanupClosePushL(data);
+
+    TRequestStatus reqStatus;
+
+    TName name(KETelIccVoiceMailBox);
+    TMockLtsyPhoneBookData0 storeInitData(name);
+    storeInitData.SerialiseL(data);
+    iMockLTSY.ExpectL(EMmTsyPhoneBookStoreInitIPC, data);   
+
+    RMobilePhoneBookStore bookStore;
+    CleanupClosePushL(bookStore);
+    TInt ret = bookStore.Open(iPhone, name);    
+    ASSERT_EQUALS(KErrNone, ret);   
+    
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds;
+    voicemailIds.iVoice = 1;
+    voicemailIds.iData = 2;
+    voicemailIds.iFax = 3;
+    voicemailIds.iOther = 4;
+    RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds);
+
+    iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    User::After(KOneSecond);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+
+    CStorageInfoData storageData;
+    SetStorageInfoData(storageData);
+    
+    TMockLtsyPhoneBookData1< CStorageInfoData > retStoreInitC(name, storageData);
+    data.Close();
+    retStoreInitC.SerialiseL(data);
+    iMockLTSY.CompleteL(EMmTsyPhoneBookStoreInitIPC, KErrNone, data, 0);
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds;
+    expVoicemailIds.iVoice = 1;
+    expVoicemailIds.iData = 2;
+    expVoicemailIds.iFax = 3;
+    expVoicemailIds.iOther = 4;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                                 voicemailIdsData( expVoicemailIds );
+    data.Close();
+    voicemailIdsData.SerialiseL(data);
+    iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data, KErrNone);
+
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    User::After(KOneSecond);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                 completeVoicemailIdsData( completeVoicemailIds );
+    completeVoicemailIds.iVoice = 5;
+    completeVoicemailIds.iData = 6;
+    completeVoicemailIds.iFax = 7;
+    completeVoicemailIds.iOther = 8;
+    data.Close();
+    completeVoicemailIdsData.SerialiseL(data);
+    iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data);
+    
+    User::WaitForRequest(reqStatus);
+    ASSERT_EQUALS(KErrNone, reqStatus.Int());
+    AssertMockLtsyStatusL();
+    ASSERT_EQUALS(completeVoicemailIds.iVoice, voicemailIds.iVoice);
+    ASSERT_EQUALS(completeVoicemailIds.iData,  voicemailIds.iData);
+    ASSERT_EQUALS(completeVoicemailIds.iFax,   voicemailIds.iFax);
+    ASSERT_EQUALS(completeVoicemailIds.iOther, voicemailIds.iOther);
+ 
+    CleanupStack::PopAndDestroy(3, this); // data, bookStore, this
+    
+    }
+
+/**
+@SYMTestCaseID BA-CTSY-MBXN-MGMN-0001d
+@SYMComponent  telephony_ctsy
+@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetMailboxNumbers when VMBX storage is not exist but another phone book store (ADN) exist
+@SYMTestPriority High
+@SYMTestActions Invokes RMobilePhone::GetMailboxNumbers
+@SYMTestExpectedResults Pass
+@SYMTestType CT
+*/
+void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0001dL()
+    {
+	// Since we can not read the mail box number from the SIM if the VMBX storage was not initilized, the 
+	// CTSY must make sure that the VMBX storage was initilize before requesting the mail box number from 
+	// the LTSY. This test test if the CTSY knows that another phone book store (ADN) initilization would do.
+
+    OpenEtelServerL(EUseExtendedError);
+    CleanupStack::PushL(TCleanupItem(Cleanup,this));
+    OpenPhoneL();
+    
+    TName name(KETelIccAdnPhoneBook);
+    RMobilePhoneBookStore adnBookStore;
+    OpenPhoneBookStoreL(adnBookStore, name, iPhone);
+    CleanupClosePushL(adnBookStore);
+    
+    RBuf8 data;
+    CleanupClosePushL(data);
+
+    TRequestStatus reqStatus;
+
+    RMobilePhoneBookStore bookStore;
+    CleanupClosePushL(bookStore);
+    TInt ret = bookStore.Open(iPhone, name);    
+    ASSERT_EQUALS(KErrNone, ret);   
+    
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds;
+    voicemailIds.iVoice = 1;
+    voicemailIds.iData = 2;
+    voicemailIds.iFax = 3;
+    voicemailIds.iOther = 4;
+    RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds);
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds;
+    expVoicemailIds.iVoice = 1;
+    expVoicemailIds.iData = 2;
+    expVoicemailIds.iFax = 3;
+    expVoicemailIds.iOther = 4;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                                 voicemailIdsData( expVoicemailIds );
+    data.Close();
+    voicemailIdsData.SerialiseL(data);
+    iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data, KErrNone);
+    
+    iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+    User::After(KOneSecond);
+    ASSERT_EQUALS(KRequestPending, reqStatus.Int());
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds;
+    TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3>
+                                 completeVoicemailIdsData( completeVoicemailIds );
+    completeVoicemailIds.iVoice = 5;
+    completeVoicemailIds.iData = 6;
+    completeVoicemailIds.iFax = 7;
+    completeVoicemailIds.iOther = 8;
+    data.Close();
+    completeVoicemailIdsData.SerialiseL(data);
+    iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data);
+    
+    User::WaitForRequest(reqStatus);
+    ASSERT_EQUALS(KErrNone, reqStatus.Int());
+    AssertMockLtsyStatusL();
+    ASSERT_EQUALS(completeVoicemailIds.iVoice, voicemailIds.iVoice);
+    ASSERT_EQUALS(completeVoicemailIds.iData,  voicemailIds.iData);
+    ASSERT_EQUALS(completeVoicemailIds.iFax,   voicemailIds.iFax);
+    ASSERT_EQUALS(completeVoicemailIds.iOther, voicemailIds.iOther);
+ 
+    CleanupStack::PopAndDestroy(4, this); // data, adnBookStore, bookStore, this
+    
+    }
 
 /**
 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0002
@@ -171,6 +443,11 @@
 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
 	OpenPhoneL();
 
+    RMobilePhoneBookStore bookStore;
+    TName name(KETelIccVoiceMailBox);
+    OpenPhoneBookStoreL(bookStore, name, iPhone);
+    CleanupClosePushL(bookStore);
+
 	TRequestStatus mockLtsyStatus;
 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
 
@@ -208,7 +485,7 @@
 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
 	AssertMockLtsyStatusL();
 
-	CleanupStack::PopAndDestroy(2); // data, this
+	CleanupStack::PopAndDestroy(3); // data, bookStore, this
 	
 	}
 
@@ -264,6 +541,11 @@
 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
 	OpenPhoneL();
 
+    RMobilePhoneBookStore bookStore;
+    TName name(KETelIccVoiceMailBox);
+    OpenPhoneBookStoreL(bookStore, name, iPhone);
+    CleanupClosePushL(bookStore);
+
 	RBuf8 data;
 	CleanupClosePushL(data);
 
@@ -323,7 +605,7 @@
 
 	AssertMockLtsyStatusL();
 	// Done !
-	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
+	CleanupStack::PopAndDestroy(5, this); // phone2, bookStore, telServer2, data, this
 
 	}
 
@@ -345,6 +627,11 @@
 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
 	OpenPhoneL();
 
+    RMobilePhoneBookStore bookStore;
+    TName name(KETelIccVoiceMailBox);
+    OpenPhoneBookStoreL(bookStore, name, iPhone);
+    CleanupClosePushL(bookStore);
+
 	RBuf8 data;
 	CleanupClosePushL(data);
 
@@ -368,7 +655,7 @@
 	AssertMockLtsyStatusL();
 
 	// Done !
-	CleanupStack::PopAndDestroy(2, this); // data, this
+	CleanupStack::PopAndDestroy(3, this); // data, bookStore, this
 
 	}