summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-09-03 16:35:10 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-09-03 16:35:10 (GMT)
commit630728ba5d1c263e62d65c3f3cac1520340b7172 (patch)
tree2e10cbc8000c8840f6adf5f18103c0b0e836ddbd /Swiften/QA/NetworkTest
parent776c7f67e845e9193993cec42fa60b2e418e9c75 (diff)
downloadswift-contrib-630728ba5d1c263e62d65c3f3cac1520340b7172.zip
swift-contrib-630728ba5d1c263e62d65c3f3cac1520340b7172.tar.bz2
Move Swiften QA test into QA module.
Diffstat (limited to 'Swiften/QA/NetworkTest')
-rw-r--r--Swiften/QA/NetworkTest/.gitignore1
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp72
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionTest.cpp59
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp64
-rw-r--r--Swiften/QA/NetworkTest/SConscript18
5 files changed, 0 insertions, 214 deletions
diff --git a/Swiften/QA/NetworkTest/.gitignore b/Swiften/QA/NetworkTest/.gitignore
deleted file mode 100644
index 5a3caca..0000000
--- a/Swiften/QA/NetworkTest/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-NetworkTest
diff --git a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp
deleted file mode 100644
index a5c51aa..0000000
--- a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Base/String.h"
-#include "Swiften/Network/BoostConnectionServer.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/EventLoop/DummyEventLoop.h"
-
-using namespace Swift;
-
-class BoostConnectionServerTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(BoostConnectionServerTest);
- CPPUNIT_TEST(testConstructor_TwoServersOnSamePort);
- CPPUNIT_TEST(testStart_Conflict);
- CPPUNIT_TEST(testStop);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- boostIOServiceThread_ = new BoostIOServiceThread();
- eventLoop_ = new DummyEventLoop();
- stopped = false;
- stoppedError.reset();
- }
-
- void tearDown() {
- delete eventLoop_;
- delete boostIOServiceThread_;
- }
-
- void testConstructor_TwoServersOnSamePort() {
- boost::shared_ptr<BoostConnectionServer> testling(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- boost::shared_ptr<BoostConnectionServer> testling2(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- }
-
- void testStart_Conflict() {
- boost::shared_ptr<BoostConnectionServer> testling(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- testling->start();
-
- boost::shared_ptr<BoostConnectionServer> testling2(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- testling2->onStopped.connect(
- boost::bind(&BoostConnectionServerTest::handleStopped, this, _1));
-
- testling->stop();
- }
-
- void testStop() {
- boost::shared_ptr<BoostConnectionServer> testling(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- testling->start();
-
- testling->stop();
-
- boost::shared_ptr<BoostConnectionServer> testling2(new BoostConnectionServer(9999, &boostIOServiceThread_->getIOService()));
- testling2->start();
-
- testling2->stop();
- }
-
- void handleStopped(boost::optional<BoostConnectionServer::Error> e) {
- stopped = true;
- stoppedError = e;
- }
-
- private:
- BoostIOServiceThread* boostIOServiceThread_;
- DummyEventLoop* eventLoop_;
- bool stopped;
- boost::optional<BoostConnectionServer::Error> stoppedError;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(BoostConnectionServerTest);
diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
deleted file mode 100644
index 9929eaa..0000000
--- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Base/String.h"
-#include "Swiften/Base/sleep.h"
-#include "Swiften/Network/BoostConnection.h"
-#include "Swiften/Network/HostAddress.h"
-#include "Swiften/Network/HostAddressPort.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/EventLoop/DummyEventLoop.h"
-
-const unsigned char* address = reinterpret_cast<const unsigned char*>("\x41\x63\xde\x89");
-
-using namespace Swift;
-
-class BoostConnectionTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(BoostConnectionTest);
- CPPUNIT_TEST(testDestructor);
- CPPUNIT_TEST(testDestructor_PendingEvents);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- BoostConnectionTest() {}
-
- void setUp() {
- boostIOServiceThread_ = new BoostIOServiceThread();
- eventLoop_ = new DummyEventLoop();
- }
-
- void tearDown() {
- delete eventLoop_;
- delete boostIOServiceThread_;
- }
-
- void testDestructor() {
- {
- boost::shared_ptr<BoostConnection> testling(new BoostConnection(&boostIOServiceThread_->getIOService()));
- testling->connect(HostAddressPort(HostAddress(address, 4), 5222));
- }
- }
-
- void testDestructor_PendingEvents() {
- {
- boost::shared_ptr<BoostConnection> testling(new BoostConnection(&boostIOServiceThread_->getIOService()));
- testling->connect(HostAddressPort(HostAddress(address, 4), 5222));
- while (!eventLoop_->hasEvents()) {
- Swift::sleep(10);
- }
- }
- eventLoop_->processEvents();
- }
-
- private:
- BoostIOServiceThread* boostIOServiceThread_;
- DummyEventLoop* eventLoop_;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(BoostConnectionTest);
diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
deleted file mode 100644
index 8968efd..0000000
--- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Base/String.h"
-#include "Swiften/Network/DomainNameResolver.h"
-#include "Swiften/Network/DomainNameResolveException.h"
-
-using namespace Swift;
-
-class DomainNameResolverTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(DomainNameResolverTest);
- CPPUNIT_TEST(testResolve_NoSRV);
- CPPUNIT_TEST(testResolve_SRV);
- CPPUNIT_TEST(testResolve_Invalid);
- //CPPUNIT_TEST(testResolve_IPv6);
- CPPUNIT_TEST(testResolve_International);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- DomainNameResolverTest() {}
-
- void setUp() {
- resolver_ = new DomainNameResolver();
- }
-
- void tearDown() {
- delete resolver_;
- }
-
- void testResolve_NoSRV() {
- HostAddressPort result = resolver_->resolve("xmpp.test.swift.im");
-
- CPPUNIT_ASSERT_EQUAL(std::string("10.0.0.0"), result.getAddress().toString());
- CPPUNIT_ASSERT_EQUAL(5222, result.getPort());
- }
-
- void testResolve_SRV() {
- HostAddressPort result = resolver_->resolve("xmpp-srv.test.swift.im");
-
- CPPUNIT_ASSERT_EQUAL(std::string("10.0.0.1"), result.getAddress().toString());
- CPPUNIT_ASSERT_EQUAL(5000, result.getPort());
- }
-
- void testResolve_Invalid() {
- CPPUNIT_ASSERT_THROW(resolver_->resolve("invalid.test.swift.im"), DomainNameResolveException);
- }
-
- void testResolve_IPv6() {
- HostAddressPort result = resolver_->resolve("xmpp-ipv6.test.swift.im");
- CPPUNIT_ASSERT_EQUAL(std::string("0000:0000:0000:0000:0000:ffff:0a00:0104"), result.getAddress().toString());
- CPPUNIT_ASSERT_EQUAL(5222, result.getPort());
- }
-
- void testResolve_International() {
- HostAddressPort result = resolver_->resolve("tron\xc3\xa7on.test.swift.im");
- CPPUNIT_ASSERT_EQUAL(std::string("10.0.0.3"), result.getAddress().toString());
- CPPUNIT_ASSERT_EQUAL(5222, result.getPort());
- }
-
- private:
- DomainNameResolver* resolver_;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(DomainNameResolverTest);
diff --git a/Swiften/QA/NetworkTest/SConscript b/Swiften/QA/NetworkTest/SConscript
deleted file mode 100644
index 606c02e..0000000
--- a/Swiften/QA/NetworkTest/SConscript
+++ /dev/null
@@ -1,18 +0,0 @@
-import os
-
-Import("env")
-
-myenv = env.Clone()
-myenv.MergeFlags(env["SWIFTEN_FLAGS"])
-myenv.MergeFlags(env["CPPUNIT_FLAGS"])
-myenv.MergeFlags(env["BOOST_FLAGS"])
-myenv.MergeFlags(env["LIBIDN_FLAGS"])
-
-tester = myenv.Program("NetworkTest", [
- "BoostConnectionServerTest.cpp",
- "BoostConnectionTest.cpp",
- "DomainNameResolverTest.cpp",
- "#/QA/UnitTest/checker.cpp"
- ])
-clientTest = myenv.Alias("NetworkTest", tester, env.get("TEST_RUNNER", "") + tester[0].abspath)
-env.AlwaysBuild(clientTest)