亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? client-test.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
字號:
/*
 * Copyright (C) 2006-2007 Funambol, Inc
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */

/** @cond API */
/** @addtogroup ClientTest */
/** @{ */

#include "spdm/DeviceManagementNode.h"
#include "client/RawFileSyncSource.h"
#include "spds/spdsutils.h"
#include "client/DMTClientConfig.h"
#include "client/SyncClient.h"
#include "test/ClientTest.h"
#include "base/test.h"

#include <string>
#include <vector>
#include <iomanip>
#include <memory>

#ifdef WIN32
#include <direct.h>
#endif
#include <sys/stat.h>

#ifdef ENABLE_INTEGRATION_TESTS

/**
 * This code uses the ClientTest and RawFileSyncSource to test real
 * synchronization against a server. More than one RawFileSyncSource can
 * be active at once and each of them may (but does not have to be)
 * used for different kinds of data. The name of the source determines
 * which data is stored in it: it must be something supported by the
 * ClientTest class, because that is where the test data comes from.
 *
 * At least the following kinds of data are currently supported by the
 * ClientTest class (see ClientTest::getTestData() for more
 * information):
 * - vcard30 = vCard 3.0 contacts
 * - vcard21 = vCard 2.1 contacts
 * - ical20 = iCalendar 2.0 calendar events
 * - vcal10 = vCalendar 1.0 calendar events
 * - itodo20 = iCalendar 2.0 tasks
 *
 * Configuration is done by environment variables which indicate which
 * part below the root node "client-test" of the the configuration tree to use;
 * beyond that everything needed for synchronization is read from the
 * configuration tree.
 *
 * - CLIENT_TEST_SERVER = maps to name of root node in configuration tree
 * - CLIENT_TEST_SOURCES = comma separated list of active sources,
 *                         names as listed above
 * - CLIENT_TEST_DELAY = number of seconds to sleep between syncs, required
 *                       by some servers
 * - CLIENT_TEST_LOG = logfile name of a server, can be empty:
 *                     if given, then the content of that file will be
 *                     copied and stored together with the client log
 *                     (only works on Unix)
 *
 * For example, on Linux running
 * @verbatim
CLIENT_TEST_SERVER=funambol CLIENT_TEST_SOURCES=vcard21,vcal10 ./client-test
@endverbatim
 *
 * expects the following configuration layout:
 * @verbatim
~/.sync4j/client-test/
                      funambol_1/spds/
                                      syncml/config.text
                                      sources/
                                              vcard21/config.txt
                                              vcal10/config.txt
                      funambol_1/spds/
                                      <same as for funambol_1>
@endverbatim
 *
 * If any of the configuration nodes does not exist yet, then it will
 * be created, but further information may have to be added, in
 * particular:
 * - server URL
 * - server user name, password
 * - sources uri
 *
 * The CLIENT_TEST_SERVER also has another meaning: it is used as hint
 * by the synccompare.pl script and causes it to automatically ignore
 * known, acceptable data modifications caused by sending an item to
 * a server and back again. Currently the script recognizes "funambol",
 * "scheduleworld", "synthesis" and "egroupware" as special server
 * names.
 *
 * The two configurations are used to simulate synchronization between
 * two different clients.
 *
 * The file sources will store their items in sub directories of
 * a "client-data" directory created in the current working directory.
 *
 * Here is an example of using the CLIENT_TEST_LOG:
 * @verbatim
CLIENT_TEST_SERVER=funambol \
CLIENT_TEST_LOG=/opt/Funambol-3.0/ds-server/logs/funambol_ds.log \
CLIENT_TEST_SOURCES=vcard21 \
   ./client-test
@endverbatim
 *
 * will create files with the suffix .client.A.log for synchronizations with
 * the first client and .client.B.log for the second client. The base name
 * of these files is unique, so the corresponding part of the server log
 * is stored with the same base name and .server.log as suffix.
 */
