1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-27 14:47:59 +01:00

Issue SMACK-308: Fixed multiple bugs in XML generation.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11678 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2010-04-14 18:24:12 +00:00
parent 31cd0ab088
commit ef74695a1b
2 changed files with 19 additions and 4 deletions

View file

@ -40,9 +40,9 @@ public class GetItemsRequest extends NodeExtension
maxItems = maxItemsToReturn;
}
public GetItemsRequest(String nodeId, String subscriptionId, int maxItems)
public GetItemsRequest(String nodeId, String subscriptionId, int maxItemsToReturn)
{
super(PubSubElementType.ITEMS, nodeId);
this(nodeId, maxItemsToReturn);
subId = subscriptionId;
}
@ -70,14 +70,14 @@ public class GetItemsRequest extends NodeExtension
{
builder.append(" subid='");
builder.append(getSubscriptionId());
builder.append("'/>");
builder.append("'");
}
if (getMaxItems() > 0)
{
builder.append(" max_items='");
builder.append(getMaxItems());
builder.append("'/>");
builder.append("'");
}
builder.append("/>");
return builder.toString();

View file

@ -98,4 +98,19 @@ public class TestMessageContent extends TestCase
{
}
}
public void testGetItemsRequest()
{
GetItemsRequest request = new GetItemsRequest("testId");
assertEquals("<items node='testId'/>", request.toXML());
request = new GetItemsRequest("testId", 5);
assertEquals("<items node='testId' max_items='5'/>", request.toXML());
request = new GetItemsRequest("testId", "qwerty");
assertEquals("<items node='testId' subid='qwerty'/>", request.toXML());
request = new GetItemsRequest("testId", "qwerty", 5);
assertEquals("<items node='testId' subid='qwerty' max_items='5'/>", request.toXML());
}
}