1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Merge branch '4.2'

This commit is contained in:
Florian Schmaus 2018-02-21 20:13:05 +01:00
commit a48e8ef843
155 changed files with 638 additions and 160 deletions

View file

@ -46,6 +46,7 @@ import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@ -131,7 +132,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
*
*/
@SmackIntegrationTest
public void testPreventDiscoInfo() throws XMPPException, NoResponseException, NotConnectedException, InterruptedException {
public void testPreventDiscoInfo() throws Exception {
final String dummyFeature = getNewDummyFeature();
conOne.addPacketSendingListener(new StanzaListener() {
@ -142,9 +143,27 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
}, new AndFilter(new StanzaTypeFilter(DiscoverInfo.class), IQTypeFilter.GET));
final SimpleResultSyncPoint presenceReceivedSyncPoint = new SimpleResultSyncPoint();
final StanzaListener presenceListener = new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
presenceReceivedSyncPoint.signal();
}
};
// Add a stanzaListener to listen for incoming presence
conOne.addAsyncStanzaListener(presenceListener, PresenceTypeFilter.AVAILABLE);
// add a bogus feature so that con1 ver won't match con0's
sdmTwo.addFeature(dummyFeature);
try {
// wait for the dummy feature to get sent via presence
presenceReceivedSyncPoint.waitForResult(timeout);
} finally {
conOne.removeAsyncStanzaListener(presenceListener);
}
dropCapsCache();
// discover that
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());

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");
* 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 {
final String nodename = "sinttest-simple-nodename-" + 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 {
LeafNode leafNode = (LeafNode) node;
leafNode.publish(new Item(itemId));
List<Item> items = leafNode.getItems();
assertEquals(1, items.size());