mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-09 20:41:07 +01:00
Fix XEP-0363 HTTP File Upload elements
Smack still expected the URLs as element text and not as value of an 'url' attribute. Fixes SMACK-790.
This commit is contained in:
parent
36a278eeca
commit
0a0066c806
7 changed files with 88 additions and 21 deletions
|
|
@ -16,23 +16,26 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.httpfileupload;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.jivesoftware.smackx.httpfileupload.element.Slot;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class SlotCreateTest {
|
||||
String testSlot
|
||||
= "<slot xmlns='urn:xmpp:http:upload:0'>"
|
||||
+ "<put>https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png</put>"
|
||||
+ "<get>https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png</get>"
|
||||
+ "<put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></put>"
|
||||
+ "<get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></get>"
|
||||
+ "</slot>";
|
||||
|
||||
@Test
|
||||
public void checkSlotRequestCreation() throws MalformedURLException {
|
||||
public void checkSlotRequestCreation() throws SAXException, IOException {
|
||||
Slot slot = new Slot(new URL("https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png"),
|
||||
new URL("https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png"));
|
||||
|
||||
|
|
@ -41,6 +44,6 @@ public class SlotCreateTest {
|
|||
Assert.assertEquals(new URL("https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png"),
|
||||
slot.getGetUrl());
|
||||
|
||||
Assert.assertEquals(testSlot, slot.getChildElementXML().toString());
|
||||
assertXMLEqual(testSlot, slot.getChildElementXML().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.jivesoftware.smackx.httpfileupload.element.Slot;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class SlotProviderTest {
|
||||
|
||||
/**
|
||||
|
|
@ -39,8 +38,8 @@ public class SlotProviderTest {
|
|||
+ "to='romeo@montague.tld/garden' "
|
||||
+ "type='result'>"
|
||||
+ "<slot xmlns='urn:xmpp:http:upload:0'>"
|
||||
+ "<put>https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png</put>"
|
||||
+ "<get>https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png</get>"
|
||||
+ "<put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></put>"
|
||||
+ "<get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></get>"
|
||||
+ "</slot>"
|
||||
+ "</iq>";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue