messagingfw/msgtestfw/TestActions/SendAs/src/CMtfTestActionSendAsGetAccount.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 // SendAsGetAccount
       
    17 // [Action Parameters]
       
    18 // CSendAsAccounts		paramAvailableAccounts	<input>	:	Reference of CSendAsAccounts object
       
    19 // TInt					paramIndex				<input>	:	Index value
       
    20 // TSendAsAccount		paramAccount			<output>:	Account object present at specified index
       
    21 // [Action Description]
       
    22 // Gets the account from the CSendAsAccounts object which is present at the specified index
       
    23 // [APIs Used]
       
    24 // CSendAsAccounts::Account (TInt aIndex) const
       
    25 // __ACTION_INFO_END__
       
    26 // 
       
    27 //
       
    28 
       
    29 /**
       
    30  @file 
       
    31  @internalTechnology 
       
    32 */
       
    33 
       
    34 
       
    35 // User include
       
    36 #include "CMtfTestActionSendAsGetAccount.h"
       
    37 #include "CMtfTestCase.h"
       
    38 #include "CMtfTestActionParameters.h"
       
    39 
       
    40 
       
    41 /**
       
    42   NewL()
       
    43   Constructs a CMtfTestActionSendAsGetAccount object.
       
    44   Uses two phase construction and leaves nothing on the CleanupStack.   
       
    45   @internalTechnology
       
    46   @param  aTestCase         Test Case to which this Test Action belongs
       
    47   @param  aActionParameters Action parameters, must not be NULL
       
    48   @return Created object of type CMtfTestActionSendAsGetAccount
       
    49   @pre    None
       
    50   @post   CMtfTestActionSendAsGetAccount object is created
       
    51 */
       
    52 CMtfTestAction* CMtfTestActionSendAsGetAccount::
       
    53 		NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    54 	{
       
    55 	CMtfTestActionSendAsGetAccount* self = 
       
    56 							new (ELeave) CMtfTestActionSendAsGetAccount(aTestCase);
       
    57 
       
    58 	CleanupStack::PushL(self);
       
    59 	self->ConstructL(aActionParameters);
       
    60 	CleanupStack::Pop(self);
       
    61 	return self;
       
    62 	}
       
    63 	
       
    64 
       
    65 /**
       
    66   CMtfTestActionSendAsGetAccount constructor
       
    67   Calls the base class' constructor
       
    68   @internalTechnology  
       
    69   @param  aTestCase  Test Case to which this Test Action belongs
       
    70   @pre    None
       
    71   @post   None
       
    72 */ 
       
    73 CMtfTestActionSendAsGetAccount::CMtfTestActionSendAsGetAccount(CMtfTestCase& aTestCase)
       
    74 	: CMtfSynchronousTestAction(aTestCase)
       
    75 	{
       
    76 	}
       
    77 
       
    78 /**
       
    79   Function : ~CMtfTestActionSendAsGetAccount
       
    80   Description : Destructor
       
    81   @internalTechnology
       
    82   @param :
       
    83   @return : 
       
    84   @pre 
       
    85   @post 
       
    86 */
       
    87 CMtfTestActionSendAsGetAccount::~CMtfTestActionSendAsGetAccount()
       
    88 	{
       
    89 	}
       
    90 	
       
    91 /**
       
    92   ExecuteActionL
       
    93 	Obtain the input parameters
       
    94 	1.	paramAvailableAccounts
       
    95 	2.	paramIndex
       
    96 	Create a TSendAsAccount object
       
    97 	Call availableAccoutns::Account(TInt aIndex) passing the index value as input 
       
    98 	parameter, store the returned value in the TSendAsAccount object
       
    99 	Store the TSendAsAccount object as the output parameter of the Test Action by 
       
   100 	calling the StoreParameterL() function
       
   101 
       
   102   @internalTechnology 
       
   103   @pre    None
       
   104   @post   None
       
   105   @leave  System wide errors
       
   106 */
       
   107 void CMtfTestActionSendAsGetAccount::ExecuteActionL()
       
   108 	{
       
   109 	if((TestCase().TestStepResult()) == EPass)
       
   110 		{
       
   111 		TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsGetAccount);
       
   112 		
       
   113 		// Get test action input parameters	
       
   114 		CSendAsAccounts* paramAvailableAccounts	= ObtainParameterReferenceL<CSendAsAccounts>(TestCase(),
       
   115 																		ActionParameters().Parameter(0));
       
   116 		TInt paramIndex 						= ObtainValueParameterL<TInt>(TestCase(),
       
   117 																		ActionParameters().Parameter(1));
       
   118 
       
   119 		TSendAsAccount paramAccount = paramAvailableAccounts->Account(paramIndex);
       
   120 
       
   121 		StoreParameterL<TSendAsAccount>(TestCase(),paramAccount,ActionParameters().Parameter(2));
       
   122 		
       
   123 		TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsGetAccount);
       
   124 		}
       
   125 	TestCase().ActionCompletedL(*this);
       
   126 	}
       
   127