messagingfw/msgtestfw/TestActions/Mms/src/CMtfTestActionSetMmsServiceParameters.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 // SetMmsServiceParameters
       
    17 // [Action Parameters]
       
    18 // Session                   <input>: Reference to the session.
       
    19 // ServiceId                 <input>: Value of the Mms service id.
       
    20 // (ConfigIndexSettingsFile) <input>: Value of config index for settings file. Default is 0. 
       
    21 // [Action Description]
       
    22 // Sets parameters of Mms service.
       
    23 // [APIs Used]
       
    24 // CMsvEntry::SetEntryL
       
    25 // CMsvEntry::EditStoreL
       
    26 // CImMmsSettings::Reset
       
    27 // CImMmsSettings::SetServerAddressL
       
    28 // CImMmsSettings::SetEmailAddressL
       
    29 // CImMmsSettings::StoreL
       
    30 // CMsvStore::CommitL
       
    31 // __ACTION_INFO_END__
       
    32 // 
       
    33 //
       
    34 
       
    35 /**
       
    36  @file
       
    37 */
       
    38 
       
    39 
       
    40 #include "CMtfTestActionSetMmsServiceParameters.h"
       
    41 #include "CMtfTestCase.h"
       
    42 #include "CMtfTestActionParameters.h"
       
    43 #include "CMtfConfigurationType.h"
       
    44 
       
    45 #include <msvapi.h>
       
    46 #include <MmsSettings.h>
       
    47 
       
    48 _LIT(KServerName,"ServerName");
       
    49 
       
    50 
       
    51 CMtfTestAction* CMtfTestActionSetMmsServiceParameters::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    52 	{
       
    53 	CMtfTestActionSetMmsServiceParameters* self = new (ELeave) CMtfTestActionSetMmsServiceParameters(aTestCase);
       
    54 	CleanupStack::PushL(self);
       
    55 	self->ConstructL(aActionParameters);
       
    56 	CleanupStack::Pop();
       
    57 	return self;
       
    58 	}
       
    59 	
       
    60 
       
    61 CMtfTestActionSetMmsServiceParameters::CMtfTestActionSetMmsServiceParameters(CMtfTestCase& aTestCase)
       
    62 	: CMtfSynchronousTestAction(aTestCase)
       
    63 	{
       
    64 	}
       
    65 
       
    66 
       
    67 CMtfTestActionSetMmsServiceParameters::~CMtfTestActionSetMmsServiceParameters()
       
    68 	{
       
    69 	delete iParser;
       
    70 	}
       
    71 
       
    72 
       
    73 void CMtfTestActionSetMmsServiceParameters::ExecuteActionL()
       
    74 	{
       
    75 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    76 	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    77 	TInt paramConfigIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2),0);
       
    78 
       
    79 	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramServiceId,TMsvSelectionOrdering());
       
    80 	CleanupStack::PushL(entry);
       
    81 	entry->SetEntryL(paramServiceId);
       
    82 	CMsvStore* store = entry->EditStoreL();
       
    83 	CleanupStack::PushL(store);
       
    84 	CMmsSettings* settings = CMmsSettings::NewL();
       
    85 	CleanupStack::PushL(settings);
       
    86 	TPtrC fileName = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfMmsSettings,paramConfigIndex);
       
    87 	iParser = CMtfTestActionUtilsConfigFileParser::NewL(fileName);
       
    88 	
       
    89 	// temporary - READ THOSE PARAMS FROM SETTINGS
       
    90 	settings->SetProtocolL(EMmsWspProtocol);
       
    91 	settings->CommsSettings().AddWapBearerPrefL(2);
       
    92 
       
    93 	TPtrC serverName;
       
    94 	User::LeaveIfError(iParser->GetFieldAsString(KServerName,serverName));
       
    95 	settings->SetServerAddressL(serverName);
       
    96 
       
    97 	settings->StoreL(*store);
       
    98 	store->CommitL();
       
    99 	CleanupStack::PopAndDestroy(settings);
       
   100 	CleanupStack::PopAndDestroy(store);
       
   101 	CleanupStack::PopAndDestroy(entry);
       
   102 
       
   103 	TestCase().ActionCompletedL(*this);
       
   104 	}