messagingfw/msgtestfw/TestActions/Sms/src/CMtfTestActionSaveSmsSettings.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // SaveSmsSettings
       
    17 // [Action Parameters]
       
    18 // configFileIndex	<input>:	Index of the config file
       
    19 // smsSettings		<output>:	Settings object
       
    20 // [Action Description]
       
    21 // SaveSmsSettings Test Action is intended to modify and save the existing Sms Service Settings
       
    22 // to CenRep using the configuration settings file.  The Test Action creates the CSmsSettings 
       
    23 // object, parses the settings file and then sets the member variables of the object to the 
       
    24 // corresponding value stored in the settings file.  The CSmsSettings object is then used to 
       
    25 // save the settings into the Central Repository.
       
    26 // [APIs Used]	
       
    27 // CSMSAccount::SaveSettingsL
       
    28 // CSmsSettings::SetCharacterSet
       
    29 // CSmsSettings::SetCommDbAction
       
    30 // CSmsSettings::SetDelivery
       
    31 // CSmsSettings::SetDeliveryReport
       
    32 // CSmsSettings::SetMessageConversion
       
    33 // CSmsSettings::SetDefaultSC
       
    34 // CSmsSettings::SetRejectDuplicate
       
    35 // CSmsSettings::SetReplyPath
       
    36 // CSmsSettings::SetReplyQuoted
       
    37 // CSmsSettings::SetSmsBearer
       
    38 // CSmsSettings::SetSmsBearerAction
       
    39 // CSmsSettings::SetSpecialMessageHandling
       
    40 // CSmsSettings::SetStatusReportHandling
       
    41 // CSmsSettings::SetValidityPeriod
       
    42 // CSmsSettings::SetValidityPeriodFormat
       
    43 // CSmsSettings::AddSCAddressL
       
    44 // CSmsSettings::SetClass2Folder
       
    45 // CSmsSettings::SetDescriptionLength
       
    46 // CSmsSettings::SetCanConcatenate
       
    47 // __ACTION_INFO_END__
       
    48 // 
       
    49 //
       
    50 
       
    51 
       
    52 //#include <smutset.h>
       
    53 
       
    54 #include <csmsaccount.h>
       
    55 
       
    56 #include "CMtfTestActionSaveSmsSettings.h"
       
    57 #include "CMtfTestActionUtilsSmsScripts.h"
       
    58 #include "CMtfTestCase.h"
       
    59 #include "CMtfTestActionParameters.h"
       
    60 
       
    61 /**
       
    62   Function : NewL
       
    63   Description : 
       
    64   @internalTechnology
       
    65   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    66   @param : aActionParams - CMtfTestActionParameters 
       
    67   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSaveSmsSettings object
       
    68   @pre none
       
    69   @post none
       
    70 */
       
    71 CMtfTestAction* CMtfTestActionSaveSmsSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    72 	{
       
    73 	CMtfTestActionSaveSmsSettings* self = new (ELeave) CMtfTestActionSaveSmsSettings(aTestCase);
       
    74 	CleanupStack::PushL(self);
       
    75 	self->ConstructL(aActionParameters);
       
    76 	CleanupStack::Pop(self);
       
    77 	return self;
       
    78 	}
       
    79 
       
    80 
       
    81 
       
    82 /**
       
    83   Function : CMtfTestActionSaveSmsSettings
       
    84   Description : Constructor
       
    85   @internalTechnology
       
    86   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    87   @return : N/A
       
    88   @pre none
       
    89   @post none
       
    90 */
       
    91 CMtfTestActionSaveSmsSettings::CMtfTestActionSaveSmsSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    92 	{
       
    93 	}
       
    94 
       
    95 /**
       
    96   Function : ~CMtfTestActionSaveSmsSettings
       
    97   Description : Destructor
       
    98   @internalTechnology
       
    99   @param :
       
   100   @
       
   101   @pre 
       
   102   @post 
       
   103 */
       
   104 CMtfTestActionSaveSmsSettings::~CMtfTestActionSaveSmsSettings()
       
   105 	{
       
   106 	}
       
   107 
       
   108 /**
       
   109   Function : ExecuteActionL
       
   110   Description : Entry point for the this test action in the test framework
       
   111   @internalTechnology
       
   112   @param : none
       
   113   @return : void
       
   114   @pre none 
       
   115   @post none
       
   116 */
       
   117 void CMtfTestActionSaveSmsSettings::ExecuteActionL()
       
   118 	{
       
   119 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSaveSmsSettings);
       
   120 	CSmsSettings* smsSettings = CSmsSettings::NewL();
       
   121 	CleanupStack::PushL(smsSettings);
       
   122 	
       
   123 	CSmsAccount* smsAccount = CSmsAccount::NewL();
       
   124 	CleanupStack::PushL(smsAccount);
       
   125 	
       
   126 	TInt configFileIndex = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0));
       
   127 	
       
   128 	// Get the settings file name from the test case
       
   129 	const TPtrC settingsFile = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfSmsSettings, configFileIndex);
       
   130 	
       
   131 	// Read SMS settings from config file
       
   132 	CMtfTestActionUtilsSmsScripts::ReadSmsSettingsFromConfigurationFileL(TestCase(), settingsFile, *smsSettings);
       
   133 		
       
   134 	// Save settings to central repository
       
   135 	smsAccount->SaveSettingsL(*smsSettings);
       
   136 	
       
   137 	StoreParameterL<CSmsSettings>(TestCase(), *smsSettings, ActionParameters().Parameter(1));
       
   138 	
       
   139 	CleanupStack::PopAndDestroy(smsAccount);
       
   140 	CleanupStack::Pop(smsSettings);
       
   141 	
       
   142 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSaveSmsSettings);
       
   143 	TestCase().ActionCompletedL(*this);
       
   144 	}
       
   145 
       
   146