use of org.jivesoftware.smackx.shim.packet.Header in project Smack by igniterealtime.
the class HeadersProviderTest method headersInMessageTest.
@Test
public void headersInMessageTest() throws Exception {
// @formatter:off
final String messageStanza = "<message from='romeo@shakespeare.lit/orchard' to='juliet@capulet.com' type='chat'>" + "<body>Wherefore are thou?!?</body>" + "<headers xmlns='http://jabber.org/protocol/shim'>" + "<header name='Urgency'>high</header>" + "</headers>" + "</message>";
// @formatter:on
XmlPullParser parser = TestUtils.getMessageParser(messageStanza);
Message message = PacketParserUtils.parseMessage(parser);
HeadersExtension headers = HeadersExtension.from(message);
Header header = headers.getHeaders().get(0);
assertEquals("Urgency", header.getName());
assertEquals("high", header.getValue());
}
use of org.jivesoftware.smackx.shim.packet.Header in project Smack by igniterealtime.
the class AbstractHttpOverXmppProviderTest method checkHeaders.
private static void checkHeaders(HeadersExtension headers, Map<String, String> expectedHeaders) {
Collection<Header> collection = headers.getHeaders();
assertEquals(collection.size(), expectedHeaders.size());
for (Header header : collection) {
assertTrue(expectedHeaders.containsKey(header.getName()));
assertEquals(expectedHeaders.get(header.getName()), header.getValue());
}
}
use of org.jivesoftware.smackx.shim.packet.Header in project Smack by igniterealtime.
the class Node method getSubscriptionIds.
private static List<String> getSubscriptionIds(Stanza packet) {
HeadersExtension headers = (HeadersExtension) packet.getExtension("headers", "http://jabber.org/protocol/shim");
List<String> values = null;
if (headers != null) {
values = new ArrayList<String>(headers.getHeaders().size());
for (Header header : headers.getHeaders()) {
values.add(header.getValue());
}
}
return values;
}
Aggregations