diff options
author | Tobias Markmann <tm@ayena.de> | 2015-02-20 09:06:33 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-02-20 16:51:51 (GMT) |
commit | 88758e2b2a24372386b8d3d5fa5390414cc8ec0f (patch) | |
tree | 8bb7183c1cc7d47715a23a9be1b414cc9c09d90f /Swiften/QA/ConcurrentFileTransferTest | |
parent | 9b4314424ee2daff9031a0027f2d8de3a84ed48e (diff) | |
download | swift-88758e2b2a24372386b8d3d5fa5390414cc8ec0f.zip swift-88758e2b2a24372386b8d3d5fa5390414cc8ec0f.tar.bz2 |
Add elements/parsers/serializers/tests for Message Carbons (XEP-0280)
In addition this patch adds an element, a parser and a serializer for
the <thread/> element from XMPP IM.
Test-Information:
Implemented unit tests pass as expected.
Change-Id: I0a14c778c2c0bf65f4b405c9878c741449bfe142
Diffstat (limited to 'Swiften/QA/ConcurrentFileTransferTest')
-rw-r--r-- | Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp | 81 | ||||
-rw-r--r-- | Swiften/QA/ConcurrentFileTransferTest/SConscript | 17 |
2 files changed, 98 insertions, 0 deletions
diff --git a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp new file mode 100644 index 0000000..4da2672 --- /dev/null +++ b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <fstream> +#include <string> +#include <map> + +#include <boost/numeric/conversion/cast.hpp> +#include <boost/filesystem.hpp> + +#include <Swiften/Base/sleep.h> +#include <Swiften/Base/foreach.h> +#include <Swiften/Base/Log.h> +#include <Swiften/Client/ClientXMLTracer.h> +#include <Swiften/Client/Client.h> +#include <Swiften/EventLoop/SimpleEventLoop.h> +#include <Swiften/Network/BoostNetworkFactories.h> +#include <Swiften/Network/Timer.h> +#include <Swiften/Network/TimerFactory.h> +#include <Swiften/Disco/EntityCapsProvider.h> +#include <Swiften/Elements/Presence.h> +#include <Swiften/FileTransfer/ReadBytestream.h> +#include <Swiften/Base/BoostRandomGenerator.h> +#include <Swiften/FileTransfer/FileReadBytestream.h> +#include <Swiften/FileTransfer/OutgoingFileTransfer.h> +#include <Swiften/FileTransfer/FileTransferManager.h> +#include <Swiften/Disco/ClientDiscoManager.h> +#include <Swiften/FileTransfer/FileWriteBytestream.h> +#include <Swiften/Base/Debug.h> + +using namespace Swift; + +static const std::string CLIENT_NAME = "Swiften FT Test"; +static const std::string CLIENT_NODE = "http://swift.im"; + +static boost::shared_ptr<SimpleEventLoop> eventLoop; +static boost::shared_ptr<BoostNetworkFactories> networkFactories; + +BoostRandomGenerator randGen; + +enum Candidate { + InBandBytestream = 1, + S5B_Direct = 2, + S5B_Proxied = 4, + S5B_Assisted = 8, +}; + +class ConcurrentFileTransferTest { + public: + ConcurrentFileTransferTest(int clientACandidates, int clientBCandidates) : clientACandidates_(clientACandidates), clientBCandidates_(clientBCandidates) { + + } + + private: + int clientACandidates_; + boost::shared_ptr<Client> clientA_; + std::map<std::string, ByteArray> clientASendFiles_; + + + int clientBCandidates_; + boost::shared_ptr<Client> clientB_; +}; + +/** + * This program tests the concurrent transfer of multiple file-transfers. + * + */ +int main(int argc, char** argv) { + int failedTests = 0; + + if (!env("SWIFT_FILETRANSFERTEST_JID") && !env("SWIFT_FILETRANSFERTEST_PASS") && !env("SWIFT_FILETRANSFERTEST2_JID") && !env("SWIFT_FILETRANSFERTEST2_PASS")) { + + return -1; + } + + + return failedTests; +} diff --git a/Swiften/QA/ConcurrentFileTransferTest/SConscript b/Swiften/QA/ConcurrentFileTransferTest/SConscript new file mode 100644 index 0000000..1b4cdbc --- /dev/null +++ b/Swiften/QA/ConcurrentFileTransferTest/SConscript @@ -0,0 +1,17 @@ +import os + +Import("env") + +if env["TEST"] : + myenv = env.Clone() + myenv.UseFlags(myenv["SWIFTEN_FLAGS"]) + myenv.UseFlags(myenv["SWIFTEN_DEP_FLAGS"]) + + for i in ["SWIFT_FILETRANSFERTEST_JID", "SWIFT_FILETRANSFERTEST_PASS", "SWIFT_FILETRANSFERTEST2_JID", "SWIFT_FILETRANSFERTEST2_PASS"]: + if ARGUMENTS.get(i.lower(), False) : + myenv["ENV"][i] = ARGUMENTS[i.lower()] + elif os.environ.get(i, "") : + myenv["ENV"][i] = os.environ[i] + + tester = myenv.Program("ConcurrentFileTransferTest", ["ConcurrentFileTransferTest.cpp"]) + myenv.Test(tester, "system") |