Search in sources :

Example 1 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class HttpOverXmppReqProviderTest method getReqOptionAttributesCorrectlyParsed.

@Test
public void getReqOptionAttributesCorrectlyParsed() throws Exception {
    String string = "<req xmlns='urn:xmpp:http' method='OPTIONS' resource='*' version='1.1' maxChunkSize='256' sipub='false' ibb='true' jingle='false'/>";
    HttpOverXmppReq req = parseReq(string);
    assertEquals(req.getMaxChunkSize(), 256);
    assertEquals(req.isSipub(), false);
    assertEquals(req.isIbb(), true);
    assertEquals(req.isJingle(), false);
}
Also used : HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq) Test(org.junit.Test)

Example 2 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class HttpOverXmppReqProviderTest method getReqOptionalAttributesDefaultValues.

@Test
public void getReqOptionalAttributesDefaultValues() throws Exception {
    String string = "<req xmlns='urn:xmpp:http' method='OPTIONS' resource='*' version='1.1'/>";
    HttpOverXmppReq req = parseReq(string);
    assertEquals(req.isSipub(), true);
    assertEquals(req.isIbb(), true);
    assertEquals(req.isJingle(), true);
}
Also used : HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq) Test(org.junit.Test)

Example 3 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class HttpOverXmppReqProviderTest method parseReq.

private static HttpOverXmppReq parseReq(String string) throws Exception {
    HttpOverXmppReqProvider provider = new HttpOverXmppReqProvider();
    XmlPullParser parser = PacketParserUtils.getParserFor(string);
    IQ iq = provider.parse(parser);
    assertTrue(iq instanceof HttpOverXmppReq);
    HttpOverXmppReq castedIq = (HttpOverXmppReq) iq;
    return castedIq;
}
Also used : XmlPullParser(org.xmlpull.v1.XmlPullParser) IQ(org.jivesoftware.smack.packet.IQ) HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq)

Example 4 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class HttpOverXmppReqProviderTest method areAllReqAttributesCorrectlyParsed.

@Test
public void areAllReqAttributesCorrectlyParsed() throws Exception {
    String string = "<req xmlns='urn:xmpp:http' method='OPTIONS' resource='*' version='1.1'/>";
    HttpOverXmppReq req = parseReq(string);
    assertEquals(req.getVersion(), "1.1");
    assertEquals(req.getMethod(), HttpMethod.OPTIONS);
    assertEquals(req.getResource(), "*");
}
Also used : HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq) Test(org.junit.Test)

Example 5 with HttpOverXmppReq

use of org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq in project Smack by igniterealtime.

the class HttpOverXmppReqProviderTest method areGetRequestAttributesCorrectlyParsed.

@Test
public void areGetRequestAttributesCorrectlyParsed() throws Exception {
    String string = "<req xmlns='urn:xmpp:http' method='GET' resource='/rdf/xep' version='1.1'/>";
    HttpOverXmppReq req = parseReq(string);
    assertEquals(req.getVersion(), "1.1");
    assertEquals(req.getMethod(), HttpMethod.GET);
    assertEquals(req.getResource(), "/rdf/xep");
}
Also used : HttpOverXmppReq(org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq) Test(org.junit.Test)

Aggregations

HttpOverXmppReq (org.jivesoftware.smackx.hoxt.packet.HttpOverXmppReq)6 Test (org.junit.Test)5 IQ (org.jivesoftware.smack.packet.IQ)2 XmlPullParser (org.xmlpull.v1.XmlPullParser)2 HashMap (java.util.HashMap)1