summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-02-20 09:06:33 (GMT)
committerTobias Markmann <tm@ayena.de>2015-02-20 16:51:51 (GMT)
commit88758e2b2a24372386b8d3d5fa5390414cc8ec0f (patch)
tree8bb7183c1cc7d47715a23a9be1b414cc9c09d90f /Swiften/Serializer
parent9b4314424ee2daff9031a0027f2d8de3a84ed48e (diff)
downloadswift-88758e2b2a24372386b8d3d5fa5390414cc8ec0f.zip
swift-88758e2b2a24372386b8d3d5fa5390414cc8ec0f.tar.bz2
Add elements/parsers/serializers/tests for Message Carbons (XEP-0280)
In addition this patch adds an element, a parser and a serializer for the <thread/> element from XMPP IM. Test-Information: Implemented unit tests pass as expected. Change-Id: I0a14c778c2c0bf65f4b405c9878c741449bfe142
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h21
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp23
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp23
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp26
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h29
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h31
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp25
-rw-r--r--Swiften/Serializer/PayloadSerializers/ThreadSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp136
14 files changed, 430 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp
new file mode 100644
index 0000000..e39d005
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ CarbonsDisableSerializer::CarbonsDisableSerializer() : GenericPayloadSerializer<CarbonsDisable>() {
+
+ }
+
+ CarbonsDisableSerializer::~CarbonsDisableSerializer() {
+
+ }
+
+ std::string CarbonsDisableSerializer::serializePayload(boost::shared_ptr<CarbonsDisable>) const {
+ XMLElement element("disable", "urn:xmpp:carbons:2");
+ return element.serialize();
+ }
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h
new file mode 100644
index 0000000..6eeb5d5
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsDisable.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class SWIFTEN_API CarbonsDisableSerializer : public GenericPayloadSerializer<CarbonsDisable> {
+ public:
+ CarbonsDisableSerializer();
+ virtual ~CarbonsDisableSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<CarbonsDisable>) const;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp
new file mode 100644
index 0000000..0bc3822
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ CarbonsEnableSerializer::CarbonsEnableSerializer() : GenericPayloadSerializer<CarbonsEnable>() {
+ }
+
+ CarbonsEnableSerializer::~CarbonsEnableSerializer() {
+
+ }
+
+ std::string CarbonsEnableSerializer::serializePayload(boost::shared_ptr<CarbonsEnable>) const {
+ XMLElement element("enable", "urn:xmpp:carbons:2");
+ return element.serialize();
+ }
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h
new file mode 100644
index 0000000..aa76d5f
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsEnable.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ class SWIFTEN_API CarbonsEnableSerializer : public GenericPayloadSerializer<CarbonsEnable> {
+ public:
+ CarbonsEnableSerializer();
+ virtual ~CarbonsEnableSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<CarbonsEnable>) const;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp
new file mode 100644
index 0000000..1e77470
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ CarbonsPrivateSerializer::CarbonsPrivateSerializer() : GenericPayloadSerializer<CarbonsPrivate>() {
+ }
+
+ CarbonsPrivateSerializer::~CarbonsPrivateSerializer() {
+
+ }
+
+ std::string CarbonsPrivateSerializer::serializePayload(boost::shared_ptr<CarbonsPrivate>) const {
+ XMLElement element("private", "urn:xmpp:carbons:2");
+ return element.serialize();
+ }
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h
new file mode 100644
index 0000000..37a6dd1
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsPrivate.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ class SWIFTEN_API CarbonsPrivateSerializer : public GenericPayloadSerializer<CarbonsPrivate> {
+ public:
+ CarbonsPrivateSerializer();
+ virtual ~CarbonsPrivateSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<CarbonsPrivate>) const;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp
new file mode 100644
index 0000000..bf63a69
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h>
+
+#include <boost/make_shared.hpp>
+
+namespace Swift {
+ CarbonsReceivedSerializer::CarbonsReceivedSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<CarbonsReceived>(), serializers_(serializers) {
+ }
+
+ CarbonsReceivedSerializer::~CarbonsReceivedSerializer() {
+ }
+
+ std::string CarbonsReceivedSerializer::serializePayload(boost::shared_ptr<CarbonsReceived> received) const {
+ XMLElement element("received", "urn:xmpp:carbons:2");
+ if (received->getForwarded()) {
+ element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(received->getForwarded())));
+ }
+ return element.serialize();
+ }
+}
+
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h
new file mode 100644
index 0000000..9ce928d
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsReceived.h>
+#include <Swiften/Elements/Forwarded.h>
+#include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+
+namespace Swift {
+ class SWIFTEN_API CarbonsReceivedSerializer : public GenericPayloadSerializer<CarbonsReceived> {
+ public:
+ CarbonsReceivedSerializer(PayloadSerializerCollection* serializers);
+ virtual ~CarbonsReceivedSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<CarbonsReceived> received) const;
+
+ private:
+ PayloadSerializerCollection* serializers_;
+ };
+}
+
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp
new file mode 100644
index 0000000..30a283e
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h>
+
+namespace Swift {
+ CarbonsSentSerializer::CarbonsSentSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<CarbonsSent>(), serializers_(serializers) {
+ }
+
+ CarbonsSentSerializer::~CarbonsSentSerializer() {
+ }
+
+ std::string CarbonsSentSerializer::serializePayload(boost::shared_ptr<CarbonsSent> sent) const {
+ XMLElement element("sent", "urn:xmpp:carbons:2");
+ if (sent->getForwarded()) {
+ element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(sent->getForwarded())));
+ }
+ return element.serialize();
+ }
+}
+
diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h
new file mode 100644
index 0000000..03d10ca
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsSent.h>
+#include <Swiften/Elements/Forwarded.h>
+#include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+
+namespace Swift {
+ class SWIFTEN_API CarbonsSentSerializer : public GenericPayloadSerializer<CarbonsSent> {
+ public:
+ CarbonsSentSerializer(PayloadSerializerCollection* serializers);
+ virtual ~CarbonsSentSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<CarbonsSent> sent) const;
+
+ private:
+ PayloadSerializerCollection* serializers_;
+ };
+}
+
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index 5da0829..2f02704 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -70,6 +70,7 @@
#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ThreadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
@@ -82,6 +83,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new IBBSerializer());
serializers_.push_back(new BodySerializer());
serializers_.push_back(new SubjectSerializer());
+ serializers_.push_back(new ThreadSerializer());
serializers_.push_back(new ChatStateSerializer());
serializers_.push_back(new PrioritySerializer());
serializers_.push_back(new ErrorSerializer(this));
diff --git a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp
new file mode 100644
index 0000000..cc4d573
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/ThreadSerializer.h>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+ ThreadSerializer::ThreadSerializer() : GenericPayloadSerializer<Thread>() {
+ }
+
+ ThreadSerializer::~ThreadSerializer() {
+ }
+
+ std::string ThreadSerializer::serializePayload(boost::shared_ptr<Thread> thread) const {
+ XMLElement threadNode("thread", "", thread->getText());
+ if (!thread->getParent().empty()) {
+ threadNode.setAttribute("parent", thread->getParent());
+ }
+ return threadNode.serialize();
+ }
+}
diff --git a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h
new file mode 100644
index 0000000..9aae887
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Elements/Thread.h>
+
+namespace Swift {
+ class SWIFTEN_API ThreadSerializer : public GenericPayloadSerializer<Thread> {
+ public:
+ ThreadSerializer();
+ virtual ~ThreadSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<Thread> thread) const;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp
new file mode 100644
index 0000000..1f0394d
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+#include <Swiften/Elements/CarbonsDisable.h>
+#include <Swiften/Elements/CarbonsEnable.h>
+#include <Swiften/Elements/CarbonsPrivate.h>
+#include <Swiften/Elements/CarbonsReceived.h>
+#include <Swiften/Elements/CarbonsSent.h>
+#include <Swiften/Elements/Message.h>
+#include <Swiften/Elements/Forwarded.h>
+#include <Swiften/Elements/Thread.h>
+#include <Swiften/JID/JID.h>
+
+using namespace Swift;
+
+class CarbonsSerializerTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(CarbonsSerializerTest);
+ CPPUNIT_TEST(testSerializeExample3);
+ CPPUNIT_TEST(testSerializeExample6);
+ CPPUNIT_TEST(testSerializeExample12);
+ CPPUNIT_TEST(testSerializeExample14);
+ CPPUNIT_TEST(testSerializeExample15);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ CarbonsSerializerTest() {}
+
+ /*
+ * Test serializing of example 3 in XEP-0280.
+ */
+ void testSerializeExample3() {
+ CarbonsEnableSerializer testling;
+
+ CPPUNIT_ASSERT_EQUAL(std::string("<enable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsEnable>()));
+ }
+
+ /*
+ * Test serializing of example 6 in XEP-0280.
+ */
+ void testSerializeExample6() {
+ CarbonsDisableSerializer testling;
+
+ CPPUNIT_ASSERT_EQUAL(std::string("<disable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsDisable>()));
+ }
+
+ /*
+ * Test serializing of example 12 in XEP-0280.
+ */
+ void testSerializeExample12() {
+ CarbonsReceivedSerializer testling(&serializers);
+
+ CarbonsReceived::ref received = boost::make_shared<CarbonsReceived>();
+
+ boost::shared_ptr<Forwarded> forwarded = boost::make_shared<Forwarded>();
+
+ Message::ref message = boost::make_shared<Message>();
+ message->setFrom(JID("juliet@capulet.example/balcony"));
+ message->setTo(JID("romeo@montague.example/garden"));
+ message->setBody("What man art thou that, thus bescreen'd in night, so stumblest on my counsel?");
+ message->addPayload(boost::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa"));
+
+ forwarded->setStanza(message);
+ received->setForwarded(forwarded);
+
+ CPPUNIT_ASSERT_EQUAL(std::string(
+ "<received xmlns=\"urn:xmpp:carbons:2\">"
+ "<forwarded xmlns=\"urn:xmpp:forward:0\">"
+ "<message from=\"juliet@capulet.example/balcony\""
+ " to=\"romeo@montague.example/garden\""
+ " type=\"chat\""
+ " xmlns=\"jabber:client\">"
+ "<body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body>"
+ "<thread>0e3141cd80894871a68e6fe6b1ec56fa</thread>"
+ "</message>"
+ "</forwarded>"
+ "</received>"), testling.serialize(received));
+ }
+
+ /*
+ * Test serializing of example 14 in XEP-0280.
+ */
+ void testSerializeExample14() {
+ CarbonsSentSerializer testling(&serializers);
+
+ CarbonsSent::ref sent = boost::make_shared<CarbonsSent>();
+
+ boost::shared_ptr<Forwarded> forwarded = boost::make_shared<Forwarded>();
+
+ Message::ref message = boost::make_shared<Message>();
+ message->setTo(JID("juliet@capulet.example/balcony"));
+ message->setFrom(JID("romeo@montague.example/home"));
+ message->setBody("Neither, fair saint, if either thee dislike.");
+ message->addPayload(boost::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa"));
+
+ forwarded->setStanza(message);
+ sent->setForwarded(forwarded);
+
+ CPPUNIT_ASSERT_EQUAL(std::string(
+ "<sent xmlns=\"urn:xmpp:carbons:2\">"
+ "<forwarded xmlns=\"urn:xmpp:forward:0\">"
+ "<message from=\"romeo@montague.example/home\""
+ " to=\"juliet@capulet.example/balcony\""
+ " type=\"chat\""
+ " xmlns=\"jabber:client\">"
+ "<body>Neither, fair saint, if either thee dislike.</body>"
+ "<thread>0e3141cd80894871a68e6fe6b1ec56fa</thread>"
+ "</message>"
+ "</forwarded>"
+ "</sent>"), testling.serialize(sent));
+ }
+
+ /*
+ * Test serializing of example 15 in XEP-0280.
+ */
+ void testSerializeExample15() {
+ CarbonsPrivateSerializer testling;
+
+ CPPUNIT_ASSERT_EQUAL(std::string("<private xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsPrivate>()));
+ }
+ private:
+ FullPayloadSerializerCollection serializers;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CarbonsSerializerTest);