xmpp-compliance-tester

XMPP Compliance Tester, forked from github.com/iNPUTmice/ComplianceTester
git clone https://git.in0rdr.ch/xmpp-compliance-tester.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

commit c4c03bb7b01553844aacffca3709015ebc64c170
parent 49e9181fcb3c0377b42271d867e6773880ed9ac8
Author: Daniel Gultsch <daniel@gultsch.de>
Date:   Wed, 23 Aug 2017 16:47:28 +0200

add MAM-MUC test

Diffstat:
Msrc/main/java/eu/siacs/compliance/suites/Conversations.java | 3++-
Asrc/main/java/eu/siacs/compliance/tests/MamMuc.java | 43+++++++++++++++++++++++++++++++++++++++++++
Msrc/main/java/eu/siacs/compliance/tests/OMEMO.java | 2+-
3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/src/main/java/eu/siacs/compliance/suites/Conversations.java b/src/main/java/eu/siacs/compliance/suites/Conversations.java @@ -22,7 +22,8 @@ public class Conversations extends AdvancedServerIM { Proxy65.class, Push.class, XmppOverTls.class, - OMEMO.class + OMEMO.class, + MamMuc.class )).collect(Collectors.toList()); } diff --git a/src/main/java/eu/siacs/compliance/tests/MamMuc.java b/src/main/java/eu/siacs/compliance/tests/MamMuc.java @@ -0,0 +1,43 @@ +package eu.siacs.compliance.tests; + +import eu.siacs.compliance.Result; +import rocks.xmpp.core.XmppException; +import rocks.xmpp.core.session.XmppClient; +import rocks.xmpp.extensions.disco.ServiceDiscoveryManager; +import rocks.xmpp.extensions.muc.ChatRoom; +import rocks.xmpp.extensions.muc.ChatService; +import rocks.xmpp.extensions.muc.MultiUserChatManager; + +import java.util.List; +import java.util.Set; +import java.util.UUID; + +public class MamMuc extends AbstractTest { + public MamMuc(XmppClient client) { + super(client); + } + + @Override + public Result run() { + final ServiceDiscoveryManager serviceDiscoveryManager = client.getManager(ServiceDiscoveryManager.class); + final MultiUserChatManager multiUserChatManager = client.getManager(MultiUserChatManager.class); + try { + List<ChatService> chatServices = multiUserChatManager.discoverChatServices().getResult(); + if (chatServices.size() < 1) { + return Result.FAILED; + } + ChatService chatService = chatServices.get(0); + ChatRoom room = chatService.createRoom(UUID.randomUUID().toString()); + room.enter("test"); + final Set<String> f = serviceDiscoveryManager.discoverInformation(room.getAddress()).getResult().getFeatures(); + return f.contains("urn:xmpp:mam:0") || f.contains("urn:xmpp:mam:1") || f.contains("urn:xmpp:mam:2") ? Result.PASSED : Result.FAILED; + } catch (XmppException e) { + return Result.FAILED; + } + } + + @Override + public String getName() { + return "XEP-0313: Message Archive Management (MUC)"; + } +} diff --git a/src/main/java/eu/siacs/compliance/tests/OMEMO.java b/src/main/java/eu/siacs/compliance/tests/OMEMO.java @@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit; * This test checks for the availability of publish-options on the account’s PEP service. * publish-options allows a client to efficiently change the access model of the OMEMO key material * such that everyone can access it. Without publish-options OMEMO is only available to contacts with - * mutual presence subscription. + * mutual presence subscription. */ public class OMEMO extends AbstractTest {