[urldata] Follow-up on initial merge of XEP-0103/0104 support

This is a follow-up on 198c51356d ("Add initial support for XEP-0103
and XEP-0104: URL Address Information"), which
1. adds the entries to the support XEPs table
2. registers the provider
3. renames the package from url_address_information to urldata (aka.
   the shortname of XEP-0130).
This commit is contained in:
Florian Schmaus 2023-12-16 13:50:30 +01:00
parent 8425671b31
commit 1ad394f256
17 changed files with 69 additions and 41 deletions

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.element;
package org.jivesoftware.smackx.urldata.element;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.XmlEnvironment;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.element;
package org.jivesoftware.smackx.urldata.element;
import org.jivesoftware.smack.packet.NamedElement;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.element;
package org.jivesoftware.smackx.urldata.element;
import java.util.ArrayList;
import java.util.List;
@ -25,10 +25,14 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.url_address_information.http.element.CookieElement;
import org.jivesoftware.smackx.url_address_information.http.element.HeaderElement;
import org.jivesoftware.smackx.url_address_information.http.element.HttpAuthElement;
import org.jivesoftware.smackx.urldata.http.element.CookieElement;
import org.jivesoftware.smackx.urldata.http.element.HeaderElement;
import org.jivesoftware.smackx.urldata.http.element.HttpAuthElement;
/**
* The url-data element.
*/
public class UrlDataElement implements ExtensionElement {
public static final String ELEMENT = "url-data";

View File

@ -20,4 +20,4 @@
*
* @see <a href="https://xmpp.org/extensions/xep-0103.html"> XEP-0103 - URL Address Information</a>.
*/
package org.jivesoftware.smackx.url_address_information.element;
package org.jivesoftware.smackx.urldata.element;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.EqualsUtil;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.EqualsUtil;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.EqualsUtil;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;
import java.util.ArrayList;
import java.util.List;
@ -23,7 +23,8 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.url_address_information.element.MetaInformationElement;
import org.jivesoftware.smackx.urldata.element.MetaInformationElement;
public final class HttpAuthElement implements MetaInformationElement {

View File

@ -14,10 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.url_address_information.element.MetaInformationElement;
import org.jivesoftware.smackx.urldata.element.MetaInformationElement;
public abstract class NameValuePairElement implements MetaInformationElement {

View File

@ -18,4 +18,4 @@
/**
* Element classes for XEP-0104.
*/
package org.jivesoftware.smackx.url_address_information.http.element;
package org.jivesoftware.smackx.urldata.http.element;

View File

@ -20,4 +20,4 @@
*
* @see <a href="https://xmpp.org/extensions/xep-0104.html"> XEP-0104 - HTTP Scheme for URL Address Information</a>
*/
package org.jivesoftware.smackx.url_address_information.http;
package org.jivesoftware.smackx.urldata.http;

View File

@ -18,4 +18,4 @@
/**
* Smack's API for <a href="https://xmpp.org/extensions/xep-0103.html"> XEP-0103 - URL Address Information</a>.
*/
package org.jivesoftware.smackx.url_address_information;
package org.jivesoftware.smackx.urldata;

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information.provider;
package org.jivesoftware.smackx.urldata.provider;
import static org.jivesoftware.smackx.url_address_information.element.UrlDataElement.ATTR_SID;
import static org.jivesoftware.smackx.url_address_information.element.UrlDataElement.ATTR_TARGET;
import static org.jivesoftware.smackx.urldata.element.UrlDataElement.ATTR_SID;
import static org.jivesoftware.smackx.urldata.element.UrlDataElement.ATTR_TARGET;
import java.io.IOException;
import java.util.ArrayList;
@ -29,15 +29,15 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.url_address_information.element.UrlDataElement;
import org.jivesoftware.smackx.url_address_information.http.element.AuthParamElement;
import org.jivesoftware.smackx.url_address_information.http.element.CookieElement;
import org.jivesoftware.smackx.url_address_information.http.element.HeaderElement;
import org.jivesoftware.smackx.url_address_information.http.element.HttpAuthElement;
import org.jivesoftware.smackx.urldata.element.UrlDataElement;
import org.jivesoftware.smackx.urldata.http.element.AuthParamElement;
import org.jivesoftware.smackx.urldata.http.element.CookieElement;
import org.jivesoftware.smackx.urldata.http.element.HeaderElement;
import org.jivesoftware.smackx.urldata.http.element.HttpAuthElement;
public class UrlDataElementProvider extends ExtensionElementProvider<UrlDataElement> {
public static UrlDataElementProvider INSTANCE = new UrlDataElementProvider();
@Override
public UrlDataElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
String target = parser.getAttributeValue(ATTR_TARGET);

View File

@ -20,4 +20,4 @@
*
* @see <a href="https://xmpp.org/extensions/xep-0103.html"> XEP-0103 - URL Address Information</a>.
*/
package org.jivesoftware.smackx.url_address_information.provider;
package org.jivesoftware.smackx.urldata.provider;

View File

@ -365,6 +365,13 @@
<className>org.jivesoftware.smackx.si.provider.StreamInitiationProvider</className>
</iqProvider>
<!-- XEP-0103: URL Address Information -->
<extensionProvider>
<elementName>url-data</elementName>
<namespace>http://jabber.org/protocol/url-data</namespace>
<className>org.jivesoftware.smackx.urldata.provider.UrlDataElementProvider</className>
</extensionProvider>
<!-- XEP-0107: User Mood -->
<extensionProvider>
<elementName>mood</elementName>

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.url_address_information;
package org.jivesoftware.smackx.urldata;
import static org.jivesoftware.smack.test.util.XmlAssertUtil.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -27,16 +27,19 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.url_address_information.element.UrlDataElement;
import org.jivesoftware.smackx.url_address_information.http.element.CookieElement;
import org.jivesoftware.smackx.url_address_information.http.element.HeaderElement;
import org.jivesoftware.smackx.url_address_information.http.element.HttpAuthElement;
import org.jivesoftware.smackx.url_address_information.provider.UrlDataElementProvider;
import org.jivesoftware.smackx.urldata.element.UrlDataElement;
import org.jivesoftware.smackx.urldata.http.element.CookieElement;
import org.jivesoftware.smackx.urldata.http.element.HeaderElement;
import org.jivesoftware.smackx.urldata.http.element.HttpAuthElement;
import org.jivesoftware.smackx.urldata.provider.UrlDataElementProvider;
import org.junit.jupiter.api.Test;
public class UrlDataElementTest extends SmackTestSuite {
public static final UrlDataElementProvider URL_DATA_ELEMENT_PROVIDER = new UrlDataElementProvider();
@Test
public void simpleSerializationTest() throws XmlPullParserException, IOException, SmackParsingException {
UrlDataElement urlDataElement = new UrlDataElement("http://www.jabber.org/members/index.php",
@ -52,7 +55,7 @@ public class UrlDataElementTest extends SmackTestSuite {
"</url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -80,7 +83,7 @@ public class UrlDataElementTest extends SmackTestSuite {
" </url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -93,7 +96,7 @@ public class UrlDataElementTest extends SmackTestSuite {
" target='http://pass.jabber.org:8519/test.txt'/>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -106,7 +109,7 @@ public class UrlDataElementTest extends SmackTestSuite {
" target='http://festhall.outer-planes.net/d20M/announce/latest/'/>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -126,7 +129,7 @@ public class UrlDataElementTest extends SmackTestSuite {
"</url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -161,7 +164,7 @@ public class UrlDataElementTest extends SmackTestSuite {
"</url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -181,7 +184,7 @@ public class UrlDataElementTest extends SmackTestSuite {
" </url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
@ -210,7 +213,7 @@ public class UrlDataElementTest extends SmackTestSuite {
" </url-data>";
assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
UrlDataElement parsed = UrlDataElementProvider.INSTANCE.parse(TestUtils.getParser(expectedXml));
UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
assertEquals(urlDataElement, parsed);
}
}

View File

@ -206,6 +206,18 @@
* <td>Transfer files between two users over XMPP.</td>
* </tr>
* <tr>
* <td>URL Address Information</td>
* <td><a href="https://xmpp.org/extensions/xep-0103.html">XEP-0103</a></td>
* <td>{@link org.jivesoftware.smackx.urldata.element}</td>
* <td>Provide information about an Uniform Resource Locator (URL), and a protocol signaling retrieval states.</td>
* </tr>
* <tr>
* <td>HTTP Scheme for URL Data</td>
* <td><a href="https://xmpp.orf/extensions/xep-0104.html">XEP-0104</a></td>
* <td></td>
* <td>A schema description for detailed information about HTTP URLs.</td>
* </tr>
* <tr>
* <td>User Mood</td>
* <td><a href="https://xmpp.org/extensions/xep-0107.html">XEP-0107</a></td>
* <td></td>