mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-15 03:59:38 +02:00
Rename 'Packet' class to 'Stanza'
Smack still uses the term 'Packet' in some places. This is just the first step towards using correct XMPP terms in Smack.
This commit is contained in:
parent
9fc26f1d83
commit
4698805a34
142 changed files with 595 additions and 572 deletions
|
@ -76,7 +76,7 @@ public class CloseTest {
|
|||
Close close = new Close("i781hf64");
|
||||
close.setFrom("romeo@montague.lit/orchard");
|
||||
close.setTo("juliet@capulet.lit/balcony");
|
||||
close.setPacketID("us71g45j");
|
||||
close.setStanzaId("us71g45j");
|
||||
|
||||
assertXMLEqual(control, close.toXML().toString());
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DataTest {
|
|||
Data data = new Data(dpe);
|
||||
data.setFrom("romeo@montague.lit/orchard");
|
||||
data.setTo("juliet@capulet.lit/balcony");
|
||||
data.setPacketID("kr91n475");
|
||||
data.setStanzaId("kr91n475");
|
||||
|
||||
assertXMLEqual(control, data.toXML().toString());
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class OpenTest {
|
|||
Open open = new Open("i781hf64", 4096, StanzaType.IQ);
|
||||
open.setFrom("romeo@montague.lit/orchard");
|
||||
open.setTo("juliet@capulet.lit/balcony");
|
||||
open.setPacketID("jn3h8g65");
|
||||
open.setStanzaId("jn3h8g65");
|
||||
|
||||
assertXMLEqual(control, open.toXML().toString());
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.util.ConnectionUtils;
|
||||
|
@ -109,7 +109,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
|
@ -153,7 +153,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
|
@ -201,7 +201,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
|
@ -243,7 +243,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertEquals(Bytestream.class, targetResponse.getClass());
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
|
||||
|
@ -293,7 +293,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertTrue(IQ.class.isInstance(targetResponse));
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
|
||||
|
@ -363,7 +363,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertEquals(Bytestream.class, targetResponse.getClass());
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
|
||||
|
@ -416,7 +416,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
|
||||
// verify targets response
|
||||
assertEquals(1, protocol.getRequests().size());
|
||||
Packet targetResponse = protocol.getRequests().remove(0);
|
||||
Stanza targetResponse = protocol.getRequests().remove(0);
|
||||
assertEquals(Bytestream.class, targetResponse.getClass());
|
||||
assertEquals(initiatorJID, targetResponse.getTo());
|
||||
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
|
||||
|
|
|
@ -100,7 +100,7 @@ public class EntityCapsManagerTest extends InitExtensions {
|
|||
private static DiscoverInfo createComplexSamplePacket() {
|
||||
DiscoverInfo di = new DiscoverInfo();
|
||||
di.setFrom("benvolio@capulet.lit/230193");
|
||||
di.setPacketID("disco1");
|
||||
di.setStanzaId("disco1");
|
||||
di.setTo("juliet@capulet.lit/chamber");
|
||||
di.setType(IQ.Type.result);
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class EntityCapsManagerTest extends InitExtensions {
|
|||
private static DiscoverInfo createMalformedDiscoverInfo() {
|
||||
DiscoverInfo di = new DiscoverInfo();
|
||||
di.setFrom("benvolio@capulet.lit/230193");
|
||||
di.setPacketID("disco1");
|
||||
di.setStanzaId("disco1");
|
||||
di.setTo(")juliet@capulet.lit/chamber");
|
||||
di.setType(IQ.Type.result);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
@ -54,7 +54,7 @@ public class FileTransferNegotiatorTest {
|
|||
} catch (NoResponseException e) {
|
||||
// Ignore
|
||||
}
|
||||
Packet packet = connection.getSentPacket();
|
||||
Stanza packet = connection.getSentPacket();
|
||||
String xml = packet.toXML().toString();
|
||||
assertTrue(xml.indexOf("var='stream-method' type='list-single'") != -1);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
||||
|
@ -47,10 +47,10 @@ public class LastActivityTest extends InitExtensions {
|
|||
assertTrue(lastRequest instanceof LastActivity);
|
||||
|
||||
c.processPacket(lastRequest);
|
||||
Packet reply = c.getSentPacket();
|
||||
Stanza reply = c.getSentPacket();
|
||||
assertTrue(reply instanceof LastActivity);
|
||||
LastActivity l = (LastActivity) reply;
|
||||
assertEquals("last2", l.getPacketID());
|
||||
assertEquals("last2", l.getStanzaId());
|
||||
assertEquals(IQ.Type.result, l.getType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.iqversion.packet.Version;
|
||||
import org.junit.Test;
|
||||
|
@ -46,14 +46,14 @@ public class VersionTest {
|
|||
|
||||
con.processPacket(versionRequest);
|
||||
|
||||
Packet replyPacket = con.getSentPacket();
|
||||
Stanza replyPacket = con.getSentPacket();
|
||||
assertTrue(replyPacket instanceof Version);
|
||||
|
||||
Version reply = (Version) replyPacket;
|
||||
//getFrom check is pending for SMACK-547
|
||||
//assertEquals("juliet@capulet.lit/balcony", reply.getFrom());
|
||||
assertEquals("capulet.lit", reply.getTo());
|
||||
assertEquals("s2c1", reply.getPacketID());
|
||||
assertEquals("s2c1", reply.getStanzaId());
|
||||
assertEquals(IQ.Type.result, reply.getType());
|
||||
assertEquals("Test", reply.getName());
|
||||
assertEquals("0.23", reply.getVersion());
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
|
|||
import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -62,12 +62,12 @@ public class PingTest extends InitExtensions {
|
|||
|
||||
con.processPacket(pingRequest);
|
||||
|
||||
Packet pongPacket = con.getSentPacket();
|
||||
Stanza pongPacket = con.getSentPacket();
|
||||
assertTrue(pongPacket instanceof IQ);
|
||||
|
||||
IQ pong = (IQ) pongPacket;
|
||||
assertEquals("capulet.lit", pong.getTo());
|
||||
assertEquals("s2c1", pong.getPacketID());
|
||||
assertEquals("s2c1", pong.getStanzaId());
|
||||
assertEquals(IQ.Type.result, pong.getType());
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class PingTest extends InitExtensions {
|
|||
// Ignore the fact the server won't answer for this unit test.
|
||||
}
|
||||
|
||||
Packet sentPacket = dummyCon.getSentPacket();
|
||||
Stanza sentPacket = dummyCon.getSentPacket();
|
||||
assertTrue(sentPacket instanceof Ping);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -103,7 +103,7 @@ public class ItemValidationTest extends InitExtensions {
|
|||
"</event>" +
|
||||
"</message>");
|
||||
|
||||
Packet message = PacketParserUtils.parseMessage(parser);
|
||||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
|
||||
assertTrue(eventExt instanceof EventElement);
|
||||
|
@ -134,7 +134,7 @@ public class ItemValidationTest extends InitExtensions {
|
|||
"</event>" +
|
||||
"</message>");
|
||||
|
||||
Packet message = PacketParserUtils.parseMessage(parser);
|
||||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = (EventElement) eventExt;
|
||||
PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
|
@ -181,7 +181,7 @@ public class ItemValidationTest extends InitExtensions {
|
|||
"</event>" +
|
||||
"</message>");
|
||||
|
||||
Packet message = PacketParserUtils.parseMessage(parser);
|
||||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = (EventElement) eventExt;
|
||||
PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
|
@ -214,7 +214,7 @@ public class ItemValidationTest extends InitExtensions {
|
|||
"</event>" +
|
||||
"</message>");
|
||||
|
||||
Packet message = PacketParserUtils.parseMessage(parser);
|
||||
Stanza message = PacketParserUtils.parseMessage(parser);
|
||||
PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns());
|
||||
|
||||
assertTrue(eventExt instanceof EventElement);
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Properties;
|
|||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.WaitForPacketListener;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -79,7 +79,7 @@ public class DeliveryReceiptTest extends InitExtensions {
|
|||
|
||||
Message m = new Message("romeo@montague.com", Message.Type.normal);
|
||||
m.setFrom("julia@capulet.com");
|
||||
m.setPacketID("reply-id");
|
||||
m.setStanzaId("reply-id");
|
||||
m.addExtension(new DeliveryReceipt("original-test-id"));
|
||||
c.processPacket(m);
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class DeliveryReceiptTest extends InitExtensions {
|
|||
|
||||
private static class TestReceiptReceivedListener extends WaitForPacketListener implements ReceiptReceivedListener {
|
||||
@Override
|
||||
public void onReceiptReceived(String fromJid, String toJid, String receiptId, Packet receipt) {
|
||||
public void onReceiptReceived(String fromJid, String toJid, String receiptId, Stanza receipt) {
|
||||
assertEquals("julia@capulet.com", fromJid);
|
||||
assertEquals("romeo@montague.com", toJid);
|
||||
assertEquals("original-test-id", receiptId);
|
||||
|
@ -108,13 +108,13 @@ public class DeliveryReceiptTest extends InitExtensions {
|
|||
// test auto-receipts
|
||||
Message m = new Message("julia@capulet.com", Message.Type.normal);
|
||||
m.setFrom("romeo@montague.com");
|
||||
m.setPacketID("test-receipt-request");
|
||||
m.setStanzaId("test-receipt-request");
|
||||
DeliveryReceiptRequest.addTo(m);
|
||||
|
||||
// the DRM will send a reply-packet
|
||||
c.processPacket(m);
|
||||
|
||||
Packet reply = c.getSentPacket();
|
||||
Stanza reply = c.getSentPacket();
|
||||
DeliveryReceipt r = DeliveryReceipt.from(reply);
|
||||
assertEquals("romeo@montague.com", reply.getTo());
|
||||
assertEquals("test-receipt-request", r.getId());
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
|
@ -80,7 +80,7 @@ public class ConnectionUtils {
|
|||
Answer<PacketCollector> collectorAndSend = new Answer<PacketCollector>() {
|
||||
@Override
|
||||
public PacketCollector answer(InvocationOnMock invocation) throws Throwable {
|
||||
Packet packet = (Packet) invocation.getArguments()[0];
|
||||
Stanza packet = (Stanza) invocation.getArguments()[0];
|
||||
protocol.getRequests().add(packet);
|
||||
return collector;
|
||||
}
|
||||
|
@ -91,24 +91,24 @@ public class ConnectionUtils {
|
|||
// mock send method
|
||||
Answer<Object> addIncoming = new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
protocol.getRequests().add((Packet) invocation.getArguments()[0]);
|
||||
protocol.getRequests().add((Stanza) invocation.getArguments()[0]);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
doAnswer(addIncoming).when(connection).sendPacket(isA(Packet.class));
|
||||
doAnswer(addIncoming).when(connection).sendPacket(isA(Stanza.class));
|
||||
|
||||
// mock receive methods
|
||||
Answer<Packet> answer = new Answer<Packet>() {
|
||||
public Packet answer(InvocationOnMock invocation) throws Throwable {
|
||||
Answer<Stanza> answer = new Answer<Stanza>() {
|
||||
public Stanza answer(InvocationOnMock invocation) throws Throwable {
|
||||
return protocol.getResponses().poll();
|
||||
}
|
||||
};
|
||||
when(collector.nextResult(anyInt())).thenAnswer(answer);
|
||||
when(collector.nextResult()).thenAnswer(answer);
|
||||
Answer<Packet> answerOrThrow = new Answer<Packet>() {
|
||||
Answer<Stanza> answerOrThrow = new Answer<Stanza>() {
|
||||
@Override
|
||||
public Packet answer(InvocationOnMock invocation) throws Throwable {
|
||||
Packet packet = protocol.getResponses().poll();
|
||||
public Stanza answer(InvocationOnMock invocation) throws Throwable {
|
||||
Stanza packet = protocol.getResponses().poll();
|
||||
if (packet == null) return packet;
|
||||
XMPPError xmppError = packet.getError();
|
||||
if (xmppError != null) throw new XMPPErrorException(xmppError);
|
||||
|
|
|
@ -32,7 +32,7 @@ import javax.xml.transform.TransformerFactory;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* This class can be used in conjunction with a mocked XMPP connection (
|
||||
|
@ -94,16 +94,16 @@ public class Protocol {
|
|||
public boolean printProtocol = false;
|
||||
|
||||
// responses to requests are taken form this queue
|
||||
Queue<Packet> responses = new LinkedList<Packet>();
|
||||
Queue<Stanza> responses = new LinkedList<Stanza>();
|
||||
|
||||
// list of verifications
|
||||
List<Verification<?, ?>[]> verificationList = new ArrayList<Verification<?, ?>[]>();
|
||||
|
||||
// list of requests
|
||||
List<Packet> requests = new ArrayList<Packet>();
|
||||
List<Stanza> requests = new ArrayList<Stanza>();
|
||||
|
||||
// list of all responses
|
||||
List<Packet> responsesList = new ArrayList<Packet>();
|
||||
List<Stanza> responsesList = new ArrayList<Stanza>();
|
||||
|
||||
/**
|
||||
* Adds a responses and all verifications for the request/response pair to
|
||||
|
@ -112,7 +112,7 @@ public class Protocol {
|
|||
* @param response the response for a request
|
||||
* @param verifications verifications for request/response pair
|
||||
*/
|
||||
public void addResponse(Packet response, Verification<?, ?>... verifications) {
|
||||
public void addResponse(Stanza response, Verification<?, ?>... verifications) {
|
||||
responses.offer(response);
|
||||
verificationList.add(verifications);
|
||||
responsesList.add(response);
|
||||
|
@ -130,8 +130,8 @@ public class Protocol {
|
|||
System.out.println("=================== Start ===============\n");
|
||||
|
||||
for (int i = 0; i < requests.size(); i++) {
|
||||
Packet request = requests.get(i);
|
||||
Packet response = responsesList.get(i);
|
||||
Stanza request = requests.get(i);
|
||||
Stanza response = responsesList.get(i);
|
||||
|
||||
if (printProtocol) {
|
||||
System.out.println("------------------- Request -------------\n");
|
||||
|
@ -145,9 +145,9 @@ public class Protocol {
|
|||
}
|
||||
}
|
||||
|
||||
Verification<Packet, Packet>[] verifications = (Verification<Packet, Packet>[]) verificationList.get(i);
|
||||
Verification<Stanza, Stanza>[] verifications = (Verification<Stanza, Stanza>[]) verificationList.get(i);
|
||||
if (verifications != null) {
|
||||
for (Verification<Packet, Packet> verification : verifications) {
|
||||
for (Verification<Stanza, Stanza> verification : verifications) {
|
||||
verification.verify(request, response);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class Protocol {
|
|||
*
|
||||
* @return the responses queue
|
||||
*/
|
||||
protected Queue<Packet> getResponses() {
|
||||
protected Queue<Stanza> getResponses() {
|
||||
return responses;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class Protocol {
|
|||
*
|
||||
* @return list of requests
|
||||
*/
|
||||
public List<Packet> getRequests() {
|
||||
public List<Stanza> getRequests() {
|
||||
return requests;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.util;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* Implement this interface to verify a request/response pair.
|
||||
|
@ -31,15 +31,15 @@ import org.jivesoftware.smack.packet.Packet;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public interface Verification<T extends Packet, S extends Packet> {
|
||||
public interface Verification<T extends Stanza, S extends Stanza> {
|
||||
|
||||
/**
|
||||
* Verifies that the "To" field of the request corresponds with the "From" field of
|
||||
* the response.
|
||||
*/
|
||||
public static Verification<Packet, Packet> correspondingSenderReceiver = new Verification<Packet, Packet>() {
|
||||
public static Verification<Stanza, Stanza> correspondingSenderReceiver = new Verification<Stanza, Stanza>() {
|
||||
|
||||
public void verify(Packet request, Packet response) {
|
||||
public void verify(Stanza request, Stanza response) {
|
||||
assertEquals(response.getFrom(), request.getTo());
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ public interface Verification<T extends Packet, S extends Packet> {
|
|||
/**
|
||||
* Verifies that the type of the request is a GET.
|
||||
*/
|
||||
public static Verification<IQ, Packet> requestTypeGET = new Verification<IQ, Packet>() {
|
||||
public static Verification<IQ, Stanza> requestTypeGET = new Verification<IQ, Stanza>() {
|
||||
|
||||
public void verify(IQ request, Packet response) {
|
||||
public void verify(IQ request, Stanza response) {
|
||||
assertEquals(IQ.Type.get, request.getType());
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,9 @@ public interface Verification<T extends Packet, S extends Packet> {
|
|||
/**
|
||||
* Verifies that the type of the request is a SET.
|
||||
*/
|
||||
public static Verification<IQ, Packet> requestTypeSET = new Verification<IQ, Packet>() {
|
||||
public static Verification<IQ, Stanza> requestTypeSET = new Verification<IQ, Stanza>() {
|
||||
|
||||
public void verify(IQ request, Packet response) {
|
||||
public void verify(IQ request, Stanza response) {
|
||||
assertEquals(IQ.Type.set, request.getType());
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ public interface Verification<T extends Packet, S extends Packet> {
|
|||
/**
|
||||
* Verifies that the type of the request is a RESULT.
|
||||
*/
|
||||
public static Verification<IQ, Packet> requestTypeRESULT = new Verification<IQ, Packet>() {
|
||||
public static Verification<IQ, Stanza> requestTypeRESULT = new Verification<IQ, Stanza>() {
|
||||
|
||||
public void verify(IQ request, Packet response) {
|
||||
public void verify(IQ request, Stanza response) {
|
||||
assertEquals(IQ.Type.result, request.getType());
|
||||
}
|
||||
|
||||
|
@ -81,9 +81,9 @@ public interface Verification<T extends Packet, S extends Packet> {
|
|||
/**
|
||||
* Verifies that the type of the request is an ERROR.
|
||||
*/
|
||||
public static Verification<IQ, Packet> requestTypeERROR = new Verification<IQ, Packet>() {
|
||||
public static Verification<IQ, Stanza> requestTypeERROR = new Verification<IQ, Stanza>() {
|
||||
|
||||
public void verify(IQ request, Packet response) {
|
||||
public void verify(IQ request, Stanza response) {
|
||||
assertEquals(IQ.Type.error, request.getType());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue