Removed examples and tests since they were not used/compiled anymore

This commit is contained in:
Jan Kaluza 2011-11-16 08:56:28 +01:00
parent e17059a6a6
commit 84de9b0ca6
21 changed files with 0 additions and 444 deletions

View file

@ -170,10 +170,8 @@ include_directories(${OPENSSL_INCLUDE_DIR})
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(plugin)
ADD_SUBDIRECTORY(include)
#ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(spectrum)
ADD_SUBDIRECTORY(backends)
#ADD_SUBDIRECTORY(tests)
if (NOT WIN32)
ADD_SUBDIRECTORY(spectrum_manager)
endif()

View file

@ -1,6 +0,0 @@
ADD_SUBDIRECTORY(server_connect)
ADD_SUBDIRECTORY(usermanager)
if (PROTOBUF_FOUND)
ADD_SUBDIRECTORY(external_network_plugin)
endif()

View file

@ -1,13 +0,0 @@
FILE(GLOB SRC *.cpp)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pbnetwork_pb2.py"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --python_out ${CMAKE_CURRENT_BINARY_DIR} pbnetwork.proto
COMMENT "Running Py protocol buffer compiler on pbnetwork.proto"
VERBATIM )
ADD_EXECUTABLE(external_network_plugin ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/pbnetwork_pb2.py)
TARGET_LINK_LIBRARIES(external_network_plugin transport ${SWIFTEN_LIBRARIES})

View file

@ -1,39 +0,0 @@
#include "transport/config.h"
#include "transport/transport.h"
#include "transport/usermanager.h"
#include "transport/logger.h"
#include "transport/sqlite3backend.h"
#include "transport/userregistration.h"
#include "transport/networkpluginserver.h"
#include "Swiften/EventLoop/SimpleEventLoop.h"
using namespace Transport;
int main(void)
{
Config config;
if (!config.load("sample.cfg")) {
std::cout << "Can't open sample.cfg configuration file.\n";
return 1;
}
Swift::SimpleEventLoop eventLoop;
Component transport(&eventLoop, &config, NULL);
Logger logger(&transport);
SQLite3Backend sql(&config);
logger.setStorageBackend(&sql);
if (!sql.connect()) {
std::cout << "Can't connect to database.\n";
}
UserManager userManager(&transport, &sql);
UserRegistration userRegistration(&transport, &userManager, &sql);
logger.setUserRegistration(&userRegistration);
logger.setUserManager(&userManager);
NetworkPluginServer plugin(&transport, &config, &userManager);
transport.connect();
eventLoop.run();
}

View file

@ -1,29 +0,0 @@
package pbnetwork;
message Connected {
required string name = 1;
}
message Disconnected {
required string name = 1;
required int32 error = 2;
optional string message = 3;
}
message Login {
required string protocol = 1;
required string legacyName = 2;
required string password = 3;
}
message WrapperMessage {
enum Type {
TYPE_CONNECTED = 1;
TYPE_DISCONNECTED = 2;
TYPE_LOGIN = 3;
TYPE_LOGOUT = 4;
}
required Type type = 1;
required bytes payload = 2;
}
;

View file

@ -1,29 +0,0 @@
#! /usr/bin/python
from pbnetwork_pb2 import *
import time
import sys
import socket
import struct
connected = Connected()
connected.name = "hanzz.k@gmail.com"
wrapper = WrapperMessage()
wrapper.type = WrapperMessage.TYPE_CONNECTED
wrapper.payload = connected.SerializeToString()
sck = socket.socket()
sck.connect(("localhost", 10000))
message = wrapper.SerializeToString();
header = struct.pack(">L", len(message))
print [header]
sck.send(header + message+header + message);
sck.send(header + message);
sck.send(header + message);
sck.send(header + message);
sck.send(header + message);
print sck.recv(255)

View file

@ -1,6 +0,0 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(transport_server_connect ${SRC})
TARGET_LINK_LIBRARIES(transport_server_connect transport ${SWIFTEN_LIBRARIES})

View file

