Move libtransport form ./src to ./libtransport. Move all tests to ./tests directory and add 'make test' target.
This commit is contained in:
parent
a025aa1085
commit
8ef948c25f
80 changed files with 453 additions and 38 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 "")
|
||||
|
|
|
@ -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()
|
|
@ -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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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)
|
||||
|
|
4
tests/CMakeLists.txt
Normal file
4
tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
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)
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -1,7 +1,7 @@
|
|||
[service]
|
||||
admin_username=admin
|
||||
admin_password=test
|
||||
config_directory=./
|
||||
config_directory=../libpurple_jabber/
|
||||
|
||||
[servers]
|
||||
server=localhostxmpp
|
53
tests/libpurple_jabber/muc_echo.py
Normal file
53
tests/libpurple_jabber/muc_echo.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
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')
|
51
tests/libpurple_jabber/muc_join_leave.py
Normal file
51
tests/libpurple_jabber/muc_join_leave.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
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)
|
62
tests/libpurple_jabber/muc_pm.py
Normal file
62
tests/libpurple_jabber/muc_pm.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
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')
|
31
tests/libtransport/CMakeLists.txt
Normal file
31
tests/libtransport/CMakeLists.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
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()
|
|
@ -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
|
53
tests/slack_jabber/muc_echo.py
Normal file
53
tests/slack_jabber/muc_echo.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
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')
|
167
tests/slack_jabber/prosody.cfg.lua
Normal file
167
tests/slack_jabber/prosody.cfg.lua
Normal file
|
@ -0,0 +1,167 @@
|
|||
-- 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"
|
|
@ -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
|
Loading…
Add table
Reference in a new issue