mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 16:22:06 +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:
parent
31cd0ab088
commit
ef74695a1b
2 changed files with 19 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue