messagingfw/msgtestfw/TestActions/Sms/src/CMtfTestActionCompareScheduleSendSettings.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 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // CompareScheduleSendSettings
       
    17 // [Action Parameters]
       
    18 // ScheduleSettings1	<input>:	CMsvScheduleSettings
       
    19 // OffPeakTimes1		<input>:	CMsvOffPeakTimes
       
    20 // ErrorActions1		<input>:	CMsvSendErrorActions
       
    21 // SysAgentActions1		<input>:	CMsvSysAgentActions
       
    22 // ScheduleSettings2	<input>:	CMsvScheduleSettings
       
    23 // OffPeakTimes2		<input>:	CMsvOffPeakTimes
       
    24 // ErrorActions2		<input>:	CMsvSendErrorActions
       
    25 // SysAgentActions2		<input>:	CMsvSysAgentActions
       
    26 // [Action Description]
       
    27 // CompareScheduleSendsettings Test Action is intended to compare one Schedule Send settings 
       
    28 // values with other Schedule Send settings values.
       
    29 // [APIs Used]	
       
    30 // __ACTION_INFO_END__
       
    31 // 
       
    32 //
       
    33 
       
    34 
       
    35 #include "CMtfTestActionCompareScheduleSendSettings.h"
       
    36 #include "CMtfTestCase.h"
       
    37 #include "CMtfTestActionParameters.h"
       
    38 
       
    39 #include <msvschedulesettings.h>
       
    40 #include <msvoffpeaktime.h>
       
    41 #include <msvsenderroraction.h>
       
    42 #include <msvsysagentaction.h>
       
    43 
       
    44 /**
       
    45   Function : NewL
       
    46   Description : 
       
    47   @internalTechnology
       
    48   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    49   @param : aActionParams - CMtfTestActionParameters 
       
    50   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionCompareScheduleSendSettings object
       
    51   @pre none
       
    52   @post none
       
    53 */
       
    54 CMtfTestAction* CMtfTestActionCompareScheduleSendSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    55 	{
       
    56 	CMtfTestActionCompareScheduleSendSettings* self = new (ELeave) CMtfTestActionCompareScheduleSendSettings(aTestCase);
       
    57 	CleanupStack::PushL(self);
       
    58 	self->ConstructL(aActionParameters);
       
    59 	CleanupStack::Pop(self);
       
    60 	return self;
       
    61 	}
       
    62 
       
    63 /**
       
    64   Function : CMtfTestActionCompareScheduleSendSettings
       
    65   Description : Constructor
       
    66   @internalTechnology
       
    67   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    68   @return : N/A
       
    69   @pre none
       
    70   @post none
       
    71 */
       
    72 CMtfTestActionCompareScheduleSendSettings::CMtfTestActionCompareScheduleSendSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    73 	{
       
    74 	}
       
    75 
       
    76 /**
       
    77   Function : ~CMtfTestActionCompareScheduleSendSettings
       
    78   Description : Destructor
       
    79   @internalTechnology
       
    80   @param :
       
    81   @return : 
       
    82   @pre 
       
    83   @post 
       
    84 */
       
    85 CMtfTestActionCompareScheduleSendSettings::~CMtfTestActionCompareScheduleSendSettings()
       
    86 	{
       
    87 	}
       
    88 		
       
    89 /**
       
    90   Function : ExecuteActionL
       
    91   Description : Entry point for the this test action in the test framework
       
    92   @internalTechnology
       
    93   @param : none
       
    94   @return : void
       
    95   @pre none 
       
    96   @post none
       
    97 */
       
    98 void CMtfTestActionCompareScheduleSendSettings::ExecuteActionL()
       
    99 	{
       
   100 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareScheduleSendSettings);
       
   101 	CMsvScheduleSettings* scheduleSettings1 = ObtainParameterReferenceL<CMsvScheduleSettings>(TestCase(), ActionParameters().Parameter(0));
       
   102 	CMsvScheduleSettings* scheduleSettings2 = ObtainParameterReferenceL<CMsvScheduleSettings>(TestCase(), ActionParameters().Parameter(1));
       
   103 	CMsvOffPeakTimes* offPeakTimes1 = ObtainParameterReferenceL<CMsvOffPeakTimes>(TestCase(), ActionParameters().Parameter(2));
       
   104 	CMsvOffPeakTimes* offPeakTimes2 = ObtainParameterReferenceL<CMsvOffPeakTimes>(TestCase(), ActionParameters().Parameter(3));
       
   105 	CMsvSendErrorActions* sendErrorActions1 = ObtainParameterReferenceL<CMsvSendErrorActions>(TestCase(), ActionParameters().Parameter(4));
       
   106 	CMsvSendErrorActions* sendErrorActions2 = ObtainParameterReferenceL<CMsvSendErrorActions>(TestCase(), ActionParameters().Parameter(5));
       
   107 	CMsvSysAgentActions* sysAgentActions1 = ObtainParameterReferenceL<CMsvSysAgentActions>(TestCase(), ActionParameters().Parameter(6));
       
   108 	CMsvSysAgentActions* sysAgentActions2 = ObtainParameterReferenceL<CMsvSysAgentActions>(TestCase(), ActionParameters().Parameter(7));
       
   109 	
       
   110 	if (scheduleSettings1->Priority() != scheduleSettings2->Priority() )
       
   111 		{
       
   112 		TestCase().ERR_PRINTF1(_L("Schedule Settings Priority() does not match !"));
       
   113 		TestCase().SetTestStepResult(EFail);		
       
   114 		}
       
   115 	
       
   116 	else if( scheduleSettings1->ValidityPeriod() != scheduleSettings2->ValidityPeriod() )
       
   117 		{
       
   118 		TestCase().ERR_PRINTF1(_L("Schedule Settings ValidityPeriod() does not match !"));
       
   119 		TestCase().SetTestStepResult(EFail);		
       
   120 		}
       
   121 	
       
   122 	else if( scheduleSettings1->IntervalType() != scheduleSettings2->IntervalType() )
       
   123 		{
       
   124 		TestCase().ERR_PRINTF1(_L("Schedule Settings IntervalType()  does not match !"));
       
   125 		TestCase().SetTestStepResult(EFail);				
       
   126 		}
       
   127 	else if( scheduleSettings1->Latency() != scheduleSettings2->Latency() )
       
   128 		{
       
   129 		TestCase().ERR_PRINTF1(_L("Schedule Settings Latency()  does not match !"));
       
   130 		TestCase().SetTestStepResult(EFail);						
       
   131 		}
       
   132 	else if( scheduleSettings1->LongInterval() != scheduleSettings2->LongInterval() )
       
   133 		{
       
   134 		TestCase().ERR_PRINTF1(_L("Schedule Settings LongInterval()  does not match !"));
       
   135 		TestCase().SetTestStepResult(EFail);								
       
   136 		}
       
   137 	else if( scheduleSettings1->ShortInterval() != scheduleSettings2->ShortInterval() )
       
   138 		{
       
   139 		TestCase().ERR_PRINTF1(_L("Schedule Settings ShortInterval()  does not match !"));
       
   140 		TestCase().SetTestStepResult(EFail);										
       
   141 		}
       
   142 	else if ( scheduleSettings1->PendingConditionsTimeout() != scheduleSettings2->PendingConditionsTimeout() )
       
   143 		{
       
   144 		TestCase().ERR_PRINTF1(_L("Schedule Settings PendingConditionsTimeout()  does not match !"));
       
   145 		TestCase().SetTestStepResult(EFail);												
       
   146 		}
       
   147 	else if(  offPeakTimes1->Count() != offPeakTimes2->Count() )
       
   148 		{
       
   149 		TestCase().ERR_PRINTF1(_L("Off peak times Count()  does not match !"));
       
   150 		TestCase().SetTestStepResult(EFail);														
       
   151 		}
       
   152 	else if( sendErrorActions1->Default().iError != sendErrorActions2->Default().iError )
       
   153 		{
       
   154 		TestCase().ERR_PRINTF1(_L("SendError Actions iError does not match !"));
       
   155 		TestCase().SetTestStepResult(EFail);																
       
   156 		}
       
   157 	else if( sendErrorActions1->Default().iAction != sendErrorActions2->Default().iAction )
       
   158 		{
       
   159 		TestCase().ERR_PRINTF1(_L("SendError Actions iAction does not match !"));
       
   160 		TestCase().SetTestStepResult(EFail);																		
       
   161 		}
       
   162 	else if( sendErrorActions1->Default().iRetries != sendErrorActions2->Default().iRetries )
       
   163 		{
       
   164 		TestCase().ERR_PRINTF1(_L("SendError Actions iRetries does not match !"));
       
   165 		TestCase().SetTestStepResult(EFail);																		
       
   166 		}
       
   167 		
       
   168 	else if( sendErrorActions1->Default().iRetrySpacing != sendErrorActions2->Default().iRetrySpacing )
       
   169 		{
       
   170 		TestCase().ERR_PRINTF1(_L("SendError Actions iRetrySpacing does not match !"));
       
   171 		TestCase().SetTestStepResult(EFail);																				
       
   172 		}
       
   173 		
       
   174 	else if( sysAgentActions1->Count() != sysAgentActions2->Count() )
       
   175 		{
       
   176 		// failed
       
   177 		TestCase().ERR_PRINTF1(_L("sysAgentActions1->Count() does not match !"));
       
   178 		TestCase().SetTestStepResult(EFail);
       
   179 		}
       
   180 	else
       
   181 		{
       
   182 		// compare variable intervals
       
   183 		TInt count1 = scheduleSettings1->VariableIntervals().Count();
       
   184 		TInt count2 = scheduleSettings2->VariableIntervals().Count();
       
   185 		if (count1 != count2)
       
   186 			{
       
   187 			// failed
       
   188 			TestCase().ERR_PRINTF1(_L("Schedule Settings objects do not match !"));
       
   189 			TestCase().SetTestStepResult(EFail);
       
   190 			}
       
   191 		else
       
   192 			{
       
   193 			// compare the actual values
       
   194 			for (TInt i = 0; i < count1; i++)
       
   195 				{
       
   196 				if (scheduleSettings1->VariableIntervals()[i] != scheduleSettings2->VariableIntervals()[i])
       
   197 					{
       
   198 					// failed
       
   199 					TestCase().ERR_PRINTF1(_L("Schedule Settings objects do not match !"));
       
   200 					TestCase().SetTestStepResult(EFail);
       
   201 					}
       
   202 				}
       
   203 			}
       
   204 		}
       
   205 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareScheduleSendSettings);
       
   206 	TestCase().ActionCompletedL(*this);
       
   207 	}
       
   208 
       
   209