Search in sources :

Example 6 with JingleContent

use of org.jivesoftware.smackx.jingle.element.JingleContent in project Smack by igniterealtime.

the class JingleTransportMethodManager method getTransportManager.

public JingleTransportManager<?> getTransportManager(Jingle request) {
    JingleContent content = request.getContents().get(0);
    if (content == null) {
        return null;
    }
    JingleContentTransport transport = content.getTransport();
    if (transport == null) {
        return null;
    }
    return getTransportManager(transport.getNamespace());
}
Also used : JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent) JingleContentTransport(org.jivesoftware.smackx.jingle.element.JingleContentTransport)

Example 7 with JingleContent

use of org.jivesoftware.smackx.jingle.element.JingleContent in project Smack by igniterealtime.

the class JingleContentTest method parserTest.

@Test
public void parserTest() throws Exception {
    JingleContent.Builder builder = JingleContent.getBuilder();
    builder.setCreator(JingleContent.Creator.initiator);
    builder.setName("A name");
    JingleContent content = builder.build();
    assertNotNull(content);
    assertNull(content.getDescription());
    assertEquals(JingleContent.Creator.initiator, content.getCreator());
    assertEquals("A name", content.getName());
    builder.setSenders(JingleContent.Senders.both);
    content = builder.build();
    assertEquals(JingleContent.Senders.both, content.getSenders());
    builder.setDisposition("session");
    JingleContent content1 = builder.build();
    assertEquals("session", content1.getDisposition());
    assertNotSame(content.toXML().toString(), content1.toXML().toString());
    assertEquals(content1.toXML().toString(), builder.build().toXML().toString());
    String xml = "<content xmlns='urn:xmpp:jingle:1' creator='initiator' disposition='session' name='A name' senders='both'/>";
    assertEquals(xml, content1.toXML().toString());
}
Also used : JingleContent(org.jivesoftware.smackx.jingle.element.JingleContent) Test(org.junit.jupiter.api.Test)

Aggregations

JingleContent (org.jivesoftware.smackx.jingle.element.JingleContent)7 Jingle (org.jivesoftware.smackx.jingle.element.Jingle)3 JingleContentTransport (org.jivesoftware.smackx.jingle.element.JingleContentTransport)3 IOException (java.io.IOException)1 TimeoutException (java.util.concurrent.TimeoutException)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 StandardExtensionElement (org.jivesoftware.smack.packet.StandardExtensionElement)1 Socks5BytestreamSession (org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession)1 Bytestream (org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream)1 JingleAction (org.jivesoftware.smackx.jingle.element.JingleAction)1 JingleContentDescription (org.jivesoftware.smackx.jingle.element.JingleContentDescription)1 JingleReason (org.jivesoftware.smackx.jingle.element.JingleReason)1 UnknownJingleContentDescription (org.jivesoftware.smackx.jingle.element.UnknownJingleContentDescription)1 UnknownJingleContentTransport (org.jivesoftware.smackx.jingle.element.UnknownJingleContentTransport)1 Test (org.junit.jupiter.api.Test)1 FullJid (org.jxmpp.jid.FullJid)1