mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-15 03:59:38 +02:00
Add IQ request handler API
This also moves the logic to send error IQ replies from "when there is no IQ provider registerd" to "when there is no IQ request handler registered". Which has for example the advantage that IQ parsing no longer asks for a connection instance.
This commit is contained in:
parent
fcb4844d10
commit
bb8dcc9874
28 changed files with 533 additions and 317 deletions
|
@ -61,7 +61,7 @@ public class CloseListenerTest {
|
|||
close.setFrom(initiatorJID);
|
||||
close.setTo(targetJID);
|
||||
|
||||
closeListener.processPacket(close);
|
||||
closeListener.handleIQRequest(close);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
|
|
@ -79,7 +79,7 @@ public class InitiationListenerTest {
|
|||
public void shouldRespondWithError() throws Exception {
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -107,7 +107,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.setMaximumBlockSize(1024);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -137,7 +137,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -165,7 +165,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener, initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -193,7 +193,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener, "other_" + initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -231,7 +231,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -265,7 +265,7 @@ public class InitiationListenerTest {
|
|||
+ initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -300,7 +300,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.ignoreBytestreamRequestOnce(sessionID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -314,7 +314,7 @@ public class InitiationListenerTest {
|
|||
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
|
||||
|
||||
// run the listener with the initiation packet again
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class InitiationListenerTest {
|
|||
public void shouldRespondWithError() throws Exception {
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -116,7 +116,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -144,7 +144,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener, initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -172,7 +172,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(listener, "other_" + initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -210,7 +210,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.addIncomingBytestreamListener(userRequestsListener, initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -244,7 +244,7 @@ public class InitiationListenerTest {
|
|||
+ initiatorJID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -279,7 +279,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager.ignoreBytestreamRequestOnce(sessionID);
|
||||
|
||||
// run the listener with the initiation packet
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
@ -293,7 +293,7 @@ public class InitiationListenerTest {
|
|||
verify(allRequestsListener, never()).incomingBytestreamRequest(byteStreamRequest.capture());
|
||||
|
||||
// run the listener with the initiation packet again
|
||||
initiationListener.processPacket(initBytestream);
|
||||
initiationListener.handleIQRequest(initBytestream);
|
||||
|
||||
// wait because packet is processed in an extra thread
|
||||
Thread.sleep(200);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class PubSubProviderTest {
|
|||
"</iq>";
|
||||
// @formatter:on
|
||||
XmlPullParser parser = TestUtils.getIQParser(resultStanza);
|
||||
PubSub pubsubResult = (PubSub) PacketParserUtils.parse(parser, null);
|
||||
PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);
|
||||
SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS);
|
||||
List<Subscription> subscriptions = subElem.getSubscriptions();
|
||||
assertEquals(2, subscriptions.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue