43 #include "ccalendarobserver.h" |
43 #include "ccalendarobserver.h" |
44 #include "mediaplugin.h" |
44 #include "mediaplugin.h" |
45 #include <harvesterclient.h> |
45 #include <harvesterclient.h> |
46 #include "mdsitementity.h" |
46 #include "mdsitementity.h" |
47 #include "cpixmdedbmanager.h" |
47 #include "cpixmdedbmanager.h" |
|
48 #include "cpixindexerutils.h" |
48 #include "cfolderrenamedharvester.h" |
49 #include "cfolderrenamedharvester.h" |
49 #include "videoplugin.h" |
50 #include "videoplugin.h" |
50 #include "imageplugin.h" |
51 #include "imageplugin.h" |
51 #include "cemailplugin.h" |
52 #include "cemailplugin.h" |
52 #include "cmessagedatahandler.h" |
53 #include "cmessagedatahandler.h" |
|
54 #include <common.h> |
|
55 |
53 _LIT(KAppBasePath,"@c:root file content"); |
56 _LIT(KAppBasePath,"@c:root file content"); |
54 _LIT(KEmailAppBasePath,"@c:root msg email"); |
57 _LIT(KEmailAppBasePath,"@c:root msg email"); |
55 _LIT(KAppBaseFolderFilePath,"@c:root file folder"); |
58 _LIT(KAppBaseFolderFilePath,"@c:root file folder"); |
56 const TInt KMsgPluginBaseAppClassMaxLen = 64; |
59 const TInt KMsgPluginBaseAppClassMaxLen = 64; |
57 |
60 |
123 ENTRY( "TestStartNotesHarvesterL", CHarvesterPluginTester::TestStartNotesHarvesterL ), |
126 ENTRY( "TestStartNotesHarvesterL", CHarvesterPluginTester::TestStartNotesHarvesterL ), |
124 ENTRY( "TestAddNoteL", CHarvesterPluginTester::TestAddNoteL ), |
127 ENTRY( "TestAddNoteL", CHarvesterPluginTester::TestAddNoteL ), |
125 ENTRY( "TestAddLongNoteL", CHarvesterPluginTester::TestAddLongNoteL ), |
128 ENTRY( "TestAddLongNoteL", CHarvesterPluginTester::TestAddLongNoteL ), |
126 ENTRY( "TestAddAlphaNumericNoteL", CHarvesterPluginTester::TestAddAlphaNumericNoteL ), |
129 ENTRY( "TestAddAlphaNumericNoteL", CHarvesterPluginTester::TestAddAlphaNumericNoteL ), |
127 ENTRY( "TestDeleteNoteL", CHarvesterPluginTester::TestDeleteNoteL ), |
130 ENTRY( "TestDeleteNoteL", CHarvesterPluginTester::TestDeleteNoteL ), |
128 ENTRY( "TestUpdateNoteL", CHarvesterPluginTester::TestUpdateNoteL ), |
131 ENTRY( "TestUpdateNoteL", CHarvesterPluginTester::TestUpdateNoteL ), |
|
132 ENTRY( "TestNotesEntryNegative", CHarvesterPluginTester::TestNotesEntryNegativeL ), |
|
133 ENTRY( "TestNotesDestructor", CHarvesterPluginTester::TestNotesDestructorL ), |
|
134 ENTRY( "TestNotesDelayedError", CHarvesterPluginTester::TestNotesDelayedErrorL ), |
|
135 ENTRY( "TestNotesChangeEntry", CHarvesterPluginTester::TestNotesChangeEntryL), |
|
136 ENTRY( "TestNotesEntryNoIndexer", CHarvesterPluginTester::TestNotesEntryNoIndexerL), |
129 ENTRY( "TestContactsHarvesting", CHarvesterPluginTester::TestStartContactsHarvesterL ), |
137 ENTRY( "TestContactsHarvesting", CHarvesterPluginTester::TestStartContactsHarvesterL ), |
130 ENTRY( "TestCreateContactIndexItemL_Add", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
138 ENTRY( "TestCreateContactIndexItemL_Add", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
131 ENTRY( "TestCreateAllContactFields", CHarvesterPluginTester::TestCreateAllContactFieldsL ), |
139 ENTRY( "TestCreateAllContactFields", CHarvesterPluginTester::TestCreateAllContactFieldsL ), |
132 ENTRY( "TestCreateContactIndexItemL_Edit", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
140 ENTRY( "TestCreateContactIndexItemL_Edit", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
133 ENTRY( "TestCreateContactIndexItemL_Delete", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
141 ENTRY( "TestCreateContactIndexItemL_Delete", CHarvesterPluginTester::TestCreateContactIndexItemL ), |
138 ENTRY( "TestContactDelayedCallbackNoIObserverL", CHarvesterPluginTester::TestContactDelayedCallbackNoIObserverL ), |
146 ENTRY( "TestContactDelayedCallbackNoIObserverL", CHarvesterPluginTester::TestContactDelayedCallbackNoIObserverL ), |
139 ENTRY( "TestContactDelayedCallbackWrongCountL", CHarvesterPluginTester::TestContactDelayedCallbackWrongCountL ), |
147 ENTRY( "TestContactDelayedCallbackWrongCountL", CHarvesterPluginTester::TestContactDelayedCallbackWrongCountL ), |
140 ENTRY( "TestCreateContactGroup", CHarvesterPluginTester::TestCreateContactGroupL ), |
148 ENTRY( "TestCreateContactGroup", CHarvesterPluginTester::TestCreateContactGroupL ), |
141 ENTRY( "TestCalenderHarvesting", CHarvesterPluginTester::TestStartCalenderHarvesterL ), |
149 ENTRY( "TestCalenderHarvesting", CHarvesterPluginTester::TestStartCalenderHarvesterL ), |
142 ENTRY( "TestCalenderEntry",CHarvesterPluginTester::TestCalenderEntryL ), |
150 ENTRY( "TestCalenderEntry",CHarvesterPluginTester::TestCalenderEntryL ), |
143 ENTRY( "TestCreateMMS",CHarvesterPluginTester::TestCreateMmsL ), |
151 ENTRY( "TestCreateMMS",CHarvesterPluginTester::TestCreateMmsL ), |
|
152 ENTRY( "Testcalenderdestructor",CHarvesterPluginTester::TestcalenderdestructorL ), |
|
153 ENTRY( "TestCalChangeEntry",CHarvesterPluginTester::TestCalChangeEntryL ), |
|
154 ENTRY( "TestCalCreateEntry",CHarvesterPluginTester::TestCalCreateEntryL ), |
144 ENTRY( "TestCreateEmail",CHarvesterPluginTester::TestCreateEmailL ), |
155 ENTRY( "TestCreateEmail",CHarvesterPluginTester::TestCreateEmailL ), |
145 ENTRY( "TestAudioHarvesting",CHarvesterPluginTester::TestAudioHarvestingL ), |
156 ENTRY( "TestAudioHarvesting",CHarvesterPluginTester::TestAudioHarvestingL ), |
146 ENTRY( "TestAudioHarvestingUpdateIndex",CHarvesterPluginTester::TestAudioHarvestingUpdateIndexL ), |
|
147 ENTRY( "TestAudioHarvestingDeleteIndex",CHarvesterPluginTester::TestAudioHarvestingDeleteIndexL ), |
|
148 ENTRY( "TestMdsSyncController",CHarvesterPluginTester::TestMdsSyncControllerL ), |
157 ENTRY( "TestMdsSyncController",CHarvesterPluginTester::TestMdsSyncControllerL ), |
|
158 ENTRY( "TestAudioHandleItem",CHarvesterPluginTester::TestAudioHandleItemL ), |
|
159 ENTRY( "TestAudioSyncDbManager",CHarvesterPluginTester::TestAudioSyncDbManagerL ), |
|
160 ENTRY( "TestAudioMMCEventL",CHarvesterPluginTester::TestAudioMMCEventL ), |
|
161 ENTRY( "TestAudioNoIndexer",CHarvesterPluginTester::TestAudioNoIndexerL ), |
149 //ENTRY( "TestBlacklistPlugin",CHarvesterPluginTester::TestBlacklistPluginL ), |
162 //ENTRY( "TestBlacklistPlugin",CHarvesterPluginTester::TestBlacklistPluginL ), |
150 //ENTRY( "TestBlacklistPluginVersion",CHarvesterPluginTester::TestBlacklistPluginVersionL ), |
163 //ENTRY( "TestBlacklistPluginVersion",CHarvesterPluginTester::TestBlacklistPluginVersionL ), |
151 ENTRY( "TestVideoHarvestingIndex",CHarvesterPluginTester::TestVideoHarvestingIndexL ), |
164 ENTRY( "TestVideoHarvesting",CHarvesterPluginTester::TestVideoHarvestingL ), |
152 ENTRY( "TestVideoHarvestingUpdateIndex",CHarvesterPluginTester::TestVideoHarvestingUpdateIndexL ), |
165 ENTRY( "TestVideoHandleItem",CHarvesterPluginTester::TestVideoHandleItemL ), |
153 ENTRY( "TestVideoHarvestingDeleteIndex",CHarvesterPluginTester::TestVideoHarvestingDeleteIndexL ), |
166 ENTRY( "TestVideoSyncDbManager",CHarvesterPluginTester::TestVideoSyncDbManagerL ), |
154 ENTRY( "TestImageHarvestingAddIndex",CHarvesterPluginTester::TestImageHarvestingAddIndexL ), |
167 ENTRY( "TestVideoMMCEventL",CHarvesterPluginTester::TestVideoMMCEventL ), |
155 ENTRY( "TestImageHarvestingUpdateIndex",CHarvesterPluginTester::TestImageHarvestingUpdateIndexL ), |
168 ENTRY( "TestVideoNoIndexer",CHarvesterPluginTester::TestVideoNoIndexerL ), |
156 ENTRY( "TestImageHarvestingDeleteIndex",CHarvesterPluginTester::TestImageHarvestingDeleteIndexL ), |
169 ENTRY( "TestImageHarvesting",CHarvesterPluginTester::TestImageHarvestingL ), |
157 ENTRY( "TestAudioMMCEventL",CHarvesterPluginTester::TestAudioMMCEventL ), |
170 ENTRY( "TestImageHandleItem",CHarvesterPluginTester::TestImageHandleItemL ), |
158 ENTRY( "TestVideoMMCEventL",CHarvesterPluginTester::TestVideoMMCEventL ), |
171 ENTRY( "TestImageSyncDbManager",CHarvesterPluginTester::TestImageSyncDbManagerL ), |
159 ENTRY( "TestImageMMCEventL",CHarvesterPluginTester::TestImageMMCEventL ), |
172 ENTRY( "TestImageMMCEventL",CHarvesterPluginTester::TestImageMMCEventL ), |
|
173 ENTRY( "TestImageNoIndexer",CHarvesterPluginTester::TestImageNoIndexerL ), |
160 ENTRY( "TestStartEmailPlugin",CHarvesterPluginTester::TestStartEmailPluginL ), |
174 ENTRY( "TestStartEmailPlugin",CHarvesterPluginTester::TestStartEmailPluginL ), |
161 ENTRY( "TestHandleEmailDoc",CHarvesterPluginTester::TestHandleEmailDocL ), |
175 ENTRY( "TestHandleEmailDoc",CHarvesterPluginTester::TestHandleEmailDocL ), |
|
176 ENTRY( "TestEmailBaseappclass",CHarvesterPluginTester::TestEmailBaseappclassL ), |
|
177 ENTRY( "TestEmailHandleDoc",CHarvesterPluginTester::TestEmailHandleDocL ), |
162 //ADD NEW ENTRY HERE |
178 //ADD NEW ENTRY HERE |
163 // [test cases entries] - Do not remove |
179 // [test cases entries] - Do not remove |
164 }; |
180 }; |
165 |
181 |
166 const TInt count = sizeof( KFunctions ) / |
182 const TInt count = sizeof( KFunctions ) / |
1041 delete iPluginTester; |
1058 delete iPluginTester; |
1042 iPluginTester = NULL; |
1059 iPluginTester = NULL; |
1043 return error; |
1060 return error; |
1044 } |
1061 } |
1045 |
1062 |
1046 TInt CHarvesterPluginTester::TestDeleteNoteL( CStifItemParser& aItem ) |
1063 TInt CHarvesterPluginTester::TestDeleteNoteL( CStifItemParser& /*aItem */) |
1047 { |
1064 { |
1048 TInt error = KErrNone; |
1065 TInt error = KErrNone; |
1049 _LIT( KSearchError, "Search Failed" ); |
1066 _LIT( KSearchError, "Search Failed" ); |
1050 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
1067 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
1051 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1068 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1052 plugin->StartPluginL(); |
1069 plugin->StartPluginL(); |
1053 |
1070 |
1054 CCalendarObserver* session = CCalendarObserver::NewL(); |
1071 CCalendarObserver* session = CCalendarObserver::NewL(); |
1055 plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) ); |
1072 plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) ); |
|
1073 session->DeleteNoteEntryL(); |
1056 iPluginTester->iWaitForHarvester->Start(); |
1074 iPluginTester->iWaitForHarvester->Start(); |
1057 // Add a Note entry |
1075 // Add a Note entry |
1058 TPtrC searchstring; |
1076 /*TPtrC searchstring; |
1059 error = aItem.GetNextString( searchstring ); |
1077 error = aItem.GetNextString( searchstring ); |
1060 HBufC8* buf8 = HBufC8::NewL(2*searchstring.Length()); |
1078 HBufC8* buf8 = HBufC8::NewL(2*searchstring.Length()); |
1061 buf8->Des().Copy(searchstring); |
1079 buf8->Des().Copy(searchstring); |
1062 session->AddNoteL( buf8->Des()); |
1080 session->AddNoteL( buf8->Des()); |
1063 User::After( (TTimeIntervalMicroSeconds32)35000000 ); |
1081 User::After( (TTimeIntervalMicroSeconds32)35000000 ); |
1123 delete iPluginTester; |
1141 delete iPluginTester; |
1124 iPluginTester = NULL; |
1142 iPluginTester = NULL; |
1125 return error; |
1143 return error; |
1126 } |
1144 } |
1127 |
1145 |
|
1146 TInt CHarvesterPluginTester::TestNotesEntryNegativeL( CStifItemParser& /*aItem*/ ) |
|
1147 { |
|
1148 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
|
1149 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1150 plugin->StartPluginL(); |
|
1151 plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) ); |
|
1152 iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. |
|
1153 plugin->CreateNoteEntryL(0, ECPixUpdateAction); |
|
1154 delete plugin; |
|
1155 delete iPluginTester; |
|
1156 iPluginTester = NULL; |
|
1157 doLog( iLog, KErrNone, KNoErrorString ); |
|
1158 return KErrNone; |
|
1159 } |
|
1160 |
|
1161 TInt CHarvesterPluginTester::TestNotesDestructorL( CStifItemParser& /*aItem*/ ) |
|
1162 { |
|
1163 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
|
1164 plugin->iAsynchronizer->CancelCallback(); |
|
1165 plugin->iAsynchronizer = NULL; |
|
1166 plugin->iSession->StopChangeNotification(); |
|
1167 plugin->iSession = NULL; |
|
1168 delete plugin; |
|
1169 return KErrNone; |
|
1170 } |
|
1171 |
|
1172 TInt CHarvesterPluginTester::TestNotesDelayedErrorL( CStifItemParser& /*aItem*/ ) |
|
1173 { |
|
1174 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
|
1175 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1176 iPluginTester->SetWaitTime(2000000); |
|
1177 plugin->StartPluginL(); |
|
1178 TRAPD(err, plugin->DelayedError( KErrGeneral )); |
|
1179 delete plugin; |
|
1180 delete iPluginTester; |
|
1181 return KErrNone; |
|
1182 } |
|
1183 |
|
1184 TInt CHarvesterPluginTester::TestNotesChangeEntryL( CStifItemParser& /*aItem*/ ) |
|
1185 { |
|
1186 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
|
1187 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1188 iPluginTester->SetWaitTime(2000000); |
|
1189 plugin->StartPluginL(); |
|
1190 TCalChangeEntry calEntry; |
|
1191 calEntry.iChangeType = MCalChangeCallBack2::EChangeUndefined; //undefined type |
|
1192 plugin->HandleNoteChangedEntryL( calEntry ); |
|
1193 calEntry.iChangeType = MCalChangeCallBack2::EChangeTzRules; //default check |
|
1194 plugin->HandleNoteChangedEntryL( calEntry ); |
|
1195 delete plugin; |
|
1196 delete iPluginTester; |
|
1197 return KErrNone; |
|
1198 } |
|
1199 |
|
1200 TInt CHarvesterPluginTester::TestNotesEntryNoIndexerL( CStifItemParser& /*aItem*/ ) |
|
1201 { |
|
1202 CNotesPlugin* plugin = CNotesPlugin::NewL(); |
|
1203 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1204 plugin->StartPluginL(); |
|
1205 TRAPD(err, plugin->CreateNoteEntryL(0, ECPixUpdateAction) ); |
|
1206 TRAP(err, plugin->CreateNoteEntryL(0, (TCPixActionType)3) ); |
|
1207 iPluginTester->SetWaitTime(2000000); |
|
1208 CCalendarObserver* calobserver = CCalendarObserver::NewL(); |
|
1209 calobserver->AddEntryL(); |
|
1210 delete calobserver; |
|
1211 delete plugin; |
|
1212 delete iPluginTester; |
|
1213 return err; |
|
1214 } |
|
1215 |
1128 TInt CHarvesterPluginTester::TestStartContactsHarvesterL( CStifItemParser& /*aItem*/ ) |
1216 TInt CHarvesterPluginTester::TestStartContactsHarvesterL( CStifItemParser& /*aItem*/ ) |
1129 { |
1217 { |
1130 CContactsPlugin* plugin = CContactsPlugin::NewL(); |
1218 CContactsPlugin* plugin = CContactsPlugin::NewL(); |
1131 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1219 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1132 plugin->StartPluginL(); //start to moniter contacts db |
1220 plugin->StartPluginL(); //start to moniter contacts db |
1529 delete iPluginTester; |
1621 delete iPluginTester; |
1530 iPluginTester = NULL; |
1622 iPluginTester = NULL; |
1531 delete sessionobserver; |
1623 delete sessionobserver; |
1532 delete msgSession; |
1624 delete msgSession; |
1533 doLog(iLog,error,KSearchError); |
1625 doLog(iLog,error,KSearchError); |
|
1626 return KErrNone; |
|
1627 } |
|
1628 |
|
1629 TInt CHarvesterPluginTester::TestcalenderdestructorL( CStifItemParser& /*aItem */ ) |
|
1630 { |
|
1631 CCalendarPlugin* plugin = CCalendarPlugin::NewL(); |
|
1632 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1633 plugin->StartPluginL(); //start to moniter contacts db |
|
1634 plugin->Progress(100); |
|
1635 iPluginTester->SetWaitTime(2000000); |
|
1636 plugin->StartHarvestingL( _L(CALENDAR_QBASEAPPCLASS) ); |
|
1637 plugin->DelayedError(KErrNone); |
|
1638 iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. |
|
1639 plugin->Completed(KErrGeneral); |
|
1640 plugin->iAsynchronizer->CancelCallback(); |
|
1641 plugin->iAsynchronizer = NULL; |
|
1642 plugin->iSession->StopChangeNotification(); |
|
1643 plugin->iSession = NULL; |
|
1644 delete plugin; |
|
1645 delete iPluginTester; |
|
1646 iPluginTester = NULL; |
|
1647 doLog( iLog, KErrNone, KNoErrorString ); |
|
1648 return KErrNone; |
|
1649 } |
|
1650 |
|
1651 TInt CHarvesterPluginTester::TestCalChangeEntryL( CStifItemParser& /*aItem */ ) |
|
1652 { |
|
1653 CCalendarPlugin* plugin = CCalendarPlugin::NewL(); |
|
1654 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1655 iPluginTester->SetWaitTime(2000000); |
|
1656 plugin->StartPluginL(); |
|
1657 TCalChangeEntry calEntry; |
|
1658 calEntry.iChangeType = MCalChangeCallBack2::EChangeAdd; //undefined type |
|
1659 plugin->HandleChangedEntryL( calEntry ); |
|
1660 calEntry.iChangeType = MCalChangeCallBack2::EChangeUndefined; //undefined type |
|
1661 plugin->HandleChangedEntryL( calEntry ); |
|
1662 calEntry.iChangeType = MCalChangeCallBack2::EChangeTzRules; //default check |
|
1663 plugin->HandleChangedEntryL( calEntry ); |
|
1664 delete plugin; |
|
1665 return KErrNone; |
|
1666 } |
|
1667 |
|
1668 TInt CHarvesterPluginTester::TestCalCreateEntryL( CStifItemParser& /*aItem */ ) |
|
1669 { |
|
1670 _LIT8(KTestmemo , "Notesplugin"); |
|
1671 CCalendarPlugin* plugin = CCalendarPlugin::NewL(); |
|
1672 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1673 iPluginTester->SetWaitTime(2000000); |
|
1674 plugin->CreateEntryL(0,ECPixAddAction ); |
|
1675 plugin->StartPluginL(); |
|
1676 plugin->CreateEntryL(0,ECPixAddAction ); |
|
1677 CCalendarObserver* calobserver = CCalendarObserver::NewL(); |
|
1678 HBufC8* memo = HBufC8::New(10); |
|
1679 TPtr8 ptr = memo->Des(); |
|
1680 ptr.Copy(KTestmemo); |
|
1681 calobserver->AddNoteL(ptr); |
|
1682 delete calobserver; |
|
1683 delete memo; |
|
1684 plugin->CreateEntryL(0,(TCPixActionType )3); |
|
1685 delete plugin; |
|
1686 delete iPluginTester; |
1534 return KErrNone; |
1687 return KErrNone; |
1535 } |
1688 } |
1536 |
1689 |
1537 TInt CHarvesterPluginTester::TestCreateEmailL( CStifItemParser& /*aItem */) |
1690 TInt CHarvesterPluginTester::TestCreateEmailL( CStifItemParser& /*aItem */) |
1538 { |
1691 { |
1594 //Do harvesting and search for Eagle it should be available |
1747 //Do harvesting and search for Eagle it should be available |
1595 plugin->StartHarvestingL(_L(MEDIA_QBASEAPPCLASS)); |
1748 plugin->StartHarvestingL(_L(MEDIA_QBASEAPPCLASS)); |
1596 //Wait for one minutes after doc processing to Index and Flush to happen |
1749 //Wait for one minutes after doc processing to Index and Flush to happen |
1597 iPluginTester->SetWaitTime((TTimeIntervalMicroSeconds32)60000000); |
1750 iPluginTester->SetWaitTime((TTimeIntervalMicroSeconds32)60000000); |
1598 iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete |
1751 iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete |
1599 TInt count = SearchForTextL(_L("Eagle"),_L(MEDIA_QBASEAPPCLASS),KNullDesC); |
1752 error = doSearchL( _L("Eagle"),_L(MEDIA_QBASEAPPCLASS), ESearchTypeResultsExpected ); |
1600 if(count <= 0) |
1753 |
1601 { |
|
1602 error = KErrNotFound; |
|
1603 } |
|
1604 doLog(iLog,error,_L("Error in TestAudioHarvestingL")); |
|
1605 delete plugin; |
1754 delete plugin; |
1606 delete iPluginTester; |
1755 delete iPluginTester; |
1607 iPluginTester = NULL; |
1756 iPluginTester = NULL; |
1608 fileSession.Close(); |
1757 fileSession.Close(); |
1609 //End search |
1758 //End search |
1610 return error; |
1759 doLog(iLog,error,_L("Error in TestAudioHarvestingL")); |
1611 } |
|
1612 TInt CHarvesterPluginTester::TestAudioHarvestingUpdateIndexL( CStifItemParser& aItem ) |
|
1613 { |
|
1614 TInt error = KErrNone; |
|
1615 TPtrC filepath; |
|
1616 TPtrC filename; |
|
1617 TPtrC newFile; |
|
1618 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Sounds\\")); |
|
1619 TBuf<KMaxFileName> desPath; |
|
1620 desPath.Copy( srcPath ); |
|
1621 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1622 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1623 plugin->StartPluginL(); |
|
1624 RFs fSession; |
|
1625 User::LeaveIfError( fSession.Connect()); |
|
1626 CleanupClosePushL( fSession ); |
|
1627 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
|
1628 { |
|
1629 srcPath.Append( filename ); |
|
1630 if( aItem.GetNextString(newFile) == KErrNone ) |
|
1631 { |
|
1632 desPath.Append( newFile ); |
|
1633 RHarvesterClient harvester; |
|
1634 User::LeaveIfError(harvester.Connect()); |
|
1635 harvester.Pause(); |
|
1636 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
|
1637 if(!fileExist) |
|
1638 { |
|
1639 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
|
1640 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
|
1641 } |
|
1642 BaflUtils::RenameFile( fSession, srcPath, desPath ); |
|
1643 harvester.Resume(); |
|
1644 harvester.Close(); |
|
1645 plugin->StartHarvestingL( _L(MEDIA_QBASEAPPCLASS) ); |
|
1646 //wait for index to flush |
|
1647 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
|
1648 //wait till video harvesting completes |
|
1649 iPluginTester->iWaitForHarvester->Start(); |
|
1650 TInt count = SearchForTextL(_L("testaudio"), _L(MEDIA_QBASEAPPCLASS), KNullDesC ); |
|
1651 if(count <= 0) |
|
1652 { |
|
1653 error = KErrNotFound; |
|
1654 } |
|
1655 doLog( iLog, error, _L("Error in TestAudioHarvestingUpdateIndexL") ); |
|
1656 } |
|
1657 } |
|
1658 else |
|
1659 doLog( iLog, KErrNotFound, _L("Error in TestAudioHarvestingUpdateIndexL") ); |
|
1660 CleanupStack::PopAndDestroy(); |
|
1661 delete plugin; |
|
1662 delete iPluginTester; |
|
1663 iPluginTester = NULL; |
|
1664 return error; |
|
1665 } |
|
1666 |
|
1667 TInt CHarvesterPluginTester::TestAudioHarvestingDeleteIndexL( CStifItemParser& aItem ) |
|
1668 { |
|
1669 TInt error = KErrNone; |
|
1670 TPtrC filepath; |
|
1671 TPtrC filename; |
|
1672 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Sounds\\")); |
|
1673 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1674 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1675 plugin->StartPluginL(); |
|
1676 RFs fSession; |
|
1677 User::LeaveIfError( fSession.Connect()); |
|
1678 CleanupClosePushL( fSession ); |
|
1679 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
|
1680 { |
|
1681 srcPath.Append( filename ); |
|
1682 RHarvesterClient harvester; |
|
1683 User::LeaveIfError(harvester.Connect()); |
|
1684 harvester.Pause(); |
|
1685 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
|
1686 if(!fileExist) |
|
1687 { |
|
1688 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
|
1689 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
|
1690 } |
|
1691 BaflUtils::DeleteFile( fSession, srcPath ); |
|
1692 harvester.Resume(); |
|
1693 harvester.Close(); |
|
1694 plugin->StartHarvestingL( _L(MEDIA_QBASEAPPCLASS) ); |
|
1695 //wait for index to flush |
|
1696 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
|
1697 //wait till video harvesting completes |
|
1698 iPluginTester->iWaitForHarvester->Start(); |
|
1699 TInt count = SearchForTextL(_L("eagle"), _L(MEDIA_QBASEAPPCLASS), KNullDesC ); |
|
1700 if(count <= 0) |
|
1701 { |
|
1702 // If the search is not found,then testcase is success |
|
1703 doLog( iLog, error, _L("Error in TestAudioHarvestingDeleteIndexL") ); |
|
1704 } |
|
1705 } |
|
1706 else |
|
1707 doLog( iLog, KErrNotFound, _L("Error in TestAudioHarvestingDeleteIndexL") ); |
|
1708 CleanupStack::PopAndDestroy(); |
|
1709 delete plugin; |
|
1710 delete iPluginTester; |
|
1711 iPluginTester = NULL; |
|
1712 return error; |
1760 return error; |
1713 } |
1761 } |
1714 |
1762 |
1715 TInt CHarvesterPluginTester::TestMdsSyncControllerL( CStifItemParser& /*aItem*/ ) |
1763 TInt CHarvesterPluginTester::TestMdsSyncControllerL( CStifItemParser& /*aItem*/ ) |
1716 { |
1764 { |
1746 dbcontroller->ResetL(); |
1794 dbcontroller->ResetL(); |
1747 delete entity; |
1795 delete entity; |
1748 delete dbcontroller; |
1796 delete dbcontroller; |
1749 return error; |
1797 return error; |
1750 } |
1798 } |
1751 |
1799 |
|
1800 TInt CHarvesterPluginTester::TestAudioHandleItemL( CStifItemParser& aItem) |
|
1801 { |
|
1802 TInt error = KErrNone; |
|
1803 TInt objId; |
|
1804 TInt actionType; |
|
1805 aItem.GetNextInt ( objId ); |
|
1806 aItem.GetNextInt ( actionType ); |
|
1807 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1808 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1809 plugin->StartPluginL(); |
|
1810 TRAPD( err , plugin->HandleMdeItemL(objId, (TCPixActionType)actionType) ); |
|
1811 doLog(iLog,error,_L("Error in TestAudioHandleItemL")); |
|
1812 delete plugin; |
|
1813 delete iPluginTester; |
|
1814 iPluginTester = NULL; |
|
1815 return KErrNone; |
|
1816 } |
|
1817 |
|
1818 TInt CHarvesterPluginTester::TestAudioSyncDbManagerL( CStifItemParser& /* aItem */) |
|
1819 { |
|
1820 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1821 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1822 plugin->StartPluginL(); |
|
1823 CMDSEntity* entity; |
|
1824 entity = CMDSEntity::NewL(); |
|
1825 entity->Setkey(100); |
|
1826 entity->SetUri(_L("\\music\\audio.mp3")); |
|
1827 TDriveNumber drive = TDriveNumber(EDriveC); |
|
1828 entity->SetDrive(drive); |
|
1829 plugin->iDBManager->AddL( entity->Key(),*entity ); |
|
1830 TRAPD( err , plugin->HandleMdeItemL(entity->Key(), ECPixAddAction)); |
|
1831 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixUpdateAction)); |
|
1832 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixRemoveAction)); |
|
1833 delete plugin; |
|
1834 delete iPluginTester; |
|
1835 iPluginTester = NULL; |
|
1836 return KErrNone; |
|
1837 } |
|
1838 |
|
1839 TInt CHarvesterPluginTester::TestAudioMMCEventL( CStifItemParser& aItem ) |
|
1840 { |
|
1841 TInt error(KErrNone); |
|
1842 TInt drive; |
|
1843 TInt mmcstatus; |
|
1844 aItem.GetNextInt ( drive ); |
|
1845 aItem.GetNextInt ( mmcstatus ); |
|
1846 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1847 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1848 plugin->StartPluginL(); //Initialize the Plugin |
|
1849 TRAPD( err , plugin->HandleMMCEventL( (TDriveNumber)drive , mmcstatus) ); |
|
1850 //iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete |
|
1851 doLog(iLog,error,_L("Error in TestAudioMMCEventL")); |
|
1852 delete plugin; |
|
1853 delete iPluginTester; |
|
1854 iPluginTester = NULL; |
|
1855 //End search |
|
1856 return err; |
|
1857 } |
|
1858 |
|
1859 TInt CHarvesterPluginTester::TestAudioNoIndexerL( CStifItemParser& aItem ) |
|
1860 { |
|
1861 TInt drive; |
|
1862 TInt objId; |
|
1863 aItem.GetNextInt ( drive ); |
|
1864 aItem.GetNextInt ( objId ); |
|
1865 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
|
1866 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1867 plugin->StartPluginL(); |
|
1868 plugin->iIndexerUtil->iIndexer[drive]= NULL; |
|
1869 TRAPD( err , plugin->HandleMdeItemL(objId, ECPixUpdateAction) ); |
|
1870 delete plugin; |
|
1871 delete iPluginTester; |
|
1872 iPluginTester = NULL; |
|
1873 return KErrNone; |
|
1874 } |
|
1875 |
1752 TInt CHarvesterPluginTester::TestBlacklistPluginL( CStifItemParser& /*aItem*/ ) |
1876 TInt CHarvesterPluginTester::TestBlacklistPluginL( CStifItemParser& /*aItem*/ ) |
1753 { |
1877 { |
1754 //@todo: This test case shoud be in IDS middleware harvester STIF cases |
1878 //@todo: This test case shoud be in IDS middleware harvester STIF cases |
1755 TInt err = KErrNone; |
1879 TInt err = KErrNone; |
1756 /* |
1880 /* |
1841 TInt count = SearchForTextL( filename, _L(VIDEO_QBASEAPPCLASS), KNullDesC ); |
1964 TInt count = SearchForTextL( filename, _L(VIDEO_QBASEAPPCLASS), KNullDesC ); |
1842 if(count <= 0) |
1965 if(count <= 0) |
1843 { |
1966 { |
1844 error = KErrNotFound; |
1967 error = KErrNotFound; |
1845 } |
1968 } |
1846 } |
1969 } |
1847 else |
1970 fSession.Close(); |
1848 error = KErrNotFound; |
1971 delete plugin; |
1849 CleanupStack::PopAndDestroy(); |
1972 delete iPluginTester; |
1850 delete plugin; |
1973 iPluginTester = NULL; |
1851 delete iPluginTester; |
1974 doLog( iLog, error, _L("Error in TestVideoHarvesting") ); |
1852 iPluginTester = NULL; |
|
1853 doLog( iLog, error, _L("Error in TestVideoHarvestingIndexL") ); |
|
1854 return error; |
1975 return error; |
1855 } |
1976 } |
1856 |
1977 |
1857 TInt CHarvesterPluginTester::TestVideoHarvestingUpdateIndexL( CStifItemParser& aItem ) |
1978 TInt CHarvesterPluginTester::TestVideoHandleItemL( CStifItemParser& aItem ) |
1858 { |
1979 { |
1859 TInt error = KErrNone; |
1980 TInt error = KErrNone; |
1860 TPtrC filepath; |
1981 TInt objId; |
1861 TPtrC filename; |
1982 TInt actionType; |
1862 TPtrC newFile; |
1983 aItem.GetNextInt ( objId ); |
1863 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Videos\\")); |
1984 aItem.GetNextInt ( actionType ); |
1864 TBuf<KMaxFileName> desPath; |
1985 CVideoPlugin* plugin = CVideoPlugin::NewL(); |
1865 desPath.Copy( srcPath ); |
1986 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1866 CVideoPlugin* plugin = CVideoPlugin::NewL(); |
1987 plugin->StartPluginL(); |
1867 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1988 TRAPD( err , plugin->HandleMdeItemL(objId, (TCPixActionType)actionType) ); |
1868 plugin->StartPluginL(); |
1989 doLog(iLog,error,_L("Error in TestVideoHandleItemL")); |
1869 RFs fSession; |
1990 delete plugin; |
1870 User::LeaveIfError( fSession.Connect()); |
1991 delete iPluginTester; |
1871 CleanupClosePushL( fSession ); |
1992 iPluginTester = NULL; |
1872 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
1993 return KErrNone; |
1873 { |
1994 } |
1874 srcPath.Append( filename ); |
1995 |
1875 if( aItem.GetNextString(newFile) == KErrNone ) |
1996 TInt CHarvesterPluginTester::TestVideoSyncDbManagerL( CStifItemParser& /*aItem */) |
1876 { |
1997 { |
1877 desPath.Append( newFile ); |
1998 CVideoPlugin* plugin = CVideoPlugin::NewL(); |
1878 RHarvesterClient harvester; |
1999 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1879 User::LeaveIfError(harvester.Connect()); |
2000 plugin->StartPluginL(); |
1880 harvester.Pause(); |
2001 CMDSEntity* entity; |
1881 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
2002 entity = CMDSEntity::NewL(); |
1882 if(!fileExist) |
2003 entity->Setkey(101); |
1883 { |
2004 entity->SetUri(_L("\\video\\video.mpg")); |
1884 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
2005 TDriveNumber drive = TDriveNumber(EDriveC); |
1885 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
2006 entity->SetDrive(drive); |
1886 } |
2007 plugin->iDBManager->AddL( entity->Key(),*entity ); |
1887 BaflUtils::RenameFile( fSession, srcPath, desPath ); |
2008 TRAPD( err , plugin->HandleMdeItemL(entity->Key(), ECPixAddAction)); |
1888 harvester.Resume(); |
2009 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixUpdateAction)); |
1889 harvester.Close(); |
2010 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixRemoveAction)); |
1890 plugin->StartHarvestingL( _L(VIDEO_QBASEAPPCLASS) ); |
2011 delete plugin; |
1891 //wait for index to flush |
2012 delete iPluginTester; |
1892 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
2013 iPluginTester = NULL; |
1893 //wait till video harvesting completes |
2014 return KErrNone; |
1894 iPluginTester->iWaitForHarvester->Start(); |
2015 } |
1895 TInt count = SearchForTextL(_L("Falls"), _L(VIDEO_QBASEAPPCLASS), KNullDesC ); |
2016 |
1896 if(count <= 0) |
2017 TInt CHarvesterPluginTester::TestVideoNoIndexerL( CStifItemParser& aItem ) |
1897 { |
2018 { |
1898 error = KErrNotFound; |
2019 TInt drive; |
1899 } |
2020 TInt objId; |
1900 doLog( iLog, error, _L("Error in TestVideoHarvestingUpdateIndexL") ); |
2021 aItem.GetNextInt ( drive ); |
1901 } |
2022 aItem.GetNextInt ( objId ); |
1902 } |
2023 CVideoPlugin* plugin = CVideoPlugin::NewL(); |
1903 else |
2024 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1904 doLog( iLog, KErrNotFound, _L("Error in TestVideoHarvestingUpdateIndexL") ); |
2025 plugin->StartPluginL(); |
1905 CleanupStack::PopAndDestroy(); |
2026 plugin->iIndexerUtil->iIndexer[drive]= NULL; |
1906 delete plugin; |
2027 TRAPD( err , plugin->HandleMdeItemL(objId, ECPixUpdateAction) ); |
1907 delete iPluginTester; |
2028 delete plugin; |
1908 iPluginTester = NULL; |
2029 delete iPluginTester; |
1909 return error; |
2030 iPluginTester = NULL; |
1910 } |
2031 return KErrNone; |
1911 |
2032 } |
1912 TInt CHarvesterPluginTester::TestVideoHarvestingDeleteIndexL( CStifItemParser& aItem ) |
2033 |
1913 { |
2034 TInt CHarvesterPluginTester::TestImageHarvestingL( CStifItemParser& aItem ) |
1914 TInt error = KErrNone; |
|
1915 TPtrC filepath; |
|
1916 TPtrC filename; |
|
1917 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Videos\\")); |
|
1918 CVideoPlugin* plugin = CVideoPlugin::NewL(); |
|
1919 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
1920 plugin->StartPluginL(); |
|
1921 RFs fSession; |
|
1922 User::LeaveIfError( fSession.Connect()); |
|
1923 CleanupClosePushL( fSession ); |
|
1924 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
|
1925 { |
|
1926 srcPath.Append( filename ); |
|
1927 RHarvesterClient harvester; |
|
1928 User::LeaveIfError(harvester.Connect()); |
|
1929 harvester.Pause(); |
|
1930 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
|
1931 if(!fileExist) |
|
1932 { |
|
1933 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
|
1934 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
|
1935 } |
|
1936 BaflUtils::DeleteFile( fSession, srcPath ); |
|
1937 harvester.Resume(); |
|
1938 harvester.Close(); |
|
1939 plugin->StartHarvestingL( _L(VIDEO_QBASEAPPCLASS) ); |
|
1940 //wait for index to flush |
|
1941 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
|
1942 //wait till video harvesting completes |
|
1943 iPluginTester->iWaitForHarvester->Start(); |
|
1944 TInt count = SearchForTextL(_L("Niagara"), _L(VIDEO_QBASEAPPCLASS), KNullDesC ); |
|
1945 if(count <= 0) |
|
1946 { |
|
1947 // If the search is not found,then testcase is success |
|
1948 doLog( iLog, error, _L("Error in TestVideoHarvestingDeleteIndexL") ); |
|
1949 } |
|
1950 } |
|
1951 else |
|
1952 doLog( iLog, KErrNotFound, _L("Error in TestVideoHarvestingDeleteIndexL") ); |
|
1953 CleanupStack::PopAndDestroy(); |
|
1954 delete plugin; |
|
1955 delete iPluginTester; |
|
1956 iPluginTester = NULL; |
|
1957 return error; |
|
1958 } |
|
1959 |
|
1960 TInt CHarvesterPluginTester::TestImageHarvestingAddIndexL( CStifItemParser& aItem ) |
|
1961 { |
2035 { |
1962 TInt error = KErrNone; |
2036 TInt error = KErrNone; |
1963 TPtrC filepath; |
2037 TPtrC filepath; |
1964 TPtrC filename; |
2038 TPtrC filename; |
1965 TPtrC newFile; |
2039 TPtrC newFile; |
1966 CImagePlugin* plugin = CImagePlugin::NewL(); |
2040 CImagePlugin* plugin = CImagePlugin::NewL(); |
1967 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2041 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
1968 plugin->StartPluginL(); |
2042 plugin->StartPluginL(); |
1969 RFs fSession; |
2043 RFs fSession; |
1970 User::LeaveIfError( fSession.Connect()); |
2044 User::LeaveIfError( fSession.Connect()); |
1971 CleanupClosePushL( fSession ); |
|
1972 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
2045 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
1973 { |
2046 { |
1974 TBuf<KMaxFileName> desPath(_L("c:\\data\\Images\\")); |
2047 TBuf<KMaxFileName> desPath(_L("c:\\data\\Images\\")); |
1975 desPath.Append( filename ); |
2048 desPath.Append( filename ); |
1976 //Delete the file if it already exists |
2049 //Delete the file if it already exists |
1996 } |
2069 } |
1997 } |
2070 } |
1998 else |
2071 else |
1999 error = KErrNotFound; |
2072 error = KErrNotFound; |
2000 doLog( iLog, error, _L("Error in TestImageHarvestingAddIndexL") ); |
2073 doLog( iLog, error, _L("Error in TestImageHarvestingAddIndexL") ); |
2001 CleanupStack::PopAndDestroy(); |
2074 fSession.Close(); |
2002 delete plugin; |
2075 delete plugin; |
2003 delete iPluginTester; |
2076 delete iPluginTester; |
2004 iPluginTester = NULL; |
2077 iPluginTester = NULL; |
2005 return error; |
2078 return error; |
2006 } |
2079 } |
2007 |
2080 |
2008 TInt CHarvesterPluginTester::TestImageHarvestingUpdateIndexL( CStifItemParser& aItem ) |
2081 TInt CHarvesterPluginTester::TestImageHandleItemL( CStifItemParser& aItem ) |
2009 { |
2082 { |
2010 TInt error = KErrNone; |
2083 TInt error = KErrNone; |
2011 TPtrC filepath; |
2084 TInt objId; |
2012 TPtrC filename; |
2085 TInt actionType; |
2013 TPtrC newFile; |
2086 aItem.GetNextInt ( objId ); |
2014 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Images\\")); |
2087 aItem.GetNextInt ( actionType ); |
2015 TBuf<KMaxFileName> desPath; |
2088 CImagePlugin* plugin = CImagePlugin::NewL(); |
2016 desPath.Copy( srcPath ); |
2089 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2017 CImagePlugin* plugin = CImagePlugin::NewL(); |
2090 plugin->StartPluginL(); |
2018 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2091 TRAPD( err , plugin->HandleMdeItemL(objId, (TCPixActionType)actionType) ); |
2019 plugin->StartPluginL(); |
2092 doLog(iLog,error,_L("Error in TestImageHandleItemL")); |
2020 RFs fSession; |
2093 delete plugin; |
2021 User::LeaveIfError( fSession.Connect()); |
2094 delete iPluginTester; |
2022 CleanupClosePushL( fSession ); |
2095 iPluginTester = NULL; |
2023 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
2096 return KErrNone; |
2024 { |
2097 } |
2025 srcPath.Append( filename ); |
2098 |
2026 if( aItem.GetNextString(newFile) == KErrNone ) |
2099 TInt CHarvesterPluginTester::TestImageSyncDbManagerL( CStifItemParser& /*aItem */) |
2027 { |
2100 { |
2028 desPath.Append( newFile ); |
2101 CImagePlugin* plugin = CImagePlugin::NewL(); |
2029 RHarvesterClient harvester; |
2102 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2030 User::LeaveIfError(harvester.Connect()); |
2103 plugin->StartPluginL(); |
2031 harvester.Pause(); |
2104 CMDSEntity* entity; |
2032 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
2105 entity = CMDSEntity::NewL(); |
2033 if(!fileExist) |
2106 entity->Setkey(102); |
2034 { |
2107 entity->SetUri(_L("\\image\\image.jpg")); |
2035 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
2108 TDriveNumber drive = TDriveNumber(EDriveC); |
2036 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
2109 entity->SetDrive(drive); |
2037 } |
2110 plugin->iDBManager->AddL( entity->Key(),*entity ); |
2038 BaflUtils::RenameFile( fSession, srcPath, desPath ); |
2111 TRAPD( err , plugin->HandleMdeItemL(entity->Key(), ECPixAddAction)); |
2039 harvester.Resume(); |
2112 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixUpdateAction)); |
2040 harvester.Close(); |
2113 TRAP( err , plugin->HandleMdeItemL(entity->Key(), ECPixRemoveAction)); |
2041 plugin->StartHarvestingL( _L(IMAGE_QBASEAPPCLASS) ); |
2114 delete plugin; |
2042 //wait for index to flush |
2115 delete iPluginTester; |
2043 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
2116 iPluginTester = NULL; |
2044 iPluginTester->iWaitForHarvester->Start(); |
2117 return KErrNone; |
2045 TInt count = SearchForTextL(_L("Portrait"), _L(IMAGE_QBASEAPPCLASS), KNullDesC ); |
2118 } |
2046 if(count <= 0) |
2119 |
2047 { |
2120 TInt CHarvesterPluginTester::TestImageNoIndexerL( CStifItemParser& aItem ) |
2048 error = KErrNotFound; |
2121 { |
2049 } |
2122 TInt drive; |
2050 doLog( iLog, error, _L("Error in TestImageHarvestingUpdateIndexL") ); |
2123 TInt objId; |
2051 } |
|
2052 } |
|
2053 else |
|
2054 doLog( iLog, KErrNotFound, _L("Error in TestImageHarvestingUpdateIndexL") ); |
|
2055 CleanupStack::PopAndDestroy(); |
|
2056 delete plugin; |
|
2057 delete iPluginTester; |
|
2058 iPluginTester = NULL; |
|
2059 return error; |
|
2060 } |
|
2061 |
|
2062 TInt CHarvesterPluginTester::TestImageHarvestingDeleteIndexL( CStifItemParser& aItem ) |
|
2063 { |
|
2064 TInt error = KErrNone; |
|
2065 TPtrC filepath; |
|
2066 TPtrC filename; |
|
2067 TBuf<KMaxFileName> srcPath(_L("c:\\data\\Images\\")); |
|
2068 CImagePlugin* plugin = CImagePlugin::NewL(); |
|
2069 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
|
2070 plugin->StartPluginL(); |
|
2071 RFs fSession; |
|
2072 User::LeaveIfError( fSession.Connect() ); |
|
2073 CleanupClosePushL( fSession ); |
|
2074 if((aItem.GetNextString(filepath)==KErrNone) && (aItem.GetNextString(filename) == KErrNone)) |
|
2075 { |
|
2076 srcPath.Append( filename ); |
|
2077 RHarvesterClient harvester; |
|
2078 User::LeaveIfError(harvester.Connect()); |
|
2079 harvester.Pause(); |
|
2080 TBool fileExist = BaflUtils::FileExists( fSession, srcPath ); |
|
2081 if(!fileExist) |
|
2082 { |
|
2083 BaflUtils::EnsurePathExistsL( fSession, srcPath );//Create folder |
|
2084 BaflUtils::CopyFile( fSession, filepath, srcPath ); |
|
2085 } |
|
2086 BaflUtils::DeleteFile( fSession, srcPath ); |
|
2087 harvester.Resume(); |
|
2088 harvester.Close(); |
|
2089 plugin->StartHarvestingL( _L(IMAGE_QBASEAPPCLASS) ); |
|
2090 //wait for index to flush |
|
2091 iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)60000000 ); |
|
2092 //wait till image harvesting completes |
|
2093 iPluginTester->iWaitForHarvester->Start(); |
|
2094 TInt count = SearchForTextL(_L("Square"), _L(IMAGE_QBASEAPPCLASS), KNullDesC ); |
|
2095 if(count <= 0) |
|
2096 { |
|
2097 // If the search is not found,then testcase is success |
|
2098 doLog( iLog, error, _L("Error in TestImageHarvestingDeleteIndexL") ); |
|
2099 } |
|
2100 } |
|
2101 else |
|
2102 doLog( iLog, KErrNotFound, _L("Error in TestImageHarvestingDeleteIndexL") ); |
|
2103 CleanupStack::PopAndDestroy(); |
|
2104 delete plugin; |
|
2105 delete iPluginTester; |
|
2106 iPluginTester = NULL; |
|
2107 return error; |
|
2108 } |
|
2109 |
|
2110 TInt CHarvesterPluginTester::TestAudioMMCEventL( CStifItemParser& aItem ) |
|
2111 { |
|
2112 TInt error(KErrNone); |
|
2113 TInt drive; |
|
2114 TInt mmcstatus; |
|
2115 aItem.GetNextInt ( drive ); |
2124 aItem.GetNextInt ( drive ); |
2116 aItem.GetNextInt ( mmcstatus ); |
2125 aItem.GetNextInt ( objId ); |
2117 CAudioPlugin* plugin = CAudioPlugin::NewL(); |
2126 CImagePlugin* plugin = CImagePlugin::NewL(); |
2118 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2127 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); |
2119 plugin->StartPluginL(); //Initialize the Plugin |
2128 plugin->StartPluginL(); |
2120 TRAPD( err , plugin->HandleMMCEventL( (TDriveNumber)drive , mmcstatus) ); |
2129 plugin->iIndexerUtil->iIndexer[drive]= NULL; |
2121 //iPluginTester->iWaitForHarvester->Start(); //Start Wait AO and let it complete |
2130 TRAPD( err , plugin->HandleMdeItemL(objId, ECPixUpdateAction) ); |
2122 doLog(iLog,error,_L("Error in TestAudioMMCEventL")); |
2131 delete plugin; |
2123 delete plugin; |
2132 delete iPluginTester; |
2124 delete iPluginTester; |
2133 iPluginTester = NULL; |
2125 iPluginTester = NULL; |
2134 return KErrNone; |
2126 //End search |
2135 } |
2127 return err; |
|
2128 } |
|
2129 |
|
2130 TInt CHarvesterPluginTester::TestVideoMMCEventL( CStifItemParser& aItem ) |
2136 TInt CHarvesterPluginTester::TestVideoMMCEventL( CStifItemParser& aItem ) |
2131 { |
2137 { |
2132 TInt error(KErrNone); |
2138 TInt error(KErrNone); |
2133 TInt drive; |
2139 TInt drive; |
2134 TInt mmcstatus; |
2140 TInt mmcstatus; |
2192 TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); |
2201 TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); |
2193 |
2202 |
2194 // Print to log file |
2203 // Print to log file |
2195 iLog->Log( KExample ); |
2204 iLog->Log( KExample ); |
2196 CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); |
2205 CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); |
2197 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); |
2206 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); |
|
2207 TRAPD(err , emailPlugin->StartPluginL()); |
2198 CSearchDocument* doc = prepareemaildocument(); |
2208 CSearchDocument* doc = prepareemaildocument(); |
2199 TRAPD(err , emailPlugin->HandleDocumentL( doc , ECPixAddAction)); |
2209 TRAP(err , emailPlugin->HandleDocumentL( doc , ECPixAddAction)); |
2200 iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. |
2210 TRAP(err , emailPlugin->HandleDocumentL( doc , ECPixRemoveAction)); |
|
2211 //iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. |
|
2212 delete doc; |
2201 delete emailPlugin; |
2213 delete emailPlugin; |
2202 delete iPluginTester; |
2214 delete iPluginTester; |
2203 doLog( iLog, err, KNoErrorString ); |
2215 doLog( iLog, err, KNoErrorString ); |
2204 return err; |
2216 return err; |
2205 } |
2217 } |
2206 |
2218 |
|
2219 TInt CHarvesterPluginTester::TestEmailBaseappclassL( CStifItemParser& /*aItem*/ ) |
|
2220 { |
|
2221 _LIT( KHarvesterPluginTester, "HarvesterPluginTester: %S" ); |
|
2222 _LIT( KExample, "In TestEmailBaseappclassL" ); |
|
2223 TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); |
|
2224 |
|
2225 TDriveNumber drive ( EDriveA ); |
|
2226 _LIT( appcls1 ,"@c:root msg email" ); |
|
2227 _LIT( appcls2 ,"@*:root msg email" ); |
|
2228 _LIT( appcls3 ,"d:root msg email" ); |
|
2229 CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); |
|
2230 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); |
|
2231 TRAPD(err , emailPlugin->StartPluginL()); |
|
2232 TRAP(err, emailPlugin->StartHarvestingL(appcls1)); |
|
2233 delete emailPlugin->iIndexer[EDriveC]; |
|
2234 emailPlugin->iIndexer[EDriveC] = NULL; |
|
2235 TRAP(err, emailPlugin->StartHarvestingL(appcls1)); |
|
2236 TRAP(err, emailPlugin->StartHarvestingL(appcls2)); |
|
2237 TRAP(err, emailPlugin->StartHarvestingL(appcls3)); |
|
2238 delete emailPlugin; |
|
2239 delete iPluginTester; |
|
2240 return err; |
|
2241 } |
|
2242 |
|
2243 TInt CHarvesterPluginTester::TestEmailHandleDocL( CStifItemParser& /*aItem*/ ) |
|
2244 { |
|
2245 _LIT( KHarvesterPluginTester, "HarvesterPluginTester: %S" ); |
|
2246 _LIT( KExample, "In TestEmailHandleDocL" ); |
|
2247 TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); |
|
2248 CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); |
|
2249 CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); |
|
2250 CSearchDocument* doc = prepareemaildocument(); |
|
2251 TRAPD(err , emailPlugin->StartPluginL()); |
|
2252 TRAP(err, emailPlugin->StartHarvestingL( KEmailAppBasePath )); |
|
2253 delete emailPlugin->iIndexer[EDriveC]; |
|
2254 TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixRemoveAction)); |
|
2255 TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixAddAction)); |
|
2256 emailPlugin->MountL(EDriveC); |
|
2257 TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixAddAction)); |
|
2258 TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixUpdateAction)); |
|
2259 delete doc; |
|
2260 delete emailPlugin; |
|
2261 delete iPluginTester; |
|
2262 return err; |
|
2263 } |
|
2264 |
2207 // [End of File] - Do not remove |
2265 // [End of File] - Do not remove |