commit 1502f32b0a39e53baa90f1abee17a7e0bd98ea08
parent 1347f9717761c0cf27fadf67736048650d16d47d
Author: Daniel Gultsch <daniel@gultsch.de>
Date: Thu, 28 Dec 2017 23:40:26 +0100
MUC MAM: test for 'mam' data form field
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main/java/eu/siacs/compliance/tests/MamMuc.java b/src/main/java/eu/siacs/compliance/tests/MamMuc.java
@@ -4,6 +4,7 @@ import eu.siacs.compliance.Result;
import eu.siacs.utils.TestUtils;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.XmppClient;
+import rocks.xmpp.extensions.data.model.DataForm;
import rocks.xmpp.extensions.disco.ServiceDiscoveryManager;
import rocks.xmpp.extensions.muc.ChatRoom;
import rocks.xmpp.extensions.muc.ChatService;
@@ -12,6 +13,7 @@ import rocks.xmpp.extensions.muc.MultiUserChatManager;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.ExecutionException;
public class MamMuc extends AbstractTest {
public MamMuc(XmppClient client) {
@@ -27,9 +29,17 @@ public class MamMuc extends AbstractTest {
if (chatServices.size() < 1) {
return Result.FAILED;
}
- ChatService chatService = chatServices.get(0);
- ChatRoom room = chatService.createRoom(UUID.randomUUID().toString());
+ final ChatService chatService = chatServices.get(0);
+ final ChatRoom room = chatService.createRoom(UUID.randomUUID().toString());
room.enter("test");
+ try {
+ final DataForm.Field mam = room.getConfigurationForm().get().findField("mam");
+ if (mam != null) {
+ return Result.PASSED;
+ }
+ } catch (ExecutionException | InterruptedException e) {
+ //ignore
+ }
final Set<String> features = serviceDiscoveryManager.discoverInformation(room.getAddress()).getResult().getFeatures();
final boolean mam = TestUtils.hasAnyone(MAM.NAMESPACES,features);
room.destroy().getResult();