class TestFileSource : public ClientTest {
public:
    TestFileSource(const std::string &id) :
        ClientTest(getenv("CLIENT_TEST_DELAY") ? atoi(getenv("CLIENT_TEST_DELAY")) : 0,
                   getenv("CLIENT_TEST_LOG") ? getenv("CLIENT_TEST_LOG") : ""),
        clientID(id) {
        const char *sourcelist = getenv("CLIENT_TEST_SOURCES");
        const char *server = getenv("CLIENT_TEST_SERVER");

        /* set up source list */
        if (!sourcelist) {
            sourcelist = "";
        }
        const char *eostr = strchr(sourcelist, ',');
        const char *start = sourcelist;

        while (eostr) {
            sources.push_back(std::string(start, 0, eostr - start));
            start = eostr + 1;
            eostr = strchr(start, ',');
        }
        if (start[0]) {
            sources.push_back(start);
        }

        /* check server */
        if (!server) {
            server = "funambol";
        }

        // get configuration and set obligatory fields
        LOG.setLevel(LOG_LEVEL_DEBUG);
        std::string root = std::string("client-test/") + server + "_" + id;
        config.reset(new DMTClientConfig(root.c_str()));
        config->read();
        DeviceConfig &dc(config->getDeviceConfig());
        if (!strlen(dc.getDevID())) {
            // no configuration yet
            config->setClientDefaults();
            dc.setDevID(id == "A" ? "sc-api-nat" : "sc-pim-ppc");
        }
        for (int source = 0; source < (int)sources.size(); source++) {
            ClientTest::Config testconfig;
            getSourceConfig(source, testconfig);
            CPPUNIT_ASSERT(testconfig.type);

            SyncSourceConfig* sc = config->getSyncSourceConfig(sources[source].c_str());
            if (!sc) {
                // no configuration yet
                config->setSourceDefaults(sources[source].c_str());
                sc = config->getSyncSourceConfig(sources[source].c_str());
                sc->setURI(testconfig.uri);
                CPPUNIT_ASSERT(sc);
            }

            sc->setType(testconfig.type);
        }
        config->save();
        config->open();

        if (id == "A") {
            /* we are the primary client, create a second one */
            clientB.reset(new TestFileSource("B"));
        }
    }

    virtual int getNumSources() {
        return (int)sources.size();
    }

    virtual void getSourceConfig(int source, Config &config) {
        memset(&config, 0, sizeof(config));

        getTestData(sources[source].c_str(), config);
        config.createSourceA =
            config.createSourceB = createSource;
    }

    virtual ClientTest* getClientB() {
        return clientB.get();
    }

    virtual bool isB64Enabled() {
        return false;
    }

    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;
    }

private:
    /** either "A" or "B" for first respectively second client */
    std::string clientID;

    /** only in "A": pointer to second client */
    std::auto_ptr<TestFileSource> clientB;

    /** vector of enabled sync sources, identified by a name which SyncClient::getConfig() supports */
    std::vector<std::string> sources;

    /** configuration tree itself */
    std::auto_ptr<DMTClientConfig> config;

    static SyncSource *createSource(ClientTest &client, int source, bool isSourceA) {
        // hand work over to real member function
        return ((TestFileSource &)client).createSource(source, isSourceA ? "A" : "B");
    }

    SyncSource *createSource(int source, const char *trackingSuffix) {
        class RawFileSyncSourceWithReport : public RawFileSyncSource {
        public:
            RawFileSyncSourceWithReport(const char* nodeName, const WCHAR* name, SyncSourceConfig* sc) :
                RawFileSyncSource(name, sc),
                fileNode(nodeName) {
                setReport(&report);
                setFileNode(&fileNode);
                /*
                 * Keeping track if changes is done via time() with a resolution of seconds.
                 * Sleep a bit to ensure that enough time passes.
                 */
#ifdef WIN32
				Sleep(1000);
#else
                sleep(1);
#endif
            }
        private:
            SyncSourceReport report;
            DeviceManagementNode fileNode;
        };

        CPPUNIT_ASSERT(source < (int)sources.size());
        ManagementNode *sourceNode = config->getSyncSourceNode(sources[source].c_str());
        CPPUNIT_ASSERT(sourceNode);
        char *fullName = sourceNode->createFullName();
        std::string nodeName = std::string(fullName) + "/changes_" + trackingSuffix;
        std::string dirName = sources[source] + "_" + clientID;
		WCHAR *name = toWideChar(sources[source].c_str());
        delete [] fullName;
        FileSyncSource *ss = new RawFileSyncSourceWithReport(
            nodeName.c_str(),
            name,
            config->getSyncSourceConfig(sources[source].c_str()));
		delete [] name;
#ifdef WIN32
        _mkdir(dirName.c_str());
#else
		mkdir(dirName.c_str(), S_IRWXU);
#endif
        ss->setDir(dirName.c_str());

        return ss;
    }
};


