1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-15 03:59:38 +02:00

Change IQ.Type to enum

This commit is contained in:
Júlio Cesar Bueno Cotta 2014-06-05 21:20:45 -03:00
parent 944ac37fc3
commit 9be0c480e3
90 changed files with 284 additions and 299 deletions

View file

@ -73,7 +73,7 @@ public class CloseListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
argument.getValue().getError().getCondition());

View file

@ -75,7 +75,7 @@ public class DataListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
argument.getValue().getError().getCondition());

View file

@ -42,7 +42,7 @@ public class IBBPacketUtils {
}
};
errorIQ.setType(IQ.Type.ERROR);
errorIQ.setType(IQ.Type.error);
errorIQ.setFrom(from);
errorIQ.setTo(to);
errorIQ.setError(xmppError);
@ -64,7 +64,7 @@ public class IBBPacketUtils {
}
};
result.setType(IQ.Type.RESULT);
result.setType(IQ.Type.result);
result.setFrom(from);
result.setTo(to);
return result;

View file

@ -83,7 +83,7 @@ public class InBandBytestreamRequestTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition());
@ -108,7 +108,7 @@ public class InBandBytestreamRequestTest {
// assert that reply is the correct acknowledgment packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.RESULT, argument.getValue().getType());
assertEquals(IQ.Type.result, argument.getValue().getType());
assertNotNull(session);
assertNotNull(session.getInputStream());

View file

@ -91,7 +91,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition());
@ -119,7 +119,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.resource_constraint.toString(),
argument.getValue().getError().getCondition());
@ -209,7 +209,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition());
}

View file

@ -48,7 +48,7 @@ public class CloseTest {
@Test
public void shouldBeOfIQTypeSET() {
Close close = new Close("sessionID");
assertEquals(IQ.Type.SET, close.getType());
assertEquals(IQ.Type.set, close.getType());
}
@Test

View file

@ -47,7 +47,7 @@ public class DataTest {
public void shouldBeOfIQTypeSET() {
DataPacketExtension dpe = mock(DataPacketExtension.class);
Data data = new Data(dpe);
assertEquals(IQ.Type.SET, data.getType());
assertEquals(IQ.Type.set, data.getType());
}
private static Properties outputProperties = new Properties();

View file

@ -65,7 +65,7 @@ public class OpenTest {
@Test
public void shouldBeOfIQTypeSET() {
Open open = new Open("sessionID", 4096);
assertEquals(IQ.Type.SET, open.getType());
assertEquals(IQ.Type.set, open.getType());
}
@Test

View file

@ -98,7 +98,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition());
@ -188,7 +188,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType());
assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition());
}

View file

@ -432,7 +432,7 @@ public class Socks5ByteStreamManagerTest {
}
};
rejectPacket.setType(Type.ERROR);
rejectPacket.setType(Type.error);
rejectPacket.setFrom(targetJID);
rejectPacket.setTo(initiatorJID);
rejectPacket.setError(xmppError);

View file

@ -111,7 +111,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType());
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition());
@ -155,7 +155,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType());
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition());
@ -203,7 +203,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType());
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition());
}
@ -245,7 +245,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType());
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
}
@ -295,7 +295,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType());
assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition());
}
@ -365,7 +365,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType());
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
serverSocket.close();
@ -418,7 +418,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType());
assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
}

View file

