Changeset - 8ef948c25f19
[Not reviewed]
! ! !
Jan Kaluza - 10 years ago 2015-12-24 10:08:19
jkaluza@redhat.com
Move libtransport form ./src to ./libtransport. Move all tests to ./tests directory and add 'make test' target.
80 files changed with 453 insertions and 38 deletions:
0 comments (0 inline, 0 general)
.travis.yml
Show inline comments
 
@@ -15,6 +15,6 @@ before_script:
 
          - sudo killall lua5.1
 
install: "pip install --user sleekxmpp"
 
script:
 
          - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON . && make && ./src/libtransport_test && cd ./spectrum/src/tests && python -V && python start.py
 
          - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON . && make && make test
 
notifications:
 
  slack: spectrum2:CIlYHtxGMAaxs3qVHfwBzCuy
CMakeLists.txt
Show inline comments
 
@@ -455,11 +455,12 @@ if (CMAKE_COMPILER_IS_GNUCXX)
 
include_directories(${OPENSSL_INCLUDE_DIR})
 
endif()
 

	
 
ADD_SUBDIRECTORY(src)
 
ADD_SUBDIRECTORY(libtransport)
 
ADD_SUBDIRECTORY(plugin)
 
ADD_SUBDIRECTORY(include)
 
ADD_SUBDIRECTORY(spectrum)
 
ADD_SUBDIRECTORY(backends)
 
ADD_SUBDIRECTORY(tests)
 
if (NOT WIN32)
 
	ADD_SUBDIRECTORY(spectrum_manager)
 
#	ADD_SUBDIRECTORY(spectrum2_send_message)
cmake_modules/eventConfig.cmake
Show inline comments
 
@@ -5,7 +5,7 @@ FIND_LIBRARY(EVENT_LIBRARIES NAMES ${EVENT_NAMES} PATH)
 

	
 
IF(EVENT_INCLUDE_DIRS AND EVENT_LIBRARIES)
 
SET(HAVE_EVENT TRUE)
 
file(APPEND src/transport_config.h "#define WITH_LIBEVENT 1\n")
 
file(APPEND libtransport/transport_config.h "#define WITH_LIBEVENT 1\n")
 
ELSE(EVENT_INCLUDE_DIRS AND EVENT_LIBRARIES)
 
SET (EVENT_INCLUDE_DIRS "")
 
SET (EVENT_LIBRARIES "")
libtransport/AdminInterface.cpp
Show inline comments
 
file renamed from src/AdminInterface.cpp to libtransport/AdminInterface.cpp
libtransport/Buddy.cpp
Show inline comments
 
file renamed from src/Buddy.cpp to libtransport/Buddy.cpp
libtransport/CMakeLists.txt
Show inline comments
 
file renamed from src/CMakeLists.txt to libtransport/CMakeLists.txt
 
@@ -19,17 +19,6 @@ endif()
 
