mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
Change Element.toXml() to toXml(String enclosingNamespace)
This commit is contained in:
parent
380f9a2b72
commit
5ab2903c32
229 changed files with 634 additions and 536 deletions
|
@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.Nonza;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StanzaError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
import org.jivesoftware.smack.packet.StreamOpen;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
@ -234,7 +235,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
private void sendElement(Element element) {
|
private void sendElement(Element element) {
|
||||||
try {
|
try {
|
||||||
send(ComposableBody.builder().setPayloadXML(element.toXML().toString()).build());
|
send(ComposableBody.builder().setPayloadXML(element.toXML(StreamOpen.CLIENT_NAMESPACE).toString()).build());
|
||||||
if (element instanceof Stanza) {
|
if (element instanceof Stanza) {
|
||||||
firePacketSendingListeners((Stanza) element);
|
firePacketSendingListeners((Stanza) element);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class Compress implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element("method", method);
|
xml.element("method", method);
|
||||||
|
@ -77,7 +77,7 @@ public class Compress implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
for (String method : methods) {
|
for (String method : methods) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class Compressed implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractDebugger extends SmackDebugger {
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (printInterpreted) {
|
if (printInterpreted) {
|
||||||
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML());
|
log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class AbstractError {
|
||||||
xml.closeElement("text");
|
xml.closeElement("text");
|
||||||
}
|
}
|
||||||
for (ExtensionElement packetExtension : extensions) {
|
for (ExtensionElement packetExtension : extensions) {
|
||||||
xml.append(packetExtension.toXML());
|
xml.append(packetExtension.toXML(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AbstractTextElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.optXmlLangAttribute(lang);
|
xml.optXmlLangAttribute(lang);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class Bind extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket();
|
buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket();
|
||||||
for (String name : getNames()) {
|
for (String name : getNames()) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014 Florian Schmaus
|
* Copyright © 2014-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,10 +23,14 @@ package org.jivesoftware.smack.packet;
|
||||||
*/
|
*/
|
||||||
public interface Element {
|
public interface Element {
|
||||||
|
|
||||||
|
// TODO: Add a toXML() non-parameter default method once Smack supports Java 8.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the XML representation of this Element.
|
* Returns the XML representation of this Element. This method takes an optional argument for the enclosing
|
||||||
|
* namespace which may be null or the empty String if the value is not known.
|
||||||
*
|
*
|
||||||
|
* @param enclosingNamespace the enclosing namespace or {@code null}.
|
||||||
* @return the stanza extension as XML.
|
* @return the stanza extension as XML.
|
||||||
*/
|
*/
|
||||||
CharSequence toXML();
|
CharSequence toXML(String enclosingNamespace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,8 @@ public abstract class IQ extends Stanza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML() {
|
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
|
||||||
buf.halfOpenElement(IQ_ELEMENT);
|
buf.halfOpenElement(IQ_ELEMENT);
|
||||||
addCommonAttributes(buf);
|
addCommonAttributes(buf);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
@ -226,7 +226,7 @@ public abstract class IQ extends Stanza {
|
||||||
protected final void initializeAsResultFor(IQ request) {
|
protected final void initializeAsResultFor(IQ request) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
||||||
}
|
}
|
||||||
setStanzaId(request.getStanzaId());
|
setStanzaId(request.getStanzaId());
|
||||||
setFrom(request.getTo());
|
setFrom(request.getTo());
|
||||||
|
@ -275,7 +275,7 @@ public abstract class IQ extends Stanza {
|
||||||
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null));
|
||||||
}
|
}
|
||||||
final ErrorIQ result = new ErrorIQ(error);
|
final ErrorIQ result = new ErrorIQ(error);
|
||||||
result.setStanzaId(request.getStanzaId());
|
result.setStanzaId(request.getStanzaId());
|
||||||
|
@ -367,6 +367,7 @@ public abstract class IQ extends Stanza {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQChildElementXmlStringBuilder(String element, String namespace) {
|
private IQChildElementXmlStringBuilder(String element, String namespace) {
|
||||||
|
super("");
|
||||||
prelude(element, namespace);
|
prelude(element, namespace);
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class Mechanisms implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
for (String mechanism : mechanisms) {
|
for (String mechanism : mechanisms) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.TypedCloneable;
|
import org.jivesoftware.smack.util.TypedCloneable;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -474,7 +475,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(ELEMENT);
|
buf.halfOpenElement(ELEMENT);
|
||||||
addCommonAttributes(buf);
|
addCommonAttributes(buf);
|
||||||
|
@ -491,7 +492,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
// Skip the default language
|
// Skip the default language
|
||||||
if (subject.equals(defaultSubject))
|
if (subject.equals(defaultSubject))
|
||||||
continue;
|
continue;
|
||||||
buf.append(subject.toXML());
|
buf.append(subject.toXML(null));
|
||||||
}
|
}
|
||||||
// Add the body in the default language
|
// Add the body in the default language
|
||||||
Body defaultBody = getMessageBody(null);
|
Body defaultBody = getMessageBody(null);
|
||||||
|
@ -503,7 +504,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
// Skip the default language
|
// Skip the default language
|
||||||
if (body.equals(defaultBody))
|
if (body.equals(defaultBody))
|
||||||
continue;
|
continue;
|
||||||
buf.append(body.toXML());
|
buf.append(body.toXML(enclosingNamespace));
|
||||||
}
|
}
|
||||||
buf.optElement("thread", thread);
|
buf.optElement("thread", thread);
|
||||||
// Append the error subpacket if the message type is an error.
|
// Append the error subpacket if the message type is an error.
|
||||||
|
@ -606,7 +607,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(getElementName()).xmllangAttribute(getLanguage()).rightAngleBracket();
|
xml.halfOpenElement(getElementName()).xmllangAttribute(getLanguage()).rightAngleBracket();
|
||||||
xml.escape(subject);
|
xml.escape(subject);
|
||||||
|
@ -624,10 +625,31 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
public static final String ELEMENT = "body";
|
public static final String ELEMENT = "body";
|
||||||
public static final String NAMESPACE = StreamOpen.CLIENT_NAMESPACE;
|
public static final String NAMESPACE = StreamOpen.CLIENT_NAMESPACE;
|
||||||
|
|
||||||
|
enum BodyElementNamespace {
|
||||||
|
client(StreamOpen.CLIENT_NAMESPACE),
|
||||||
|
server(StreamOpen.SERVER_NAMESPACE),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String xmlNamespace;
|
||||||
|
|
||||||
|
BodyElementNamespace(String xmlNamespace) {
|
||||||
|
this.xmlNamespace = xmlNamespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNamespace() {
|
||||||
|
return xmlNamespace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final String message;
|
private final String message;
|
||||||
private final String language;
|
private final String language;
|
||||||
|
private final BodyElementNamespace namespace;
|
||||||
|
|
||||||
private Body(String language, String message) {
|
public Body(String language, String message) {
|
||||||
|
this(language, message, BodyElementNamespace.client);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Body(String language, String message, BodyElementNamespace namespace) {
|
||||||
if (language == null) {
|
if (language == null) {
|
||||||
throw new NullPointerException("Language cannot be null.");
|
throw new NullPointerException("Language cannot be null.");
|
||||||
}
|
}
|
||||||
|
@ -636,6 +658,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
}
|
}
|
||||||
this.language = language;
|
this.language = language;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
this.namespace = Objects.requireNonNull(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -688,13 +711,13 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE;
|
return namespace.xmlNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
|
||||||
xml.halfOpenElement(getElementName()).xmllangAttribute(getLanguage()).rightAngleBracket();
|
xml.xmllangAttribute(getLanguage()).rightAngleBracket();
|
||||||
xml.escape(message);
|
xml.escape(message);
|
||||||
xml.closeElement(getElementName());
|
xml.closeElement(getElementName());
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -272,7 +272,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(ELEMENT);
|
buf.halfOpenElement(ELEMENT);
|
||||||
addCommonAttributes(buf);
|
addCommonAttributes(buf);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class Session extends SimpleIQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
if (optional) {
|
if (optional) {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -132,10 +132,6 @@ public final class StandardExtensionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
|
||||||
return toXML(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
if (xmlCache != null) {
|
if (xmlCache != null) {
|
||||||
return xmlCache;
|
return xmlCache;
|
||||||
|
|
|
@ -490,7 +490,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
// Add in all standard extension sub-packets.
|
// Add in all standard extension sub-packets.
|
||||||
for (ExtensionElement extension : getExtensions()) {
|
for (ExtensionElement extension : getExtensions()) {
|
||||||
xml.append(extension.toXML());
|
xml.append(extension.toXML(null));
|
||||||
}
|
}
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class StartTls implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.condEmptyElement(required, "required");
|
xml.condEmptyElement(required, "required");
|
||||||
|
|
|
@ -136,11 +136,11 @@ public class StreamError extends AbstractError implements Nonza {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML().toString();
|
return toXML(null).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement(ELEMENT);
|
xml.openElement(ELEMENT);
|
||||||
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
|
xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement();
|
||||||
|
|
|
@ -96,8 +96,12 @@ public class StreamOpen implements Nonza {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
|
xml.halfOpenElement(getElementName());
|
||||||
|
// We always want to state 'xmlns' for stream open tags.
|
||||||
|
xml.attribute("xmlns", enclosingNamespace);
|
||||||
|
|
||||||
xml.attribute("to", to);
|
xml.attribute("to", to);
|
||||||
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
|
xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
|
||||||
xml.attribute("version", VERSION);
|
xml.attribute("version", VERSION);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket();
|
||||||
xml.optAppend(authenticationText);
|
xml.optAppend(authenticationText);
|
||||||
|
@ -84,7 +84,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute(
|
XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute(
|
||||||
NAMESPACE).rightAngleBracket();
|
NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(data);
|
xml.optAppend(data);
|
||||||
|
@ -120,7 +120,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(authenticationText);
|
xml.optAppend(authenticationText);
|
||||||
|
@ -171,7 +171,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.optAppend(data);
|
xml.optAppend(data);
|
||||||
|
@ -236,7 +236,7 @@ public class SaslStreamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
|
||||||
xml.emptyElement(saslErrorString);
|
xml.emptyElement(saslErrorString);
|
||||||
|
@ -247,7 +247,7 @@ public class SaslStreamElements {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML().toString();
|
return toXML(null).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2017 Florian Schmaus
|
* Copyright 2014-2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -27,13 +27,20 @@ import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
|
|
||||||
public class XmlStringBuilder implements Appendable, CharSequence {
|
public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
public static final String RIGHT_ANGLE_BRACKET = Character.toString('>');
|
public static final String RIGHT_ANGLE_BRACKET = Character.toString('>');
|
||||||
|
|
||||||
private final LazyStringBuilder sb;
|
private final LazyStringBuilder sb;
|
||||||
|
|
||||||
|
private final String enclosingNamespace;
|
||||||
|
|
||||||
public XmlStringBuilder() {
|
public XmlStringBuilder() {
|
||||||
|
this("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlStringBuilder(String enclosingNamespace) {
|
||||||
sb = new LazyStringBuilder();
|
sb = new LazyStringBuilder();
|
||||||
|
this.enclosingNamespace = enclosingNamespace != null ? enclosingNamespace : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(ExtensionElement pe) {
|
public XmlStringBuilder(ExtensionElement pe) {
|
||||||
|
@ -47,13 +54,9 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(ExtensionElement ee, String enclosingNamespace) {
|
public XmlStringBuilder(ExtensionElement ee, String enclosingNamespace) {
|
||||||
this();
|
this(enclosingNamespace);
|
||||||
String namespace = ee.getNamespace();
|
String namespace = ee.getNamespace();
|
||||||
if (namespace.equals(enclosingNamespace)) {
|
prelude(ee);
|
||||||
halfOpenElement(ee.getElementName());
|
|
||||||
} else {
|
|
||||||
prelude(ee);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder escapedElement(String name, String escapedContent) {
|
public XmlStringBuilder escapedElement(String name, String escapedContent) {
|
||||||
|
@ -111,7 +114,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
public XmlStringBuilder element(Element element) {
|
public XmlStringBuilder element(Element element) {
|
||||||
assert element != null;
|
assert element != null;
|
||||||
return append(element.toXML());
|
return append(element.toXML(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder optElement(String name, String content) {
|
public XmlStringBuilder optElement(String name, String content) {
|
||||||
|
@ -146,7 +149,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
public XmlStringBuilder optElement(Element element) {
|
public XmlStringBuilder optElement(Element element) {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
append(element.toXML());
|
append(element.toXML(null));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -350,8 +353,41 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class XmlNsAttribute implements CharSequence {
|
||||||
|
private final String value;
|
||||||
|
private final String xmlFragment;
|
||||||
|
|
||||||
|
private XmlNsAttribute(String value) {
|
||||||
|
this.value = StringUtils.requireNotNullOrEmpty(value, "Value must not be null");
|
||||||
|
this.xmlFragment = " xmlns='" + value + '\'';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return xmlFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int length() {
|
||||||
|
return xmlFragment.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char charAt(int index) {
|
||||||
|
return xmlFragment.charAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence subSequence(int start, int end) {
|
||||||
|
return xmlFragment.subSequence(start, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public XmlStringBuilder xmlnsAttribute(String value) {
|
public XmlStringBuilder xmlnsAttribute(String value) {
|
||||||
optAttribute("xmlns", value);
|
if (value != null && !enclosingNamespace.equals(value)) {
|
||||||
|
XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value);
|
||||||
|
append(xmlNsAttribute);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +445,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
public XmlStringBuilder optAppend(Element element) {
|
public XmlStringBuilder optAppend(Element element) {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
append(element.toXML());
|
append(element.toXML(enclosingNamespace));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +458,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
public XmlStringBuilder append(Collection<? extends Element> elements) {
|
public XmlStringBuilder append(Collection<? extends Element> elements) {
|
||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
append(element.toXML());
|
append(element.toXML(null));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -512,14 +548,46 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
* @param writer
|
* @param writer
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void write(Writer writer) throws IOException {
|
public void write(Writer writer, String enclosingNamespace) throws IOException {
|
||||||
for (CharSequence csq : sb.getAsList()) {
|
for (CharSequence csq : sb.getAsList()) {
|
||||||
if (csq instanceof XmlStringBuilder) {
|
if (csq instanceof XmlStringBuilder) {
|
||||||
((XmlStringBuilder) csq).write(writer);
|
((XmlStringBuilder) csq).write(writer, enclosingNamespace);
|
||||||
|
}
|
||||||
|
else if (csq instanceof XmlNsAttribute) {
|
||||||
|
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||||
|
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||||
|
writer.write(xmlNsAttribute.toString());
|
||||||
|
enclosingNamespace = xmlNsAttribute.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
writer.write(csq.toString());
|
writer.write(csq.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
|
StringBuilder res = new StringBuilder();
|
||||||
|
appendXmlTo(res, enclosingNamespace);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendXmlTo(StringBuilder res, String enclosingNamespace) {
|
||||||
|
for (CharSequence csq : sb.getAsList()) {
|
||||||
|
if (csq instanceof XmlStringBuilder) {
|
||||||
|
((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace);
|
||||||
|
}
|
||||||
|
else if (csq instanceof XmlNsAttribute) {
|
||||||
|
XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq;
|
||||||
|
if (!xmlNsAttribute.value.equals(enclosingNamespace)) {
|
||||||
|
sb.append(xmlNsAttribute);
|
||||||
|
enclosingNamespace = xmlNsAttribute.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.append(csq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,13 +167,13 @@ public class StanzaCollectorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return "<packetId>" + getStanzaId() + "</packetId>";
|
return "<packetId>" + getStanzaId() + "</packetId>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML();
|
return toXML(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class MessageTest {
|
||||||
Message messageTypeInConstructor = new Message(null, Message.Type.chat);
|
Message messageTypeInConstructor = new Message(null, Message.Type.chat);
|
||||||
messageTypeInConstructor.setStanzaId(null);
|
messageTypeInConstructor.setStanzaId(null);
|
||||||
assertEquals(type, messageTypeInConstructor.getType());
|
assertEquals(type, messageTypeInConstructor.getType());
|
||||||
assertXMLEqual(control, messageTypeInConstructor.toXML().toString());
|
assertXMLEqual(control, messageTypeInConstructor.toXML(null).toString());
|
||||||
|
|
||||||
controlBuilder = new StringBuilder();
|
controlBuilder = new StringBuilder();
|
||||||
controlBuilder.append("<message")
|
controlBuilder.append("<message")
|
||||||
|
@ -62,7 +62,7 @@ public class MessageTest {
|
||||||
Message messageTypeSet = getNewMessage();
|
Message messageTypeSet = getNewMessage();
|
||||||
messageTypeSet.setType(type2);
|
messageTypeSet.setType(type2);
|
||||||
assertEquals(type2, messageTypeSet.getType());
|
assertEquals(type2, messageTypeSet.getType());
|
||||||
assertXMLEqual(control, messageTypeSet.toXML().toString());
|
assertXMLEqual(control, messageTypeSet.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test(expected = NullPointerException.class)
|
||||||
|
@ -87,7 +87,7 @@ public class MessageTest {
|
||||||
message.setSubject(messageSubject);
|
message.setSubject(messageSubject);
|
||||||
|
|
||||||
assertEquals(messageSubject, message.getSubject());
|
assertEquals(messageSubject, message.getSubject());
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -106,7 +106,7 @@ public class MessageTest {
|
||||||
message.setBody(messageBody);
|
message.setBody(messageBody);
|
||||||
|
|
||||||
assertEquals(messageBody, message.getBody());
|
assertEquals(messageBody, message.getBody());
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -139,7 +139,7 @@ public class MessageTest {
|
||||||
message.addBody(null, messageBody1);
|
message.addBody(null, messageBody1);
|
||||||
message.addBody(lang2, messageBody2);
|
message.addBody(lang2, messageBody2);
|
||||||
message.addBody(lang3, messageBody3);
|
message.addBody(lang3, messageBody3);
|
||||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||||
|
|
||||||
Collection<String> languages = message.getBodyLanguages();
|
Collection<String> languages = message.getBodyLanguages();
|
||||||
List<String> controlLanguages = new ArrayList<>();
|
List<String> controlLanguages = new ArrayList<>();
|
||||||
|
@ -183,7 +183,7 @@ public class MessageTest {
|
||||||
message.setThread(messageThread);
|
message.setThread(messageThread);
|
||||||
|
|
||||||
assertEquals(messageThread, message.getThread());
|
assertEquals(messageThread, message.getThread());
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -201,7 +201,7 @@ public class MessageTest {
|
||||||
Message message = getNewMessage();
|
Message message = getNewMessage();
|
||||||
message.setLanguage(lang);
|
message.setLanguage(lang);
|
||||||
|
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Message getNewMessage() {
|
private static Message getNewMessage() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class PresenceTest {
|
||||||
Presence presenceTypeInConstructor = new Presence(type);
|
Presence presenceTypeInConstructor = new Presence(type);
|
||||||
presenceTypeInConstructor.setStanzaId(null);
|
presenceTypeInConstructor.setStanzaId(null);
|
||||||
assertEquals(type, presenceTypeInConstructor.getType());
|
assertEquals(type, presenceTypeInConstructor.getType());
|
||||||
assertXMLEqual(control, presenceTypeInConstructor.toXML().toString());
|
assertXMLEqual(control, presenceTypeInConstructor.toXML(null).toString());
|
||||||
|
|
||||||
controlBuilder = new StringBuilder();
|
controlBuilder = new StringBuilder();
|
||||||
controlBuilder.append("<presence")
|
controlBuilder.append("<presence")
|
||||||
|
@ -56,7 +56,7 @@ public class PresenceTest {
|
||||||
Presence presenceTypeSet = getNewPresence();
|
Presence presenceTypeSet = getNewPresence();
|
||||||
presenceTypeSet.setType(type2);
|
presenceTypeSet.setType(type2);
|
||||||
assertEquals(type2, presenceTypeSet.getType());
|
assertEquals(type2, presenceTypeSet.getType());
|
||||||
assertXMLEqual(control, presenceTypeSet.toXML().toString());
|
assertXMLEqual(control, presenceTypeSet.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test(expected = NullPointerException.class)
|
||||||
|
@ -90,7 +90,7 @@ public class PresenceTest {
|
||||||
presence.setStatus(status);
|
presence.setStatus(status);
|
||||||
|
|
||||||
assertEquals(status, presence.getStatus());
|
assertEquals(status, presence.getStatus());
|
||||||
assertXMLEqual(control, presence.toXML().toString());
|
assertXMLEqual(control, presence.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -109,7 +109,7 @@ public class PresenceTest {
|
||||||
presence.setPriority(priority);
|
presence.setPriority(priority);
|
||||||
|
|
||||||
assertEquals(priority, presence.getPriority());
|
assertEquals(priority, presence.getPriority());
|
||||||
assertXMLEqual(control, presence.toXML().toString());
|
assertXMLEqual(control, presence.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
@ -142,7 +142,7 @@ public class PresenceTest {
|
||||||
mode1);
|
mode1);
|
||||||
presenceModeInConstructor.setStanzaId(null);
|
presenceModeInConstructor.setStanzaId(null);
|
||||||
assertEquals(mode1, presenceModeInConstructor.getMode());
|
assertEquals(mode1, presenceModeInConstructor.getMode());
|
||||||
assertXMLEqual(control, presenceModeInConstructor.toXML().toString());
|
assertXMLEqual(control, presenceModeInConstructor.toXML(null).toString());
|
||||||
|
|
||||||
controlBuilder = new StringBuilder();
|
controlBuilder = new StringBuilder();
|
||||||
controlBuilder.append("<presence>")
|
controlBuilder.append("<presence>")
|
||||||
|
@ -155,7 +155,7 @@ public class PresenceTest {
|
||||||
Presence presenceModeSet = getNewPresence();
|
Presence presenceModeSet = getNewPresence();
|
||||||
presenceModeSet.setMode(mode2);
|
presenceModeSet.setMode(mode2);
|
||||||
assertEquals(mode2, presenceModeSet.getMode());
|
assertEquals(mode2, presenceModeSet.getMode());
|
||||||
assertXMLEqual(control, presenceModeSet.toXML().toString());
|
assertXMLEqual(control, presenceModeSet.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -183,7 +183,7 @@ public class PresenceTest {
|
||||||
Presence presence = getNewPresence();
|
Presence presence = getNewPresence();
|
||||||
presence.setLanguage(lang);
|
presence.setLanguage(lang);
|
||||||
|
|
||||||
assertXMLEqual(control, presence.toXML().toString());
|
assertXMLEqual(control, presence.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Presence getNewPresence() {
|
private static Presence getNewPresence() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class StandardExtensionElementParserTest {
|
||||||
builder.addAttribute("attr1", "attr1-value");
|
builder.addAttribute("attr1", "attr1-value");
|
||||||
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
|
builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build());
|
||||||
builder.addElement("another-element", "another-element-text");
|
builder.addElement("another-element", "another-element-text");
|
||||||
final String elementString = builder.build().toXML().toString();
|
final String elementString = builder.build().toXML(null).toString();
|
||||||
|
|
||||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class StandardExtensionElementParserTest {
|
||||||
|
|
||||||
assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText());
|
assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText());
|
||||||
|
|
||||||
String parsedElementString = parsedElement.toXML().toString();
|
String parsedElementString = parsedElement.toXML(null).toString();
|
||||||
assertEquals(elementString, parsedElementString);
|
assertEquals(elementString, parsedElementString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class StandardExtensionElementParserTest {
|
||||||
Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
|
Builder builder = StandardExtensionElement.builder("foo", "ns1-value");
|
||||||
builder.addAttribute("xmlns:ns2", "ns2-value");
|
builder.addAttribute("xmlns:ns2", "ns2-value");
|
||||||
builder.addAttribute("ns2:bar", "bar-ns2-value");
|
builder.addAttribute("ns2:bar", "bar-ns2-value");
|
||||||
final String elementString = builder.build().toXML().toString();
|
final String elementString = builder.build().toXML(null).toString();
|
||||||
|
|
||||||
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString));
|
||||||
assertEquals("foo", parsedElement.getElementName());
|
assertEquals("foo", parsedElement.getElementName());
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StanzaError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
import org.jivesoftware.smack.packet.StreamOpen;
|
||||||
import org.jivesoftware.smack.sasl.SASLError;
|
import org.jivesoftware.smack.sasl.SASLError;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
|
||||||
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
|
||||||
|
@ -82,7 +83,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has non-default language, body has no language
|
// message has non-default language, body has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -101,7 +102,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, body has no language
|
// message has no language, body has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -119,7 +120,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().isEmpty());
|
assertTrue(message.getBodyLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, body has default language
|
// message has no language, body has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -140,7 +141,7 @@ public class PacketParserUtilsTest {
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
|
|
||||||
// body attribute xml:lang is unnecessary
|
// body attribute xml:lang is unnecessary
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, body has non-default language
|
// message has no language, body has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -160,7 +161,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
// message has default language, body has non-default language
|
// message has default language, body has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -181,7 +182,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertNull(message.getBody(defaultLanguage));
|
assertNull(message.getBody(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
// message has non-default language, body has default language
|
// message has non-default language, body has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -202,7 +203,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertNull(message.getBody(otherLanguage));
|
assertNull(message.getBody(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().isEmpty());
|
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertNull(message.getSubject(otherLanguage));
|
assertNull(message.getSubject(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has non-default language, subject has no language
|
// message has non-default language, subject has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -250,7 +251,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().isEmpty());
|
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||||
assertNull(message.getSubject(defaultLanguage));
|
assertNull(message.getSubject(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, subject has no language
|
// message has no language, subject has no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -268,7 +269,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().isEmpty());
|
assertTrue(message.getSubjectLanguages().isEmpty());
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertNull(message.getSubject(otherLanguage));
|
assertNull(message.getSubject(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, subject has default language
|
// message has no language, subject has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -289,7 +290,7 @@ public class PacketParserUtilsTest {
|
||||||
assertNull(message.getSubject(otherLanguage));
|
assertNull(message.getSubject(otherLanguage));
|
||||||
|
|
||||||
// subject attribute xml:lang is unnecessary
|
// subject attribute xml:lang is unnecessary
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, subject has non-default language
|
// message has no language, subject has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -309,7 +310,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||||
assertNull(message.getSubject(defaultLanguage));
|
assertNull(message.getSubject(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has default language, subject has non-default language
|
// message has default language, subject has non-default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -330,7 +331,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||||
assertNull(message.getSubject(defaultLanguage));
|
assertNull(message.getSubject(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has non-default language, subject has default language
|
// message has non-default language, subject has default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -351,7 +352,7 @@ public class PacketParserUtilsTest {
|
||||||
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertNull(message.getSubject(otherLanguage));
|
assertNull(message.getSubject(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +387,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
assertTrue(message.getBodyLanguages().contains(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
// message has default language, first body no language, second body default language
|
// message has default language, first body no language, second body default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -410,7 +411,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertEquals(1, message.getBodies().size());
|
assertEquals(1, message.getBodies().size());
|
||||||
assertEquals(0, message.getBodyLanguages().size());
|
assertEquals(0, message.getBodyLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has non-default language, first body no language, second body default language
|
// message has non-default language, first body no language, second body default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -435,7 +436,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
assertTrue(message.getBodyLanguages().contains(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
// message has no language, first body no language, second body default language
|
// message has no language, first body no language, second body default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -458,7 +459,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertEquals(1, message.getBodies().size());
|
assertEquals(1, message.getBodies().size());
|
||||||
assertEquals(0, message.getBodyLanguages().size());
|
assertEquals(0, message.getBodyLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, first body no language, second body other language
|
// message has no language, first body no language, second body other language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -482,7 +483,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
assertEquals(otherLanguage, message.getBody(otherLanguage));
|
||||||
assertEquals(2, message.getBodies().size());
|
assertEquals(2, message.getBodies().size());
|
||||||
assertEquals(1, message.getBodyLanguages().size());
|
assertEquals(1, message.getBodyLanguages().size());
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
|
|
||||||
// message has no language, first body no language, second body no language
|
// message has no language, first body no language, second body no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -504,7 +505,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
assertEquals(defaultLanguage, message.getBody(defaultLanguage));
|
||||||
assertEquals(1, message.getBodies().size());
|
assertEquals(1, message.getBodies().size());
|
||||||
assertEquals(0, message.getBodyLanguages().size());
|
assertEquals(0, message.getBodyLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +540,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getSubjects().size());
|
assertEquals(2, message.getSubjects().size());
|
||||||
assertEquals(1, message.getSubjectLanguages().size());
|
assertEquals(1, message.getSubjectLanguages().size());
|
||||||
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has default language, first subject no language, second subject default language
|
// message has default language, first subject no language, second subject default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -563,7 +564,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertEquals(1, message.getSubjects().size());
|
assertEquals(1, message.getSubjects().size());
|
||||||
assertEquals(0, message.getSubjectLanguages().size());
|
assertEquals(0, message.getSubjectLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has non-default language, first subject no language, second subject default language
|
// message has non-default language, first subject no language, second subject default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -588,7 +589,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(2, message.getSubjects().size());
|
assertEquals(2, message.getSubjects().size());
|
||||||
assertEquals(1, message.getSubjectLanguages().size());
|
assertEquals(1, message.getSubjectLanguages().size());
|
||||||
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, first subject no language, second subject default language
|
// message has no language, first subject no language, second subject default language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -611,7 +612,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertEquals(1, message.getSubjects().size());
|
assertEquals(1, message.getSubjects().size());
|
||||||
assertEquals(0, message.getSubjectLanguages().size());
|
assertEquals(0, message.getSubjectLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, first subject no language, second subject other language
|
// message has no language, first subject no language, second subject other language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -635,7 +636,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
assertEquals(otherLanguage, message.getSubject(otherLanguage));
|
||||||
assertEquals(2, message.getSubjects().size());
|
assertEquals(2, message.getSubjects().size());
|
||||||
assertEquals(1, message.getSubjectLanguages().size());
|
assertEquals(1, message.getSubjectLanguages().size());
|
||||||
assertXMLEqual(control, message.toXML().toString());
|
assertXMLEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
// message has no language, first subject no language, second subject no language
|
// message has no language, first subject no language, second subject no language
|
||||||
control = XMLBuilder.create("message")
|
control = XMLBuilder.create("message")
|
||||||
|
@ -657,7 +658,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
|
||||||
assertEquals(1, message.getSubjects().size());
|
assertEquals(1, message.getSubjects().size());
|
||||||
assertEquals(0, message.getSubjectLanguages().size());
|
assertEquals(0, message.getSubjectLanguages().size());
|
||||||
assertXMLNotEqual(control, message.toXML().toString());
|
assertXMLNotEqual(control, message.toXML(null).toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +685,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
|
Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
|
||||||
|
|
||||||
fail("Should throw exception. Instead got message: " + message.toXML().toString());
|
fail("Should throw exception. Instead got message: " + message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -749,7 +750,7 @@ public class PacketParserUtilsTest {
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
Stanza message = PacketParserUtils.parseStanza(control);
|
Stanza message = PacketParserUtils.parseStanza(control);
|
||||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -759,7 +760,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXMLEqual(stanza, presence.toXML().toString());
|
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +771,7 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXMLEqual(stanza, presence.toXML().toString());
|
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
@ -785,7 +786,7 @@ public class PacketParserUtilsTest {
|
||||||
+ "</presence>";
|
+ "</presence>";
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
assertXMLEqual(stanza, presence.toXML().toString());
|
assertXMLEqual(stanza, presence.toXML(null).toString());
|
||||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||||
assertEquals("dnd", presence.getMode().name());
|
assertEquals("dnd", presence.getMode().name());
|
||||||
assertEquals("en", presence.getLanguage());
|
assertEquals("en", presence.getLanguage());
|
||||||
|
@ -851,7 +852,7 @@ public class PacketParserUtilsTest {
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT);
|
XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT);
|
||||||
SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser);
|
SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser);
|
||||||
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML());
|
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML(StreamOpen.CLIENT_NAMESPACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ReferenceEquality")
|
@SuppressWarnings("ReferenceEquality")
|
||||||
|
|
|
@ -113,14 +113,14 @@ public class SLF4JSmackDebugger extends SmackDebugger {
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||||
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOutgoingStreamElement(TopLevelStreamElement streamElement) {
|
public void onOutgoingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) {
|
||||||
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML());
|
logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
|
|
||||||
messagesTable.addRow(
|
messagesTable.addRow(
|
||||||
new Object[] {
|
new Object[] {
|
||||||
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
||||||
dateFormatter.format(new Date()),
|
dateFormatter.format(new Date()),
|
||||||
packetReceivedIcon,
|
packetReceivedIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
|
@ -889,7 +889,7 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
|
|
||||||
messagesTable.addRow(
|
messagesTable.addRow(
|
||||||
new Object[] {
|
new Object[] {
|
||||||
XmlUtil.prettyFormatXml(packet.toXML().toString()),
|
XmlUtil.prettyFormatXml(packet.toXML(null).toString()),
|
||||||
dateFormatter.format(new Date()),
|
dateFormatter.format(new Date()),
|
||||||
packetSentIcon,
|
packetSentIcon,
|
||||||
packetTypeIcon,
|
packetTypeIcon,
|
||||||
|
@ -946,13 +946,13 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML();
|
return toXML(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,8 +331,8 @@ public class LiteDebugger extends SmackDebugger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
public void onIncomingStreamElement(TopLevelStreamElement streamElement) {
|
||||||
interpretedText1.append(streamElement.toXML().toString());
|
interpretedText1.append(streamElement.toXML(null).toString());
|
||||||
interpretedText2.append(streamElement.toXML().toString());
|
interpretedText2.append(streamElement.toXML(null).toString());
|
||||||
interpretedText1.append(NEWLINE);
|
interpretedText1.append(NEWLINE);
|
||||||
interpretedText2.append(NEWLINE);
|
interpretedText2.append(NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,10 +79,10 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.append(fwd.toXML());
|
xml.append(fwd.toXML(null));
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
return xml;
|
return xml;
|
||||||
|
@ -113,7 +113,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("id", id);
|
xml.attribute("id", id);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -166,7 +166,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("id", id);
|
xml.attribute("id", id);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -219,7 +219,7 @@ public class ChatMarkersElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("id", id);
|
xml.attribute("id", id);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class ClientStateIndication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("namespace", getEncryptionNamespace());
|
xml.attribute("namespace", getEncryptionNamespace());
|
||||||
xml.optAttribute("name", getName());
|
xml.optAttribute("name", getName());
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class HashElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.attribute(ATTR_ALGO, algorithm.toString());
|
sb.attribute(ATTR_ALGO, algorithm.toString());
|
||||||
sb.rightAngleBracket();
|
sb.rightAngleBracket();
|
||||||
|
@ -117,6 +117,6 @@ public class HashElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toXML().toString().hashCode();
|
return toXML(null).toString().hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoCopyHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoPermanentStoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class NoStoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class StoreHint extends MessageProcessingHint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
* @return xml representation of this object
|
* @return xml representation of this object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element(child);
|
xml.element(child);
|
||||||
|
@ -215,7 +215,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -259,7 +259,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -303,7 +303,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optAppend(text);
|
xml.optAppend(text);
|
||||||
|
@ -347,7 +347,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("streamId", streamId);
|
xml.attribute("streamId", streamId);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -390,7 +390,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("sid", sid);
|
xml.attribute("sid", sid);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class Base64BinaryChunk implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("streamId", streamId);
|
xml.attribute("streamId", streamId);
|
||||||
xml.attribute("nr", nr);
|
xml.attribute("nr", nr);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class FileTooLargeError implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.element("max-file-size", String.valueOf(maxFileSize));
|
xml.element("max-file-size", String.valueOf(maxFileSize));
|
||||||
|
|
|
@ -82,7 +82,7 @@ public abstract class SetData implements NamedElement {
|
||||||
* @return the stanza extension as XML.
|
* @return the stanza extension as XML.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML() {
|
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name);
|
xml.attribute("name", name);
|
||||||
xml.attribute("value", value);
|
xml.attribute("value", value);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public abstract class IoTDataField implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML() {
|
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name).attribute("value", getValueString());
|
xml.attribute("name", name).attribute("value", getValueString());
|
||||||
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
|
// TODO handle 'unit' attribute as special case if <numeric/> is implemented.
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class IoTFieldsExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("seqnr", Integer.toString(seqNr));
|
xml.attribute("seqnr", Integer.toString(seqNr));
|
||||||
xml.attribute("done", done);
|
xml.attribute("done", done);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class NodeElement implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
nodeInfo.appendTo(xml);
|
nodeInfo.appendTo(xml);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TimestampElement implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("value", date);
|
xml.attribute("value", date);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Tag implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("name", name);
|
xml.attribute("name", name);
|
||||||
xml.attribute("value", value);
|
xml.attribute("value", value);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class Friend implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", friend);
|
xml.attribute("jid", friend);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Unfriend implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", jid);
|
xml.attribute("jid", jid);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class Checksum implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.optAttribute(ATTR_CREATOR, creator);
|
sb.optAttribute(ATTR_CREATOR, creator);
|
||||||
sb.optAttribute(ATTR_NAME, name);
|
sb.optAttribute(ATTR_NAME, name);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class JingleFileTransferChild extends JingleContentDescriptionChildElemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
sb.rightAngleBracket();
|
sb.rightAngleBracket();
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class Range implements NamedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||||
|
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
|
@ -130,6 +130,6 @@ public class Range implements NamedElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toXML().toString().hashCode();
|
return toXML(null).toString().hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class AbstractJsonPacketExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final XmlStringBuilder toXML() {
|
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.append(json);
|
xml.append(json);
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.xmlnsAttribute(NAMESPACE);
|
xml.xmlnsAttribute(NAMESPACE);
|
||||||
|
@ -167,7 +167,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("always");
|
xml.openElement("always");
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public class MamElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("never");
|
xml.openElement("never");
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class BlockQuoteElement implements MarkupElement.BlockLevelMarkupElement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class CodeBlockElement implements MarkupElement.BlockLevelMarkupElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
@ -76,7 +76,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
for (ListEntryElement li : getEntries()) {
|
for (ListEntryElement li : getEntries()) {
|
||||||
xml.append(li.toXML());
|
xml.append(li.toXML(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
|
@ -110,7 +110,7 @@ public class ListElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -68,11 +68,11 @@ public class MarkupElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
|
XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
|
||||||
|
|
||||||
for (MarkupChildElement child : getChildElements()) {
|
for (MarkupChildElement child : getChildElements()) {
|
||||||
xml.append(child.toXML());
|
xml.append(child.toXML(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SpanElement implements MarkupElement.MarkupChildElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(this);
|
xml.halfOpenElement(this);
|
||||||
xml.attribute(ATTR_START, getStart());
|
xml.attribute(ATTR_START, getStart());
|
||||||
|
|
|
@ -94,7 +94,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("configuration");
|
xml.openElement("configuration");
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.openElement("occupants");
|
xml.openElement("occupants");
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement("user");
|
xml.halfOpenElement("user");
|
||||||
xml.attribute("affiliation", affiliation);
|
xml.attribute("affiliation", affiliation);
|
||||||
|
@ -373,7 +373,7 @@ public abstract class MUCLightElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
|
|
||||||
String tag = isRoom ? "room" : "user";
|
String tag = isRoom ? "room" : "user";
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class PushNotificationsElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
|
|
||||||
xml.attribute("node", node);
|
xml.attribute("node", node);
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this)
|
XmlStringBuilder xml = new XmlStringBuilder(this)
|
||||||
.optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1)
|
.optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1)
|
||||||
.optIntAttribute(ATTR_END, end != null ? end : -1)
|
.optIntAttribute(ATTR_END, end != null ? end : -1)
|
||||||
|
@ -186,7 +186,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
return xml.closeEmptyElement();
|
return xml.closeEmptyElement();
|
||||||
} else {
|
} else {
|
||||||
return xml.rightAngleBracket()
|
return xml.rightAngleBracket()
|
||||||
.append(child.toXML())
|
.append(child.toXML(null))
|
||||||
.closeElement(this);
|
.closeElement(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class OriginIdElement extends StableAndUniqueIdElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
return new XmlStringBuilder(this)
|
return new XmlStringBuilder(this)
|
||||||
.attribute(ATTR_ID, getId())
|
.attribute(ATTR_ID, getId())
|
||||||
.closeEmptyElement();
|
.closeEmptyElement();
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class StanzaIdElement extends StableAndUniqueIdElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
return new XmlStringBuilder(this)
|
return new XmlStringBuilder(this)
|
||||||
.attribute(ATTR_ID, getId())
|
.attribute(ATTR_ID, getId())
|
||||||
.attribute(ATTR_BY, getBy())
|
.attribute(ATTR_BY, getBy())
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class SpoilerElement implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.optXmlLangAttribute(getLanguage());
|
xml.optXmlLangAttribute(getLanguage());
|
||||||
if (getHint() == null) {
|
if (getHint() == null) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class AcknowledgedExtensionTest {
|
||||||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||||
message.setStanzaId("message-2");
|
message.setStanzaId("message-2");
|
||||||
message.addExtension(new ChatMarkersElements.AcknowledgedExtension("message-1"));
|
message.addExtension(new ChatMarkersElements.AcknowledgedExtension("message-1"));
|
||||||
Assert.assertEquals(acknowledgedMessageStanza, message.toXML().toString());
|
Assert.assertEquals(acknowledgedMessageStanza, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class DisplayedExtensionTest {
|
||||||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||||
message.setStanzaId("message-2");
|
message.setStanzaId("message-2");
|
||||||
message.addExtension(new ChatMarkersElements.DisplayedExtension("message-1"));
|
message.addExtension(new ChatMarkersElements.DisplayedExtension("message-1"));
|
||||||
Assert.assertEquals(displayedMessageStanza, message.toXML().toString());
|
Assert.assertEquals(displayedMessageStanza, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -42,18 +42,18 @@ public class MarkableExtensionTest {
|
||||||
message.setStanzaId("message-1");
|
message.setStanzaId("message-1");
|
||||||
message.setBody("My lord, dispatch; read o'er these articles.");
|
message.setBody("My lord, dispatch; read o'er these articles.");
|
||||||
message.addExtension(new ChatMarkersElements.MarkableExtension());
|
message.addExtension(new ChatMarkersElements.MarkableExtension());
|
||||||
Assert.assertEquals(markableMessageStanza, message.toXML().toString());
|
Assert.assertEquals(markableMessageStanza, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkMarkableProvider() throws Exception {
|
public void checkMarkableProvider() throws Exception {
|
||||||
XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension);
|
XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension);
|
||||||
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
||||||
Assert.assertEquals(markableExtension, markableExtension1.toXML().toString());
|
Assert.assertEquals(markableExtension, markableExtension1.toXML(null).toString());
|
||||||
|
|
||||||
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
||||||
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
||||||
Assert.assertEquals(markableExtension, markableExtension2.toXML().toString());
|
Assert.assertEquals(markableExtension, markableExtension2.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ReceivedExtensionTest {
|
||||||
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
|
||||||
message.setStanzaId("message-2");
|
message.setStanzaId("message-2");
|
||||||
message.addExtension(new ChatMarkersElements.ReceivedExtension("message-1"));
|
message.addExtension(new ChatMarkersElements.ReceivedExtension("message-1"));
|
||||||
Assert.assertEquals(receivedMessageStanza, message.toXML().toString());
|
Assert.assertEquals(receivedMessageStanza, message.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -41,10 +41,10 @@ public class HashElementTest extends SmackTestSuite {
|
||||||
String message = "Hello World!";
|
String message = "Hello World!";
|
||||||
HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message));
|
HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message));
|
||||||
String expected = "<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=</hash>";
|
String expected = "<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=</hash>";
|
||||||
assertEquals(expected, element.toXML().toString());
|
assertEquals(expected, element.toXML(null).toString());
|
||||||
|
|
||||||
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
|
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
|
||||||
assertEquals(expected, parsed.toXML().toString());
|
assertEquals(expected, parsed.toXML(null).toString());
|
||||||
assertEquals(SHA_256, parsed.getAlgorithm());
|
assertEquals(SHA_256, parsed.getAlgorithm());
|
||||||
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
|
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
|
||||||
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());
|
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class FileTooLargeErrorCreateTest {
|
||||||
FileTooLargeError fileTooLargeError = new FileTooLargeError(20000);
|
FileTooLargeError fileTooLargeError = new FileTooLargeError(20000);
|
||||||
|
|
||||||
Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize());
|
Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize());
|
||||||
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML().toString());
|
Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML(null).toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SlotProviderTest {
|
||||||
|
|
||||||
checkUrls(slot);
|
checkUrls(slot);
|
||||||
|
|
||||||
assertXMLEqual(SLOT_IQ, slot.toXML().toString());
|
assertXMLEqual(SLOT_IQ, slot.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String SLOT_V0_2_IQ =
|
private static final String SLOT_V0_2_IQ =
|
||||||
|
@ -88,7 +88,7 @@ public class SlotProviderTest {
|
||||||
|
|
||||||
checkUrls(slot);
|
checkUrls(slot);
|
||||||
|
|
||||||
String slotXml = slot.toXML().toString();
|
String slotXml = slot.toXML(null).toString();
|
||||||
assertXMLEqual(SLOT_V0_2_IQ, slotXml);
|
assertXMLEqual(SLOT_V0_2_IQ, slotXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class SlotProviderTest {
|
||||||
|
|
||||||
checkUrls(slot);
|
checkUrls(slot);
|
||||||
|
|
||||||
String slotXml = slot.toXML().toString();
|
String slotXml = slot.toXML(null).toString();
|
||||||
assertXMLEqual(SLOT_WITH_HEADERS_IQ, slotXml);
|
assertXMLEqual(SLOT_WITH_HEADERS_IQ, slotXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||||
|
|
||||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -76,7 +76,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(XmppDateTime.formatXEP0082Date(date));
|
values.add(XmppDateTime.formatXEP0082Date(date));
|
||||||
|
|
||||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -93,7 +93,7 @@ public class FiltersTest extends MamTest {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(jid);
|
values.add(jid);
|
||||||
|
|
||||||
Assert.assertEquals(dataForm.toXML().toString(), getMamXMemberWith(fields, values));
|
Assert.assertEquals(dataForm.toXML(null).toString(), getMamXMemberWith(fields, values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -113,7 +113,7 @@ public class FiltersTest extends MamTest {
|
||||||
methodAddStartDateFilter.invoke(mamManager, date, dataForm);
|
methodAddStartDateFilter.invoke(mamManager, date, dataForm);
|
||||||
methodAddEndDateFilter.invoke(mamManager, date, dataForm);
|
methodAddEndDateFilter.invoke(mamManager, date, dataForm);
|
||||||
methodAddJidFilter.invoke(mamManager, JidCreate.from(jid), dataForm);
|
methodAddJidFilter.invoke(mamManager, JidCreate.from(jid), dataForm);
|
||||||
String dataFormResult = dataForm.toXML().toString();
|
String dataFormResult = dataForm.toXML(null).toString();
|
||||||
|
|
||||||
List<String> fields = new ArrayList<>();
|
List<String> fields = new ArrayList<>();
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class PagingTest extends MamTest {
|
||||||
|
|
||||||
Assert.assertEquals(mamQueryIQ.getDataForm(), dataForm);
|
Assert.assertEquals(mamQueryIQ.getDataForm(), dataForm);
|
||||||
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0), "urn:xmpp:mam:1");
|
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0), "urn:xmpp:mam:1");
|
||||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), pagingStanza);
|
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), pagingStanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class PreferencesTest {
|
||||||
public void checkRetrievePrefsStanza() throws Exception {
|
public void checkRetrievePrefsStanza() throws Exception {
|
||||||
MamPrefsIQ mamPrefIQ = new MamPrefsIQ();
|
MamPrefsIQ mamPrefIQ = new MamPrefsIQ();
|
||||||
mamPrefIQ.setStanzaId("sarasa");
|
mamPrefIQ.setStanzaId("sarasa");
|
||||||
Assert.assertEquals(mamPrefIQ.toXML().toString(), retrievePrefsStanzaExample);
|
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), retrievePrefsStanzaExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -55,7 +55,7 @@ public class PreferencesTest {
|
||||||
|
|
||||||
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, DefaultBehavior.roster);
|
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, DefaultBehavior.roster);
|
||||||
mamPrefIQ.setStanzaId("sarasa");
|
mamPrefIQ.setStanzaId("sarasa");
|
||||||
Assert.assertEquals(mamPrefIQ.toXML().toString(), updatePrefsStanzaExample);
|
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), updatePrefsStanzaExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class QueryArchiveTest extends MamTest {
|
||||||
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId, dataForm);
|
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId, dataForm);
|
||||||
mamQueryIQ.setType(IQ.Type.set);
|
mamQueryIQ.setType(IQ.Type.set);
|
||||||
mamQueryIQ.setStanzaId("sarasa");
|
mamQueryIQ.setStanzaId("sarasa");
|
||||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), mamSimpleQueryIQ);
|
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), mamSimpleQueryIQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -80,7 +80,7 @@ public class QueryArchiveTest extends MamTest {
|
||||||
|
|
||||||
message.addExtension(new MamResultExtension("g27", "34482-21985-73620", forwarded));
|
message.addExtension(new MamResultExtension("g27", "34482-21985-73620", forwarded));
|
||||||
|
|
||||||
Assert.assertEquals(message.toXML().toString(), mamQueryResultExample);
|
Assert.assertEquals(message.toXML(null).toString(), mamQueryResultExample);
|
||||||
|
|
||||||
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ResultsLimitTest extends MamTest {
|
||||||
mamQueryIQ.setStanzaId("sarasa");
|
mamQueryIQ.setStanzaId("sarasa");
|
||||||
|
|
||||||
methodAddResultsLimit.invoke(mamManager, 10, mamQueryIQ);
|
methodAddResultsLimit.invoke(mamManager, 10, mamQueryIQ);
|
||||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), resultsLimitStanza);
|
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), resultsLimitStanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class RetrieveFormFieldsTest extends MamTest {
|
||||||
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId);
|
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId);
|
||||||
mamQueryIQ.setStanzaId("sarasa");
|
mamQueryIQ.setStanzaId("sarasa");
|
||||||
|
|
||||||
Assert.assertEquals(mamQueryIQ.toXML().toString(), retrieveFormFieldStanza);
|
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), retrieveFormFieldStanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -70,7 +70,7 @@ public class RetrieveFormFieldsTest extends MamTest {
|
||||||
|
|
||||||
methodAddAdditionalFields.invoke(mamManager, additionalFields, dataForm);
|
methodAddAdditionalFields.invoke(mamManager, additionalFields, dataForm);
|
||||||
|
|
||||||
String dataFormResult = dataForm.toXML().toString();
|
String dataFormResult = dataForm.toXML(null).toString();
|
||||||
|
|
||||||
Assert.assertEquals(dataFormResult, additionalFieldsStanza);
|
Assert.assertEquals(dataFormResult, additionalFieldsStanza);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setEmphasis(9, 15);
|
m.setEmphasis(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -69,7 +69,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setCode(9, 15);
|
m.setCode(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -93,7 +93,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setDeleted(9, 15);
|
m.setDeleted(9, 15);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -127,7 +127,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setCodeBlock(23, 48);
|
m.setCodeBlock(23, 48);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -157,7 +157,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
.addEntry(61, 69)
|
.addEntry(61, 69)
|
||||||
.addEntry(69, 89)
|
.addEntry(69, 89)
|
||||||
.endList();
|
.endList();
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -186,7 +186,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setBlockQuote(9 ,32);
|
m.setBlockQuote(9 ,32);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
@ -208,7 +208,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setBlockQuote(0, 57);
|
m.setBlockQuote(0, 57);
|
||||||
m.setBlockQuote(11, 34);
|
m.setBlockQuote(11, 34);
|
||||||
assertXMLEqual(xml, m.build().toXML().toString());
|
assertXMLEqual(xml, m.build().toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
MarkupElement parsed = new MarkupElementProvider().parse(parser);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MUCLightBlockingTest {
|
||||||
mucLightBlockingIQ.setStanzaId("getblock1");
|
mucLightBlockingIQ.setStanzaId("getblock1");
|
||||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||||
|
|
||||||
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML().toString());
|
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -88,7 +88,7 @@ public class MUCLightBlockingTest {
|
||||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||||
mucLightBlockingIQ.setStanzaId("block1");
|
mucLightBlockingIQ.setStanzaId("block1");
|
||||||
|
|
||||||
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML().toString());
|
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -102,7 +102,7 @@ public class MUCLightBlockingTest {
|
||||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||||
mucLightBlockingIQ.setStanzaId("block2");
|
mucLightBlockingIQ.setStanzaId("block2");
|
||||||
|
|
||||||
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML().toString());
|
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -118,7 +118,7 @@ public class MUCLightBlockingTest {
|
||||||
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
|
||||||
mucLightBlockingIQ.setStanzaId("unblock1");
|
mucLightBlockingIQ.setStanzaId("unblock1");
|
||||||
|
|
||||||
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML().toString());
|
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject());
|
Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject());
|
||||||
Assert.assertNull(configurationsChangeExtension.getRoomName());
|
Assert.assertNull(configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||||
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML().toString());
|
Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -65,7 +65,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||||
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
Assert.assertNull(configurationsChangeExtension.getCustomConfigs());
|
||||||
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML().toString());
|
Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -79,7 +79,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName());
|
||||||
Assert.assertNull(configurationsChangeExtension.getSubject());
|
Assert.assertNull(configurationsChangeExtension.getSubject());
|
||||||
Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color"));
|
Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color"));
|
||||||
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML().toString());
|
Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class MUCLightDestroyTest {
|
||||||
public void checkDestroyMUCLightStanza() throws Exception {
|
public void checkDestroyMUCLightStanza() throws Exception {
|
||||||
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
|
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
|
||||||
mucLightDestroyIQ.setStanzaId("destroy1");
|
mucLightDestroyIQ.setStanzaId("destroy1");
|
||||||
Assert.assertEquals(mucLightDestroyIQ.toXML().toString(), stanza);
|
Assert.assertEquals(mucLightDestroyIQ.toXML(null).toString(), stanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MUCLightGetAffiliationsTest {
|
||||||
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(
|
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||||
mucLightGetAffiliationsIQ.setStanzaId("getmembers");
|
mucLightGetAffiliationsIQ.setStanzaId("getmembers");
|
||||||
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML().toString());
|
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MUCLightGetConfigsTest {
|
||||||
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(
|
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||||
mucLightGetConfigsIQ.setStanzaId("config0");
|
mucLightGetConfigsIQ.setStanzaId("config0");
|
||||||
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML().toString());
|
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MUCLightInfoTest {
|
||||||
MUCLightGetInfoIQ mucLightGetInfoIQWithVersion = new MUCLightGetInfoIQ(
|
MUCLightGetInfoIQ mucLightGetInfoIQWithVersion = new MUCLightGetInfoIQ(
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
|
||||||
mucLightGetInfoIQWithVersion.setStanzaId("getinfo1");
|
mucLightGetInfoIQWithVersion.setStanzaId("getinfo1");
|
||||||
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML().toString(), exampleWithVersion);
|
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(null).toString(), exampleWithVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -53,7 +53,7 @@ public class MUCLightInfoTest {
|
||||||
MUCLightGetInfoIQ mucLightGetInfoIQWithoutVersion = new MUCLightGetInfoIQ(
|
MUCLightGetInfoIQ mucLightGetInfoIQWithoutVersion = new MUCLightGetInfoIQ(
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), null);
|
JidCreate.from("coven@muclight.shakespeare.lit"), null);
|
||||||
mucLightGetInfoIQWithoutVersion.setStanzaId("getinfo1");
|
mucLightGetInfoIQWithoutVersion.setStanzaId("getinfo1");
|
||||||
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML().toString(), exampleWithoutVersion);
|
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(null).toString(), exampleWithoutVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MUCLightSetConfigsIQTest {
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", customConfigs);
|
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", customConfigs);
|
||||||
mucLightSetConfigsIQ.setStanzaId("conf1");
|
mucLightSetConfigsIQ.setStanzaId("conf1");
|
||||||
|
|
||||||
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML().toString());
|
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -56,7 +56,7 @@ public class MUCLightSetConfigsIQTest {
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", null);
|
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", null);
|
||||||
mucLightChangeRoomNameIQ.setStanzaId("roomName1");
|
mucLightChangeRoomNameIQ.setStanzaId("roomName1");
|
||||||
|
|
||||||
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML().toString());
|
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -65,7 +65,7 @@ public class MUCLightSetConfigsIQTest {
|
||||||
JidCreate.from("coven@muclight.shakespeare.lit"), null, "To be or not to be?", null);
|
JidCreate.from("coven@muclight.shakespeare.lit"), null, "To be or not to be?", null);
|
||||||
mucLightChangeSubjectIQ.setStanzaId("subject1");
|
mucLightChangeSubjectIQ.setStanzaId("subject1");
|
||||||
|
|
||||||
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML().toString());
|
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class DisablePushNotificationsIQTest {
|
||||||
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
||||||
JidCreate.from("push-5.client.example"));
|
JidCreate.from("push-5.client.example"));
|
||||||
disablePushNotificationsIQ.setStanzaId("x97");
|
disablePushNotificationsIQ.setStanzaId("x97");
|
||||||
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML().toString());
|
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -44,7 +44,7 @@ public class DisablePushNotificationsIQTest {
|
||||||
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
|
||||||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
||||||
disablePushNotificationsIQ.setStanzaId("x97");
|
disablePushNotificationsIQ.setStanzaId("x97");
|
||||||
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML().toString());
|
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class EnablePushNotificationsIQTest {
|
||||||
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(
|
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(
|
||||||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
|
||||||
enablePushNotificationsIQ.setStanzaId("x42");
|
enablePushNotificationsIQ.setStanzaId("x42");
|
||||||
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML().toString());
|
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -53,7 +53,7 @@ public class EnablePushNotificationsIQTest {
|
||||||
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo", publishOptions);
|
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo", publishOptions);
|
||||||
enablePushNotificationsIQ.setStanzaId("x42");
|
enablePushNotificationsIQ.setStanzaId("x42");
|
||||||
|
|
||||||
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML().toString());
|
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
"uri='xmpp:juliet@capulet.lit' />";
|
"uri='xmpp:juliet@capulet.lit' />";
|
||||||
URI uri = new URI("xmpp:juliet@capulet.lit");
|
URI uri = new URI("xmpp:juliet@capulet.lit");
|
||||||
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
|
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
|
||||||
assertXMLEqual(xml, element.toXML().toString());
|
assertXMLEqual(xml, element.toXML(null).toString());
|
||||||
assertEquals(72, (int) element.getBegin());
|
assertEquals(72, (int) element.getBegin());
|
||||||
assertEquals(78, (int) element.getEnd());
|
assertEquals(78, (int) element.getEnd());
|
||||||
assertEquals(ReferenceElement.Type.mention, element.getType());
|
assertEquals(ReferenceElement.Type.mention, element.getType());
|
||||||
|
@ -49,7 +49,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
assertEquals(uri, element.getUri());
|
assertEquals(uri, element.getUri());
|
||||||
|
|
||||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||||
assertXMLEqual(xml, parsed.toXML().toString());
|
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +64,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
"uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />";
|
"uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />";
|
||||||
URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be");
|
URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be");
|
||||||
ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri);
|
ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri);
|
||||||
assertXMLEqual(xml, element.toXML().toString());
|
assertXMLEqual(xml, element.toXML(null).toString());
|
||||||
|
|
||||||
assertNull(element.getBegin());
|
assertNull(element.getBegin());
|
||||||
assertNull(element.getEnd());
|
assertNull(element.getEnd());
|
||||||
|
@ -73,7 +73,7 @@ public class ReferenceTest extends SmackTestSuite {
|
||||||
assertEquals(uri, element.getUri());
|
assertEquals(uri, element.getUri());
|
||||||
|
|
||||||
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
|
||||||
assertXMLEqual(xml, parsed.toXML().toString());
|
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
|
||||||
StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit");
|
StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit");
|
||||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||||
assertEquals("alice@wonderland.lit", element.getBy());
|
assertEquals("alice@wonderland.lit", element.getBy());
|
||||||
assertXMLEqual(xml, element.toXML().toString());
|
assertXMLEqual(xml, element.toXML(null).toString());
|
||||||
|
|
||||||
StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||||
assertEquals(element.getId(), parsed.getId());
|
assertEquals(element.getId(), parsed.getId());
|
||||||
|
@ -52,7 +52,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
|
||||||
String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />";
|
String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />";
|
||||||
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
|
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
|
||||||
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
|
||||||
assertXMLEqual(xml, element.toXML().toString());
|
assertXMLEqual(xml, element.toXML(null).toString());
|
||||||
|
|
||||||
OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml));
|
||||||
assertEquals(element.getId(), parsed.getId());
|
assertEquals(element.getId(), parsed.getId());
|
||||||
|
|
|
@ -46,11 +46,11 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertNull(empty.getHint());
|
assertNull(empty.getHint());
|
||||||
assertNull(empty.getLanguage());
|
assertNull(empty.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, empty.toXML().toString());
|
assertXMLEqual(xml, empty.toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
assertXMLEqual(xml, parsed.toXML().toString());
|
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -65,12 +65,12 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertEquals("Love story end", withHint.getHint());
|
assertEquals("Love story end", withHint.getHint());
|
||||||
assertNull(withHint.getLanguage());
|
assertNull(withHint.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, withHint.toXML().toString());
|
assertXMLEqual(xml, withHint.toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
|
|
||||||
assertXMLEqual(xml, parsed.toXML().toString());
|
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -85,13 +85,13 @@ public class SpoilerTest extends SmackTestSuite {
|
||||||
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
||||||
assertEquals("de", i18nHint.getLanguage());
|
assertEquals("de", i18nHint.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, i18nHint.toXML().toString());
|
assertXMLEqual(xml, i18nHint.toXML(null).toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
|
||||||
assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
|
assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
|
||||||
|
|
||||||
assertXMLEqual(xml, parsed.toXML().toString());
|
assertXMLEqual(xml, parsed.toXML(null).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -211,19 +211,19 @@ public class MultipleRecipientManager {
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
for (Jid jid : to) {
|
for (Jid jid : to) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cc != null) {
|
if (cc != null) {
|
||||||
for (Jid jid : cc) {
|
for (Jid jid : cc) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bcc != null) {
|
if (bcc != null) {
|
||||||
for (Jid jid : bcc) {
|
for (Jid jid : bcc) {
|
||||||
packet.setTo(jid);
|
packet.setTo(jid);
|
||||||
connection.sendStanza(new PacketCopy(packet.toXML()));
|
connection.sendStanza(new PacketCopy(packet.toXML(null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,13 +309,13 @@ public class MultipleRecipientManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toXML().toString();
|
return toXML(null).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,12 +118,12 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder(this);
|
XmlStringBuilder buf = new XmlStringBuilder(this);
|
||||||
buf.rightAngleBracket();
|
buf.rightAngleBracket();
|
||||||
// Loop through all the addresses and append them to the string buffer
|
// Loop through all the addresses and append them to the string buffer
|
||||||
for (Address address : addresses) {
|
for (Address address : addresses) {
|
||||||
buf.append(address.toXML());
|
buf.append(address.toXML(null));
|
||||||
}
|
}
|
||||||
buf.closeElement(this);
|
buf.closeElement(this);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -194,7 +194,7 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(this).attribute("type", type);
|
buf.halfOpenElement(this).attribute("type", type);
|
||||||
buf.optAttribute("jid", jid);
|
buf.optAttribute("jid", jid);
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class AMPExtension implements ExtensionElement {
|
||||||
* Returns the XML representation of a XHTML extension according the specification.
|
* Returns the XML representation of a XHTML extension according the specification.
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"');
|
buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"');
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
* @see org.jivesoftware.smack.packet.PacketExtension#toXML()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML(String enclosingNamespace) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
||||||
getNamespace()).append("\"/>");
|
getNamespace()).append("\"/>");
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class BlockedErrorExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BoBExtension extends XHTMLExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class DataPacketExtension implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this));
|
XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this));
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return xml;
|
return xml;
|
||||||
|
|
|
@ -232,11 +232,11 @@ public class Bytestream extends IQ {
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
if (getToActivate() == null) {
|
if (getToActivate() == null) {
|
||||||
for (StreamHost streamHost : getStreamHosts()) {
|
for (StreamHost streamHost : getStreamHosts()) {
|
||||||
xml.append(streamHost.toXML());
|
xml.append(streamHost.toXML(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xml.append(getToActivate().toXML());
|
xml.append(getToActivate().toXML(null));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case result:
|
case result:
|
||||||
|
@ -246,7 +246,7 @@ public class Bytestream extends IQ {
|
||||||
// constructions mechanisms of Bytestream
|
// constructions mechanisms of Bytestream
|
||||||
// A result from the server can also contain stream hosts
|
// A result from the server can also contain stream hosts
|
||||||
for (StreamHost host : streamHosts) {
|
for (StreamHost host : streamHosts) {
|
||||||
xml.append(host.toXML());
|
xml.append(host.toXML(null));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case get:
|
case get:
|
||||||
|
@ -325,7 +325,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", getJID());
|
xml.attribute("jid", getJID());
|
||||||
xml.attribute("host", getAddress());
|
xml.attribute("host", getAddress());
|
||||||
|
@ -375,7 +375,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.attribute("jid", getJID());
|
xml.attribute("jid", getJID());
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
@ -418,7 +418,7 @@ public class Bytestream extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.escape(getTarget());
|
xml.escape(getTarget());
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache
|
||||||
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
|
private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
|
||||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
|
||||||
try {
|
try {
|
||||||
dos.writeUTF(info.toXML().toString());
|
dos.writeUTF(info.toXML(null).toString());
|
||||||
} finally {
|
} finally {
|
||||||
dos.close();
|
dos.close();
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue