|
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 // CheckIfMessageScheduleDateExpired |
|
17 // [Action Parameters] |
|
18 // CMsvSession Session <input>: Reference to the session. |
|
19 // TMsvId MessageId <input>: Value of the Message id. |
|
20 // [Action Description] |
|
21 // Checks if the schedule time of the message has expired. If not, the Test Action |
|
22 // fails. |
|
23 // [APIs Used] |
|
24 // TMsvEntry::iDate |
|
25 // TMsvEntry::Id |
|
26 // CMsvEntry::EntryL |
|
27 // CMsvSession::GetEntryL |
|
28 // __ACTION_INFO_END__ |
|
29 // |
|
30 // |
|
31 |
|
32 // System Includes |
|
33 #include <msvapi.h> |
|
34 |
|
35 // User Includes |
|
36 #include "CMtfTestActionCheckIfMessageScheduleDateExpired.h" |
|
37 #include "CMtfTestCase.h" |
|
38 #include "CMtfTestActionParameters.h" |
|
39 |
|
40 |
|
41 /** |
|
42 Function : NewL |
|
43 Description : Constructs a new CMtfTestActionCheckIfMessageScheduleDateExpired object |
|
44 @internalTechnology |
|
45 @param : aTestCase :Reference to the Test case |
|
46 @param : aActionParams :Test Action parameters |
|
47 @return : CMtfTestAction* :a base class pointer to the newly created object |
|
48 @pre none |
|
49 @post: none |
|
50 */ |
|
51 CMtfTestAction* CMtfTestActionCheckIfMessageScheduleDateExpired::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
52 { |
|
53 CMtfTestActionCheckIfMessageScheduleDateExpired* self = new (ELeave) CMtfTestActionCheckIfMessageScheduleDateExpired(aTestCase); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(aActionParameters); |
|
56 CleanupStack::Pop(self); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 /** |
|
62 Function : CMtfTestActionCheckIfMessageScheduleDateExpired |
|
63 Description : Constructor |
|
64 @internalTechnology |
|
65 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
66 @pre none |
|
67 @post: none |
|
68 */ |
|
69 CMtfTestActionCheckIfMessageScheduleDateExpired::CMtfTestActionCheckIfMessageScheduleDateExpired(CMtfTestCase& aTestCase) |
|
70 : CMtfSynchronousTestAction(aTestCase) |
|
71 { |
|
72 } |
|
73 |
|
74 |
|
75 /** |
|
76 Function : ExecuteActionL |
|
77 Description : Checks if the schedule time of the message has expired. If not, |
|
78 fails the Test Action. |
|
79 @internalTechnology |
|
80 @param : none |
|
81 @return : void |
|
82 @pre : none |
|
83 @post none |
|
84 */ |
|
85 void CMtfTestActionCheckIfMessageScheduleDateExpired::ExecuteActionL() |
|
86 { |
|
87 if((TestCase().TestStepResult())== EPass) |
|
88 { |
|
89 TestCase().Logger().Write(_L("CMtfTestActionCheckIfMessageScheduleDateExpired::ExecuteActionL IN")); |
|
90 |
|
91 // Obtain Input parameters |
|
92 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(), |
|
93 ActionParameters().Parameter(0)); |
|
94 |
|
95 TMsvId paramMsgId = ObtainValueParameterL<TMsvId>(TestCase(), |
|
96 ActionParameters().Parameter(1)); |
|
97 |
|
98 // Create a message entry |
|
99 CMsvEntry* entry = paramSession->GetEntryL(paramMsgId); |
|
100 CleanupStack::PushL(entry); |
|
101 TMsvEntry msgEntry = entry->Entry(); |
|
102 |
|
103 // Get the message scheduled time |
|
104 TTime date ; |
|
105 date = msgEntry.iDate; |
|
106 |
|
107 // Get the current time |
|
108 TTime currentTime; |
|
109 currentTime.HomeTime(); |
|
110 |
|
111 // Compre the message schedule time with the current time |
|
112 if(date >= currentTime) |
|
113 { |
|
114 // Message schedule time not expired |
|
115 TestCase().ERR_PRINTF1(_L("Message schedule time has not expired.")); |
|
116 TestCase().SetTestStepResult(EFail); |
|
117 } |
|
118 else |
|
119 { |
|
120 TestCase().INFO_PRINTF1(_L("Message schedule time has expired.")); |
|
121 } |
|
122 |
|
123 CleanupStack::PopAndDestroy(entry); |
|
124 |
|
125 TestCase().Logger().Write(_L("CMtfTestActionCheckIfMessageScheduleDateExpired::ExecuteActionL OUT")); |
|
126 } |
|
127 |
|
128 TestCase().ActionCompletedL(*this); |
|
129 } |