mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Change IQ.Type to enum
This commit is contained in:
parent
944ac37fc3
commit
9be0c480e3
90 changed files with 284 additions and 299 deletions
|
@ -62,7 +62,7 @@ public class IQTest extends SmackTestCase {
|
|||
if (result == null) {
|
||||
fail("No response from server");
|
||||
}
|
||||
else if (result.getType() != IQ.Type.ERROR) {
|
||||
else if (result.getType() != IQ.Type.error) {
|
||||
fail("The server didn't reply with an error packet");
|
||||
}
|
||||
else {
|
||||
|
@ -77,7 +77,7 @@ public class IQTest extends SmackTestCase {
|
|||
public void testFullJIDToOfflineUser() {
|
||||
// Request the version from the server.
|
||||
Version versionRequest = new Version();
|
||||
versionRequest.setType(IQ.Type.GET);
|
||||
versionRequest.setType(IQ.Type.get);
|
||||
versionRequest.setFrom(getFullJID(0));
|
||||
versionRequest.setTo(getBareJID(0) + "/Something");
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class IQTest extends SmackTestCase {
|
|||
// Stop queuing results
|
||||
collector.cancel();
|
||||
assertNotNull("No response from server", result);
|
||||
assertEquals("The server didn't reply with an error packet", IQ.Type.ERROR, result.getType());
|
||||
assertEquals("The server didn't reply with an error packet", IQ.Type.error, result.getType());
|
||||
assertEquals("Server answered an incorrect error code", 503, result.getError().getCode());
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
}
|
||||
};
|
||||
iqPacket.setTo(getFullJID(1));
|
||||
iqPacket.setType(IQ.Type.GET);
|
||||
iqPacket.setType(IQ.Type.get);
|
||||
|
||||
// Send the IQ and wait for the answer
|
||||
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||
|
@ -89,7 +89,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
if (response == null) {
|
||||
fail("No response from the other user.");
|
||||
}
|
||||
assertEquals("The received IQ is not of type ERROR", IQ.Type.ERROR, response.getType());
|
||||
assertEquals("The received IQ is not of type ERROR", IQ.Type.error, response.getType());
|
||||
assertEquals("The error code is not 501", 501, response.getError().getCode());
|
||||
collector.cancel();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class AccountManager extends Manager {
|
|||
// to discover if this feature is supported
|
||||
if (info == null) {
|
||||
getRegistrationInfo();
|
||||
accountCreationSupported = info.getType() != IQ.Type.ERROR;
|
||||
accountCreationSupported = info.getType() != IQ.Type.error;
|
||||
}
|
||||
return accountCreationSupported;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class AccountManager extends Manager {
|
|||
public void createAccount(String username, String password, Map<String, String> attributes)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setType(IQ.Type.SET);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
attributes.put("username", username);
|
||||
attributes.put("password", password);
|
||||
|
@ -240,7 +240,7 @@ public class AccountManager extends Manager {
|
|||
*/
|
||||
public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setType(IQ.Type.SET);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("username",XmppStringUtils.parseLocalpart(connection().getUser()));
|
||||
|
@ -261,7 +261,7 @@ public class AccountManager extends Manager {
|
|||
*/
|
||||
public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setType(IQ.Type.SET);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
Map<String, String> attributes = new HashMap<String, String>();
|
||||
// To delete an account, we add a single attribute, "remove", that is blank.
|
||||
|
|
|
@ -303,7 +303,7 @@ public class Roster {
|
|||
|
||||
// Create and send roster entry creation packet.
|
||||
RosterPacket rosterPacket = new RosterPacket();
|
||||
rosterPacket.setType(IQ.Type.SET);
|
||||
rosterPacket.setType(IQ.Type.set);
|
||||
RosterPacket.Item item = new RosterPacket.Item(user, name);
|
||||
if (groups != null) {
|
||||
for (String group : groups) {
|
||||
|
@ -348,7 +348,7 @@ public class Roster {
|
|||
return;
|
||||
}
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(IQ.Type.SET);
|
||||
packet.setType(IQ.Type.set);
|
||||
RosterPacket.Item item = RosterEntry.toRosterItem(entry);
|
||||
// Set the item type as REMOVE so that the server will delete the entry
|
||||
item.setItemType(RosterPacket.ItemType.remove);
|
||||
|
@ -951,7 +951,7 @@ public class Roster {
|
|||
connection.removePacketListener(this);
|
||||
|
||||
IQ result = (IQ)packet;
|
||||
if (!result.getType().equals(IQ.Type.RESULT)) {
|
||||
if (!result.getType().equals(IQ.Type.result)) {
|
||||
LOGGER.severe("Roster result IQ not of type result. Packet: " + result.toXML());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class RosterEntry {
|
|||
}
|
||||
this.name = name;
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(IQ.Type.SET);
|
||||
packet.setType(IQ.Type.set);
|
||||
packet.addRosterItem(toRosterItem(this));
|
||||
connection.sendPacket(packet);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class RosterGroup {
|
|||
synchronized (entries) {
|
||||
for (RosterEntry entry : entries) {
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(IQ.Type.SET);
|
||||
packet.setType(IQ.Type.set);
|
||||
RosterPacket.Item item = RosterEntry.toRosterItem(entry);
|
||||
item.removeGroupName(this.name);
|
||||
item.addGroupName(name);
|
||||
|
@ -173,7 +173,7 @@ public class RosterGroup {
|
|||
synchronized (entries) {
|
||||
if (!entries.contains(entry)) {
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(IQ.Type.SET);
|
||||
packet.setType(IQ.Type.set);
|
||||
RosterPacket.Item item = RosterEntry.toRosterItem(entry);
|
||||
item.addGroupName(getName());
|
||||
packet.addRosterItem(item);
|
||||
|
@ -207,7 +207,7 @@ public class RosterGroup {
|
|||
synchronized (entries) {
|
||||
if (entries.contains(entry)) {
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(IQ.Type.SET);
|
||||
packet.setType(IQ.Type.set);
|
||||
RosterPacket.Item item = RosterEntry.toRosterItem(entry);
|
||||
item.removeGroupName(this.getName());
|
||||
packet.addRosterItem(item);
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
|||
*/
|
||||
public class IQTypeFilter extends FlexiblePacketTypeFilter<IQ> {
|
||||
|
||||
public static final PacketFilter GET = new IQTypeFilter(Type.GET);
|
||||
public static final PacketFilter SET = new IQTypeFilter(Type.SET);
|
||||
public static final PacketFilter RESULT = new IQTypeFilter(Type.RESULT);
|
||||
public static final PacketFilter ERROR = new IQTypeFilter(Type.ERROR);
|
||||
public static final PacketFilter GET = new IQTypeFilter(Type.get);
|
||||
public static final PacketFilter SET = new IQTypeFilter(Type.set);
|
||||
public static final PacketFilter RESULT = new IQTypeFilter(Type.result);
|
||||
public static final PacketFilter ERROR = new IQTypeFilter(Type.error);
|
||||
|
||||
private final IQ.Type type;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class Bind extends IQ {
|
|||
private String jid = null;
|
||||
|
||||
public Bind() {
|
||||
setType(IQ.Type.SET);
|
||||
setType(IQ.Type.set);
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
package org.jivesoftware.smack.packet;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
|
@ -39,8 +41,9 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
* @author Matt Tucker
|
||||
*/
|
||||
public abstract class IQ extends Packet {
|
||||
private static final Logger LOGGER = Logger.getLogger(IQ.class.getName());
|
||||
|
||||
private Type type = Type.GET;
|
||||
private Type type = Type.get;
|
||||
|
||||
public IQ() {
|
||||
super();
|
||||
|
@ -66,7 +69,7 @@ public abstract class IQ extends Packet {
|
|||
*/
|
||||
public void setType(Type type) {
|
||||
if (type == null) {
|
||||
this.type = Type.GET;
|
||||
this.type = Type.get;
|
||||
}
|
||||
else {
|
||||
this.type = type;
|
||||
|
@ -107,23 +110,23 @@ public abstract class IQ extends Packet {
|
|||
public abstract CharSequence getChildElementXML();
|
||||
|
||||
/**
|
||||
* Convenience method to create a new empty {@link Type#RESULT IQ.Type.RESULT}
|
||||
* IQ based on a {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}
|
||||
* Convenience method to create a new empty {@link Type#result IQ.Type.result}
|
||||
* IQ based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
|
||||
* IQ. The new packet will be initialized with:<ul>
|
||||
* <li>The sender set to the recipient of the originating IQ.
|
||||
* <li>The recipient set to the sender of the originating IQ.
|
||||
* <li>The type set to {@link Type#RESULT IQ.Type.RESULT}.
|
||||
* <li>The type set to {@link Type#result IQ.Type.result}.
|
||||
* <li>The id set to the id of the originating IQ.
|
||||
* <li>No child element of the IQ element.
|
||||
* </ul>
|
||||
*
|
||||
* @param request the {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} IQ packet.
|
||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||
* @throws IllegalArgumentException if the IQ packet does not have a type of
|
||||
* {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}.
|
||||
* @return a new {@link Type#RESULT IQ.Type.RESULT} IQ based on the originating IQ.
|
||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||
* @return a new {@link Type#result IQ.Type.result} IQ based on the originating IQ.
|
||||
*/
|
||||
public static IQ createResultIQ(final IQ request) {
|
||||
if (!(request.getType() == Type.GET || request.getType() == Type.SET)) {
|
||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||
throw new IllegalArgumentException(
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||
}
|
||||
|
@ -132,7 +135,7 @@ public abstract class IQ extends Packet {
|
|||
return null;
|
||||
}
|
||||
};
|
||||
result.setType(Type.RESULT);
|
||||
result.setType(Type.result);
|
||||
result.setPacketID(request.getPacketID());
|
||||
result.setFrom(request.getTo());
|
||||
result.setTo(request.getFrom());
|
||||
|
@ -140,25 +143,25 @@ public abstract class IQ extends Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convenience method to create a new {@link Type#ERROR IQ.Type.ERROR} IQ
|
||||
* based on a {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}
|
||||
* Convenience method to create a new {@link Type#error IQ.Type.error} IQ
|
||||
* based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
|
||||
* IQ. The new packet will be initialized with:<ul>
|
||||
* <li>The sender set to the recipient of the originating IQ.
|
||||
* <li>The recipient set to the sender of the originating IQ.
|
||||
* <li>The type set to {@link Type#ERROR IQ.Type.ERROR}.
|
||||
* <li>The type set to {@link Type#error IQ.Type.error}.
|
||||
* <li>The id set to the id of the originating IQ.
|
||||
* <li>The child element contained in the associated originating IQ.
|
||||
* <li>The provided {@link XMPPError XMPPError}.
|
||||
* </ul>
|
||||
*
|
||||
* @param request the {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} IQ packet.
|
||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||
* @param error the error to associate with the created IQ packet.
|
||||
* @throws IllegalArgumentException if the IQ packet does not have a type of
|
||||
* {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}.
|
||||
* @return a new {@link Type#ERROR IQ.Type.ERROR} IQ based on the originating IQ.
|
||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
||||
*/
|
||||
public static IQ createErrorResponse(final IQ request, final XMPPError error) {
|
||||
if (!(request.getType() == Type.GET || request.getType() == Type.SET)) {
|
||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||
throw new IllegalArgumentException(
|
||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||
}
|
||||
|
@ -168,7 +171,7 @@ public abstract class IQ extends Packet {
|
|||
return request.getChildElementXML();
|
||||
}
|
||||
};
|
||||
result.setType(Type.ERROR);
|
||||
result.setType(Type.error);
|
||||
result.setPacketID(request.getPacketID());
|
||||
result.setFrom(request.getTo());
|
||||
result.setTo(request.getFrom());
|
||||
|
@ -177,59 +180,41 @@ public abstract class IQ extends Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* A class to represent the type of the IQ packet. The types are:
|
||||
* A enum to represent the type of the IQ packet. The types are:
|
||||
*
|
||||
* <ul>
|
||||
* <li>IQ.Type.GET
|
||||
* <li>IQ.Type.SET
|
||||
* <li>IQ.Type.RESULT
|
||||
* <li>IQ.Type.ERROR
|
||||
* <li>IQ.Type.get
|
||||
* <li>IQ.Type.set
|
||||
* <li>IQ.Type.result
|
||||
* <li>IQ.Type.error
|
||||
* </ul>
|
||||
*/
|
||||
public static class Type {
|
||||
public enum Type {
|
||||
|
||||
public static final Type GET = new Type("get");
|
||||
public static final Type SET = new Type("set");
|
||||
public static final Type RESULT = new Type("result");
|
||||
public static final Type ERROR = new Type("error");
|
||||
get,
|
||||
set,
|
||||
result,
|
||||
error;
|
||||
|
||||
/**
|
||||
* Converts a String into the corresponding types. Valid String values
|
||||
* that can be converted to types are: "get", "set", "result", and "error".
|
||||
*
|
||||
* @param type the String value to covert.
|
||||
* @param string the String value to covert.
|
||||
* @return the corresponding Type.
|
||||
* @throws IllegalArgumentException when not able to parse the string parameter
|
||||
*/
|
||||
public static Type fromString(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
public static Type fromString(String string) {
|
||||
Type type = null;
|
||||
try {
|
||||
type = Type.valueOf(string.toLowerCase(Locale.US));
|
||||
}
|
||||
type = type.toLowerCase(Locale.US);
|
||||
if (GET.toString().equals(type)) {
|
||||
return GET;
|
||||
catch (Exception e) {
|
||||
final String msg = "Could not transform string '" + string + "' to IQ.Type";
|
||||
LOGGER.log(Level.WARNING, msg, e);
|
||||
throw new IllegalArgumentException(msg, e);
|
||||
}
|
||||
else if (SET.toString().equals(type)) {
|
||||
return SET;
|
||||
}
|
||||
else if (ERROR.toString().equals(type)) {
|
||||
return ERROR;
|
||||
}
|
||||
else if (RESULT.toString().equals(type)) {
|
||||
return RESULT;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String value;
|
||||
|
||||
private Type(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return value;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.jivesoftware.smack.packet;
|
|||
public class Session extends IQ {
|
||||
|
||||
public Session() {
|
||||
setType(IQ.Type.SET);
|
||||
setType(IQ.Type.set);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -381,7 +381,7 @@ public class PacketParserUtils {
|
|||
}
|
||||
// Only handle unknown IQs of type result. Types of 'get' and 'set' which are not understood
|
||||
// have to be answered with an IQ error response. See the code a few lines below
|
||||
else if (IQ.Type.RESULT == type){
|
||||
else if (IQ.Type.result == type){
|
||||
// No Provider found for the IQ stanza, parse it to an UnparsedIQ instance
|
||||
// so that the content of the IQ can be examined later on
|
||||
iqPacket = new UnparsedResultIQ(parseContent(parser));
|
||||
|
@ -396,7 +396,7 @@ public class PacketParserUtils {
|
|||
}
|
||||
// Decide what to do when an IQ packet was not understood
|
||||
if (iqPacket == null) {
|
||||
if (connection != null && (IQ.Type.GET == type || IQ.Type.SET == type)) {
|
||||
if (connection != null && (IQ.Type.get == type || IQ.Type.set == type)) {
|
||||
// If the IQ stanza is of type "get" or "set" containing a child element qualified
|
||||
// by a namespace with no registered Smack provider, then answer an IQ of type
|
||||
// "error" with code 501 ("feature-not-implemented")
|
||||
|
@ -409,7 +409,7 @@ public class PacketParserUtils {
|
|||
iqPacket.setPacketID(id);
|
||||
iqPacket.setTo(from);
|
||||
iqPacket.setFrom(to);
|
||||
iqPacket.setType(IQ.Type.ERROR);
|
||||
iqPacket.setType(IQ.Type.error);
|
||||
iqPacket.setError(new XMPPError(XMPPError.Condition.feature_not_implemented));
|
||||
connection.sendPacket(iqPacket);
|
||||
return null;
|
||||
|
|
|
@ -360,7 +360,7 @@ public class RosterTest {
|
|||
@Test(timeout=5000)
|
||||
public void testIgnoreInvalidFrom() {
|
||||
RosterPacket packet = new RosterPacket();
|
||||
packet.setType(Type.SET);
|
||||
packet.setType(Type.set);
|
||||
packet.setTo(connection.getUser());
|
||||
packet.setFrom("mallory@example.com");
|
||||
packet.addRosterItem(new Item("spam@example.com", "Cool products!"));
|
||||
|
@ -500,7 +500,7 @@ public class RosterTest {
|
|||
for(RosterEntry entry : roster.getEntries()) {
|
||||
// prepare the roster push packet
|
||||
final RosterPacket rosterPush= new RosterPacket();
|
||||
rosterPush.setType(Type.SET);
|
||||
rosterPush.setType(Type.set);
|
||||
rosterPush.setTo(connection.getUser());
|
||||
|
||||
// prepare the buddy's item entry which should be removed
|
||||
|
@ -526,7 +526,7 @@ public class RosterTest {
|
|||
roster.reload();
|
||||
while (true) {
|
||||
final Packet sentPacket = connection.getSentPacket();
|
||||
if (sentPacket instanceof RosterPacket && ((IQ) sentPacket).getType() == Type.GET) {
|
||||
if (sentPacket instanceof RosterPacket && ((IQ) sentPacket).getType() == Type.get) {
|
||||
// setup the roster get request
|
||||
final RosterPacket rosterRequest = (RosterPacket) sentPacket;
|
||||
assertSame("The <query/> element MUST NOT contain any <item/> child elements!",
|
||||
|
@ -536,7 +536,7 @@ public class RosterTest {
|
|||
// prepare the roster result
|
||||
final RosterPacket rosterResult = new RosterPacket();
|
||||
rosterResult.setTo(connection.getUser());
|
||||
rosterResult.setType(Type.RESULT);
|
||||
rosterResult.setType(Type.result);
|
||||
rosterResult.setPacketID(rosterRequest.getPacketID());
|
||||
|
||||
// prepare romeo's roster entry
|
||||
|
@ -642,7 +642,7 @@ public class RosterTest {
|
|||
try {
|
||||
while (true) {
|
||||
final Packet packet = connection.getSentPacket();
|
||||
if (packet instanceof RosterPacket && ((IQ) packet).getType() == Type.SET) {
|
||||
if (packet instanceof RosterPacket && ((IQ) packet).getType() == Type.set) {
|
||||
final RosterPacket rosterRequest = (RosterPacket) packet;
|
||||
|
||||
// Prepare and process the roster push
|
||||
|
@ -651,7 +651,7 @@ public class RosterTest {
|
|||
if (item.getItemType() != ItemType.remove) {
|
||||
item.setItemType(ItemType.none);
|
||||
}
|
||||
rosterPush.setType(Type.SET);
|
||||
rosterPush.setType(Type.set);
|
||||
rosterPush.setTo(connection.getUser());
|
||||
rosterPush.addRosterItem(item);
|
||||
connection.processPacket(rosterPush);
|
||||
|
@ -663,7 +663,7 @@ public class RosterTest {
|
|||
}
|
||||
};
|
||||
response.setPacketID(rosterRequest.getPacketID());
|
||||
response.setType(Type.RESULT);
|
||||
response.setType(Type.result);
|
||||
response.setTo(connection.getUser());
|
||||
connection.processPacket(response);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public class RosterVersioningTest {
|
|||
RosterPacket sentRP = (RosterPacket)sentPacket;
|
||||
RosterPacket answer = new RosterPacket();
|
||||
answer.setPacketID(sentRP.getPacketID());
|
||||
answer.setType(Type.RESULT);
|
||||
answer.setType(Type.result);
|
||||
answer.setTo(sentRP.getFrom());
|
||||
|
||||
answer.setVersion("newVersion");
|
||||
|
@ -173,7 +173,7 @@ public class RosterVersioningTest {
|
|||
{
|
||||
RosterPacket rosterPush = new RosterPacket();
|
||||
rosterPush.setTo("rostertest@example.com/home");
|
||||
rosterPush.setType(Type.SET);
|
||||
rosterPush.setType(Type.set);
|
||||
rosterPush.setVersion("v97");
|
||||
|
||||
Item pushedItem = vaglafItem();
|
||||
|
@ -197,7 +197,7 @@ public class RosterVersioningTest {
|
|||
{
|
||||
RosterPacket rosterPush = new RosterPacket();
|
||||
rosterPush.setTo("rostertest@example.com/home");
|
||||
rosterPush.setType(Type.SET);
|
||||
rosterPush.setType(Type.set);
|
||||
rosterPush.setVersion("v98");
|
||||
|
||||
Item item = new Item("vaglaf@example.com", "vaglaf the only");
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
|||
replyPacket.setPacketID(packet.getPacketID());
|
||||
replyPacket.setFrom(packet.getTo());
|
||||
replyPacket.setTo(packet.getFrom());
|
||||
replyPacket.setType(Type.RESULT);
|
||||
replyPacket.setType(Type.result);
|
||||
|
||||
new ProcessQueue(replyQ).start();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IQResponseTest {
|
|||
|
||||
final IQ result = IQ.createResultIQ(request);
|
||||
|
||||
assertEquals(IQ.Type.RESULT, result.getType());
|
||||
assertEquals(IQ.Type.result, result.getType());
|
||||
assertNotNull(result.getPacketID());
|
||||
assertEquals(request.getPacketID(), result.getPacketID());
|
||||
assertEquals(request.getFrom(), result.getTo());
|
||||
|
@ -68,13 +68,13 @@ public class IQResponseTest {
|
|||
return childElement;
|
||||
}
|
||||
};
|
||||
request.setType(IQ.Type.SET);
|
||||
request.setType(IQ.Type.set);
|
||||
request.setFrom("sender@test/Smack");
|
||||
request.setTo("receiver@test/Smack");
|
||||
|
||||
final IQ result = IQ.createErrorResponse(request, error);
|
||||
|
||||
assertEquals(IQ.Type.ERROR, result.getType());
|
||||
assertEquals(IQ.Type.error, result.getType());
|
||||
assertNotNull(result.getPacketID());
|
||||
assertEquals(request.getPacketID(), result.getPacketID());
|
||||
assertEquals(request.getFrom(), result.getTo());
|
||||
|
@ -93,7 +93,7 @@ public class IQResponseTest {
|
|||
return childElement;
|
||||
}
|
||||
};
|
||||
request.setType(IQ.Type.RESULT);
|
||||
request.setType(IQ.Type.result);
|
||||
request.setFrom("sender@test/Smack");
|
||||
request.setTo("receiver@test/Smack");
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class IQResponseTest {
|
|||
return childElement;
|
||||
}
|
||||
};
|
||||
request.setType(IQ.Type.ERROR);
|
||||
request.setType(IQ.Type.error);
|
||||
request.setFrom("sender@test/Smack");
|
||||
request.setTo("receiver@test/Smack");
|
||||
request.setError(error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue