Changeset - 17f3dabe1419
[Not reviewed]
0 5 0
Jan Kaluza - 10 years ago 2016-02-06 07:57:48
jkaluza@redhat.com
Libtransport: Fix and enable rawXML tests
5 files changed with 6 insertions and 9 deletions:
0 comments (0 inline, 0 general)
include/transport/Frontend.h
Show inline comments
 
@@ -93,12 +93,14 @@ class Frontend {
 

	
 
		virtual std::string setOAuth2Code(const std::string &code, const std::string &state) { return "OAuth2 code is not needed for this frontend."; }
 
		virtual std::string getOAuth2URL(const std::vector<std::string> &args) { return ""; }
 
		virtual std::string getRegistrationFields() { return "Jabber ID\n3rd-party network username\n3rd-party network password"; }
 
		virtual bool handleAdminMessage(Swift::Message::ref /*message*/) { return false; }
 

	
 
		virtual bool isRawXMLEnabled() { return false; }
 

	
 
		boost::signal<void (User *, const std::string &name, unsigned int id)> onVCardRequired;
 
		boost::signal<void (User *, boost::shared_ptr<Swift::VCard> vcard)> onVCardUpdated;
 
		boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyUpdated;
 
		boost::signal<void (Buddy *)> onBuddyRemoved;
 
		boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyAdded;
 
		boost::signal<void (Swift::Message::ref message)> onMessageReceived;
include/transport/Transport.h
Show inline comments
 
@@ -98,16 +98,12 @@ namespace Transport {
 
			boost::signal<void ()> onConnected;
 

	
 
			/// This signal is emitted when XML stanza is sent to server.
 

	
 
			Config *getConfig() { return m_config; }
 

	
 
			bool isRawXMLEnabled() {
 
				return m_rawXML;
 
			}
 

	
 
			/// It's emitted only for presences addressed to transport itself
 
			/// (for example to="j2j.domain.tld") and for presences comming to
 
			/// MUC (for example to="#chat%irc.freenode.org@irc.domain.tld")
 
			/// \param presence Presence.
 
			boost::signal<void (Swift::Presence::ref presence)> onUserPresenceReceived;
 

	
 
@@ -139,13 +135,12 @@ namespace Transport {
 
			StorageBackend *m_storageBackend;
 
			int m_reconnectCount;
 
			Config* m_config;
 
			Swift::JID m_jid;
 
			Factory *m_factory;
 
			Swift::EventLoop *m_loop;
 
			bool m_rawXML;
 
			Frontend *m_frontend;
 

	
 
		friend class User;
 
		friend class UserRegistration;
 
		friend class NetworkPluginServer;
 
	};
libtransport/LocalBuddy.cpp
Show inline comments
 
@@ -19,12 +19,13 @@
 
 */
 

	
 
#include "transport/LocalBuddy.h"
 
#include "transport/User.h"
 
#include "transport/RosterManager.h"
 
#include "transport/Transport.h"
 
#include "transport/Frontend.h"
 

	
 
namespace Transport {
 

	
 
LocalBuddy::LocalBuddy(RosterManager *rosterManager, long id, const std::string &name, const std::string &alias, const std::vector<std::string> &groups, BuddyFlag flags) : Buddy(rosterManager, id, flags) {
 
	m_status = Swift::StatusShow::None;
 
	m_alias = alias;
 
@@ -98,13 +99,13 @@ void LocalBuddy::setGroups(const std::vector<std::string> &groups) {
 
		getRosterManager()->doUpdateBuddy(this);
 
		getRosterManager()->storeBuddy(this);
 
	}
 
}
 

	
 
bool LocalBuddy::getStatus(Swift::StatusShow &status, std::string &statusMessage) {
 
	if (getRosterManager()->getUser()->getComponent()->isRawXMLEnabled()) {
 
	if (getRosterManager()->getUser()->getComponent()->getFrontend()->isRawXMLEnabled()) {
 
		return false;
 
	}
 
	status = m_status;
 
	statusMessage = m_statusMessage;
 
	return true;
 
}
libtransport/Transport.cpp
Show inline comments
 
@@ -40,13 +40,12 @@ Component::Component(Frontend *frontend, Swift::EventLoop *loop, Swift::NetworkF
 
	m_userRegistry = NULL;
 
	m_reconnectCount = 0;
 
	m_config = config;
 
	m_factory = factory;
 
	m_loop = loop;
 
	m_userRegistry = userRegistry;
 
	m_rawXML = false;
 
	m_jid = Swift::JID(CONFIG_STRING(m_config, "service.jid"));
 

	
 
	m_factories = factories;
 

	
 
	m_reconnectTimer = m_factories->getTimerFactory()->createTimer(3000);
 
	m_reconnectTimer->onTick.connect(boost::bind(&Component::start, this)); 
tests/libtransport/networkpluginserver.cpp
Show inline comments
 
@@ -39,14 +39,14 @@ class NetworkPluginServerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
 
	CPPUNIT_TEST_SUITE(NetworkPluginServerTest);
 
	CPPUNIT_TEST(handleBuddyChangedPayload);
 
	CPPUNIT_TEST(handleBuddyChangedPayloadNoEscaping);
 
	CPPUNIT_TEST(handleBuddyChangedPayloadUserContactInRoster);
 
	CPPUNIT_TEST(handleMessageHeadline);
 
	CPPUNIT_TEST(handleConvMessageAckPayload);
 
// 	CPPUNIT_TEST(handleRawXML);
 
// 	CPPUNIT_TEST(handleRawXMLSplit);
 
	CPPUNIT_TEST(handleRawXML);
 
	CPPUNIT_TEST(handleRawXMLSplit);
 

	
 
	CPPUNIT_TEST(benchmarkHandleBuddyChangedPayload);
 
	CPPUNIT_TEST(benchmarkSendUnavailablePresence);
 
	CPPUNIT_TEST_SUITE_END();
 

	
 
	public:
0 comments (0 inline, 0 general)