summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGurmeen Bindra <gurmeen.bindra@isode.com>2012-04-17 09:18:20 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-19 10:45:50 (GMT)
commitb54bc5406f95902ce2438ac64a19390ae0f2f409 (patch)
treea9fcd31575e3773f26a32b74b0793f43ce3a0cd4 /test
parentc040dd31cf285f9e2ffddab859586badf6ae059e (diff)
downloadstroke-b54bc5406f95902ce2438ac64a19390ae0f2f409.zip
stroke-b54bc5406f95902ce2438ac64a19390ae0f2f409.tar.bz2
Port MUC Payload Serializers from Swiften to Stroke
All the serializers for different kind of MUC payloads have been ported from swiften to stroke. Test-information: There is a junit test that's ported which tests the admin payload serialiser. Also executed the other MUC Junits.
Diffstat (limited to 'test')
-rw-r--r--test/com/isode/stroke/serializer/payloadserializers/MUCAdminPayloadSerializerTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/com/isode/stroke/serializer/payloadserializers/MUCAdminPayloadSerializerTest.java b/test/com/isode/stroke/serializer/payloadserializers/MUCAdminPayloadSerializerTest.java
new file mode 100644
index 0000000..9d55ad5
--- /dev/null
+++ b/test/com/isode/stroke/serializer/payloadserializers/MUCAdminPayloadSerializerTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2011, Kevin Smith
+ * All rights reserved.
+ */
+package com.isode.stroke.serializer.payloadserializers;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.isode.stroke.elements.MUCAdminPayload;
+import com.isode.stroke.elements.MUCItem;
+import com.isode.stroke.elements.MUCOccupant;
+import com.isode.stroke.jid.JID;
+import com.isode.stroke.serializer.payloadserializers.MUCAdminPayloadSerializer;
+
+public class MUCAdminPayloadSerializerTest {
+
+ @Test
+ public void testSerialize() {
+ MUCAdminPayloadSerializer testling = new MUCAdminPayloadSerializer();
+ MUCAdminPayload admin = new MUCAdminPayload();
+ MUCItem item = new MUCItem();
+ item.affiliation = MUCOccupant.Affiliation.Owner;
+ item.role = MUCOccupant.Role.Visitor;
+ item.reason = "malice";
+ item.actor = new JID("kev@tester.lit");
+ admin.addItem(item);
+
+ assertEquals("<query xmlns=\"http://jabber.org/protocol/muc#admin\"><item affiliation=\"owner\" " +
+ "role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item></query>",
+ testling.serialize(admin));
+ }
+
+}