commit cc09dd1ea722dd0b7b10087d2bbb3d77a98bd38d parent 3bbec8c71a10ab7715606d5a18cacbc3b5810708 Author: Daniel Gultsch <daniel@gultsch.de> Date: Mon, 6 Jun 2016 21:49:47 +0200 when testing for services test on server as well Diffstat:
M | src/main/java/eu/siacs/compliance/tests/AbstractServiceTest.java | | | 13 | +++++++++---- |
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/main/java/eu/siacs/compliance/tests/AbstractServiceTest.java b/src/main/java/eu/siacs/compliance/tests/AbstractServiceTest.java @@ -2,13 +2,15 @@ package eu.siacs.compliance.tests; import eu.siacs.compliance.Result; +import rocks.xmpp.addr.Jid; import rocks.xmpp.core.session.XmppClient; import rocks.xmpp.extensions.disco.ServiceDiscoveryManager; import rocks.xmpp.extensions.disco.model.items.Item; import rocks.xmpp.extensions.disco.model.items.ItemNode; import rocks.xmpp.util.concurrent.AsyncResult; -import java.util.concurrent.TimeUnit; +import java.util.ArrayList; +import java.util.List; public abstract class AbstractServiceTest extends AbstractTest { @@ -21,11 +23,14 @@ public abstract class AbstractServiceTest extends AbstractTest { ServiceDiscoveryManager manager = client.getManager(ServiceDiscoveryManager.class); //manually iterating over items. ignoring the faulty ones - AsyncResult<ItemNode> items = manager.discoverItems(client.getDomain()); + AsyncResult<ItemNode> itemNode = manager.discoverItems(client.getDomain()); try { - for(Item item : items.getResult(10,TimeUnit.SECONDS).getItems()) { + List<Jid> items = new ArrayList<>(); + itemNode.getResult().getItems().stream().map(Item::getJid).forEach(items::add); + items.add(client.getDomain()); + for(Jid jid : items) { try { - for(String feature : manager.discoverInformation(item.getJid()).getResult(10, TimeUnit.SECONDS).getFeatures()) { + for(String feature : manager.discoverInformation(jid).getResult().getFeatures()) { if (getNamespace().equals(feature)) { return Result.PASSED; }