@ -1,36 +0,0 @@
#include "transport/config.h"
#include "transport/transport.h"
#include "transport/logger.h"
#include "Swiften/EventLoop/SimpleEventLoop.h"
#include "Swiften/Network/BoostTimerFactory.h"
#include "Swiften/Network/BoostIOServiceThread.h"
#include "Swiften/Network/BoostNetworkFactories.h"
#include "Swiften/Server/UserRegistry.h"
#include "Swiften/Server/Server.h"
#include "Swiften/Swiften.h"
using namespace Transport;
class DummyUserRegistry : public Swift::UserRegistry {
public:
DummyUserRegistry() {}
virtual bool isValidUserPassword(const Swift::JID&user, const Swift::SafeByteArray&) const {
onPasswordValid(user.toString());
return true;
}
};
int main(void)
{
Swift::logging = true;
Swift::SimpleEventLoop loop;
Swift::BoostNetworkFactories *m_factories = new Swift::BoostNetworkFactories(&loop);
DummyUserRegistry dummyregistry;
Swift::Server server(&loop, m_factories, &dummyregistry, "localhost", 5222);
server.start();
loop.run();
}

View file

@ -1,6 +0,0 @@
[service]
jid = icq.localhost
password = secret
server = 127.0.0.1
port = 5222
server_mode = 1

View file

@ -1,6 +0,0 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(transport_usermanager ${SRC})
TARGET_LINK_LIBRARIES(transport_usermanager transport ${SWIFTEN_LIBRARIES})

View file

@ -1,36 +0,0 @@
#include "transport/config.h"
#include "transport/transport.h"
#include "transport/usermanager.h"
#include "transport/logger.h"
#include "transport/sqlite3backend.h"
#include "transport/userregistration.h"
#include "Swiften/EventLoop/SimpleEventLoop.h"
using namespace Transport;
int main(void)
{
Config config;
if (!config.load("sample.cfg")) {
std::cout << "Can't open sample.cfg configuration file.\n";
return 1;
}
Swift::SimpleEventLoop eventLoop;
Component transport(&eventLoop, &config, NULL);
Logger logger(&transport);
SQLite3Backend sql(&config);
logger.setStorageBackend(&sql);
if (!sql.connect()) {
std::cout << "Can't connect to database.\n";
}
UserManager userManager(&transport, &sql);
UserRegistration userRegistration(&transport, &userManager, &sql);
logger.setUserRegistration(&userRegistration);
logger.setUserManager(&userManager);
transport.connect();
eventLoop.run();
}

View file

@ -1,9 +0,0 @@
[service]
jid = icq.localhost
password = secret
server = 127.0.0.1
port = 8888
[database]
database = test.sql
prefix=icq

View file

