messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionSetDefaultConfiguration.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-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 // SetDefaultConfiguration
       
    17 // [Action Parameters]
       
    18 // CMtfConfigurationType::TMtfConfigurationType 	ConfigType <input>: Configuration type to set.
       
    19 // HBufC&	FilePath(s) <input>: Name of the file paths to be set as the input file(s)  
       
    20 // for the specified configuration type for this test case.
       
    21 // There can be more than one parameter, each identifying one input file
       
    22 // [Action Description]
       
    23 // Sets the default input file(s) for the specified configuration type for the test case.
       
    24 // [APIs Used]
       
    25 // none.
       
    26 // __ACTION_INFO_END__
       
    27 // 
       
    28 //
       
    29 
       
    30 /**
       
    31  @file
       
    32 */
       
    33 
       
    34 #include "CMtfTestActionSetDefaultConfiguration.h"
       
    35 #include "CMtfTestCase.h"
       
    36 #include "CMtfTestActionParameters.h"
       
    37 
       
    38 #include <s32file.h>
       
    39 
       
    40 
       
    41 CMtfTestAction* CMtfTestActionSetDefaultConfiguration::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    42 	{
       
    43 	CMtfTestActionSetDefaultConfiguration* self = new (ELeave) CMtfTestActionSetDefaultConfiguration(aTestCase);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL(aActionParameters);
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 	
       
    50 
       
    51 CMtfTestActionSetDefaultConfiguration::CMtfTestActionSetDefaultConfiguration(CMtfTestCase& aTestCase)
       
    52 	: CMtfSynchronousTestAction(aTestCase)
       
    53 	{
       
    54 	}
       
    55 
       
    56 
       
    57 CMtfTestActionSetDefaultConfiguration::~CMtfTestActionSetDefaultConfiguration()
       
    58 	{
       
    59 	}
       
    60 
       
    61 void CMtfTestActionSetDefaultConfiguration::ExecuteActionL()
       
    62 	{
       
    63 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetDefaultConfiguration);
       
    64 	HBufC* paramFilePath = NULL;
       
    65 
       
    66 	/*
       
    67 	TSmsDataCodingScheme::TSmsAlphabet characterSet = ObtainValueParameterL<TSmsDataCodingScheme::TSmsAlphabet>(aTestCase, stringPtr);
       
    68 	*/
       
    69 	CMtfConfigurationType::TMtfConfigurationType configType = ObtainValueParameterL<CMtfConfigurationType::TMtfConfigurationType>(TestCase(), ActionParameters().Parameter(0));
       
    70 	
       
    71 	// Create a ConfigurationType object of the specified type
       
    72 	CMtfConfigurationType* configTypeRecord = CMtfConfigurationType::NewL(configType);
       
    73 	CleanupStack::PushL(configTypeRecord);
       
    74 	
       
    75 	// loop through the parameters and add the files as configuration files to the object
       
    76 	TInt numFiles = ActionParameters().Count() - 1;
       
    77 	
       
    78 	if(numFiles <= 0) // panic if we don't have any parameters
       
    79 		TestCase().Panic(CMtfTestCase::EMtfMissingParameters);
       
    80 
       
    81 	for (TInt i=1; i<=numFiles; i++)
       
    82 		{
       
    83 		paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(i));
       
    84 		configTypeRecord->AddConfigurationFilenameL(paramFilePath->Des());
       
    85 		} 
       
    86 
       
    87 	// Pop it, since the test case will take ownership of it.
       
    88 	CleanupStack::Pop(configTypeRecord); // configTypeRecord
       
    89 	
       
    90 	TestCase().SetTestCaseDefaultConfigurationTypeL(configTypeRecord);
       
    91 
       
    92 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetDefaultConfiguration );
       
    93 	TestCase().ActionCompletedL(*this);
       
    94 	}
       
    95 
       
    96 
       
    97