summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-09-14 18:57:59 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-09-14 19:15:45 (GMT)
commitb8201141afdbd4cab6fcda37cf8daad492b1f996 (patch)
treeab4908b05a7bb0b1fe97bc4609b68dd9c0b538a9 /Swiften/Serializer/PayloadSerializers/UnitTest
parent5e3ef73cc312d0d79504faa3e0adf4de9bf836c2 (diff)
downloadswift-b8201141afdbd4cab6fcda37cf8daad492b1f996.zip
swift-b8201141afdbd4cab6fcda37cf8daad492b1f996.tar.bz2
Added private storage element, parser, and serializer.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/UnitTest')
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp
new file mode 100644
index 0000000..37c3adb
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp
@@ -0,0 +1,44 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h"
+#include "Swiften/Elements/PrivateStorage.h"
+#include "Swiften/Elements/Storage.h"
+
+using namespace Swift;
+
+class PrivateStorageSerializerTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(PrivateStorageSerializerTest);
+ CPPUNIT_TEST(testSerialize);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ PrivateStorageSerializerTest() {}
+
+ void testSerialize() {
+ PayloadsSerializer serializer;
+
+ boost::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage());
+ boost::shared_ptr<Storage> storage(new Storage());
+ Storage::Conference conference;
+ conference.name = "Swift";
+ conference.jid = JID("swift@rooms.swift.im");
+ conference.nick = "Alice";
+ storage->addConference(conference);
+ privateStorage->setPayload(storage);
+
+ CPPUNIT_ASSERT_EQUAL(String(
+ "<query xmlns=\"jabber:iq:private\">"
+ "<storage xmlns=\"storage:bookmarks\">"
+ "<conference "
+ "autojoin=\"1\" "
+ "jid=\"swift@rooms.swift.im\" "
+ "name=\"Swift\">"
+ "<nick>Alice</nick>"
+ "</conference>"
+ "</storage>"
+ "</query>"), serializer.serialize(privateStorage));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PrivateStorageSerializerTest);