@ -1,5 +0,0 @@
ADD_SUBDIRECTORY(login)
ADD_SUBDIRECTORY(login_bad_name)
ADD_SUBDIRECTORY(login_bad_name2)
add_custom_target(tests python runtests.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

View file

@ -1,6 +0,0 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(login_test ${SRC})
TARGET_LINK_LIBRARIES(login_test transport ${SWIFTEN_LIBRARIES})

View file

@ -1,44 +0,0 @@
#include <iostream>
#include <boost/bind.hpp>
#include <Swiften/Swiften.h>
#include <Swiften/Client/ClientOptions.h>
using namespace Swift;
using namespace boost;
Client* client;
static void handleDisconnected(const boost::optional<ClientError> &) {
exit(1);
}
static void handleConnected() {
exit(0);
}
static void handleMessageReceived(Message::ref message) {
// Echo back the incoming message
message->setTo(message->getFrom());
message->setFrom(JID());
client->sendMessage(message);
}
int main(int, char **argv) {
SimpleEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
client = new Client(argv[1], argv[2], &networkFactories);
client->setAlwaysTrustCertificates();
client->onConnected.connect(&handleConnected);
client->onDisconnected.connect(bind(&handleDisconnected, _1));
client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
Swift::ClientOptions opt;
opt.allowPLAINWithoutTLS = true;
client->connect(opt);
eventLoop.run();
delete client;
return 0;
}

View file

@ -1,6 +0,0 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(login_bad_name_test ${SRC})
TARGET_LINK_LIBRARIES(login_bad_name_test transport ${SWIFTEN_LIBRARIES})

View file

@ -1,45 +0,0 @@
#include <iostream>
#include <boost/bind.hpp>
#include <Swiften/Swiften.h>
#include <Swiften/Client/ClientOptions.h>
using namespace Swift;
using namespace boost;
Client* client;
static void handleDisconnected(const boost::optional<ClientError> &error) {
exit(error->getType() != ClientError::AuthenticationFailedError);
}
static void handleConnected() {
exit(1);
}
static void handleMessageReceived(Message::ref message) {
// Echo back the incoming message
message->setTo(message->getFrom());
message->setFrom(JID());
client->sendMessage(message);
}
int main(int, char **argv) {
SimpleEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
JID jid(JID(argv[1]).getNode() + "something", JID(argv[1]).getDomain());
client = new Client(jid, argv[2], &networkFactories);
client->setAlwaysTrustCertificates();
client->onConnected.connect(&handleConnected);
client->onDisconnected.connect(bind(&handleDisconnected, _1));
client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
Swift::ClientOptions opt;
opt.allowPLAINWithoutTLS = true;
client->connect(opt);
eventLoop.run();
delete client;
return 0;
}

View file

@ -1,6 +0,0 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(login_bad_name2_test ${SRC})
TARGET_LINK_LIBRARIES(login_bad_name2_test transport ${SWIFTEN_LIBRARIES})

View file

@ -1,45 +0,0 @@
#include <iostream>
#include <boost/bind.hpp>
#include <Swiften/Swiften.h>
#include <Swiften/Client/ClientOptions.h>
using namespace Swift;
using namespace boost;
Client* client;
static void handleDisconnected(const boost::optional<ClientError> &error) {
exit(error->getType() != ClientError::AuthenticationFailedError);
}
static void handleConnected() {
exit(1);
}
static void handleMessageReceived(Message::ref message) {
// Echo back the incoming message
message->setTo(message->getFrom());
message->setFrom(JID());
client->sendMessage(message);
}
int main(int, char **argv) {
SimpleEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
JID jid(std::string("something") + JID(argv[1]).getNode(), JID(argv[1]).getDomain());
client = new Client(jid, argv[2], &networkFactories);
client->setAlwaysTrustCertificates();
client->onConnected.connect(&handleConnected);
client->onDisconnected.connect(bind(&handleDisconnected, _1));
client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
Swift::ClientOptions opt;
opt.allowPLAINWithoutTLS = true;
client->connect(opt);
eventLoop.run();
delete client;
return 0;
}

View file

@ -1,70 +0,0 @@
import os
import sys
from subprocess import *
import time
def run_spectrum(backend, test):
os.system("rm test.sql")
f = open("sample.cfg", "w")
f.write("\
[service]\n\
jid = localhost\n\
password = secret\n\
server = 127.0.0.1\n\
port = 5222\n\
server_mode = 1\n\
backend=../backends/%s/%s_backend\n\
protocol=prpl-jabber\n\
\
[database]\n\
database = test.sql\n\
prefix=icq\n\
" % (backend, backend)
)
f.close()
p = Popen("../spectrum/src/spectrum sample.cfg > " + backend + "_" + test + ".log 2>&1", shell=True)
time.sleep(4)
return p
def one_test_run():
os.system("killall spectrum 2> /dev/null")
os.system("rm *.log")
for backend in os.listdir("../backends"):
if not os.path.isdir("../backends/" + backend) or backend == "CMakeFiles":
continue
for d in os.listdir("."):
binary = d + "/" + d + "_test"
if not os.path.exists(binary):
continue
if os.path.exists(d + "/.no" + backend):
continue
p = run_spectrum(backend, d)
if backend.find("purple") >= 0:
p = Popen(binary + " pyjim%jabber.cz@localhost test", shell=True)
else:
p = Popen(binary + " testnickname%irc.freenode.net@localhost test", shell=True)
seconds = 0
while p.poll() is None and seconds < 20:
time.sleep(1)
seconds += 1
if p.returncode == 0 and seconds < 20:
print "[ PASS ]", backend, binary
else:
if seconds == 20:
print "[ TIME ]", backend, binary
else:
print "[ FAIL ]", backend, binary
os.system("killall spectrum 2> /dev/null")
one_test_run()