@ -204,7 +204,7 @@ public class Socks5ClientForInitiatorTest {
}
};
error.setType(Type.ERROR);
error.setType(Type.error);
error.setFrom(proxyJID);
error.setTo(initiatorJID);
error.setError(xmppError);
@ -259,7 +259,7 @@ public class Socks5ClientForInitiatorTest {
};
activationResponse.setFrom(proxyJID);
activationResponse.setTo(initiatorJID);
activationResponse.setType(IQ.Type.RESULT);
activationResponse.setType(IQ.Type.result);
protocol.addResponse(activationResponse, Verification.correspondingSenderReceiver,
Verification.requestTypeSET, new Verification<Bytestream, IQ>() {

View file

@ -43,7 +43,7 @@ public class Socks5PacketUtils {
bytestream.setFrom(from);
bytestream.setTo(to);
bytestream.setSessionID(sessionID);
bytestream.setType(IQ.Type.SET);
bytestream.setType(IQ.Type.set);
return bytestream;
}
@ -60,7 +60,7 @@ public class Socks5PacketUtils {
streamHostInfo.getPacketID();
streamHostInfo.setFrom(from);
streamHostInfo.setTo(to);
streamHostInfo.setType(IQ.Type.RESULT);
streamHostInfo.setType(IQ.Type.result);
return streamHostInfo;
}
@ -76,7 +76,7 @@ public class Socks5PacketUtils {
discoverItems.getPacketID();
discoverItems.setFrom(from);
discoverItems.setTo(to);
discoverItems.setType(IQ.Type.RESULT);
discoverItems.setType(IQ.Type.result);
return discoverItems;
}
@ -92,7 +92,7 @@ public class Socks5PacketUtils {
discoverInfo.getPacketID();
discoverInfo.setFrom(from);
discoverInfo.setTo(to);
discoverInfo.setType(IQ.Type.RESULT);
discoverInfo.setType(IQ.Type.result);
return discoverInfo;
}
@ -115,7 +115,7 @@ public class Socks5PacketUtils {
response.getPacketID();
response.setFrom(from);
response.setTo(to);
response.setType(IQ.Type.RESULT);
response.setType(IQ.Type.result);
return response;
}

View file

@ -107,7 +107,7 @@ public class EntityCapsManagerTest extends InitExtensions {
di.setFrom("benvolio@capulet.lit/230193");
di.setPacketID("disco1");
di.setTo("juliet@capulet.lit/chamber");
di.setType(IQ.Type.RESULT);
di.setType(IQ.Type.result);
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc");
@ -160,7 +160,7 @@ public class EntityCapsManagerTest extends InitExtensions {
di.setFrom("benvolio@capulet.lit/230193");
di.setPacketID("disco1");
di.setTo(")juliet@capulet.lit/chamber");
di.setType(IQ.Type.RESULT);
di.setType(IQ.Type.result);
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc");

View file

@ -50,6 +50,6 @@ public class LastActivityTest extends InitExtensions {
assertTrue(reply instanceof LastActivity);
LastActivity l = (LastActivity) reply;
assertEquals("last2", l.getPacketID());
assertEquals(IQ.Type.RESULT, l.getType());
assertEquals(IQ.Type.result, l.getType());
}
}

View file

@ -52,7 +52,7 @@ public class VersionTest {
//assertEquals("juliet@capulet.lit/balcony", reply.getFrom());
assertEquals("capulet.lit", reply.getTo());
assertEquals("s2c1", reply.getPacketID());
assertEquals(IQ.Type.RESULT, reply.getType());
assertEquals(IQ.Type.result, reply.getType());
assertEquals("Test", reply.getName());
assertEquals("0.23", reply.getVersion());
assertEquals("DummyOS", reply.getOs());

View file

@ -104,7 +104,7 @@
// public void processPacket(Packet packet) {
// latch.countDown();
// }
// }, new IQTypeFilter(IQ.Type.RESULT));
// }, new IQTypeFilter(IQ.Type.result));
//
// // Time based testing kind of sucks, but this should be reliable on a DummyConnection since there
// // is no actual server involved. This will provide enough time to ping and wait for the lack of response.

View file

@ -68,7 +68,7 @@ public class PingTest extends InitExtensions {
IQ pong = (IQ) pongPacket;
assertEquals("capulet.lit", pong.getTo());
assertEquals("s2c1", pong.getPacketID());
assertEquals(IQ.Type.RESULT, pong.getType());
assertEquals(IQ.Type.result, pong.getType());
}
@Test

View file

@ -51,7 +51,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeGET = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.GET, request.getType());
assertEquals(IQ.Type.get, request.getType());
}
};
@ -62,7 +62,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeSET = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.SET, request.getType());
assertEquals(IQ.Type.set, request.getType());
}
};
@ -73,7 +73,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeRESULT = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.RESULT, request.getType());
assertEquals(IQ.Type.result, request.getType());
}
};
@ -84,7 +84,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeERROR = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.ERROR, request.getType());
assertEquals(IQ.Type.error, request.getType());
}
};