summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-10 17:23:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-10 17:38:05 (GMT)
commite2f5588d089e4d2148762ea092e032976254a467 (patch)
tree851946c7a36ffa96e0f3ab54bc72f233f8b2c746 /Swiften/Controllers/UnitTest
parent7214d768dca85a6d43892169d5008898249dce73 (diff)
downloadswift-contrib-e2f5588d089e4d2148762ea092e032976254a467.zip
swift-contrib-e2f5588d089e4d2148762ea092e032976254a467.tar.bz2
Moved Swiften/Controllers to Swift/Controllers.
Diffstat (limited to 'Swiften/Controllers/UnitTest')
-rw-r--r--Swiften/Controllers/UnitTest/Makefile.inc4
-rw-r--r--Swiften/Controllers/UnitTest/NickResolverTest.cpp62
-rw-r--r--Swiften/Controllers/UnitTest/XMPPRosterControllerTest.cpp88
3 files changed, 0 insertions, 154 deletions
diff --git a/Swiften/Controllers/UnitTest/Makefile.inc b/Swiften/Controllers/UnitTest/Makefile.inc
deleted file mode 100644
index 163da01..0000000
--- a/Swiften/Controllers/UnitTest/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-UNITTEST_SOURCES += \
- Swiften/Controllers/UnitTest/NickResolverTest.cpp \
- Swiften/Controllers/UnitTest/XMPPRosterControllerTest.cpp
-
diff --git a/Swiften/Controllers/UnitTest/NickResolverTest.cpp b/Swiften/Controllers/UnitTest/NickResolverTest.cpp
deleted file mode 100644
index 9c89d4d..0000000
--- a/Swiften/Controllers/UnitTest/NickResolverTest.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Controllers/NickResolver.h"
-#include "Swiften/Roster/XMPPRoster.h"
-
-using namespace Swift;
-
-class NickResolverTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(NickResolverTest);
- CPPUNIT_TEST(testNoMatch);
- CPPUNIT_TEST(testMatch);
- CPPUNIT_TEST(testOverwrittenMatch);
- CPPUNIT_TEST(testRemovedMatch);
- CPPUNIT_TEST_SUITE_END();
-
- std::vector<String> groups_;
-
- public:
- NickResolverTest() {}
-
- void testNoMatch() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- NickResolver resolver(xmppRoster);
- JID testling("foo@bar/baz");
-
- CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testling));
- }
-
- void testMatch() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- NickResolver resolver(xmppRoster);
- JID testling("foo@bar/baz");
- xmppRoster->addContact(testling, "Test", groups_);
-
- CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testling));
- }
-
- void testOverwrittenMatch() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- NickResolver resolver(xmppRoster);
- JID testling("foo@bar/baz");
- xmppRoster->addContact(testling, "FailTest", groups_);
- xmppRoster->addContact(testling, "Test", groups_);
-
- CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testling));
- }
-
- void testRemovedMatch() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- NickResolver resolver(xmppRoster);
- JID testling("foo@bar/baz");
- xmppRoster->addContact(testling, "FailTest", groups_);
- xmppRoster->removeContact(testling);
- CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testling));
- }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(NickResolverTest);
-
diff --git a/Swiften/Controllers/UnitTest/XMPPRosterControllerTest.cpp b/Swiften/Controllers/UnitTest/XMPPRosterControllerTest.cpp
deleted file mode 100644
index 17cc31c..0000000
--- a/Swiften/Controllers/UnitTest/XMPPRosterControllerTest.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-#include "Swiften/Controllers/XMPPRosterController.h"
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/RosterItemPayload.h"
-#include "Swiften/Elements/RosterPayload.h"
-#include "Swiften/Queries/DummyIQChannel.h"
-#include "Swiften/Queries/IQRouter.h"
-#include "Swiften/Roster/XMPPRoster.h"
-
-using namespace Swift;
-
-class XMPPRosterControllerTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE(XMPPRosterControllerTest);
- CPPUNIT_TEST(testAdd);
- CPPUNIT_TEST(testModify);
- CPPUNIT_TEST(testRemove);
- CPPUNIT_TEST_SUITE_END();
-
- DummyIQChannel* channel_;
- IQRouter* router_;
- public:
- XMPPRosterControllerTest() {}
-
- void setUp() {
- channel_ = new DummyIQChannel();
- router_ = new IQRouter(channel_);
- }
-
- void tearDown() {
- delete channel_;
- delete router_;
- }
-
- void testAdd() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- XMPPRosterController controller(router_, xmppRoster);
- JID testling("foo@bar");
- CPPUNIT_ASSERT(!xmppRoster->containsJID(testling));
- boost::shared_ptr<Payload> payload(new RosterPayload());
- RosterItemPayload item(testling, "Bob", RosterItemPayload::Both);
- dynamic_cast<RosterPayload*>(payload.get())->addItem(item);
- controller.handleIQ(IQ::createRequest(IQ::Set, JID(), "eou", payload));
- CPPUNIT_ASSERT(xmppRoster->containsJID(testling));
- }
-
- void testModify() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- XMPPRosterController controller(router_, xmppRoster);
- JID testling("foo@bar");
- CPPUNIT_ASSERT(!xmppRoster->containsJID(testling));
- boost::shared_ptr<Payload> payload1(new RosterPayload());
- RosterItemPayload item1(testling, "Bob", RosterItemPayload::Both);
- dynamic_cast<RosterPayload*>(payload1.get())->addItem(item1);
- controller.handleIQ(IQ::createRequest(IQ::Set, JID(), "eou", payload1));
- CPPUNIT_ASSERT(xmppRoster->containsJID(testling));
- CPPUNIT_ASSERT_EQUAL(String("Bob"), xmppRoster->getNameForJID(testling));
- boost::shared_ptr<Payload> payload2(new RosterPayload());
- RosterItemPayload item2(testling, "Bob2", RosterItemPayload::Both);
- dynamic_cast<RosterPayload*>(payload2.get())->addItem(item2);
- controller.handleIQ(IQ::createRequest(IQ::Set, JID(), "eou", payload2));
- CPPUNIT_ASSERT_EQUAL(String("Bob2"), xmppRoster->getNameForJID(testling));
- }
-
- void testRemove() {
- boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster());
- XMPPRosterController controller(router_, xmppRoster);
- JID testling("foo@bar");
- CPPUNIT_ASSERT(!xmppRoster->containsJID(testling));
- boost::shared_ptr<Payload> payload1(new RosterPayload());
- RosterItemPayload item1(testling, "Bob", RosterItemPayload::Both);
- dynamic_cast<RosterPayload*>(payload1.get())->addItem(item1);
- controller.handleIQ(IQ::createRequest(IQ::Set, JID(), "eou", payload1));
- CPPUNIT_ASSERT(xmppRoster->containsJID(testling));
- boost::shared_ptr<Payload> payload2(new RosterPayload());
- RosterItemPayload item2(testling, "Bob", RosterItemPayload::Remove);
- dynamic_cast<RosterPayload*>(payload2.get())->addItem(item2);
- controller.handleIQ(IQ::createRequest(IQ::Set, JID(), "eou", payload2));
- CPPUNIT_ASSERT(!xmppRoster->containsJID(testling));
- }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(XMPPRosterControllerTest);
-
-