mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-07 13:41:08 +01:00
Treat <body/> just like all other extension elements in Message
This turned out to be a rather large change.
This commit is contained in:
parent
cb9a11b74e
commit
a9e45475ab
39 changed files with 261 additions and 219 deletions
|
|
@ -30,19 +30,19 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class MUCLightAffiliationsChangeExtensionTest {
|
||||
|
||||
private static final String exampleMessageStanza = "<message " + "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||
private static final String exampleMessageStanza = "<message xmlns='jabber:client' to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>"
|
||||
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "</message>";
|
||||
|
||||
private static final String exampleMessageStanzaWithVersion = "<message "
|
||||
private static final String exampleMessageStanzaWithVersion = "<message xmlns='jabber:client' "
|
||||
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>qwerty</version>"
|
||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "<body></body>" + "</message>";
|
||||
|
||||
private static final String exampleMessageStanzaWithPrevVersion = "<message "
|
||||
private static final String exampleMessageStanzaWithPrevVersion = "<message xmlns='jabber:client' "
|
||||
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<prev-version>njiokm</prev-version>"
|
||||
+ "<version>qwerty</version>" + "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.HashMap;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ;
|
||||
|
|
@ -61,7 +62,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setStanzaId("getblock1");
|
||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
|
||||
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -88,7 +89,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block1");
|
||||
|
||||
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -102,7 +103,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("block2");
|
||||
|
||||
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -118,7 +119,7 @@ public class MUCLightBlockingTest {
|
|||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||
mucLightBlockingIQ.setStanzaId("unblock1");
|
||||
|
||||
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(null).toString());
|
||||
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,16 +26,16 @@ import org.junit.Test;
|
|||
|
||||
public class MUCLightConfigurationsChangeExtensionTest {
|
||||
|
||||
private static final String messageWithSubjectChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
private static final String messageWithSubjectChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>"
|
||||
+ "<prev-version>asdfghj000</prev-version>" + "<version>asdfghj</version>"
|
||||
+ "<subject>To be or not to be?</subject>" + "</x>" + "</message>";
|
||||
|
||||
private static final String messageWithRoomNameChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
private static final String messageWithRoomNameChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
||||
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "</x>" + "</message>";
|
||||
|
||||
private static final String messageWithConfigsChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
private static final String messageWithConfigsChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
||||
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "<color>blue</color>" + "</x>"
|
||||
+ "</message>";
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muclight;
|
||||
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightDestroyIQ;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
|
@ -31,7 +33,7 @@ public class MUCLightDestroyTest {
|
|||
public void checkDestroyMUCLightStanza() throws Exception {
|
||||
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
|
||||
mucLightDestroyIQ.setStanzaId("destroy1");
|
||||
Assert.assertEquals(mucLightDestroyIQ.toXML(null).toString(), stanza);
|
||||
Assert.assertEquals(mucLightDestroyIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), stanza);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ;
|
||||
|
|
@ -45,7 +46,7 @@ public class MUCLightGetAffiliationsTest {
|
|||
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetAffiliationsIQ.setStanzaId("getmembers");
|
||||
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(null).toString());
|
||||
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
|
|||
import java.util.HashMap;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ;
|
||||
|
|
@ -48,7 +49,7 @@ public class MUCLightGetConfigsTest {
|
|||
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetConfigsIQ.setStanzaId("config0");
|
||||
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(null).toString());
|
||||
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.muclight;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightGetInfoIQ;
|
||||
|
|
@ -45,7 +46,7 @@ public class MUCLightInfoTest {
|
|||
MUCLightGetInfoIQ mucLightGetInfoIQWithVersion = new MUCLightGetInfoIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||
mucLightGetInfoIQWithVersion.setStanzaId("getinfo1");
|
||||
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(null).toString(), exampleWithVersion);
|
||||
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), exampleWithVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -53,7 +54,7 @@ public class MUCLightInfoTest {
|
|||
MUCLightGetInfoIQ mucLightGetInfoIQWithoutVersion = new MUCLightGetInfoIQ(
|
||||
JidCreate.from("coven@muclight.shakespeare.lit"), null);
|
||||
mucLightGetInfoIQWithoutVersion.setStanzaId("getinfo1");
|
||||
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(null).toString(), exampleWithoutVersion);
|
||||
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), exampleWithoutVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ package org.jivesoftware.smackx.muclight;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
import org.jivesoftware.smackx.muclight.element.MUCLightSetConfigsIQ;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
|
@ -47,7 +49,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", customConfigs);
|
||||
mucLightSetConfigsIQ.setStanzaId("conf1");
|
||||
|
||||
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(null).toString());
|
||||
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -56,7 +58,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", null);
|
||||
mucLightChangeRoomNameIQ.setStanzaId("roomName1");
|
||||
|
||||
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(null).toString());
|
||||
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -65,7 +67,7 @@ public class MUCLightSetConfigsIQTest {
|
|||
JidCreate.from("coven@muclight.shakespeare.lit"), null, "To be or not to be?", null);
|
||||
mucLightChangeSubjectIQ.setStanzaId("subject1");
|
||||
|
||||
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(null).toString());
|
||||
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue