messagingfw/msgtestfw/TestActions/Email/Smtp/src/CMtfTestActionCreateSmtpService.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 // CreateSmtpService
       
    17 // [Action Parameters]
       
    18 // Session        <input>: Reference to the session.
       
    19 // (Priority)     <input>: Value of the entry priority. Default is medium priority.
       
    20 // (ReadOnlyFlag) <input>: Value of the read only flag. Default is false.
       
    21 // (VisibleFlag)  <input>: Value of the visible flag. Default is true.
       
    22 // (Description)  <input>: Name of the description.	Default is blank.
       
    23 // (Details)      <input>: Name of the details. Default is blank.
       
    24 // ServiceId     <output>: Value of the created service id.
       
    25 // [Action Description]
       
    26 // Creates a SMTP service.
       
    27 // [APIs Used]
       
    28 // TMsvEntry::iType
       
    29 // TMsvEntry::SetPriority	
       
    30 // TMsvEntry::iMtm	
       
    31 // TMsvEntry::SetReadOnly	
       
    32 // TMsvEntry::SetVisible	
       
    33 // TMsvEntry::iDescription
       
    34 // TMsvEntry::iDetails
       
    35 // TMsvEntry::iDate
       
    36 // TMsvEntry::Id
       
    37 // CMsvEntry::SetEntryL
       
    38 // CMsvEntry::CreateL
       
    39 // __ACTION_INFO_END__
       
    40 // 
       
    41 //
       
    42 
       
    43 /**
       
    44  @file
       
    45 */
       
    46 
       
    47 
       
    48 #include <msvapi.h>
       
    49 #include <miutset.h>
       
    50 
       
    51 #include <cemailaccounts.h>
       
    52 
       
    53 
       
    54 
       
    55 #include "CMtfTestActionCreateSmtpService.h"
       
    56 #include "CMtfTestCase.h"
       
    57 #include "CMtfTestActionParameters.h"
       
    58 
       
    59 
       
    60 
       
    61 CMtfTestAction* CMtfTestActionCreateSmtpService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    62 	{
       
    63 	CMtfTestActionCreateSmtpService* self = new (ELeave) CMtfTestActionCreateSmtpService(aTestCase);
       
    64 	CleanupStack::PushL(self);
       
    65 	self->ConstructL(aActionParameters);
       
    66 	CleanupStack::Pop();
       
    67 	return self;
       
    68 	}
       
    69 	
       
    70 
       
    71 CMtfTestActionCreateSmtpService::CMtfTestActionCreateSmtpService(CMtfTestCase& aTestCase)
       
    72 	: CMtfSynchronousTestAction(aTestCase)
       
    73 	{
       
    74 	}
       
    75 
       
    76 
       
    77 CMtfTestActionCreateSmtpService::~CMtfTestActionCreateSmtpService()
       
    78 	{
       
    79 	delete iBlank;
       
    80 	}
       
    81 
       
    82 
       
    83 void CMtfTestActionCreateSmtpService::ExecuteActionL()
       
    84 	{
       
    85 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateSmtpService);
       
    86 	// This method requires that a related IMAP4 or POP3 account has been previously set up
       
    87 	// in the central repository - this is because SMTP accounts do not exist independently
       
    88 	// but only as part of an IMAP4 or POP3 account
       
    89 	CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
       
    90 	TSmtpAccount smtpAccount;
       
    91 	User::LeaveIfError(emailAccounts->DefaultSmtpAccountL(smtpAccount));
       
    92 		
       
    93 	TMsvId paramServiceId = smtpAccount.iSmtpService;
       
    94 	CleanupStack::PopAndDestroy(emailAccounts);
       
    95 
       
    96 	StoreParameterL<TMsvId>(TestCase(),paramServiceId,ActionParameters().Parameter(6));
       
    97 
       
    98 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateSmtpService );
       
    99 	TestCase().ActionCompletedL(*this);
       
   100 	}
       
   101