commit b1c0bad342698aa708a1e87c8839743b66ef227f
parent 93605bf212ed41362b7f158c09165989520b814f
Author: Daniel Gultsch <daniel@gultsch.de>
Date: Wed, 8 Jun 2016 18:32:48 +0200
introduced hooks and print server version in conversations test
Diffstat:
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/main/java/eu/siacs/compliance/suites/AbstractTestSuite.java b/src/main/java/eu/siacs/compliance/suites/AbstractTestSuite.java
@@ -6,6 +6,8 @@ import eu.siacs.compliance.TestFactory;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.XmppClient;
+import rocks.xmpp.extensions.version.SoftwareVersionManager;
+import rocks.xmpp.extensions.version.model.SoftwareVersion;
import java.util.Collections;
import java.util.HashMap;
@@ -28,9 +30,11 @@ public abstract class AbstractTestSuite {
public void run() throws XmppException {
mXmppClient.connect();
mXmppClient.login(mJid.getLocal(), mPassword, "ComplianceTester");
+ preHook();
for(Class<? extends AbstractTest> test : getTests()) {
run(test);
}
+ postHook();
mXmppClient.close();
int passed = Collections.frequency(mTestResults.values(),Result.PASSED);
System.out.println("passed "+passed+"/"+mTestResults.size());
@@ -53,6 +57,24 @@ public abstract class AbstractTestSuite {
}
}
+ protected void preHook() {
+
+ }
+
+ protected void postHook() {
+
+ }
+
+ protected void printServerVersion() {
+ final SoftwareVersionManager softwareVersionManager = mXmppClient.getManager(SoftwareVersionManager.class);
+ try {
+ SoftwareVersion softwareVersion = softwareVersionManager.getSoftwareVersion(mXmppClient.getDomain()).getResult();
+ System.out.println("Server is "+softwareVersion.getName()+" "+softwareVersion.getVersion());
+ } catch (XmppException e) {
+ //ignored
+ }
+ }
+
abstract List<Class<?extends AbstractTest>> getTests();
public abstract String getName();
diff --git a/src/main/java/eu/siacs/compliance/suites/Conversations.java b/src/main/java/eu/siacs/compliance/suites/Conversations.java
@@ -25,6 +25,11 @@ public class Conversations extends AdvancedServerIM {
}
@Override
+ protected void preHook() {
+ printServerVersion();
+ }
+
+ @Override
public String getName() {
return "Conversations Compliance Suite";
}
diff --git a/src/main/java/eu/siacs/compliance/tests/AbstractServiceTest.java b/src/main/java/eu/siacs/compliance/tests/AbstractServiceTest.java
@@ -43,16 +43,6 @@ public abstract class AbstractServiceTest extends AbstractTest {
return Result.FAILED;
}
return Result.FAILED;
-
- //this is how it should be. but it throws an exeception if one of the items fails
- /*
- AsyncResult<List<Item>> result = manager.discoverServices(getNamespace());
- try {
- return result.getResult(10, TimeUnit.SECONDS).size() >= 1 ? Result.PASSED : Result.FAILED;
- } catch (Exception e) {
- return Result.FAILED;
- }
- */
}
public abstract String getNamespace();