mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02: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
|
@ -31,10 +31,10 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class BlockContactsIQTest {
|
||||
|
||||
private static final String blockContactIQExample = "<iq id='block1' type='set'>" + "<block xmlns='urn:xmpp:blocking'>"
|
||||
private static final String blockContactIQExample = "<iq xmlns='jabber:client' id='block1' type='set'>" + "<block xmlns='urn:xmpp:blocking'>"
|
||||
+ "<item jid='romeo@montague.net'/>" + "<item jid='pepe@montague.net'/>" + "</block>" + "</iq>";
|
||||
|
||||
private static final String blockContactPushIQExample = "<iq to='juliet@capulet.com/chamber' type='set' id='push1'>"
|
||||
private static final String blockContactPushIQExample = "<iq xmlns='jabber:client' to='juliet@capulet.com/chamber' type='set' id='push1'>"
|
||||
+ "<block xmlns='urn:xmpp:blocking'>" + "<item jid='romeo@montague.net'/>"
|
||||
+ "<item jid='pepe@montague.net'/>" + "</block>" + "</iq>";
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.blocking;
|
|||
|
||||
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.blocking.element.BlockListIQ;
|
||||
|
@ -42,7 +43,7 @@ public class GetBlockingListTest {
|
|||
BlockListIQ getBlockListIQ = new BlockListIQ(null);
|
||||
getBlockListIQ.setType(Type.get);
|
||||
getBlockListIQ.setStanzaId("blocklist1");
|
||||
Assert.assertEquals(getBlockingListIQExample, getBlockListIQ.toXML(null).toString());
|
||||
Assert.assertEquals(getBlockingListIQExample, getBlockListIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.blocking.element.UnblockContactsIQ;
|
||||
|
@ -53,7 +54,7 @@ public class UnblockContactsIQTest {
|
|||
UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(jids);
|
||||
unblockContactIQ.setStanzaId("unblock1");
|
||||
|
||||
Assert.assertEquals(unblockContactIQExample, unblockContactIQ.toXML(null).toString());
|
||||
Assert.assertEquals(unblockContactIQExample, unblockContactIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -68,7 +69,7 @@ public class UnblockContactsIQTest {
|
|||
public void checkUnblockAllIQStanza() throws Exception {
|
||||
UnblockContactsIQ unblockAllIQ = new UnblockContactsIQ(null);
|
||||
unblockAllIQ.setStanzaId("unblock2");
|
||||
Assert.assertEquals(unblockAllIQExample, unblockAllIQ.toXML(null).toString());
|
||||
Assert.assertEquals(unblockAllIQExample, unblockAllIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.jivesoftware.smackx.bob;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
@ -45,7 +46,7 @@ public class BoBIQTest extends SmackTestSuite {
|
|||
createdBoBIQ.setTo(JidCreate.from("ladymacbeth@shakespeare.lit/castle"));
|
||||
createdBoBIQ.setType(Type.get);
|
||||
|
||||
Assert.assertEquals(sampleBoBIQRequest, createdBoBIQ.toXML(null).toString());
|
||||
Assert.assertEquals(sampleBoBIQRequest, createdBoBIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,7 +66,7 @@ public class BoBIQTest extends SmackTestSuite {
|
|||
Assert.assertEquals(bobIQ.getBoBData().getMaxAge(), createdBoBIQ.getBoBData().getMaxAge());
|
||||
Assert.assertEquals(bobIQ.getBoBData().getType(), createdBoBIQ.getBoBData().getType());
|
||||
Assert.assertEquals(bobIQ.getBoBData().getContentBase64Encoded(), createdBoBIQ.getBoBData().getContentBase64Encoded());
|
||||
Assert.assertEquals(bobIQ.toXML(null).toString(), createdBoBIQ.toXML(null).toString());
|
||||
Assert.assertEquals(bobIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), createdBoBIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
||||
|
@ -80,7 +81,7 @@ public class CloseTest extends InitExtensions {
|
|||
close.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
|
||||
close.setStanzaId("us71g45j");
|
||||
|
||||
assertXMLEqual(control, close.toXML(null).toString());
|
||||
assertXMLEqual(control, close.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -77,7 +78,7 @@ public class DataTest extends InitExtensions {
|
|||
data.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
|
||||
data.setStanzaId("kr91n475");
|
||||
|
||||
assertXMLEqual(control, data.toXML(null).toString());
|
||||
assertXMLEqual(control, data.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
|
@ -102,7 +103,7 @@ public class OpenTest extends InitExtensions {
|
|||
open.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
|
||||
open.setStanzaId("jn3h8g65");
|
||||
|
||||
assertXMLEqual(control, open.toXML(null).toString());
|
||||
assertXMLEqual(control, open.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2014 Florian Schmaus
|
||||
* Copyright 2014-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -44,7 +44,7 @@ public class JivePropertiesExtensionTest extends InitExtensions {
|
|||
@Test
|
||||
public void checkProvider() throws Exception {
|
||||
// @formatter:off
|
||||
String properties = "<message from='romeo@example.net/orchard' to='juliet@example.com/balcony'>"
|
||||
String properties = "<message xmlns='jabber:client' from='romeo@example.net/orchard' to='juliet@example.com/balcony'>"
|
||||
+ "<body>Neither, fair saint, if either thee dislike.</body>"
|
||||
+ "<properties xmlns='http://www.jivesoftware.com/xmlns/xmpp/properties'>"
|
||||
+ "<property>"
|
||||
|
|
|
@ -28,12 +28,12 @@ public class MessageCorrectExtensionTest {
|
|||
|
||||
private static final String idInitialMessage = "bad1";
|
||||
|
||||
private static final String initialMessageXml = "<message to='juliet@capulet.net/balcony' id='good1'>"
|
||||
private static final String initialMessageXml = "<message xmlns='jabber:client' to='juliet@capulet.net/balcony' id='good1'>"
|
||||
+ "<body>But soft, what light through yonder window breaks?</body>" + "</message>";
|
||||
|
||||
private static final CharSequence messageCorrectionXml = "<replace xmlns='urn:xmpp:message-correct:0' id='bad1'/>";
|
||||
|
||||
private static final CharSequence expectedXml = "<message to='juliet@capulet.net/balcony' id='good1'>"
|
||||
private static final CharSequence expectedXml = "<message xmlns='jabber:client' to='juliet@capulet.net/balcony' id='good1'>"
|
||||
+ "<body>But soft, what light through yonder window breaks?</body>"
|
||||
+ "<replace xmlns='urn:xmpp:message-correct:0' id='bad1'/>" + "</message>";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2014 Florian Schmaus
|
||||
* Copyright 2014-2018 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,7 +34,7 @@ public class HeadersProviderTest {
|
|||
public void headersInMessageTest() throws Exception {
|
||||
// @formatter:off
|
||||
final String messageStanza =
|
||||
"<message from='romeo@shakespeare.lit/orchard' to='juliet@capulet.com' type='chat'>" +
|
||||
"<message xmlns='jabber:client' from='romeo@shakespeare.lit/orchard' to='juliet@capulet.com' type='chat'>" +
|
||||
"<body>Wherefore are thou?!?</body>" +
|
||||
"<headers xmlns='http://jabber.org/protocol/shim'>" +
|
||||
"<header name='Urgency'>high</header>" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue