int WebOsCalendarSyncSource::deleteItem(SyncItem &item)
{
	int ret = STC_COMMAND_FAILED;
	LOG.info("deleteItem called with %s data. And Type %s.",item.getKey(),item.getDataType());

	LOG.info("Calling deleteEvent.");
	std::vector<WString> result = BlockingServiceCall("deleteEvent",item.getKey());
	if(result.empty())
	{
		LOG.error("delete event %s did not work.",item.getKey());
		ret = STC_COMMAND_FAILED;
	}
	else
	{
		LOG.error("delete event was successful, received: %s.",result[0].c_str());
		ret = STC_OK;
	}

	if (isErrorCode(ret))
	{
		report->setLastErrorCode(ERR_ITEM_ERROR);
	    report->setLastErrorMsg(ERRMSG_ITEM_ERROR);
	    report->setState(SOURCE_ERROR);
	    LOG.debug("Error deleting item: %", item.getKey());
	}

	return ret;
}
Exemplo n.º 2
0
int LOSyncSource::addItem(SyncItem& item) {

    WCHAR luid[128];
    wsprintf(luid, TEXT("%s-luid"), item.getKey());
    item.setKey(luid);
    return 200;
}
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;
}
Exemplo n.º 4
0
int AbstractSyncSource::deleteItem(SyncItem& item)
{
    QUniqueId id(QString((char *)item.getKey()));
    //qDebug() << "AbstractSyncSource::deleteItem()" << toString(item) << "Id:" << id.toString();
    if (m_model->removeRecord(id))
        return 200; //ok, the SyncML command completed successfully
    else
        return 211; //failed, the recipient encountered an error
}
Exemplo n.º 5
0
int TestSyncSource::deleteItem(SyncItem& item) {
    char* val = toMultibyte( item.getKey() );
    LOG.info("deleted item: %s", val);
    if(val){
        delete [] val;
        val = 0;
    }
    return 200;
}
Exemplo n.º 6
0
int CacheSyncSource::addItem(SyncItem& item) {
    int ret = insertItem(item);
    switch (ret) {        
        case 200:
        case 201:
        case 418: {
            LOG.info("[%s] Successful add of item with key %s - code %d", getName(), item.getKey(), ret);
            KeyValuePair k;
            getKeyAndSignature(item, k);
            insertInCache(k);
        }
        break;
        default:
            LOG.error("[%s] Failed add of item with key %s - code %d", getName(), item.getKey(), ret);
        break;
    }
    return ret;
}
Exemplo n.º 7
0
int AbstractSyncSource::updateItem(SyncItem& item)
{
    QByteArray data((char *)item.getData());
    QUniqueId id(QString((char *)item.getKey()));
    //qDebug() << "AbstractSyncSource::updateItem()" << toString(item) << "Id:" << id.toString();
    if (m_model->updateRecord(id, data, m_type))
        return 200; //ok, the SyncML command completed successfully
    else
        return 500; //failed, the recipient encountered an error
}
Exemplo n.º 8
0
int TestSyncSource::addItem(SyncItem& item) {
    char* val = toMultibyte( item.getKey() );
    LOG.info("added item: %s", val);
    if(val){
        delete [] val;
        val = 0;
    }
    char *data = new char [item.getDataSize()];
    memcpy(data, item.getData(), item.getDataSize());
    data[item.getDataSize()] = 0;
    LOG.info("Data: %s", data);
    delete [] data;

    WCHAR *luid = new WCHAR[wcslen(item.getKey())+10];
    wsprintf(luid, TEXT("%s-luid"), item.getKey());
    item.setKey(luid);

    return 200;
}
Exemplo n.º 9
0
void CacheSyncSource::getKeyAndSignature(SyncItem& item, KeyValuePair& kvp) {
    
    char* t = toMultibyte(item.getKey());
    StringBuffer s(t);
    StringBuffer sign = getItemSignature(s);
    kvp.setKey(t);
    kvp.setValue(sign);
    delete [] t;
    
}
Exemplo n.º 10
0
int CacheSyncSource::deleteItem(SyncItem& item) {
    int ret = removeItem(item);
    switch (ret) {        
        case 200:
        case 201:
        case 418: {
            LOG.info("[%s] Successful delete of item with key %s - code %d", getName(), item.getKey(), ret);  
            char* t = toMultibyte(item.getKey());
            KeyValuePair k (t, "");
            removeFromCache(k);
            delete [] t;
        }
        break;
        default:
            LOG.error("[%s] Failed delete of item with key %s - code %d", getName(), item.getKey(), ret);
        break;
    }
    
    return ret;
} 
Exemplo n.º 11
0
int TestSyncSource::updateItem(SyncItem& item) {
    char* val = toMultibyte( item.getKey() );
    LOG.info("updated item: %s", val);
    if(val){
        delete [] val;
        val = 0;
    }

    char *data = new char [item.getDataSize()];
    memcpy(data, item.getData(), item.getDataSize());
    data[item.getDataSize()] = 0;
    LOG.info("Data: %s", data);
    delete [] data;

    return 200;
}
Exemplo n.º 12
0
QString AbstractSyncSource::toString(SyncItem& item)
{
    QByteArray data((char *)item.getData());
    QString ret("Key: ");
    ret += item.getKey();
    ret += " Mod.Time: ";
    ret += QString::number(item.getModificationTime());
    ret += " Encoding: ";
    ret += item.getDataEncoding();
    ret += " Size: ";
    ret += QString::number(item.getDataSize());
    ret += " Type: ";
    ret += item.getDataType();
    ret += " State: ";
    ret += QString::number(item.getState());
    ret += " Data:\n";
    ret += data;
    return ret;
}
Exemplo n.º 13
0
    void testSetItemStatus(){
        StringBuffer inFile = getTestFileFullPath(TEST_INPUT_DIR, TEST_FILE_NAME1);
        SyncItem* si = fmss->fakeFillSyncItem(&inFile, true);

        const WCHAR* wKey = si->getKey();
        const char* key = toMultibyte(wKey);
        fmss->setItemStatus(wKey, 200, "Add");
        ArrayList luidToSend = fmss->getLUIDArray();

        bool luidPresent = false;
        for (int i = 0; i < luidToSend.size(); i++){
            if( strcmp( ((StringBuffer*)luidToSend.get(i))->c_str(), key) == 0 ){
                luidPresent = true;
            }
        }
        CPPUNIT_ASSERT(luidPresent);

        int ret = fmss->endSync();
        CPPUNIT_ASSERT( ret == 0 );
    
        StringBuffer propval = fmss->fakeReadCachePropertyValue(inFile.c_str());
        CPPUNIT_ASSERT( !propval.empty() );
    }
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;
    
}