messagingfw/msgtestfw/TestActions/Email/Imap4/src/CMtfTestActionCreateImap4Mtm.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 // CreateImap4Mtm
       
    17 // [Action Parameters]
       
    18 // Session     <input>: Reference to the session.
       
    19 // ServiceId   <input>: Value of the the service id.
       
    20 // MtmRegistry <input>: Reference to the client MTM registry.
       
    21 // Mtm        <output>: Reference to the created Imap4 client MTM.
       
    22 // [Action Description]
       
    23 // Creates Imap4 client MTM.
       
    24 // [APIs Used]
       
    25 // CClientMtmRegistry::NewMtmL
       
    26 // CMsvSession::GetEntryL
       
    27 // CBaseMtm::SetCurrentEntryL
       
    28 // __ACTION_INFO_END__
       
    29 // 
       
    30 //
       
    31 
       
    32 /**
       
    33  @file
       
    34 */
       
    35 
       
    36 
       
    37 #include "CMtfTestActionCreateImap4Mtm.h"
       
    38 #include "CMtfTestCase.h"
       
    39 #include "CMtfTestActionParameters.h"
       
    40 
       
    41 #include <msvapi.h>
       
    42 #include <impcmtm.h>
       
    43 #include <mtclreg.h>
       
    44 
       
    45 
       
    46 CMtfTestAction* CMtfTestActionCreateImap4Mtm::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    47 	{
       
    48 	CMtfTestActionCreateImap4Mtm* self = new (ELeave) CMtfTestActionCreateImap4Mtm(aTestCase);
       
    49 	CleanupStack::PushL(self);
       
    50 	self->ConstructL(aActionParameters);
       
    51 	CleanupStack::Pop();
       
    52 	return self;
       
    53 	}
       
    54 	
       
    55 
       
    56 CMtfTestActionCreateImap4Mtm::CMtfTestActionCreateImap4Mtm(CMtfTestCase& aTestCase)
       
    57 	: CMtfSynchronousTestAction(aTestCase)
       
    58 	{
       
    59 	}
       
    60 
       
    61 
       
    62 CMtfTestActionCreateImap4Mtm::~CMtfTestActionCreateImap4Mtm()
       
    63 	{
       
    64 	}
       
    65 
       
    66 
       
    67 void CMtfTestActionCreateImap4Mtm::ExecuteActionL()
       
    68 	{
       
    69 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateImap4Mtm);
       
    70 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    71 	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    72 	CClientMtmRegistry* paramMtmRegistry = ObtainParameterReferenceL<CClientMtmRegistry>(TestCase(),ActionParameters().Parameter(2));;
       
    73 
       
    74 	CBaseMtm* paramMtm = paramMtmRegistry->NewMtmL(KUidMsgTypeIMAP4);
       
    75 	CleanupStack::PushL(paramMtm);
       
    76 	CMsvEntry* entry = paramSession->GetEntryL(paramServiceId);
       
    77 	CleanupStack::PushL(entry);
       
    78 	paramMtm->SetCurrentEntryL(entry);
       
    79 
       
    80 	StoreParameterL<CImap4ClientMtm>(TestCase(),*(reinterpret_cast<CImap4ClientMtm*>(paramMtm)),ActionParameters().Parameter(3));
       
    81 	CleanupStack::Pop(entry);
       
    82 	CleanupStack::Pop(paramMtm);
       
    83 	
       
    84 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateImap4Mtm);
       
    85 	TestCase().ActionCompletedL(*this);
       
    86 	}
       
    87 
       
    88 
       
    89