Skip to content

Commit a55cd9e

Browse files
committed
Merge pull request #286 from buddycloud/issue-285
Fixes #285
2 parents 109510c + 63277e3 commit a55cd9e

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

src/main/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/get/AffiliationsGet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import org.buddycloud.channelserver.utils.XMLConstants;
1414
import org.buddycloud.channelserver.utils.node.item.payload.Buddycloud;
1515
import org.dom4j.Element;
16+
import org.dom4j.Namespace;
17+
import org.dom4j.QName;
1618
import org.xmpp.packet.IQ;
1719
import org.xmpp.packet.JID;
1820
import org.xmpp.packet.Packet;
@@ -121,7 +123,7 @@ private boolean getUserMemberships(Element affiliations) throws NodeStoreExcepti
121123

122124
String ephemeralValue =
123125
request.getChildElement().element(XMLConstants.AFFILIATIONS_ELEM)
124-
.attributeValue(XMLConstants.BUDDYCLOUD_XMLNS_PREFIX + XMLConstants.EPHEMERAL);
126+
.attributeValue(new QName(XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)));
125127
if ((null != ephemeralValue) && ephemeralValue.equals("true")) {
126128
ephemeral = true;
127129
}

src/main/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/get/SubscriptionsGet.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.buddycloud.channelserver.utils.XMLConstants;
1313
import org.buddycloud.channelserver.utils.node.item.payload.Buddycloud;
1414
import org.dom4j.Element;
15+
import org.dom4j.Namespace;
16+
import org.dom4j.QName;
1517
import org.xmpp.packet.IQ;
1618
import org.xmpp.packet.JID;
1719
import org.xmpp.packet.Packet;
@@ -137,7 +139,7 @@ private boolean getUserMemberships(Element subscriptions) throws NodeStoreExcept
137139

138140
String ephemeralValue =
139141
requestIq.getChildElement().element(XMLConstants.SUBSCRIPTIONS_ELEM)
140-
.attributeValue(XMLConstants.BUDDYCLOUD_XMLNS_PREFIX + XMLConstants.EPHEMERAL);
142+
.attributeValue(new QName(XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)));
141143
if ((null != ephemeralValue) && ephemeralValue.equals("true")) {
142144
ephemeral = true;
143145
}

src/test/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/get/AffiliationsGetTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
import org.buddycloud.channelserver.channel.ChannelManager;
1212
import org.buddycloud.channelserver.packetHandler.iq.IQTestHandler;
1313
import org.buddycloud.channelserver.packetprocessor.iq.namespace.pubsub.JabberPubsub;
14-
import org.buddycloud.channelserver.packetprocessor.iq.namespace.pubsub.PubSubElementProcessor;
1514
import org.buddycloud.channelserver.pubsub.affiliation.Affiliations;
1615
import org.buddycloud.channelserver.pubsub.model.NodeMembership;
1716
import org.buddycloud.channelserver.pubsub.model.impl.NodeMembershipImpl;
1817
import org.buddycloud.channelserver.pubsub.subscription.Subscriptions;
1918
import org.buddycloud.channelserver.utils.XMLConstants;
2019
import org.buddycloud.channelserver.utils.node.item.payload.Buddycloud;
2120
import org.dom4j.Element;
21+
import org.dom4j.Namespace;
22+
import org.dom4j.QName;
2223
import org.dom4j.tree.BaseElement;
2324
import org.junit.Before;
2425
import org.junit.Test;
@@ -427,7 +428,8 @@ public void canRequestAffiliationsForEphemeralOnlyNodes() throws Exception {
427428
request.getElement().element(XMLConstants.PUBSUB_ELEM)
428429
.element(XMLConstants.AFFILIATIONS_ELEM);
429430
affiliations.addNamespace("bc", Buddycloud.NS);
430-
affiliations.addAttribute("bc:ephemeral", "true");
431+
affiliations.addAttribute(new QName(
432+
XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)), "true");
431433

432434
try {
433435
affiliationsGet.process(element, jid, request, null);
@@ -460,7 +462,8 @@ public void providingAnIncorrectValueForEphemeralAttributeResultsInNotEphemeralG
460462
request.getElement().element(XMLConstants.PUBSUB_ELEM)
461463
.element(XMLConstants.AFFILIATIONS_ELEM);
462464
affiliations.addNamespace("bc", Buddycloud.NS);
463-
affiliations.addAttribute("bc:ephemeral", "sure");
465+
affiliations.addAttribute(new QName(
466+
XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)), "sure");
464467

465468
try {
466469
affiliationsGet.process(element, jid, request, null);

src/test/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/get/SubscriptionsGetTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.buddycloud.channelserver.utils.XMLConstants;
1818
import org.buddycloud.channelserver.utils.node.item.payload.Buddycloud;
1919
import org.dom4j.Element;
20+
import org.dom4j.Namespace;
21+
import org.dom4j.QName;
2022
import org.dom4j.tree.BaseElement;
2123
import org.junit.Before;
2224
import org.junit.Test;
@@ -218,7 +220,8 @@ public void canRequestUserSubscriptionsForEphemeralOnlyNodes() throws Exception
218220
request.getElement().element(XMLConstants.PUBSUB_ELEM)
219221
.element(XMLConstants.SUBSCRIPTIONS_ELEM);
220222
subscriptions.addNamespace("bc", Buddycloud.NS);
221-
subscriptions.addAttribute("bc:ephemeral", "true");
223+
subscriptions.addAttribute(new QName(
224+
XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)), "true");
222225

223226
try {
224227
subscriptionsGet.process(element, jid, request, null);
@@ -246,7 +249,8 @@ public void providingAnIncorrectValueForEphemeralAttributeResultsInNotEphemeralG
246249
request.getElement().element(XMLConstants.PUBSUB_ELEM)
247250
.element(XMLConstants.SUBSCRIPTIONS_ELEM);
248251
subscriptions.addNamespace("bc", Buddycloud.NS);
249-
subscriptions.addAttribute("bc:ephemeral", "sure");
252+
subscriptions.addAttribute(new QName(
253+
XMLConstants.EPHEMERAL, Namespace.get(Buddycloud.NS)), "sure");
250254

251255
try {
252256
subscriptionsGet.process(element, jid, request, null);

0 commit comments

Comments
 (0)