mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02: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
|
@ -37,7 +37,7 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
public static final String PRE_KEY_ID = "preKeyId";
|
||||
|
||||
@Override
|
||||
public abstract XmlStringBuilder toXML();
|
||||
public abstract XmlStringBuilder toXML(String enclosingNamespace);
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
|
@ -46,11 +46,11 @@ public abstract class OmemoBundleElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
OmemoBundleElement otherOmemoBundleElement = (OmemoBundleElement) other;
|
||||
return toXML().equals(otherOmemoBundleElement.toXML());
|
||||
return toXML(null).equals(otherOmemoBundleElement.toXML(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.toXML().hashCode();
|
||||
return this.toXML(null).hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public class OmemoBundleVAxolotlElement extends OmemoBundleElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
|
||||
|
||||
sb.halfOpenElement(SIGNED_PRE_KEY_PUB).attribute(SIGNED_PRE_KEY_ID, signedPreKeyId).rightAngleBracket()
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class OmemoDeviceListElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final XmlStringBuilder toXML() {
|
||||
public final XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
|
||||
|
||||
for (Integer id : deviceIds) {
|
||||
|
|
|
@ -120,7 +120,7 @@ public abstract class OmemoElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
sb.attribute(SID, getSid()).rightAngleBracket();
|
||||
|
||||
|
@ -176,7 +176,7 @@ public abstract class OmemoElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CharSequence toXML() {
|
||||
public CharSequence toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this);
|
||||
|
||||
if (isPreKey()) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class OmemoVAxolotlElement extends OmemoElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
public XmlStringBuilder toXML(String enclosingNamespace) {
|
||||
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
|
||||
|
||||
sb.element(header);
|
||||
|
|
|
@ -76,7 +76,7 @@ public class OmemoBundleVAxolotlElementTest extends SmackTestSuite {
|
|||
"</preKeyPublic>" +
|
||||
"</prekeys>" +
|
||||
"</bundle>";
|
||||
String actual = bundle.toXML().toString();
|
||||
String actual = bundle.toXML(null).toString();
|
||||
assertEquals("Bundles XML must match.", expected, actual);
|
||||
|
||||
byte[] signedPreKey = "SignedPreKey".getBytes(StringUtils.UTF8);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OmemoDeviceListVAxolotlElementTest extends SmackTestSuite {
|
|||
ids.add(9876);
|
||||
|
||||
OmemoDeviceListVAxolotlElement element = new OmemoDeviceListVAxolotlElement(ids);
|
||||
String xml = element.toXML().toString();
|
||||
String xml = element.toXML(null).toString();
|
||||
|
||||
XmlPullParser parser = TestUtils.getParser(xml);
|
||||
OmemoDeviceListVAxolotlElement parsed = new OmemoDeviceListVAxolotlProvider().parse(parser);
|
||||
|
|
|
@ -66,10 +66,10 @@ public class OmemoVAxolotlElementTest extends SmackTestSuite {
|
|||
"</payload>" +
|
||||
"</encrypted>";
|
||||
|
||||
String actual = element.toXML().toString();
|
||||
String actual = element.toXML(null).toString();
|
||||
assertEquals("Serialized xml of OmemoElement must match.", expected, actual);
|
||||
|
||||
OmemoVAxolotlElement parsed = new OmemoVAxolotlProvider().parse(TestUtils.getParser(actual));
|
||||
assertEquals("Parsed OmemoElement must equal the original.", element.toXML().toString(), parsed.toXML().toString());
|
||||
assertEquals("Parsed OmemoElement must equal the original.", element.toXML(null).toString(), parsed.toXML(null).toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue