SyncItem* WebOsCalendarSyncSource::getNextItem() { LOG.info("========== GET NEXT ITEM CALLED ==========="); if(mEvents.empty()) { //no items anymore, need to get more. If that doesn't work, there are no more items. getMoreItems(); if(mEvents.empty()) { LOG.info("======= NO MORE ELEMENTS =========="); return NULL; } } if(!mEvents.empty()) { //take first event and convert into item of correct type. std::pair<WString,WString>& e = mEvents.front(); SyncItem* item = new SyncItem(); item->setDataType(TEXT("text/calendar")); item->setData(e.second.c_str(),e.second.length()); item->setKey(e.first.c_str()); LOG.debug("Received %s from JS with key %s.",e.second.c_str(),e.first.c_str()); mEvents.pop_front(); return item; } else return NULL; }
SyncItem* WebOsCalendarSyncSource::getNextUpdatedItem() { LOG.info("=========== GET NEXT UPDATED ITEM CALLED =================="); if(!mGetChangesCalled) { getChanges(); } if(!mEvents.empty()) { //take first event and convert into item of correct type. std::pair<WString,WString>& e = mEvents.front(); SyncItem* item = new SyncItem(); item->setDataType(TEXT("text/calendar")); item->setData(e.second.c_str(),e.second.length()); item->setKey(e.first.c_str()); LOG.debug("Received %s from JS.",e.second.c_str()); mEvents.pop_front(); return item; } else return NULL; return NULL; }
SyncItem* LOSyncSource::getNextNewItem() { if (getUseAdd() == false) { return NULL; } if (count == 2) { return NULL; } StringBuffer name = getSyncItemName(); WCHAR key[256]; wsprintf(key, TEXT(WCHAR_PRINTF_STRING), name.c_str()); wcscat(key, getName()); SyncItem* item = new SyncItem(key); if (getUseDataEncoding()) { // just to test that the api works properly with custom encoding item->setDataEncoding("bin"); } char* data = getNewCard(true); item->setData(data, (long)strlen(data)); delete [] data; return item; }
END_TEST /** * Removed the STATUS from the winevent parser */ BEGIN_TEST(WinEventNoSTATUS) { int ret = 0; SyncItem* item = NULL; WCHAR* internalKey = NULL; wstring propValue; WindowsSyncSource* ss = createAppointmentWindowsSyncSource(); WIN_ASSERT_NOT_NULL(ss, TEXT("The syncSource is null.")); StringBuffer VCal; VCal.append("BEGIN:VCALENDAR\r\n"); VCal.append("VERSION:1.0\r\n"); VCal.append("BEGIN:VEVENT\r\n"); VCal.append("X-FUNAMBOL-FOLDER:DEFAULT_FOLDER\r\n"); VCal.append("X-FUNAMBOL-ALLDAY:1\r\n"); VCal.append("DTSTART:20110407\r\n"); VCal.append("DTEND:20110408\r\n"); VCal.append("X-MICROSOFT-CDO-BUSYSTATUS:FREE\r\n"); VCal.append("CATEGORIES:\r\n"); VCal.append("DESCRIPTION:\r\n"); VCal.append("LOCATION:Roma\r\n"); VCal.append("PRIORITY:1\r\n"); VCal.append("STATUS:NEED ACTION\r\n"); VCal.append("X-MICROSOFT-CDO-REPLYTIME:\r\n"); VCal.append("SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Da test\r\n"); VCal.append("CLASS:PUBLIC\r\n"); VCal.append("AALARM:20110406T060000Z;;0;\r\n"); VCal.append("RRULE:\r\n"); VCal.append("X-FUNAMBOL-BILLINGINFO:\r\n"); VCal.append("X-FUNAMBOL-COMPANIES:\r\n"); VCal.append("X-FUNAMBOL-MILEAGE:\r\n"); VCal.append("X-FUNAMBOL-NOAGING:0 \r\n"); VCal.append("END:VEVENT\r\n"); VCal.append("END:VCALENDAR"); item = new SyncItem(TEXT("GUID")); item->setData(VCal.c_str(), VCal.length()); WCHAR* tt = toWideChar(VCal.c_str()); WinEvent d(tt); printf("%S", d.toString().c_str()); // insert test item ret = ss->addItem(*item); WIN_ASSERT_EQUAL(ret, 201, TEXT("Adding item is not correct")); internalKey = (WCHAR*)item->getKey(); delete item; delete ss; }
int setModifiedItems() { SyncItem item; StringBuffer val; for (int ii = 0; ii<1; ii++){ val.append("This is the updated item one"); } for (int i = 0; i < 4; ++i) { switch (i) { case 0: item.setKey(TEXT("item5")); item.setData(val.c_str() , (val.length())*sizeof(char)); newItems.add(item); break; case 1: item.setKey(TEXT("item1")); item.setData(val.c_str() , (val.length())*sizeof(char)); updatedItems.add(item); break; case 2: item.setKey(TEXT("item3")); item.setData(val.c_str() , (val.length())*sizeof(char)); updatedItems.add(item); break; case 3: item.setKey(TEXT("item4")); deletedItems.add(item); break; } } return 0; }
SyncItem *AbstractSyncSource::createSyncItem(const QUniqueId &id, bool wantData, SyncState state) const { //qDebug() << "AbstractSyncSource::createSyncItem(" << id.toString() << "," << wantData << "," << state << ")"; QByteArray record = m_model->record(id, m_type); SyncItem *item = new SyncItem(); QString key = id.toString(); item->setKey(key.toAscii().data()); item->setModificationTime(m_lastSync.toTime_t()); item->setState(state); if (wantData) { item->setData(record.data(), record.size() - 1); // have to omit '\0' item->setDataType(getConfig().getType()); } //qDebug() << "AbstractSyncSource::createSyncItem()" << toString(*item); return item; }
int setAllItems() { SyncItem item; WCHAR name[64]; char data[128]; for (int i = 0; i < 4; ++i) { wsprintf(name, TEXT("%s%d"), TEXT("item"), i); sprintf(data, "This is item %d", i); item.setKey(name); item.setData(data , (strlen(data))*sizeof(char)); items.add(item); } return 0; }
SyncItem* MappingTestSyncSource::getNextNewItem() { if (count == 3) { return NULL; } WCHAR key[256]; wsprintf(key, TEXT("%i-%lu"), count, this->getConfig().getLast()); wcscat(key, getName()); SyncItem* item = new SyncItem(key); StringBuffer data = getNewCard(); item->setData(data, data.length()); return item; }
SyncItem* LOSyncSource::getNextUpdatedItem() { if (getUseUpdate() == false) { return NULL; } if (count == 2) { return NULL; } StringBuffer name = getSyncItemName(); WCHAR key[256]; wsprintf(key, TEXT(WCHAR_PRINTF_STRING), name.c_str()); wcscat(key, getName()); SyncItem* item = new SyncItem(key); char* data = getNewCard(false); item->setData(data, (long)strlen(data)); delete [] data; return item; }
SyncItem* CacheSyncSource::fillSyncItem(StringBuffer* key) { SyncItem* syncItem = NULL; size_t size = 0; void* content = NULL; if (!key) { return NULL; } LOG.debug("[%s] Filling item with key %s", getName(), key->c_str()); content = getItemContent((*key), &size); WCHAR* wkey = toWideChar(key->c_str()); syncItem = new SyncItem(wkey); syncItem->setData(content, size); if (wkey) { delete [] wkey; wkey = NULL; } if (content) { delete [] (char*)content; content = NULL; } return syncItem; }
END_TEST /** * The test must be executed with an already installed Outlook client */ BEGIN_TEST(WinContactPhotoIsTheSame) { int ret = 0; SyncItem* item = NULL; WCHAR* internalKey = NULL; wstring propValue; WindowsSyncSource* ss = createContactWindowsSyncSource(); WIN_ASSERT_NOT_NULL(ss, TEXT("The syncSource is null.")); StringBuffer VCard; VCard.append("BEGIN:VCARD\r\n"); VCard.append("VERSION:2.1\r\n"); VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n"); VCard.append("BDAY:20100901\r\n"); VCard.append("NOTE:\r\n"); VCard.append("TEL;WORK;FAX:4444444444\r\n"); VCard.append("TEL;VOICE;WORK:22222222222\r\n"); VCard.append("TEL;VOICE;WORK:333333333333\r\n"); VCard.append("TEL;CAR;VOICE:66666666666\r\n"); VCard.append("CATEGORIES:\r\n"); VCard.append("TEL;WORK;PREF:777777777777\r\n"); VCard.append("FN:Paperino, Paolino Middle\r\n"); VCard.append("EMAIL;INTERNET:[email protected]\r\n"); VCard.append("EMAIL;INTERNET;HOME:[email protected]\r\n"); VCard.append("EMAIL;INTERNET;WORK:[email protected]\r\n"); VCard.append("TITLE:JobTitle\r\n"); VCard.append("TEL;VOICE;HOME:8888888888888\r\n"); VCard.append("TEL;VOICE;HOME:999999999999\r\n"); VCard.append("TEL;HOME;FAX:000000000\r\n"); VCard.append("URL;HOME:\r\n"); VCard.append("TEL;CELL:1212121212121\r\n"); VCard.append("NICKNAME:nickname\r\n"); VCard.append("TEL;FAX:14141414141\r\n"); VCard.append("TEL;VOICE:131313131313\r\n"); VCard.append("TEL;PAGER:151515151\r\n"); VCard.append("TEL;PREF;VOICE:16161616161\r\n"); VCard.append("ROLE:profession\r\n"); VCard.append("URL:www.web.com\r\n"); VCard.append("ORG:Company;department;office\r\n"); VCard.append("ADR;HOME:;;Via Riviera 55;pavia;pv;27100;Italy\r\n"); VCard.append("ADR:;;Via Naples 23;milano;mi;3993;Italy\r\n"); VCard.append("ADR;WORK:;;Via Roma;New york;NY;20111;Italy\r\n"); VCard.append(" /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY\r\n"); VCard.append(" GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa\r\n"); VCard.append(" KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR\r\n"); VCard.append(" CAA2AEgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA\r\n"); VCard.append(" AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK\r\n"); VCard.append(" FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG\r\n"); VCard.append(" h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl\r\n"); VCard.append(" 5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA\r\n"); VCard.append(" AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk\r\n"); VCard.append(" NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE\r\n"); VCard.append(" hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk\r\n"); VCard.append(" 5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCfxl4r1qy8S69Aut61bW9vqMysHmlCRxu7\r\n"); VCard.append(" BSrKeFHbsBjpivOm8d+KAQreJtdSVE8uRW1CbnGSJFGemB+tbXxIef8A4THxCDaXAjF/dees\r\n"); VCard.append(" t1tjuYhMxG0Z4xXnN9dwNAkTTJIAodFlRi6jkbAfoc14+HUuaTu3r/X9Py6n0s3FQjdJaLdW\r\n"); VCard.append(" v99vw8007pnZaf418TSW0lxceK9eUjaVRb6U9eSuN3pjmki8beKhOF/4SnWAQcfNqExAx1zg\r\n"); VCard.append(" +tcL9qMSxqc+WoABxt8zBwMep55zVyzlclwxJl+6Y2kC/MTnp3rrcZK7uYQ5FJJr+v8AhtvT\r\n"); VCard.append(" RbHoFn4z8Qmf7NL4p1tVbBybyRmLHsDngZ7VqP4p8SxHYfEOsEoNzn7bIck9FHzVx8Yit7SL\r\n"); VCard.append(" M8Ksko3nAZ93XgDqK1IyWRbi4iaNC2Y1I+82eGPevLrTle6bsfTYKEGuWpFX7WX9fgj0f4Z+\r\n"); VCard.append(" JvEUt4H1PWLtrQnGLudmLk9hk9q91tpJpFBM0hyP7xr5d8MTeVqcVzK4Yq3yjzAQzemK+gdD\r\n"); VCard.append(" 1rdax+YArY5Gc0YfFqM3GbPJzvDLn5qaXyRuam1wIG8ueVTjqrkUVXudQR4D0NFTipxlO6kz\r\n"); VCard.append(" yKMZRjZo+WvippZi8c+JmW1VojcTytLdTEj5nJJQdsE4xXBXxaaCZ/tE5DwxmIvags4UjO0j\r\n"); VCard.append(" oB616f43uGfxX4kgtrW5ucalcfajcSfucea2wY9B1Fcrb6LfraahdWs4lkgk+zs6yARpCwyy\r\n"); VCard.append(" qOua0jX9m37R6p/13td/gep7HmpLk6r9H2tffzfmcdNZt5rSIXO9TLBJcDHnJ0IUdM5rRsra\r\n"); VCard.append(" Ozk+z3Bt4wrhBBeptYbh1LD0qe408vYs9nZSXdhM4jiTBae2VTyfYHnH0rRsoEk3ix1KKW3N\r\n"); VCard.append(" zGyJqEW5gMdc+ma6Z17x3/r8bf1YzpUXz2S/p3+9PTXW6tcdpVu0LL9k/siEnMRl3FiW9Rxk\r\n"); VCard.append(" H0NbMiAW28CSWVsh5X65H931qIfZ7JmkkTSkZZyCYY9xX8PQ1oWn+mlfJikmbcWAb5Vj+ntX\r\n"); VCard.append(" l1qjb5+n9dT6DCwVFa6eX/AsjS8MbIriF7i3jRzgRsyEkfX0r2rSbLzbdCWRmxztrhPDOm2U\r\n"); VCard.append(" yhZoZI7t1w+GO0H2rfFvq2hvvtibi367T1FdGCnCrHmWp5+Omq0rRdn5nWNpDMuASPoaKqaR\r\n"); VCard.append(" 4rgmwlwDFJ3Vxiiu7kpvc8Wf1iDs0eA/EMMvjTXZb65kNs+pzq1vFxuVZGxn9K5qNvJSIXu+\r\n"); VCard.append(" DTZBJNDHGfmJ7Z716r460xpte1u6KIu28lC7x/DvOT+NcI2kXUrtdxx+bDGhTa3Rc+lcDqxb\r\n"); VCard.append(" l2Tt218vPzPYpwXs1UjLay/K9328kUI9X1HTrm8acGKWdIpIxF91VxjJH40+U3Mas1pcW062\r\n"); VCard.append(" bY5XDMj8nP0P8q0zp8ttfSK7ec4gCHcP4SOlX38LfZ7dJ4Y1+WMEn+9+FYynSi4tpJy28+nr\r\n"); VCard.append(" tp8zoVNpqMpb3afXv6f8BGRFFPE2w2tnOEjwzIOSp5/MV19hokl3psN1bOHwmJI06g0umaEl\r\n"); VCard.append(" 9BHPbRgMRtkUcV13hq2TS5mjePaH4J9az9lOp70d4vVF1a3IrxfvL0Mu0uHtliVt8ciDAY9f\r\n"); VCard.append(" xrttC1qO5QRXON386XU9Dh1C33KAGxwwrjbizu9Mnw6ttB4YV2fVuR89LR/gedy0sTdrSR6P\r\n"); VCard.append(" PolpdjeEUk98UVh+GdfLFYZzg9j60V0xrRt76szz6ixFKXKmc349zNq17HnG+7kB+gY0+Cwj\r\n"); VCard.append(" t9EWNAP3h5OKKK4cVBLAysuv6nYm44KFjMnsEGtIGwQVCn3Fbt1pccKrCrHZ5fGaKKzx0I+x\r\n"); VCard.append(" oytqmjbEzkvZ2ZmeGv8ARL+SEcrursrqySWLfwDiiiu+OlZ27E4ttVE0P0K9dJTbv8wHQ1t3\r\n"); VCard.append(" enw3MeWUc+tFFdrSaPNxPuVLx0OcvdHht2LxYUj0ooorwsVJqpodMJykk2z/2Q==\r\n"); VCard.append("\r\n"); VCard.append("X-ANNIVERSARY:20100902\r\n"); VCard.append("X-FUNAMBOL-BILLINGINFO:\r\n"); VCard.append("TEL;X-FUNAMBOL-CALLBACK:5555555555\r\n"); VCard.append("X-FUNAMBOL-CHILDREN:\r\n"); VCard.append("X-FUNAMBOL-COMPANIES:\r\n"); VCard.append("X-FUNAMBOL-FOLDER:DEFAULT_FOLDER\r\n"); VCard.append("X-FUNAMBOL-HOBBIES:\r\n"); VCard.append("EMAIL;INTERNET;HOME;X-FUNAMBOL-INSTANTMESSENGER:IMaddress\r\n"); VCard.append("X-FUNAMBOL-INITIALS:P.M.P.\r\n"); VCard.append("X-FUNAMBOL-LANGUAGES:\r\n"); VCard.append("X-MANAGER:managerName\r\n"); VCard.append("X-FUNAMBOL-MILEAGE:\r\n"); VCard.append("X-FUNAMBOL-ORGANIZATIONALID:\r\n"); VCard.append("TEL;X-FUNAMBOL-RADIO:1717171717\r\n"); VCard.append("X-SPOUSE:spuse\r\n"); VCard.append("X-FUNAMBOL-SUBJECT:Paolino Middle Paperino suffix\r\n"); VCard.append("TEL;X-FUNAMBOL-TELEX:1181818181818\r\n"); VCard.append("X-FUNAMBOL-YOMICOMPANYNAME:\r\n"); VCard.append("X-FUNAMBOL-YOMIFIRSTNAME:\r\n"); VCard.append("X-FUNAMBOL-YOMILASTNAME:\r\n"); VCard.append("END:VCARD"); item = new SyncItem(TEXT("GUID")); item->setData(VCard.c_str(), VCard.length()); // insert test item ret = ss->addItem(*item); WIN_ASSERT_EQUAL(ret, 201, TEXT("Adding item is not correct")); internalKey = (WCHAR*)item->getKey(); // // remove work and car tel number // VCard.reset(); VCard.append("BEGIN:VCARD\r\n"); VCard.append("VERSION:2.1\r\n"); VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n"); VCard.append("PHOTO;ENCODING=b;TYPE=JPEG:\r\n"); VCard.append(" /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY\r\n"); VCard.append(" GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa\r\n"); VCard.append(" KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR\r\n"); VCard.append(" CAA2AEgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA\r\n"); VCard.append(" AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK\r\n"); VCard.append(" FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG\r\n"); VCard.append(" h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl\r\n"); VCard.append(" 5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA\r\n"); VCard.append(" AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk\r\n"); VCard.append(" NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE\r\n"); VCard.append(" hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk\r\n"); VCard.append(" 5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCfxl4r1qy8S69Aut61bW9vqMysHmlCRxu7\r\n"); VCard.append(" BSrKeFHbsBjpivOm8d+KAQreJtdSVE8uRW1CbnGSJFGemB+tbXxIef8A4THxCDaXAjF/dees\r\n"); VCard.append(" t1tjuYhMxG0Z4xXnN9dwNAkTTJIAodFlRi6jkbAfoc14+HUuaTu3r/X9Py6n0s3FQjdJaLdW\r\n"); VCard.append(" v99vw8007pnZaf418TSW0lxceK9eUjaVRb6U9eSuN3pjmki8beKhOF/4SnWAQcfNqExAx1zg\r\n"); VCard.append(" +tcL9qMSxqc+WoABxt8zBwMep55zVyzlclwxJl+6Y2kC/MTnp3rrcZK7uYQ5FJJr+v8AhtvT\r\n"); VCard.append(" RbHoFn4z8Qmf7NL4p1tVbBybyRmLHsDngZ7VqP4p8SxHYfEOsEoNzn7bIck9FHzVx8Yit7SL\r\n"); VCard.append(" M8Ksko3nAZ93XgDqK1IyWRbi4iaNC2Y1I+82eGPevLrTle6bsfTYKEGuWpFX7WX9fgj0f4Z+\r\n"); VCard.append(" JvEUt4H1PWLtrQnGLudmLk9hk9q91tpJpFBM0hyP7xr5d8MTeVqcVzK4Yq3yjzAQzemK+gdD\r\n"); VCard.append(" 1rdax+YArY5Gc0YfFqM3GbPJzvDLn5qaXyRuam1wIG8ueVTjqrkUVXudQR4D0NFTipxlO6kz\r\n"); VCard.append(" yKMZRjZo+WvippZi8c+JmW1VojcTytLdTEj5nJJQdsE4xXBXxaaCZ/tE5DwxmIvags4UjO0j\r\n"); VCard.append(" oB616f43uGfxX4kgtrW5ucalcfajcSfucea2wY9B1Fcrb6LfraahdWs4lkgk+zs6yARpCwyy\r\n"); VCard.append(" qOua0jX9m37R6p/13td/gep7HmpLk6r9H2tffzfmcdNZt5rSIXO9TLBJcDHnJ0IUdM5rRsra\r\n"); VCard.append(" Ozk+z3Bt4wrhBBeptYbh1LD0qe408vYs9nZSXdhM4jiTBae2VTyfYHnH0rRsoEk3ix1KKW3N\r\n"); VCard.append(" zGyJqEW5gMdc+ma6Z17x3/r8bf1YzpUXz2S/p3+9PTXW6tcdpVu0LL9k/siEnMRl3FiW9Rxk\r\n"); VCard.append(" H0NbMiAW28CSWVsh5X65H931qIfZ7JmkkTSkZZyCYY9xX8PQ1oWn+mlfJikmbcWAb5Vj+ntX\r\n"); VCard.append(" l1qjb5+n9dT6DCwVFa6eX/AsjS8MbIriF7i3jRzgRsyEkfX0r2rSbLzbdCWRmxztrhPDOm2U\r\n"); VCard.append(" yhZoZI7t1w+GO0H2rfFvq2hvvtibi367T1FdGCnCrHmWp5+Omq0rRdn5nWNpDMuASPoaKqaR\r\n"); VCard.append(" 4rgmwlwDFJ3Vxiiu7kpvc8Wf1iDs0eA/EMMvjTXZb65kNs+pzq1vFxuVZGxn9K5qNvJSIXu+\r\n"); VCard.append(" DTZBJNDHGfmJ7Z716r460xpte1u6KIu28lC7x/DvOT+NcI2kXUrtdxx+bDGhTa3Rc+lcDqxb\r\n"); VCard.append(" l2Tt218vPzPYpwXs1UjLay/K9328kUI9X1HTrm8acGKWdIpIxF91VxjJH40+U3Mas1pcW062\r\n"); VCard.append(" bY5XDMj8nP0P8q0zp8ttfSK7ec4gCHcP4SOlX38LfZ7dJ4Y1+WMEn+9+FYynSi4tpJy28+nr\r\n"); VCard.append(" tp8zoVNpqMpb3afXv6f8BGRFFPE2w2tnOEjwzIOSp5/MV19hokl3psN1bOHwmJI06g0umaEl\r\n"); VCard.append(" 9BHPbRgMRtkUcV13hq2TS5mjePaH4J9az9lOp70d4vVF1a3IrxfvL0Mu0uHtliVt8ciDAY9f\r\n"); VCard.append(" xrttC1qO5QRXON386XU9Dh1C33KAGxwwrjbizu9Mnw6ttB4YV2fVuR89LR/gedy0sTdrSR6P\r\n"); VCard.append(" PolpdjeEUk98UVh+GdfLFYZzg9j60V0xrRt76szz6ixFKXKmc349zNq17HnG+7kB+gY0+Cwj\r\n"); VCard.append(" t9EWNAP3h5OKKK4cVBLAysuv6nYm44KFjMnsEGtIGwQVCn3Fbt1pccKrCrHZ5fGaKKzx0I+x\r\n"); VCard.append(" oytqmjbEzkvZ2ZmeGv8ARL+SEcrursrqySWLfwDiiiu+OlZ27E4ttVE0P0K9dJTbv8wHQ1t3\r\n"); VCard.append(" enw3MeWUc+tFFdrSaPNxPuVLx0OcvdHht2LxYUj0ooorwsVJqpodMJykk2z/2Q==\r\n"); VCard.append("\r\n"); VCard.append("END:VCARD"); // update item item->setData(VCard.c_str(), VCard.length()); WinContact* winC = updateOutlookItem(ss, item); WIN_ASSERT_NOT_NULL(winC, TEXT("The item retrieved from the backend is null.")); // check some modifications winC->getProperty(L"Email1Address", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Email2Address is not null")); winC->getProperty(L"Email3Address", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Email3Address is not null")); winC->getProperty(L"Email2Address", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Email2Address is not null")); winC->getProperty(L"Birthday", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Birthday is not null")); winC->getProperty(L"OtherAddress", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The OtherAddress is not null")); winC->getProperty(L"MobileTelephoneNumber", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The MobileTelephoneNumber is not null")); winC->getProperty(L"Photo", propValue); WIN_ASSERT_TRUE(!propValue.empty(), TEXT("The BusinessAddress is not null")); delete winC; // // delete the test item // ret = ss->deleteItem(*item); WIN_ASSERT_EQUAL(ret, 200, TEXT("delete item is not correct")); delete item; }
END_TEST /** * The test must be executed with an already installed Outlook client */ BEGIN_TEST(WinContactRemoveEmail) { int ret = 0; SyncItem* item = NULL; WCHAR* internalKey = NULL; wstring propValue; WindowsSyncSource* ss = createContactWindowsSyncSource(); WIN_ASSERT_NOT_NULL(ss, TEXT("The syncSource is null.")); StringBuffer VCard; VCard.append("BEGIN:VCARD\r\n"); VCard.append("VERSION:2.1\r\n"); VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n"); VCard.append("BDAY:20100901\r\n"); VCard.append("TEL;WORK;FAX:4444444444\r\n"); VCard.append("TEL;VOICE;WORK:22222222222\r\n"); VCard.append("TEL;VOICE;WORK:333333333333\r\n"); VCard.append("TEL;CAR;VOICE:66666666666\r\n"); VCard.append("EMAIL;INTERNET:[email protected]\r\n"); VCard.append("EMAIL;INTERNET;HOME:[email protected]\r\n"); VCard.append("EMAIL;INTERNET;WORK:[email protected]\r\n"); VCard.append("ADR;HOME:;;Via Riviera 55;pavia;pv;27100;Italy\r\n"); VCard.append("ADR:;;Via Naples 23;milano;mi;3993;Italy\r\n"); VCard.append("ADR;WORK:;;Via Roma;New york;NY;20111;Italy\r\n"); VCard.append("END:VCARD"); item = new SyncItem(TEXT("GUID")); item->setData(VCard.c_str(), VCard.length()); // insert test item ret = ss->addItem(*item); WIN_ASSERT_EQUAL(ret, 201, TEXT("Adding item is not correct")); internalKey = (WCHAR*)item->getKey(); // // remove work and car tel number // VCard.reset(); VCard.append("BEGIN:VCARD\r\n"); VCard.append("VERSION:2.1\r\n"); VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n"); VCard.append("TEL;WORK;FAX:4444444444\r\n"); VCard.append("TEL;VOICE;WORK:22222222222\r\n"); VCard.append("TEL;VOICE;WORK:333333333333\r\n"); VCard.append("TEL;CAR;VOICE:66666666666\r\n"); VCard.append("EMAIL;INTERNET;HOME:[email protected]\r\n"); VCard.append("ADR;HOME:;;Via Riviera 55;pavia;pv;27100;Italy\r\n"); VCard.append("ADR;WORK:;;Via Roma;New york;NY;20111;Italy\r\n"); VCard.append("END:VCARD"); // update item item->setData(VCard.c_str(), VCard.length()); WinContact* winC = updateOutlookItem(ss, item); WIN_ASSERT_NOT_NULL(winC, TEXT("The item retrieved from the backend is null.")); // check modifications // Mapping is: // Email1Address <-> EMAIL;INTERNET: // Email2Address <-> EMAIL;INTERNET;HOME: // Email3Address <-> EMAIL;INTERNET;WORK: winC->getProperty(L"Email1Address", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Email2Address is not null")); winC->getProperty(L"Email3Address", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Email3Address is not null")); winC->getProperty(L"Birthday", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The Birthday is not null")); winC->getProperty(L"OtherAddress", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The OtherAddress is not null")); delete winC; // // remove one work tel number // VCard.reset(); VCard.reset(); VCard.append("BEGIN:VCARD\r\n"); VCard.append("VERSION:2.1\r\n"); VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n"); VCard.append("TEL;WORK;FAX:4444444444\r\n"); VCard.append("TEL;VOICE;WORK:22222222222\r\n"); VCard.append("TEL;VOICE;WORK:333333333333\r\n"); VCard.append("TEL;CAR;VOICE:66666666666\r\n"); VCard.append("EMAIL;INTERNET;HOME:[email protected]\r\n"); VCard.append("END:VCARD"); item->setData(VCard.c_str(), VCard.length()); winC = updateOutlookItem(ss, item); WIN_ASSERT_NOT_NULL(winC, TEXT("The item retrieved from the backend is null.")); winC->getProperty(L"HomeAddress", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The HomeAddress is not null")); winC->getProperty(L"BusinessAddress", propValue); WIN_ASSERT_TRUE(propValue.empty(), TEXT("The BusinessAddress is not null")); delete winC; // // delete the test item // ret = ss->deleteItem(*item); WIN_ASSERT_EQUAL(ret, 200, TEXT("delete item is not correct")); delete item; delete ss; }