예제 #1
0
SyncSourceConfig* DefaultConfigFactory::getSyncSourceConfig(const char* name) {

    SyncSourceConfig* sc = new SyncSourceConfig();

    sc->setName                 (name);
    sc->setSyncModes            ("slow,two-way");
    sc->setSync                 ("two-way");
    sc->setEncoding             ("b64");
    sc->setLast                 (0);
    sc->setSupportedTypes       ("");
    sc->setVersion              ("");
    sc->setEncryption           ("");

    if (!strcmp(name, "contact")){
        sc->setURI              ("scard");
        sc->setType             ("text/x-s4j-sifc");
    }
    else if (!strcmp(name, "calendar")){
        sc->setURI              ("scal");
        sc->setType             ("text/x-s4j-sife");
    }
    else if (!strcmp(name, "task")){
        sc->setURI              ("stask");
        sc->setType             ("text/x-s4j-sift");
    }
    else if (!strcmp(name, "note")){
        sc->setURI              ("snote");
        sc->setType             ("text/x-s4j-sifn");
    }

    // *** TBD ***
    //sc->setCtCap

    return sc;
}
예제 #2
0
    virtual int sync(
        const int *activeSources,
        SyncMode syncMode,
        const CheckSyncReport &checkReport,
        long maxMsgSize,
        long maxObjSize,
        bool loSupport,
        const char *encoding = 0) {
        SyncSource **syncSources = new SyncSource *[sources.size() + 1];
        int index, numsources = 0;
        memset(syncSources, 0, sizeof(syncSources[0]) * (sources.size() + 1));

        for (index = 0; activeSources[index] >= 0 && index < (int)sources.size(); index++) {
            // rewrite configuration as needed for test
            SyncSourceConfig *sourceConfig = config->getSyncSourceConfig(sources[activeSources[index]].c_str());
            CPPUNIT_ASSERT(sourceConfig);
            sourceConfig->setSync(syncModeKeyword(syncMode));
            sourceConfig->setEncoding(encoding);
            config->getAccessConfig().setMaxMsgSize(maxMsgSize);
            config->getDeviceConfig().setMaxObjSize(maxObjSize);
            config->getDeviceConfig().setLoSupport(loSupport);

            // create sync source using the third change tracking for syncs
            syncSources[numsources++] = createSource(activeSources[index], "S");
        }

        SyncClient client;
        int res = client.sync(*config, syncSources);
        CPPUNIT_ASSERT(client.getSyncReport());

        for (int source = 0; syncSources[source]; source++) {
            delete syncSources[source];
        }
        checkReport.check(res, *client.getSyncReport());
        return res;
    }