use of org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider.JingleIBBTransportProvider in project Smack by igniterealtime.
the class JingleIBBTransportTest method parserTest.
@Test
public void parserTest() throws Exception {
String sid = StringUtils.randomString(24);
short size = 8192;
String xml = "<transport xmlns='urn:xmpp:jingle:transports:ibb:1' block-size='8192' sid='" + sid + "'/>";
JingleIBBTransport transport = new JingleIBBTransport(size, sid);
assertEquals(xml, transport.toXML().toString());
assertEquals(size, transport.getBlockSize());
assertEquals(sid, transport.getSessionId());
JingleIBBTransport parsed = new JingleIBBTransportProvider().parse(TestUtils.getParser(xml));
assertEquals(transport, parsed);
assertTrue(transport.equals(parsed));
assertEquals(xml, parsed.toXML().toString());
JingleIBBTransport transport1 = new JingleIBBTransport((short) 1024);
assertEquals((short) 1024, transport1.getBlockSize());
assertNotSame(transport, transport1);
assertNotSame(transport.getSessionId(), transport1.getSessionId());
assertFalse(transport.equals(null));
JingleIBBTransport transport2 = new JingleIBBTransport();
assertEquals(JingleIBBTransport.DEFAULT_BLOCK_SIZE, transport2.getBlockSize());
assertFalse(transport1.equals(transport2));
JingleIBBTransport transport3 = new JingleIBBTransport((short) -1024);
assertEquals(JingleIBBTransport.DEFAULT_BLOCK_SIZE, transport3.getBlockSize());
assertEquals(transport3.getNamespace(), JingleIBBTransport.NAMESPACE_V1);
assertEquals(transport3.getElementName(), "transport");
JingleIBBTransport transport4 = new JingleIBBTransport("session-id");
assertEquals(JingleIBBTransport.DEFAULT_BLOCK_SIZE, transport4.getBlockSize());
}
use of org.jivesoftware.smackx.jingle.transports.jingle_ibb.provider.JingleIBBTransportProvider in project Smack by igniterealtime.
the class JingleContentProviderManagerTest method transportProviderTest.
@Test
public void transportProviderTest() {
assertNull(JingleContentProviderManager.getJingleContentTransportProvider(JingleIBBTransport.NAMESPACE_V1));
assertNull(JingleContentProviderManager.getJingleContentTransportProvider(JingleS5BTransport.NAMESPACE_V1));
JingleIBBTransportProvider ibbProvider = new JingleIBBTransportProvider();
JingleContentProviderManager.addJingleContentTransportProvider(JingleIBBTransport.NAMESPACE_V1, ibbProvider);
assertEquals(ibbProvider, JingleContentProviderManager.getJingleContentTransportProvider(JingleIBBTransport.NAMESPACE_V1));
assertNull(JingleContentProviderManager.getJingleContentTransportProvider(JingleS5BTransport.NAMESPACE_V1));
JingleS5BTransportProvider s5bProvider = new JingleS5BTransportProvider();
JingleContentProviderManager.addJingleContentTransportProvider(JingleS5BTransport.NAMESPACE_V1, s5bProvider);
assertEquals(s5bProvider, JingleContentProviderManager.getJingleContentTransportProvider(JingleS5BTransport.NAMESPACE_V1));
}
Aggregations