mood
diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/urldata/UrlDataElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/urldata/UrlDataElementTest.java
new file mode 100644
index 000000000..72bc4f32a
--- /dev/null
+++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/urldata/UrlDataElementTest.java
@@ -0,0 +1,219 @@
+/**
+ *
+ * Copyright 2020 Paul Schaub
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jivesoftware.smackx.urldata;
+
+import static org.jivesoftware.smack.test.util.XmlAssertUtil.assertXmlSimilar;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+
+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.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",
+ null,
+ Collections.singletonList(HttpAuthElement.basicAuth()),
+ null, null);
+
+ final String expectedXml = "" +
+ "" +
+ "" +
+ "";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void additionalAuthParamTest() throws XmlPullParserException, IOException, SmackParsingException {
+
+ UrlDataElement urlDataElement = new UrlDataElement("http://www.jabber.org/members/index.php",
+ null,
+ Collections.singletonList(HttpAuthElement.basicAuth(
+ "www.jabber.org",
+ "defaultuser",
+ "defaultpwd"
+ )),
+ null,
+ null);
+
+ final String expectedXml = "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " ";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void simpleUrlWithSidTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement("http://pass.jabber.org:8519/test.txt", "a0");
+
+ final String expectedXml = "";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void simpleUrlNoChildrenTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement("http://festhall.outer-planes.net/d20M/announce/latest/", null);
+
+ final String expectedXml = "";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void simpleCookieTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement("http://www.jabber.org/members/index.php",
+ null,
+ null,
+ Collections.singletonList(new CookieElement("jsessionid", "1243asd234190sa32ds")),
+ null);
+
+ final String expectedXml = "" +
+ "\n" +
+ " \n" +
+ "";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void additionalParametersCookieTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement("http://www.jabber.org/members/index.php",
+ null,
+ null,
+ Collections.singletonList(new CookieElement(
+ "jsessionid",
+ "1243asd234190sa32ds",
+ "jabber.org",
+ 1234000,
+ "/members",
+ "Web Session Identifier",
+ "1.0",
+ false
+ )),
+ null);
+
+ final String expectedXml = "\n" +
+ " \n" +
+ "";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void simpleHeaderTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement(
+ "http://www.jabber.org/members/index.php",
+ null,
+ null,
+ null,
+ Collections.singletonList(new HeaderElement("Custom-Data", "some custom data")));
+
+ final String expectedXml = "\n" +
+ " \n" +
+ " ";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+
+ @Test
+ public void multiChildTest() throws XmlPullParserException, IOException, SmackParsingException {
+ UrlDataElement urlDataElement = new UrlDataElement(
+ "https://blog.jabberhead.tk",
+ null,
+ Collections.singletonList(HttpAuthElement.basicAuth()),
+ Arrays.asList(
+ new CookieElement("jsessionid", "somecookievalue"),
+ new CookieElement("come2darkSide", "weHaveCookies")),
+ Arrays.asList(
+ new HeaderElement("Accept", "text/plain"),
+ new HeaderElement("Access-Control-Allow-Origin", "*")));
+
+ final String expectedXml =
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " ";
+ assertXmlSimilar(expectedXml, urlDataElement.toXML().toString());
+
+ UrlDataElement parsed = URL_DATA_ELEMENT_PROVIDER.parse(TestUtils.getParser(expectedXml));
+ assertEquals(urlDataElement, parsed);
+ }
+}
diff --git a/smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java b/smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
index 803afc7da..d9f01636e 100644
--- a/smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
+++ b/smack-java8-full/src/main/java/org/jivesoftware/smackx/package-info.java
@@ -206,6 +206,18 @@
* Transfer files between two users over XMPP. |
*
*
+ * URL Address Information |
+ * XEP-0103 |
+ * {@link org.jivesoftware.smackx.urldata.element} |
+ * Provide information about an Uniform Resource Locator (URL), and a protocol signaling retrieval states. |
+ *
+ *
+ * HTTP Scheme for URL Data |
+ * XEP-0104 |
+ * |
+ * A schema description for detailed information about HTTP URLs. |
+ *
+ *
* User Mood |
* XEP-0107 |
* |
@@ -358,6 +370,12 @@
* Allows sending a MUC invitation directly from the user to the contact with mediation by the room. |
*
*
+ * Jingle Content Thumbnails |
+ * XEP-0264 |
+ * {@link org.jivesoftware.smackx.thumbnails.element} |
+ * Defines a way for a client to supply a preview image for Jingle content. |
+ *
+ *
* Message Carbons |
* XEP-0280 |
* {@link org.jivesoftware.smackx.carbons} |
@@ -571,6 +589,12 @@
* Declare body elements of a message as ignorable fallback for naive legacy clients. |
*
*
+ * File metadata element |
+ * XEP-0446 |
+ * {@link org.jivesoftware.smackx.file_metadata.element} |
+ * Defines a generic file metadata element to be used in other specifications. |
+ *
+ *
* Google GCM JSON payload |
* |
* |