1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 13:32:07 +01:00

Improve PubSubIntegrationTest.simplePubSubNodeTest()

by setting the node's deliverPayloads to 'false'.
This commit is contained in:
Florian Schmaus 2018-02-21 20:01:18 +01:00
parent 98708d67a2
commit 79cb639f93

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015 Florian Schmaus * Copyright 2015-2018 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -52,8 +52,15 @@ public class PubSubIntegrationTest extends AbstractSmackIntegrationTest {
public void simplePubSubNodeTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public void simplePubSubNodeTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final String nodename = "sinttest-simple-nodename-" + testRunId; final String nodename = "sinttest-simple-nodename-" + testRunId;
final String itemId = "sintest-simple-itemid-" + testRunId; final String itemId = "sintest-simple-itemid-" + testRunId;
LeafNode leafNode = pubSubManagerOne.createNode(nodename); ConfigureForm defaultConfiguration = pubSubManagerOne.getDefaultConfiguration();
ConfigureForm config = new ConfigureForm(defaultConfiguration.createAnswerForm());
// Configure the node as "Notification-Only Node", which in turn means that
// items do not need payload, to prevent payload-required error responses when
// publishing the item.
config.setDeliverPayloads(false);
Node node = pubSubManagerOne.createNode(nodename, config);
try { try {
LeafNode leafNode = (LeafNode) node;
leafNode.publish(new Item(itemId)); leafNode.publish(new Item(itemId));
List<Item> items = leafNode.getItems(); List<Item> items = leafNode.getItems();
assertEquals(1, items.size()); assertEquals(1, items.size());