messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionLoadMsvIdParamToFile.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 //
       
    15 
       
    16 #include "CMtfTestActionLoadMsvIdParamToFile.h"
       
    17 
       
    18 #include <e32std.h>
       
    19 #include <e32base.h>
       
    20 #include <s32file.h>
       
    21 
       
    22 #include <msvipc.h>
       
    23 #include "MCLIENT.H"
       
    24 #include "MSERVER.H"
       
    25 
       
    26 
       
    27 #include "CMtfTestCase.h"
       
    28 #include "CMtfTestActionParameters.h"
       
    29 
       
    30 
       
    31 /**
       
    32   Function : NewL
       
    33   Description : 
       
    34   @internalTechnology
       
    35   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    36   @param : aActionParams - CMtfTestActionParameters 
       
    37   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionLoadMsvIdParamToFile object
       
    38   @pre none
       
    39   @post none
       
    40 */
       
    41 CMtfTestAction* CMtfTestActionLoadMsvIdParamToFile::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    42 	{
       
    43 	CMtfTestActionLoadMsvIdParamToFile* self = new (ELeave) CMtfTestActionLoadMsvIdParamToFile(aTestCase);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL(aActionParameters);
       
    46 	CleanupStack::Pop(self);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 /**
       
    51   Function : CMtfTestActionLoadMsvIdParamToFile
       
    52   Description : Constructor
       
    53   @internalTechnology
       
    54   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    55   @return : N/A
       
    56   @pre none
       
    57   @post none
       
    58 */
       
    59 CMtfTestActionLoadMsvIdParamToFile::CMtfTestActionLoadMsvIdParamToFile(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    60 	{
       
    61 	}
       
    62 	
       
    63 /**
       
    64   Function : ~CMtfTestActionLoadMsvIdParamToFile
       
    65   Description : Destructor
       
    66   @internalTechnology
       
    67   @param :
       
    68   @return : 
       
    69   @pre 
       
    70   @post 
       
    71 */
       
    72 CMtfTestActionLoadMsvIdParamToFile::~CMtfTestActionLoadMsvIdParamToFile()
       
    73 	{
       
    74 	}
       
    75 
       
    76 /**
       
    77   Function : ExecuteActionL
       
    78   Description : Entry point for the this test action in the test framework
       
    79   @internalTechnology
       
    80   @param : none
       
    81   @return : void
       
    82   @pre none 
       
    83   @post none
       
    84 */
       
    85 
       
    86 
       
    87 
       
    88 
       
    89 void CMtfTestActionLoadMsvIdParamToFile::ExecuteActionL()
       
    90 	{
       
    91 
       
    92 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionLoadMsvIdParamToFile);
       
    93 	HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(1));
       
    94 	
       
    95 	RFs fs;
       
    96  	User::LeaveIfError( fs.Connect() );
       
    97  	CleanupClosePushL(fs);
       
    98 	
       
    99 	RFileReadStream rf;
       
   100 	TInt err = rf.Open( fs , *paramFilePath , EFileRead );
       
   101 	User::LeaveIfError(err);
       
   102 	rf.PushL();
       
   103 
       
   104 	TMsvId messageId;
       
   105 	rf >> messageId; 
       
   106 
       
   107 	StoreParameterL<TMsvId>(TestCase(), messageId, ActionParameters().Parameter(0) );
       
   108 	
       
   109 	rf.Pop();
       
   110 	rf.Release();
       
   111 	
       
   112 	CleanupStack::PopAndDestroy(); // fs
       
   113 		
       
   114 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionLoadMsvIdParamToFile);
       
   115 	TestCase().ActionCompletedL(*this);	
       
   116 
       
   117 	
       
   118 	}