/**
 * the only purpose of this class is to own the first TestFileSource
 * and to register its tests at program startup
 */
static class RegisterTest {
public:
    RegisterTest() :
        testFileSource("A") {
        testFileSource.registerTests();
    }

private:
    TestFileSource testFileSource;
} registerTest;

/** @} */
/** @endcond */
#endif // ENABLE_INTEGRATION_TESTS

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
夜夜精品视频一区二区| 国产美女精品人人做人人爽| 日韩电影一区二区三区四区| 国产成人精品亚洲日本在线桃色| 欧美性大战久久久久久久蜜臀| 久久亚洲精华国产精华液| 亚洲一区二区在线视频| 成人h精品动漫一区二区三区| 日韩一区二区视频| 国产精品成人一区二区三区夜夜夜| 一区二区三区精品视频在线| 国产美女精品在线| 日韩一级二级三级| 亚洲国产精品精华液网站| 国产91精品入口| 久久久影视传媒| 麻豆成人综合网| 欧美大胆一级视频| 青青草一区二区三区| 欧美日韩国产乱码电影| 国产一区二区成人久久免费影院 | 亚洲天天做日日做天天谢日日欢| 日韩精品一二三四| 在线一区二区三区四区五区| 最新日韩在线视频| 99久久精品久久久久久清纯| 中文文精品字幕一区二区| 国产一区二三区| 亚洲精品一区二区三区蜜桃下载| 久久国产欧美日韩精品| 日韩一区二区三区av| 青青草成人在线观看| 欧美日韩在线不卡| 亚洲va国产天堂va久久en| 欧美午夜理伦三级在线观看| 亚洲国产日韩综合久久精品| 欧美吻胸吃奶大尺度电影| 日日夜夜免费精品| 欧美一区二区三区不卡| 美女视频黄a大片欧美| 日韩欧美电影一二三| 国产一区日韩二区欧美三区| 国产三级精品三级| av亚洲产国偷v产偷v自拍| 亚洲美女在线一区| 欧美日韩成人综合天天影院 | 激情综合亚洲精品| 精品粉嫩aⅴ一区二区三区四区| 激情五月婷婷综合网| 国产日产欧美一区| 91麻豆精东视频| 日本午夜一本久久久综合| 亚洲精品一区二区三区在线观看| 国产精品综合一区二区| 中文字幕中文字幕中文字幕亚洲无线 | 一区二区三区国产精华| 欧美亚洲另类激情小说| 日本美女一区二区三区| 久久精品夜色噜噜亚洲aⅴ| 97久久精品人人做人人爽| 亚洲电影欧美电影有声小说| 久久综合五月天婷婷伊人| aaa亚洲精品| 欧美96一区二区免费视频| 久久久不卡影院| 欧美网站一区二区| 国内精品自线一区二区三区视频| 亚洲婷婷综合色高清在线| 欧美精品久久久久久久多人混战| 国产乱理伦片在线观看夜一区| 1区2区3区国产精品| 日韩一二三区不卡| 91在线观看成人| 国内精品久久久久影院色| 又紧又大又爽精品一区二区| 久久新电视剧免费观看| 欧美丝袜第三区| 播五月开心婷婷综合| 日韩黄色在线观看| √…a在线天堂一区| 日韩美女视频在线| 在线观看亚洲一区| 粉嫩久久99精品久久久久久夜| 性做久久久久久免费观看| 国产欧美日韩在线看| 91麻豆精品国产91久久久久久久久 | 国产精品福利一区| 欧美色手机在线观看| 国产成人在线观看免费网站| 亚洲成人av福利| 亚洲国产精品传媒在线观看| 91精品国产综合久久久久久 | 亚洲欧洲中文日韩久久av乱码| 日韩精品一区二区三区老鸭窝| 色狠狠色噜噜噜综合网| 国产乱一区二区| 男女男精品视频网| 亚洲九九爱视频| 国产精品天美传媒| 久久久久久久性| 欧美一级精品大片| 欧美性做爰猛烈叫床潮| 色婷婷久久综合| 91美女精品福利| 91影院在线免费观看| 大白屁股一区二区视频| 国产成人免费av在线| 国产乱码精品一区二区三| 韩国av一区二区三区| 国产一区二区三区黄视频| 国产呦萝稀缺另类资源| 美女尤物国产一区| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲成年人影院| 五月天视频一区| 日韩激情一区二区| 久久国产精品无码网站| 极品瑜伽女神91| 国产久卡久卡久卡久卡视频精品| 国产精品一区二区三区四区| 久久aⅴ国产欧美74aaa| 韩国av一区二区三区四区| 国产成人高清视频| 91看片淫黄大片一级在线观看| 91网址在线看| 精品视频全国免费看| 欧美精三区欧美精三区| 欧美一区二区私人影院日本| 欧美一区二区成人| www成人在线观看| 国产亚洲欧美激情| 亚洲人成在线观看一区二区| 亚洲午夜av在线| 精品影院一区二区久久久| 成人小视频免费在线观看| 99re这里都是精品| 欧美日韩一区在线观看| 日韩一区二区三区四区| 欧美tk—视频vk| 国产精品久久久久影院老司| 亚洲五码中文字幕| 精品亚洲国内自在自线福利| 成人高清视频在线观看| 91成人网在线| 精品久久久久av影院| 日韩久久一区二区| 琪琪久久久久日韩精品| 国产成人夜色高潮福利影视| 在线免费精品视频| 精品电影一区二区| 一卡二卡欧美日韩| 精品午夜久久福利影院| 91视频国产观看| 欧美不卡在线视频| 亚洲品质自拍视频| 久久av资源站| 欧美三级电影一区| 国产精品免费人成网站| 国产伦精一区二区三区| 8v天堂国产在线一区二区| 亚洲第一av色| 国产成人av福利| 欧美日韩亚洲综合在线| 国产婷婷精品av在线| 亚洲一区二区三区精品在线| 国产成a人亚洲精| 日韩午夜小视频| 亚洲精品成人悠悠色影视| 国产一区视频网站| 91精品国产福利在线观看| 亚洲女与黑人做爰| 国产mv日韩mv欧美| 欧美tk丨vk视频| 免费观看在线色综合| 91在线观看一区二区| 久久久久97国产精华液好用吗| 午夜欧美2019年伦理| 在线亚洲一区观看| 国产精品精品国产色婷婷| 狠狠色丁香婷婷综合久久片| 欧美性一级生活| 尤物av一区二区| 91老司机福利 在线| 国产精品嫩草久久久久| 岛国精品在线观看| 久久九九久精品国产免费直播| 午夜精品在线看| 久久久五月婷婷| 国产成人亚洲综合色影视| 久久99热狠狠色一区二区| 国产在线播放一区二区三区| 欧美一级片免费看| 无吗不卡中文字幕| 欧美日韩一二区| 天天爽夜夜爽夜夜爽精品视频| 在线免费观看日本欧美| 亚洲一区二区三区四区中文字幕| 972aa.com艺术欧美| 亚洲欧洲av另类| 99精品视频在线播放观看|