commit 35f4be8c4292f0ae6dd5dd7446a0788d6532efac
parent cac4752496a1d1ccb3745a4c80404bd1ed1c0234
Author: Daniel Gultsch <daniel@gultsch.de>
Date: Sat, 22 Jul 2017 20:10:45 +0200
added omemo test to check for publish-options
Diffstat:
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/main/java/eu/siacs/compliance/suites/Conversations.java b/src/main/java/eu/siacs/compliance/suites/Conversations.java
@@ -21,7 +21,8 @@ public class Conversations extends AdvancedServerIM {
HttpUpload.class,
Proxy65.class,
Push.class,
- XmppOverTls.class
+ XmppOverTls.class,
+ OMEMO.class
)).collect(Collectors.toList());
}
diff --git a/src/main/java/eu/siacs/compliance/tests/OMEMO.java b/src/main/java/eu/siacs/compliance/tests/OMEMO.java
@@ -0,0 +1,44 @@
+package eu.siacs.compliance.tests;
+
+import eu.siacs.compliance.Result;
+import rocks.xmpp.core.session.XmppClient;
+import rocks.xmpp.extensions.disco.ServiceDiscoveryManager;
+import rocks.xmpp.extensions.disco.model.info.Identity;
+import rocks.xmpp.extensions.disco.model.info.InfoNode;
+import rocks.xmpp.util.concurrent.AsyncResult;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+public class OMEMO extends AbstractTest {
+
+ public OMEMO(XmppClient client) {
+ super(client);
+ }
+
+ @Override
+ public Result run() {
+ ServiceDiscoveryManager manager = client.getManager(ServiceDiscoveryManager.class);
+ AsyncResult<InfoNode> result = manager.discoverInformation(client.getConnectedResource().asBareJid());
+ try {
+ final InfoNode infoNode = result.get(10, TimeUnit.SECONDS);
+ if (!infoNode.getFeatures().contains("http://jabber.org/protocol/pubsub#publish-options")) {
+ return Result.FAILED;
+ }
+ for(Identity identity : infoNode.getIdentities()) {
+ if ("pep".equalsIgnoreCase(identity.getType()) && "pubsub".equalsIgnoreCase(identity.getCategory())) {
+ return Result.PASSED;
+ }
+ }
+ return Result.FAILED;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return Result.FAILED;
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "XEP-0384: OMEMO Encryption";
+ }
+}