messagingfw/msgtestfw/TestActions/Capabilities/src/CMtfTestActionSendEMsvStopService.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 
       
    17 #include <e32std.h>
       
    18 #include <e32base.h>
       
    19 #include <msvipc.h>
       
    20 #include <impcmtm.h>
       
    21 
       
    22 
       
    23 #include "MCLIENT.H"
       
    24 #include "MSERVER.H"
       
    25 #include "CMtfTestCase.h"
       
    26 #include "CMtfTestActionParameters.h"
       
    27 #include "MtfTestActionUtilsUser.h"
       
    28 #include "IPCCommandForCapsPermissions.h"
       
    29 #include "SendProxyClient.h"
       
    30 #include "SendProxyserver.h"
       
    31 #include "CMtfTestActionSendEMsvStopService.h"
       
    32 
       
    33 
       
    34 /**
       
    35   Function : NewL
       
    36   Description : 
       
    37   @internalTechnology
       
    38   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    39   @param : aActionParams - CMtfTestActionParameters 
       
    40   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSendEMsvStopService object
       
    41   @pre none
       
    42   @post none
       
    43 */
       
    44 CMtfTestAction* CMtfTestActionSendEMsvStopService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    45 	{
       
    46 	CMtfTestActionSendEMsvStopService* self = new (ELeave) CMtfTestActionSendEMsvStopService(aTestCase);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL(aActionParameters);
       
    49 	CleanupStack::Pop(self);
       
    50 	return self;
       
    51 	}
       
    52 
       
    53 /**
       
    54   Function : CMtfTestActionSendEMsvStopService
       
    55   Description : Constructor
       
    56   @internalTechnology
       
    57   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    58   @return : N/A
       
    59   @pre none
       
    60   @post none
       
    61 */
       
    62 CMtfTestActionSendEMsvStopService::CMtfTestActionSendEMsvStopService(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    63 																																														
       
    64 	{
       
    65 	}
       
    66 	
       
    67 /**
       
    68   Function : ~CMtfTestActionSendEMsvStopService
       
    69   Description : Destructor
       
    70   @internalTechnology
       
    71   @param :
       
    72   @return : 
       
    73   @pre 
       
    74   @post 
       
    75 */
       
    76 CMtfTestActionSendEMsvStopService::~CMtfTestActionSendEMsvStopService()
       
    77 	{
       
    78 	}
       
    79 
       
    80 
       
    81 /**
       
    82   Function : ExecuteActionL
       
    83   Description : Entry point for the this test action in the test framework
       
    84   @internalTechnology
       
    85   @param : none
       
    86   @return : void
       
    87   @pre none 
       
    88   @post none
       
    89 */
       
    90 void CMtfTestActionSendEMsvStopService::ExecuteActionL()
       
    91 	{
       
    92 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvStopService);
       
    93 	// for this test action we need a pending operation on the MTM
       
    94 	// we will create a spurious imap4 disconnect operation
       
    95 	TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0));
       
    96 	CImap4ClientMtm* paramMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1));
       
    97 	TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2) );
       
    98 	
       
    99 	CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
       
   100 	CleanupStack::PushL( selection );
       
   101 	selection->AppendL( serviceId );
       
   102 	TBuf8<1> param;
       
   103 
       
   104 	CMsvOperation* operation = paramMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*selection,param,iStatus);
       
   105 	CleanupStack::PushL( operation );
       
   106 
       
   107 	RProxyServerSession RPSS;
       
   108 	
       
   109 	TInt error = RPSS.Connect();
       
   110 		
       
   111 	if (error!=KErrNone)
       
   112 		{
       
   113 		TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvStopService :: Unable to start proxy server. !"));
       
   114 		TestCase().SetTestStepResult(EFail);
       
   115 		}
       
   116 	else
       
   117 		{
       
   118 		TInt32 serverCaps;
       
   119 		RPSS.GetServerCapabilities(serverCaps);
       
   120 		TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps);
       
   121 				
       
   122 		error = 0;			
       
   123 		error=RPSS.SendReceive(EMsvStopService , TIpcArgs( serviceId ) );
       
   124 		IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass );
       
   125 		}
       
   126 
       
   127 	CleanupStack::PopAndDestroy( 2, selection );	
       
   128 	TestCase().INFO_PRINTF2(_L(" (<: Test Action %S completed :>) "), &KTestActionSendEMsvStopService );
       
   129 	TestCase().ActionCompletedL(*this);
       
   130 	}
       
   131 
       
   132