summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-06-21 12:33:44 (GMT)
committerTarun Gupta <tarun1995gupta@gmail.com>2015-06-30 13:24:34 (GMT)
commit25fade1995f559c8937b57585f462aaa2ae01c6a (patch)
tree008b432b08decc871f07bece2bc4307c033a6651 /src/com/isode/stroke/parser
parentb830f64de47271777d8e45ddb0a18dc2ac740dd9 (diff)
downloadstroke-25fade1995f559c8937b57585f462aaa2ae01c6a.zip
stroke-25fade1995f559c8937b57585f462aaa2ae01c6a.tar.bz2
Add tests for Payloads Parsers and Payloads Serializers.
Updates DiscoInfoParser, DiscoItemsParser and VCard Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test are added for: DeliveryReceipt Parser and Serializer. DiscoInfo Parser and Serializer, DiscoItemsParser. Replace Parser and Serializer. ResourceBind Parser and Serializer. SecurityLabel Parser and Serializer. SecurityLabelsCatalog Parser and Serializer. Status Parser and Serializer. StatusShow Parser and Serializer. SoftwareVersion Parser and Serializer. VCard Parser and Serializer. All tests passes. Change-Id: I8023372273e63813e1c8fe708fa6cdf39614e1f7
Diffstat (limited to 'src/com/isode/stroke/parser')
-rw-r--r--src/com/isode/stroke/parser/payloadparsers/DiscoInfoParser.java5
-rw-r--r--src/com/isode/stroke/parser/payloadparsers/DiscoItemsParser.java5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/payloadparsers/DiscoInfoParser.java b/src/com/isode/stroke/parser/payloadparsers/DiscoInfoParser.java
index acd1ae0..181caa2 100644
--- a/src/com/isode/stroke/parser/payloadparsers/DiscoInfoParser.java
+++ b/src/com/isode/stroke/parser/payloadparsers/DiscoInfoParser.java
@@ -19,6 +19,11 @@ public class DiscoInfoParser extends GenericPayloadParser<DiscoInfo> {
}
public void handleStartElement(String element, String ns, AttributeMap attributes) {
+ if (level_ == TopLevel) {
+ if (attributes.getAttributeValue("node") != null) {
+ getPayloadInternal().setNode(attributes.getAttributeValue("node"));
+ }
+ }
if (level_ == PayloadLevel) {
if (element .equals("identity")) {
getPayloadInternal().addIdentity(new DiscoInfo.Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
diff --git a/src/com/isode/stroke/parser/payloadparsers/DiscoItemsParser.java b/src/com/isode/stroke/parser/payloadparsers/DiscoItemsParser.java
index 091fd32..abf7c29 100644
--- a/src/com/isode/stroke/parser/payloadparsers/DiscoItemsParser.java
+++ b/src/com/isode/stroke/parser/payloadparsers/DiscoItemsParser.java
@@ -26,6 +26,11 @@ public class DiscoItemsParser extends GenericPayloadParser<DiscoItems> {
getPayloadInternal().addItem(item);
}
}
+ else if (level_ == TopLevel) {
+ if (element.equals("query")) {
+ getPayloadInternal().setNode(attributes.getAttribute("node"));
+ }
+ }
++level_;
}