From f045c0dd0818927b4d16911995af2c934c147ae4 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 24 May 2020 12:26:36 +0200 Subject: [PATCH] Update Message Archive Management (XEP-0313) support to urn:xmpp:mam:2 Fixes SMACK-890. --- .../jivesoftware/smackx/mam/element/MamElements.java | 4 ++-- .../experimental.providers | 8 ++++---- .../jivesoftware/smackx/mam/MamFinProviderTest.java | 4 ++-- .../jivesoftware/smackx/mam/MamPrefIQProviderTest.java | 8 ++++---- .../smackx/mam/MamQueryIQProviderTest.java | 10 +++++----- .../jivesoftware/smackx/mam/MamResultProviderTest.java | 4 ++-- .../java/org/jivesoftware/smackx/mam/PagingTest.java | 6 +++--- .../org/jivesoftware/smackx/mam/QueryArchiveTest.java | 4 ++-- .../org/jivesoftware/smackx/mam/ResultsLimitTest.java | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java index 034245a5a..9fcff7b9c 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2016 Florian Schmaus and Fernando Ramirez + * Copyright © 2016-2020 Florian Schmaus and Fernando Ramirez * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import org.jxmpp.jid.Jid; */ public class MamElements { - public static final String NAMESPACE = "urn:xmpp:mam:1"; + public static final String NAMESPACE = "urn:xmpp:mam:2"; /** * MAM result extension class. diff --git a/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers b/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers index a6791cbb7..8e6d3df51 100644 --- a/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers +++ b/smack-experimental/src/main/resources/org.jivesoftware.smack.experimental/experimental.providers @@ -17,22 +17,22 @@ prefs - urn:xmpp:mam:1 + urn:xmpp:mam:2 org.jivesoftware.smackx.mam.provider.MamPrefsIQProvider query - urn:xmpp:mam:1 + urn:xmpp:mam:2 org.jivesoftware.smackx.mam.provider.MamQueryIQProvider fin - urn:xmpp:mam:1 + urn:xmpp:mam:2 org.jivesoftware.smackx.mam.provider.MamFinIQProvider result - urn:xmpp:mam:1 + urn:xmpp:mam:2 org.jivesoftware.smackx.mam.provider.MamResultProvider diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamFinProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamFinProviderTest.java index f0cd5df68..cbb1b5c1d 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamFinProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamFinProviderTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; public class MamFinProviderTest extends MamTest { - static final String exmapleMamFinXml = "" + static final String exmapleMamFinXml = "" + "" + "10" + "09af3-cc343-b409f" + "" + ""; @@ -56,7 +56,7 @@ public class MamFinProviderTest extends MamTest { public void checkQueryLimitedResults() throws Exception { // @formatter:off final String IQ_LIMITED_RESULTS_EXAMPLE = "" - + "" + + "" + "" + "23452-4534-1" + "390-2342-22" + "16" diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamPrefIQProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamPrefIQProviderTest.java index 1c0ff85f8..cd5d4c0ca 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamPrefIQProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamPrefIQProviderTest.java @@ -33,19 +33,19 @@ import org.jxmpp.jid.Jid; public class MamPrefIQProviderTest extends MamTest { - private static final String exampleMamPrefsIQ1 = "" + "" + private static final String exampleMamPrefsIQ1 = "" + "" + "" + "romeo@montague.lit" + "" + "" + "montague@montague.lit" + "" + "" + ""; - private static final String exampleMamPrefsIQ2 = "" + "" + private static final String exampleMamPrefsIQ2 = "" + "" + "" + "romeo@montague.lit" + "montague@montague.lit" + "" + "" + "" + "" + ""; - private static final String exampleMamPrefsIQ3 = "" + "" + "" + private static final String exampleMamPrefsIQ3 = "" + "" + "" + ""; private static final String exampleMamPrefsResultIQ = "" - + "" + "" + "romeo@montague.lit" + + "" + "" + "romeo@montague.lit" + "" + "" + "sarasa@montague.lit" + "montague@montague.lit" + "" + "" + ""; diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java index c9f3be99e..eeac45f5e 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java @@ -35,18 +35,18 @@ import org.junit.jupiter.api.Test; public class MamQueryIQProviderTest { - private static final String exampleMamQueryIQ1 = "" + "" + private static final String exampleMamQueryIQ1 = "" + "" + "" + "" - + "urn:xmpp:mam:1" + "" + + "urn:xmpp:mam:2" + "" + "" + "Where arth thou, my Juliet?" + "" + "" + "{http://jabber.org/protocol/mood}mood/lonely" + "" + "" + "" + ""; - private static final String exampleMamQueryIQ2 = "" + "" + private static final String exampleMamQueryIQ2 = "" + "" + "" + "" - + "urn:xmpp:mam:1" + "" + "" + + "urn:xmpp:mam:2" + "" + "" + "" + "" + "" + "" + "" + "" + ""; @@ -80,7 +80,7 @@ public class MamQueryIQProviderTest { assertEquals(dataForm2.getType(), DataForm.Type.form); List fields2 = dataForm2.getFields(); - assertEquals(fields2.get(0).getValues().get(0).toString(), "urn:xmpp:mam:1"); + assertEquals(fields2.get(0).getValues().get(0).toString(), "urn:xmpp:mam:2"); assertTrue(fields2.get(0).getValues().size() == 1); assertEquals(fields2.get(1).getType(), FormField.Type.jid_single); assertEquals(fields2.get(2).getType(), FormField.Type.text_single); diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamResultProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamResultProviderTest.java index 7fbcd7c7e..f7a0a28b4 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamResultProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamResultProviderTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; public class MamResultProviderTest { - private static final String exampleMamResultXml = "" + private static final String exampleMamResultXml = "" + "" + "" + "" @@ -42,7 +42,7 @@ public class MamResultProviderTest { + "" + "" + ""; private static final String exampleResultMessage = "" - + "" + + "" + "" + "" + "" + "Hail to thee" + "" + "" + "" + ""; diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PagingTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PagingTest.java index 1f1450efd..9a3a4e61a 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PagingTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PagingTest.java @@ -29,9 +29,9 @@ import org.junit.jupiter.api.Test; public class PagingTest extends MamTest { - private static final String pagingStanza = "" + "" + private static final String pagingStanza = "" + "" + "" + "" - + "urn:xmpp:mam:1" + "" + "" + "" + + "urn:xmpp:mam:2" + "" + "" + "" + "10" + "" + "" + ""; @Test @@ -46,7 +46,7 @@ public class PagingTest extends MamTest { mamQueryIQ.addExtension(rsmSet); assertEquals(mamQueryIQ.getDataForm(), dataForm); - assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0).toString(), "urn:xmpp:mam:1"); + assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0).toString(), "urn:xmpp:mam:2"); assertEquals(pagingStanza, mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/QueryArchiveTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/QueryArchiveTest.java index 8fe38eeec..1603fb99f 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/QueryArchiveTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/QueryArchiveTest.java @@ -40,12 +40,12 @@ import org.jxmpp.jid.impl.JidCreate; public class QueryArchiveTest extends MamTest { - private static final String mamSimpleQueryIQ = "" + "" + private static final String mamSimpleQueryIQ = "" + "" + "" + "" + "" + MamElements.NAMESPACE + "" + "" + "" + "" + ""; private static final String mamQueryResultExample = "" - + "" + + "" + "" + "" + "" + private static final String resultsLimitStanza = "" + "" + "" + "" + "" + MamElements.NAMESPACE + "" + "" + "" + "" + "10" + "" + "" + "";