summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/QA')
-rw-r--r--Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp81
-rw-r--r--Swiften/QA/ConcurrentFileTransferTest/SConscript17
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")