summaryrefslogtreecommitdiffstats
blob: 4da2672e849387ebc358bea4f2c0e4aecf39a28d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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;
}