FILE(GLOB HEADERS ../include/transport/*.h)
 
include_directories(../spectrum/src/frontends/xmpp/)
 

	
 
if (CPPUNIT_FOUND)
 
	FILE(GLOB SRC_TEST tests/*.cpp)
 
	FILE(GLOB SRC_TEST_FRONTEND ../spectrum/src/frontends/xmpp/*.cpp)
 

	
 
	ADD_EXECUTABLE(libtransport_test ${SRC_TEST} ${SRC_TEST_FRONTEND})
 
	set_target_properties(libtransport_test PROPERTIES COMPILE_DEFINITIONS LIBTRANSPORT_TEST=1)
 
	
 

	
 
	target_link_libraries(libtransport_test transport ${CPPUNIT_LIBRARY} ${Boost_LIBRARIES})
 
endif()
 

	
 
if (NOT WIN32)
 
include_directories(${POPT_INCLUDE_DIR})
 
endif()
libtransport/Config.cpp
Show inline comments
 
file renamed from src/Config.cpp to libtransport/Config.cpp
libtransport/Conversation.cpp
Show inline comments
 
file renamed from src/Conversation.cpp to libtransport/Conversation.cpp
libtransport/ConversationManager.cpp
Show inline comments
 
file renamed from src/ConversationManager.cpp to libtransport/ConversationManager.cpp
libtransport/FileTransferManager.cpp
Show inline comments
 
file renamed from src/FileTransferManager.cpp to libtransport/FileTransferManager.cpp
libtransport/HTTPRequest.cpp
Show inline comments
 
file renamed from src/HTTPRequest.cpp to libtransport/HTTPRequest.cpp
libtransport/HTTPRequestQueue.cpp
Show inline comments
 
file renamed from src/HTTPRequestQueue.cpp to libtransport/HTTPRequestQueue.cpp
libtransport/LocalBuddy.cpp
Show inline comments
 
file renamed from src/LocalBuddy.cpp to libtransport/LocalBuddy.cpp
libtransport/Logging.cpp
Show inline comments
 
file renamed from src/Logging.cpp to libtransport/Logging.cpp
libtransport/MemoryReadByteStream.cpp
Show inline comments
 
file renamed from src/MemoryReadByteStream.cpp to libtransport/MemoryReadByteStream.cpp
libtransport/MemoryUsage.cpp
Show inline comments
 
file renamed from src/MemoryUsage.cpp to libtransport/MemoryUsage.cpp
libtransport/MySQLBackend.cpp
Show inline comments
 
file renamed from src/MySQLBackend.cpp to libtransport/MySQLBackend.cpp
libtransport/NetworkPluginServer.cpp
Show inline comments
 
file renamed from src/NetworkPluginServer.cpp to libtransport/NetworkPluginServer.cpp
libtransport/OAuth2.cpp
Show inline comments
 
file renamed from src/OAuth2.cpp to libtransport/OAuth2.cpp
libtransport/PQXXBackend.cpp
Show inline comments
 
file renamed from src/PQXXBackend.cpp to libtransport/PQXXBackend.cpp
libtransport/PresenceOracle.cpp
Show inline comments
 
file renamed from src/PresenceOracle.cpp to libtransport/PresenceOracle.cpp
libtransport/RosterManager.cpp
Show inline comments
 
file renamed from src/RosterManager.cpp to libtransport/RosterManager.cpp
libtransport/RosterStorage.cpp
Show inline comments
 
file renamed from src/RosterStorage.cpp to libtransport/RosterStorage.cpp
libtransport/SQLite3Backend.cpp
Show inline comments
 
file renamed from src/SQLite3Backend.cpp to libtransport/SQLite3Backend.cpp
libtransport/StorageBackend.cpp
Show inline comments
 
file renamed from src/StorageBackend.cpp to libtransport/StorageBackend.cpp
libtransport/ThreadPool.cpp
Show inline comments
 
file renamed from src/ThreadPool.cpp to libtransport/ThreadPool.cpp
libtransport/Transport.cpp
Show inline comments
 
file renamed from src/Transport.cpp to libtransport/Transport.cpp
libtransport/User.cpp
Show inline comments
 
file renamed from src/User.cpp to libtransport/User.cpp
libtransport/UserManager.cpp
Show inline comments
 
file renamed from src/UserManager.cpp to libtransport/UserManager.cpp
libtransport/UserRegistration.cpp
Show inline comments
 
file renamed from src/UserRegistration.cpp to libtransport/UserRegistration.cpp
libtransport/UserRegistry.cpp
Show inline comments
 
file renamed from src/UserRegistry.cpp to libtransport/UserRegistry.cpp
libtransport/UsersReconnecter.cpp
Show inline comments
 
file renamed from src/UsersReconnecter.cpp to libtransport/UsersReconnecter.cpp
libtransport/Util.cpp
Show inline comments
 
file renamed from src/Util.cpp to libtransport/Util.cpp
libtransport/WebSocketClient.cpp
Show inline comments
 
file renamed from src/WebSocketClient.cpp to libtransport/WebSocketClient.cpp
libtransport/transport.pc.in
Show inline comments
 
file renamed from src/transport.pc.in to libtransport/transport.pc.in
plugin/cpp/CMakeLists.txt
Show inline comments
 
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.6)
 
FILE(GLOB SRC *.cpp *.h)
 
FILE(GLOB HEADERS ../include/transport/*.h)
 

	
 
set(EXTRA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../src/MemoryUsage.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Logging.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Config.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/Util.cpp)
 
set(EXTRA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/MemoryUsage.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Logging.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Config.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../libtransport/Util.cpp)
 
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc)
 

	
 
if (NOT WIN32)
spectrum_manager/src/CMakeLists.txt
Show inline comments
 
cmake_minimum_required(VERSION 2.6)
 
FILE(GLOB SRC *.cpp *.c)
 

	
 
ADD_EXECUTABLE(spectrum2_manager ${SRC} ../../src/Config.cpp ../../src/Util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc)
 
ADD_EXECUTABLE(spectrum2_manager ${SRC} ../../libtransport/Config.cpp ../../libtransport/Util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc)
 

	
 
ADD_DEPENDENCIES(spectrum2_manager pb)
 
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include/transport/protocol.pb.cc PROPERTIES GENERATED 1)
tests/CMakeLists.txt
Show inline comments
 
new file 100644
 
ADD_SUBDIRECTORY(libtransport)
 

	
 

	
 
add_custom_target(test ${CMAKE_CURRENT_BINARY_DIR}/libtransport/libtransport_test COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/start.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests_output)
tests/libcommuni/irc_test.cfg
Show inline comments
 
file renamed from spectrum/src/tests/irc_test.cfg to tests/libcommuni/irc_test.cfg
 
@@ -15,7 +15,7 @@ admin_password=test
 
users_per_backend=10
 
#backend=../..//backends/swiften/spectrum2_swiften_backend
 
#backend=../../../backends/twitter/spectrum2_twitter_backend
 
backend=../../../backends/libcommuni/spectrum2_libcommuni_backend
 
backend=../../backends/libcommuni/spectrum2_libcommuni_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=any
tests/libcommuni/irc_test2.cfg
Show inline comments
 
file renamed from spectrum/src/tests/irc_test2.cfg to tests/libcommuni/irc_test2.cfg
 
@@ -15,7 +15,7 @@ admin_password=test
 
users_per_backend=10
 
#backend=../..//backends/swiften/spectrum2_swiften_backend
 
#backend=../../../backends/twitter/spectrum2_twitter_backend
 
backend=../../../backends/libcommuni/spectrum2_libcommuni_backend
 
backend=../../backends/libcommuni/spectrum2_libcommuni_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=any
tests/libcommuni/muc_change_topic.py
Show inline comments
 
file renamed from spectrum/src/tests/muc_change_topic.py to tests/libcommuni/muc_change_topic.py
tests/libcommuni/muc_echo.py
Show inline comments
 
file renamed from spectrum/src/tests/muc_echo.py to tests/libcommuni/muc_echo.py
tests/libcommuni/muc_join_leave.py
Show inline comments
 
file renamed from spectrum/src/tests/muc_join_leave.py to tests/libcommuni/muc_join_leave.py
tests/libcommuni/muc_pm.py
Show inline comments
 
file renamed from spectrum/src/tests/muc_pm.py to tests/libcommuni/muc_pm.py
tests/libcommuni/muc_whois.py
Show inline comments
 
file renamed from spectrum/src/tests/muc_whois.py to tests/libcommuni/muc_whois.py
tests/libcommuni/ngircd.conf
Show inline comments
 
file renamed from spectrum/src/tests/ngircd.conf to tests/libcommuni/ngircd.conf
tests/libpurple_jabber/jabber_test.cfg
Show inline comments
 
file renamed from spectrum/src/tests/jabber_test.cfg to tests/libpurple_jabber/jabber_test.cfg
 
@@ -15,7 +15,7 @@ admin_password=test
 
users_per_backend=10
 
#backend=../..//backends/swiften/spectrum2_swiften_backend
 
#backend=../../../backends/twitter/spectrum2_twitter_backend
 
backend=../../../backends/libpurple/spectrum2_libpurple_backend
 
backend=../../backends/libpurple/spectrum2_libpurple_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=any
tests/libpurple_jabber/manager.conf
Show inline comments
 
file renamed from spectrum/src/tests/manager.conf to tests/libpurple_jabber/manager.conf
 
[service]
 
admin_username=admin
 
admin_password=test
 
config_directory=./
 
config_directory=../libpurple_jabber/
 

	
 
[servers]
 
server=localhostxmpp
tests/libpurple_jabber/muc_echo.py
Show inline comments
 
new file 100644
 
import optparse
 
import sys
 
import time
 
import subprocess
 
import os
 

	
 
import sleekxmpp
 

	
 

	
 
class Responder(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, room_password, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.room_password = room_password
 
		self.finished = False
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("groupchat_message", self.muc_message)
 

	
 
		self.tests = {}
 

	
 
	def muc_message(self, msg):
 
		if msg['mucnick'] != self.nick:
 
			self.send_message(mto=msg['from'].bare,
 
							mbody="echo %s" % msg['body'],
 
							mtype='groupchat')
 

	
 
	def start(self, event):
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True)
 

	
 
class Client(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("groupchat_message", self.muc_message)
 
		self.finished = False
 

	
 
		self.tests = {}
 
		self.tests["echo_received"] = ["libcommuni: Send and receive messages", False]
 

	
 
	def muc_message(self, msg):
 
		if msg['mucnick'] != self.nick:
 
			if msg['body'] == "echo abc" or msg['body'] == "<owner> echo abc":
 
				self.tests["echo_received"][1] = True
 
				self.finished = True
 

	
 
	def start(self, event):
 
		self.getRoster()
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.send_message(mto=self.room, mbody="abc", mtype='groupchat')
tests/libpurple_jabber/muc_join_leave.py
Show inline comments
 
new file 100644
 
import optparse
 
import sys
 
import time
 
import subprocess
 
import os
 

	
 
import sleekxmpp
 

	
 

	
 
class Responder(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, room_password, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.room_password = room_password
 
		self.nick = nick
 
		self.finished = False
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("muc::" + room + "::got_online", self.muc_got_online)
 
		self.add_event_handler("muc::" + room + "::got_offline", self.muc_got_offline)
 

	
 
		self.tests = {}
 
		self.tests["online_received"] = ["libcommuni: Received available presence", False]
 
		self.tests["offline_received"] = ["libcommuni: Received unavailable presence", False]
 

	
 
	def muc_got_online(self, presence):
 
		if presence['muc']['nick'] == "client":
 
			self.tests["online_received"][1] = True
 

	
 
	def muc_got_offline(self, presence):
 
		if presence['muc']['nick'] == "client":
 
			self.tests["offline_received"][1] = True
 
			self.finished = True
 

	
 
	def start(self, event):
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True)
 

	
 
class Client(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.add_event_handler("session_start", self.start)
 
		self.finished = False
 

	
 
		self.tests = {}
 

	
 
	def start(self, event):
 
		self.getRoster()
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.plugin['xep_0045'].leaveMUC(self.room, self.nick)
tests/libpurple_jabber/muc_pm.py
Show inline comments
 
new file 100644
 
import optparse
 
import sys
 
import time
 
import subprocess
 
import os
 

	
 
import sleekxmpp
 

	
 

	
 
class Responder(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, room_password, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.room_password = room_password
 
		self.nick = nick
 
		self.finished = False
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("message", self.message)
 

	
 
		self.tests = {}
 

	
 
	def message(self, msg):
 
		if msg['body'] == "abc" and msg['from'] == self.room + "/client":
 
			self.send_message(mto=self.room + "/client",
 
							mbody="echo %s" % msg['body'],
 
							mtype='chat')
 
		elif msg['body'] == "def" and msg['from'] == self.room + "/client":
 
			self.send_message(mto=self.room + "/client",
 
							mbody="echo %s" % msg['body'],
 
							mtype='chat')
 
		else:
 
			self.finished = True
 

	
 
	def start(self, event):
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True)
 

	
 
class Client(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("message", self.message)
 
		self.finished = False
 

	
 
		self.tests = {}
 
		self.tests["echo1_received"] = ["libcommuni: Send and receive private messages - 1st msg", False]
 
		self.tests["echo2_received"] = ["libcommuni: Send and receive private messages - 2nd msg", False]
 

	
 
	def message(self, msg):
 
		if msg['body'] == "echo abc" and msg['from'] == self.room + "/responder":
 
			self.tests["echo1_received"][1] = True
 
			self.send_message(mto=self.room + "/responder", mbody="def", mtype='chat')
 
		elif msg['body'] == "echo def" and msg['from'] == self.room + "/responder":
 
			self.tests["echo2_received"][1] = True
 
			self.finished = True
 

	
 
	def start(self, event):
 
		self.getRoster()
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.send_message(mto=self.room + "/responder", mbody="abc", mtype='chat')
tests/libpurple_jabber/prosody.cfg.lua
Show inline comments
 
file renamed from spectrum/src/tests/prosody.cfg.lua to tests/libpurple_jabber/prosody.cfg.lua
tests/libtransport/CMakeLists.txt
Show inline comments
 
new file 100644
 
cmake_minimum_required(VERSION 2.6)
 
FILE(GLOB SRC *.cpp *.h)
 
FILE(GLOB_RECURSE SWIFTEN_SRC ../include/Swiften/*.cpp)
 

	
 
# Build without openssl on msvc
 
if (NOT MSVC)
 
if (APPLE)
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
else()
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
endif()
 
else()
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
endif()
 

	
 
FILE(GLOB HEADERS ../../include/transport/*.h)
 
include_directories(../../spectrum/src/frontends/xmpp/)
 

	
 
if (CPPUNIT_FOUND)
 
	FILE(GLOB SRC_TEST *.cpp)
 
	FILE(GLOB SRC_TEST_FRONTEND ../../spectrum/src/frontends/xmpp/*.cpp)
 

	
 
	ADD_EXECUTABLE(libtransport_test ${SRC_TEST} ${SRC_TEST_FRONTEND})
 
	set_target_properties(libtransport_test PROPERTIES COMPILE_DEFINITIONS LIBTRANSPORT_TEST=1)
 
	
 

	
 
	target_link_libraries(libtransport_test transport ${CPPUNIT_LIBRARY} ${Boost_LIBRARIES})
 
endif()
tests/libtransport/basictest.cpp
Show inline comments
 
file renamed from src/tests/basictest.cpp to tests/libtransport/basictest.cpp
tests/libtransport/basictest.h
Show inline comments
 
file renamed from src/tests/basictest.h to tests/libtransport/basictest.h
tests/libtransport/component.cpp
Show inline comments
 
file renamed from src/tests/component.cpp to tests/libtransport/component.cpp
tests/libtransport/config.cpp
Show inline comments
 
file renamed from src/tests/config.cpp to tests/libtransport/config.cpp
tests/libtransport/conversationmanager.cpp
Show inline comments
 
file renamed from src/tests/conversationmanager.cpp to tests/libtransport/conversationmanager.cpp
tests/libtransport/discoitemsresponder.cpp
Show inline comments
 
file renamed from src/tests/discoitemsresponder.cpp to tests/libtransport/discoitemsresponder.cpp
tests/libtransport/gatewayresponder.cpp
Show inline comments
 
file renamed from src/tests/gatewayresponder.cpp to tests/libtransport/gatewayresponder.cpp
tests/libtransport/localbuddy.cpp
Show inline comments
 
file renamed from src/tests/localbuddy.cpp to tests/libtransport/localbuddy.cpp
tests/libtransport/main.cpp
Show inline comments
 
file renamed from src/tests/main.cpp to tests/libtransport/main.cpp
tests/libtransport/main.h
Show inline comments
 
file renamed from src/tests/main.h to tests/libtransport/main.h
tests/libtransport/networkpluginserver.cpp
Show inline comments
 
file renamed from src/tests/networkpluginserver.cpp to tests/libtransport/networkpluginserver.cpp
tests/libtransport/rostermanager.cpp
Show inline comments
 
file renamed from src/tests/rostermanager.cpp to tests/libtransport/rostermanager.cpp
tests/libtransport/rosterresponder.cpp
Show inline comments
 
file renamed from src/tests/rosterresponder.cpp to tests/libtransport/rosterresponder.cpp
tests/libtransport/settingsadhoccommand.cpp
Show inline comments
 
file renamed from src/tests/settingsadhoccommand.cpp to tests/libtransport/settingsadhoccommand.cpp
tests/libtransport/stringtreeparser.cpp
Show inline comments
 
file renamed from src/tests/stringtreeparser.cpp to tests/libtransport/stringtreeparser.cpp
tests/libtransport/user.cpp
Show inline comments
 
file renamed from src/tests/user.cpp to tests/libtransport/user.cpp
tests/libtransport/usermanager.cpp
Show inline comments
 
file renamed from src/tests/usermanager.cpp to tests/libtransport/usermanager.cpp
tests/libtransport/userregistration.cpp
Show inline comments
 
file renamed from src/tests/userregistration.cpp to tests/libtransport/userregistration.cpp
tests/libtransport/userregistry.cpp
Show inline comments
 
file renamed from src/tests/userregistry.cpp to tests/libtransport/userregistry.cpp
tests/libtransport/util.cpp
Show inline comments
 
file renamed from src/tests/util.cpp to tests/libtransport/util.cpp
tests/slack_jabber/jabber_slack_test.cfg
Show inline comments
 
file renamed from spectrum/src/tests/jabber_slack_test.cfg to tests/slack_jabber/jabber_slack_test.cfg
 
@@ -16,7 +16,7 @@ admin_password=test
 
users_per_backend=10
 
#backend=../..//backends/swiften/spectrum2_swiften_backend
 
#backend=../../../backends/twitter/spectrum2_twitter_backend
 
backend=../../../backends/libpurple/spectrum2_libpurple_backend
 
backend=../../backends/libpurple/spectrum2_libpurple_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=any
tests/slack_jabber/muc_echo.py
Show inline comments
 
new file 100644
 
import optparse
 
import sys
 
import time
 
import subprocess
 
import os
 

	
 
import sleekxmpp
 

	
 

	
 
class Responder(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, room_password, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.room_password = room_password
 
		self.finished = False
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("groupchat_message", self.muc_message)
 

	
 
		self.tests = {}
 

	
 
	def muc_message(self, msg):
 
		if msg['mucnick'] != self.nick:
 
			self.send_message(mto=msg['from'].bare,
 
							mbody="echo %s" % msg['body'],
 
							mtype='groupchat')
 

	
 
	def start(self, event):
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, password=self.room_password, wait=True)
 

	
 
class Client(sleekxmpp.ClientXMPP):
 
	def __init__(self, jid, password, room, nick):
 
		sleekxmpp.ClientXMPP.__init__(self, jid, password)
 
		self.room = room
 
		self.nick = nick
 
		self.add_event_handler("session_start", self.start)
 
		self.add_event_handler("groupchat_message", self.muc_message)
 
		self.finished = False
 

	
 
		self.tests = {}
 
		self.tests["echo_received"] = ["libcommuni: Send and receive messages", False]
 

	
 
	def muc_message(self, msg):
 
		if msg['mucnick'] != self.nick:
 
			if msg['body'] == "echo abc" or msg['body'] == "<owner> echo abc":
 
				self.tests["echo_received"][1] = True
 
				self.finished = True
 

	
 
	def start(self, event):
 
		self.getRoster()
 
		self.sendPresence()
 
		self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
 
		self.send_message(mto=self.room, mbody="abc", mtype='groupchat')
tests/slack_jabber/prosody.cfg.lua
Show inline comments
 
new file 100644
 
-- Prosody Example Configuration File
 
--
 
-- Information on configuring Prosody can be found on our
 
-- website at http://prosody.im/doc/configure
 
--
 
-- Tip: You can check that the syntax of this file is correct
 
-- when you have finished by running: luac -p prosody.cfg.lua
 
-- If there are any errors, it will let you know what and where
 
-- they are, otherwise it will keep quiet.
 
--
 
-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
 
-- blanks. Good luck, and happy Jabbering!
 

	
 

	
 
---------- Server-wide settings ----------
 
-- Settings in this section apply to the whole server and are the default settings
 
-- for any virtual hosts
 

	
 
-- This is a (by default, empty) list of accounts that are admins
 
-- for the server. Note that you must create the accounts separately
 
-- (see http://prosody.im/doc/creating_accounts for info)
 
-- Example: admins = { "user1@example.com", "user2@example.net" }
 
admins = { }
 

	
 
data_path="."
 

	
 
-- Enable use of libevent for better performance under high load
 
-- For more information see: http://prosody.im/doc/libevent
 
--use_libevent = true;
 

	
 
-- This is the list of modules Prosody will load on startup.
 
-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
 
-- Documentation on modules can be found at: http://prosody.im/doc/modules
 
modules_enabled = {
 

	
 
	-- Generally required
 
		"roster"; -- Allow users to have a roster. Recommended ;)
 
		"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
 
-- 		"tls"; -- Add support for secure TLS on c2s/s2s connections
 
		"dialback"; -- s2s dialback support
 
		"disco"; -- Service discovery
 
		"muc";
 

	
 
	-- Not essential, but recommended
 
		"private"; -- Private XML storage (for room bookmarks, etc.)
 
		"vcard"; -- Allow users to set vCards
 
	
 
	-- These are commented by default as they have a performance impact
 
		--"privacy"; -- Support privacy lists
 
		--"compression"; -- Stream compression (Note: Requires installed lua-zlib RPM package)
 

	
 
	-- Nice to have
 
		"version"; -- Replies to server version requests
 
		"uptime"; -- Report how long server has been running
 
		"time"; -- Let others know the time here on this server
 
		"ping"; -- Replies to XMPP pings with pongs
 
		"pep"; -- Enables users to publish their mood, activity, playing music and more
 
		"register"; -- Allow users to register on this server using a client and change passwords
 

	
 
	-- Admin interfaces
 
		"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
 
		--"admin_telnet"; -- Opens telnet console interface on localhost port 5582
 
	
 
	-- HTTP modules
 
		--"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
 
		--"http_files"; -- Serve static files from a directory over HTTP
 

	
 
	-- Other specific functionality
 
-- 		"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
 
		--"groups"; -- Shared roster support
 
		--"announce"; -- Send announcement to all online users
 
		--"welcome"; -- Welcome users who register accounts
 
		--"watchregistrations"; -- Alert admins of registrations
 
		--"motd"; -- Send a message to users when they log in
 
		--"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
 
};
 

	
 
-- These modules are auto-loaded, but should you want
 
-- to disable them then uncomment them here:
 
modules_disabled = {
 
	-- "offline"; -- Store offline messages
 
	-- "c2s"; -- Handle client connections
 
	-- "s2s"; -- Handle server-to-server connections
 
};
 

	
 
-- Disable account creation by default, for security
 
-- For more information see http://prosody.im/doc/creating_accounts
 
allow_registration = true
 

	
 
-- These are the SSL/TLS-related settings. If you don't want
 
-- to use SSL/TLS, you may comment or remove this
 
-- ssl = {
 
-- 	key = "/etc/pki/prosody/localhost.key";
 
-- 	certificate = "/etc/pki/prosody/localhost.crt";
 
-- }
 

	
 
-- Force clients to use encrypted connections? This option will
 
-- prevent clients from authenticating unless they are using encryption.
 

	
 
c2s_require_encryption = false
 

	
 
-- Force certificate authentication for server-to-server connections?
 
-- This provides ideal security, but requires servers you communicate
 
-- with to support encryption AND present valid, trusted certificates.
 
-- NOTE: Your version of LuaSec must support certificate verification!
 
-- For more information see http://prosody.im/doc/s2s#security
 

	
 
s2s_secure_auth = false
 

	
 
-- Many servers don't support encryption or have invalid or self-signed
 
-- certificates. You can list domains here that will not be required to
 
-- authenticate using certificates. They will be authenticated using DNS.
 

	
 
--s2s_insecure_domains = { "gmail.com" }
 

	
 
-- Even if you leave s2s_secure_auth disabled, you can still require valid
 
-- certificates for some domains by specifying a list here.
 

	
 
--s2s_secure_domains = { "jabber.org" }
 

	
 
-- Select the authentication backend to use. The 'internal' providers
 
-- use Prosody's configured data storage to store the authentication data.
 
-- To allow Prosody to offer secure authentication mechanisms to clients, the
 
-- default provider stores passwords in plaintext. If you do not trust your
 
-- server please see http://prosody.im/doc/modules/mod_auth_internal_hashed
 
-- for information about using the hashed backend.
 

	
 
authentication = "internal_plain"
 

	
 
-- Select the storage backend to use. By default Prosody uses flat files
 
-- in its configured data directory, but it also supports more backends
 
-- through modules. An "sql" backend is included by default, but requires
 
-- additional dependencies. See http://prosody.im/doc/storage for more info.
 

	
 
--storage = "sql" -- Default is "internal" (Note: "sql" requires installed
 
-- lua-dbi RPM package)
 

	
 
-- For the "sql" backend, you can uncomment *one* of the below to configure:
 
-- sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
 
--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
 
--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
 

	
 
-- Logging configuration
 
-- For advanced logging see http://prosody.im/doc/logging
 
-- log = {
 
	-- Log everything of level "info" and higher (that is, all except "debug" messages)
 
	-- to /var/log/prosody/prosody.log and errors also to /var/log/prosody/prosody.err
 
-- 	info = "/var/log/prosody/prosody.log"; -- Change 'info' to 'debug' for verbose logging
 
-- 	error = "/var/log/prosody/prosody.err"; -- Log errors also to file
 
	-- error = "*syslog"; -- Log errors also to syslog
 
	-- log = "*console"; -- Log to the console, useful for debugging with daemonize=false
 
-- }
 
log = "*console"
 

	
 
-- POSIX configuration, see also http://prosody.im/doc/modules/mod_posix
 
-- pidfile = "/run/prosody/prosody.pid";
 
daemonize = false -- Default is "true"
 

	
 
------ Additional config files ------
 
-- For organizational purposes you may prefer to add VirtualHost and
 
-- Component definitions in their own config files. This line includes
 
-- all config files in /etc/prosody/conf.d/
 

	
 
VirtualHost "localhost"
 
--Component "gateway.localhost"
 
--	component_secret = "secret"
 
Component "conference.localhost" "muc"
tests/slack_jabber/slack.sql
Show inline comments
 
file renamed from spectrum/src/tests/slack.sql to tests/slack_jabber/slack.sql
tests/start.py
Show inline comments
 
file renamed from spectrum/src/tests/start.py to tests/start.py
 
@@ -38,7 +38,7 @@ class BaseTest:
 
		return False
 

	
 
	def start(self, Client, Responder):
 
		os.system("../spectrum2 -n ./" + self.config + " > spectrum2.log &")
 
		os.system("../../spectrum/src/spectrum2 -n ./" + self.config + " > spectrum2.log &")
 
		self.pre_test()
 
		time.sleep(1)
 

	
 
@@ -106,10 +106,11 @@ class BaseTest:
 

	
 
class LibcommuniServerModeSingleServerConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "irc_test.cfg", True, "#channel@localhost")
 
		BaseTest.__init__(self, "../libcommuni/irc_test.cfg", True, "#channel@localhost")
 
		self.directory = "../libcommuni/"
 

	
 
	def pre_test(self):
 
		os.system("ngircd -f ngircd.conf &")
 
		os.system("ngircd -f ../libcommuni/ngircd.conf &")
 

	
 
	def post_test(self):
 
		os.system("killall ngircd 2>/dev/null")
 
@@ -117,10 +118,11 @@ class LibcommuniServerModeSingleServerConf(BaseTest):
 

	
 
class LibcommuniServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "irc_test2.cfg", True, "#channel%localhost@localhost")
 
		BaseTest.__init__(self, "../libcommuni/irc_test2.cfg", True, "#channel%localhost@localhost")
 
		self.directory = "../libcommuni/"
 

	
 
	def pre_test(self):
 
		os.system("ngircd -f ngircd.conf &")
 
		os.system("ngircd -f ../libcommuni/ngircd.conf &")
 

	
 
	def post_test(self):
 
		os.system("killall ngircd 2>/dev/null")
 
@@ -128,7 +130,8 @@ class LibcommuniServerModeConf(BaseTest):
 

	
 
class JabberServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "jabber_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		BaseTest.__init__(self, "../libpurple_jabber/jabber_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		self.directory = "../libpurple_jabber/"
 
		self.client_jid = "client%localhost@localhostxmpp"
 
		self.responder_jid = "responder%localhost@localhostxmpp"
 

	
 
@@ -138,10 +141,10 @@ class JabberServerModeConf(BaseTest):
 
		return False
 

	
 
	def pre_test(self):
 
		os.system("prosody --config prosody.cfg.lua >prosody.log &")
 
		os.system("prosody --config ../libpurple_jabber/prosody.cfg.lua >prosody.log &")
 
		time.sleep(3)
 
		os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null")
 
		os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null")
 
		os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null")
 
		os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null")
 

	
 
	def post_test(self):
 
		os.system("killall lua-5.1 2>/dev/null")
 
@@ -149,7 +152,8 @@ class JabberServerModeConf(BaseTest):
 

	
 
class JabberSlackServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		BaseTest.__init__(self, "../slack_jabber/jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		self.directory = "../slack_jabber/"
 
		self.client_jid = "client@localhost"
 
		self.client_room = "room@conference.localhost"
 
		self.responder_jid = "owner@spectrum2tests.xmpp.slack.com"
 
@@ -159,13 +163,13 @@ class JabberSlackServerModeConf(BaseTest):
 
		self.responder_roompassword = "spectrum2tests.rkWHkOrjYucxsmBVkA9K"
 

	
 
	def skip_test(self, test):
 
		os.system("cp slack.sql users.sqlite")
 
		os.system("cp ../slack_jabber/slack.sql users.sqlite")
 
		if test in ["muc_whois.py", "muc_change_topic.py", "muc_join_leave.py", "muc_pm.py"]:
 
			return True
 
		return False
 

	
 
	def pre_test(self):
 
		os.system("prosody --config prosody.cfg.lua > prosody.log &")
 
		os.system("prosody --config ../slack_jabber/prosody.cfg.lua > prosody.log &")
 
		#time.sleep(3)
 
		#os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp set_oauth2_code xoxb-17213576196-VV2K8kEwwrJhJFfs5YWv6La6 use_bot_token 2>/dev/null >/dev/null")
 

	
 
@@ -182,7 +186,7 @@ configurations.append(JabberSlackServerModeConf())
 
exitcode = 0
 

	
 
for conf in configurations:
 
	for f in os.listdir("."):
 
	for f in os.listdir(conf.directory):
 
		if not f.endswith(".py") or f == "start.py":
 
			continue
 

	
 
@@ -190,7 +194,7 @@ for conf in configurations:
 
			continue
 

	
 
		print conf.__class__.__name__ + ": Starting " + f + " test ..."
 
		test = imp.load_source('test', './' + f)
 
		test = imp.load_source('test', conf.directory + f)
 
		if conf.skip_test(f):
 
			print "Skipped."
 
			continue
tests/tests_output/localhost/accounts/client.dat
Show inline comments
 
file renamed from spectrum/src/tests/localhost/accounts/client.dat to tests/tests_output/localhost/accounts/client.dat
tests/tests_output/localhost/accounts/responder.dat
Show inline comments
 
file renamed from spectrum/src/tests/localhost/accounts/responder.dat to tests/tests_output/localhost/accounts/responder.dat
0 comments (0 inline, 0 general)