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 1cc04660aff38d9519e1733ba04843de9f5e616a
parent e62c7b7ce80b21e78dbed5308d01f36f6385b235
Author: Daniel Gultsch <daniel@gultsch.de>
Date:   Sun,  5 Jun 2016 20:05:38 +0200

added predefined test suits for advanced server profiles core, im, mobile

Diffstat:
Msrc/main/java/eu/siacs/ComplianceTester.java | 19+++++++++++++++----
Asrc/main/java/eu/siacs/compliance/TestFactory.java | 24++++++++++++++++++++++++
Asrc/main/java/eu/siacs/compliance/TestSuiteFactory.java | 25+++++++++++++++++++++++++
Msrc/main/java/eu/siacs/compliance/suites/AbstractTestSuite.java | 2+-
Asrc/main/java/eu/siacs/compliance/suites/AdvancedServerCore.java | 28++++++++++++++++++++++++++++
Asrc/main/java/eu/siacs/compliance/suites/AdvancedServerIM.java | 35+++++++++++++++++++++++++++++++++++
Asrc/main/java/eu/siacs/compliance/suites/AdvancedServerMobile.java | 32++++++++++++++++++++++++++++++++
Asrc/main/java/eu/siacs/compliance/suites/Conversations.java | 31+++++++++++++++++++++++++++++++
Dsrc/main/java/eu/siacs/compliance/suites/EverythingTestSuite.java | 42------------------------------------------
Dsrc/main/java/eu/siacs/compliance/suites/TestSuiteFactory.java | 24------------------------
Dsrc/main/java/eu/siacs/compliance/tests/TestFactory.java | 23-----------------------
11 files changed, 191 insertions(+), 94 deletions(-)

diff --git a/src/main/java/eu/siacs/ComplianceTester.java b/src/main/java/eu/siacs/ComplianceTester.java @@ -1,12 +1,14 @@ package eu.siacs; -import eu.siacs.compliance.suites.AbstractTestSuite; -import eu.siacs.compliance.suites.EverythingTestSuite; -import eu.siacs.compliance.suites.TestSuiteFactory; +import eu.siacs.compliance.suites.*; +import eu.siacs.compliance.TestSuiteFactory; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; import rocks.xmpp.core.sasl.AuthenticationException; +import java.util.Arrays; +import java.util.List; + public class ComplianceTester { @@ -17,7 +19,16 @@ public class ComplianceTester { } Jid jid = Jid.of(args[0]); String password = args[1]; - runTestSuite(EverythingTestSuite.class, jid, password); + List<Class <? extends AbstractTestSuite>> testSuites = Arrays.asList( + AdvancedServerCore.class, + AdvancedServerIM.class, + AdvancedServerMobile.class, + Conversations.class + ); + for(Class<?extends AbstractTestSuite> testSuite : testSuites) { + runTestSuite(testSuite, jid, password); + System.out.println("\n"); + } } private static void runTestSuite(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) { diff --git a/src/main/java/eu/siacs/compliance/TestFactory.java b/src/main/java/eu/siacs/compliance/TestFactory.java @@ -0,0 +1,24 @@ +package eu.siacs.compliance; + +import eu.siacs.compliance.tests.AbstractTest; +import rocks.xmpp.core.session.XmppClient; + +public class TestFactory { + + public static AbstractTest create(Class <? extends AbstractTest> clazz, XmppClient client) throws TestCreationException { + if (client == null) { + throw new TestCreationException(); + } + try { + AbstractTest test = clazz.getDeclaredConstructor(XmppClient.class).newInstance(client); + return test; + } catch (Exception e) { + e.printStackTrace(); + throw new TestCreationException(); + } + } + + public static class TestCreationException extends Exception { + + } +} diff --git a/src/main/java/eu/siacs/compliance/TestSuiteFactory.java b/src/main/java/eu/siacs/compliance/TestSuiteFactory.java @@ -0,0 +1,25 @@ +package eu.siacs.compliance; + +import eu.siacs.compliance.extensions.csi.ClientStateIndication; +import eu.siacs.compliance.suites.AbstractTestSuite; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.Extension; +import rocks.xmpp.core.session.XmppClient; +import rocks.xmpp.core.session.XmppSessionConfiguration; + +public class TestSuiteFactory { + + public static AbstractTestSuite create(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) throws AbstractTestSuite.TestSuiteCreationException { + XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() + .extensions(Extension.of(ClientStateIndication.class)) + .build(); + final XmppClient client = XmppClient.create(jid.getDomain(),configuration); + try { + AbstractTestSuite testSuite = clazz.getDeclaredConstructor(XmppClient.class, Jid.class, String.class).newInstance(client, jid, password); + return testSuite; + } catch (Exception e) { + e.printStackTrace(); + throw new AbstractTestSuite.TestSuiteCreationException(); + } + } +} diff --git a/src/main/java/eu/siacs/compliance/suites/AbstractTestSuite.java b/src/main/java/eu/siacs/compliance/suites/AbstractTestSuite.java @@ -2,7 +2,7 @@ package eu.siacs.compliance.suites; import eu.siacs.compliance.tests.AbstractTest; import eu.siacs.compliance.Result; -import eu.siacs.compliance.tests.TestFactory; +import eu.siacs.compliance.TestFactory; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; import rocks.xmpp.core.session.XmppClient; diff --git a/src/main/java/eu/siacs/compliance/suites/AdvancedServerCore.java b/src/main/java/eu/siacs/compliance/suites/AdvancedServerCore.java @@ -0,0 +1,28 @@ +package eu.siacs.compliance.suites; + +import eu.siacs.compliance.tests.*; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.XmppClient; + +import java.util.Arrays; +import java.util.List; + +public class AdvancedServerCore extends AbstractTestSuite { + + public AdvancedServerCore(XmppClient client, Jid jid, String password) { + super(client, jid, password); + } + + @Override + List<Class<? extends AbstractTest>> getTests() { + return Arrays.asList( + EntityCapabilities.class, + PEP.class + ); + } + + @Override + public String getName() { + return "Advanced Server Core Compliance Suite"; + } +} diff --git a/src/main/java/eu/siacs/compliance/suites/AdvancedServerIM.java b/src/main/java/eu/siacs/compliance/suites/AdvancedServerIM.java @@ -0,0 +1,35 @@ +package eu.siacs.compliance.suites; + +import eu.siacs.compliance.tests.*; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.XmppClient; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + + +public class AdvancedServerIM extends AdvancedServerCore { + + public AdvancedServerIM(XmppClient client, Jid jid, String password) { + super(client, jid, password); + } + + @Override + List<Class<? extends AbstractTest>> getTests() { + return Stream.concat(super.getTests().stream(), Arrays.asList( + RosterVersioning.class, + MessageCarbons.class, + Blocking.class, + MultiUserChat.class, + StreamManagement.class, + MAM.class + ).stream()).collect(Collectors.toList()); + } + + @Override + public String getName() { + return "Advanced Server IM Compliance Suite"; + } +} diff --git a/src/main/java/eu/siacs/compliance/suites/AdvancedServerMobile.java b/src/main/java/eu/siacs/compliance/suites/AdvancedServerMobile.java @@ -0,0 +1,32 @@ +package eu.siacs.compliance.suites; + +import eu.siacs.compliance.tests.*; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.XmppClient; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + + +public class AdvancedServerMobile extends AdvancedServerCore { + + public AdvancedServerMobile(XmppClient client, Jid jid, String password) { + super(client, jid, password); + } + + @Override + List<Class<? extends AbstractTest>> getTests() { + return Stream.concat(super.getTests().stream(), Arrays.asList( + StreamManagement.class, + CSI.class, + Push.class + ).stream()).collect(Collectors.toList()); + } + + @Override + public String getName() { + return "Advanced Server IM Compliance Suite"; + } +} diff --git a/src/main/java/eu/siacs/compliance/suites/Conversations.java b/src/main/java/eu/siacs/compliance/suites/Conversations.java @@ -0,0 +1,31 @@ +package eu.siacs.compliance.suites; + +import eu.siacs.compliance.tests.*; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.XmppClient; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class Conversations extends AdvancedServerIM { + public Conversations(XmppClient client, Jid jid, String password) { + super(client, jid, password); + } + + @Override + List<Class<? extends AbstractTest>> getTests() { + return Stream.concat(super.getTests().stream(), Arrays.asList( + CSI.class, + HttpUpload.class, + Proxy65.class, + Push.class + ).stream()).collect(Collectors.toList()); + } + + @Override + public String getName() { + return "Conversations Compliance Suite"; + } +} diff --git a/src/main/java/eu/siacs/compliance/suites/EverythingTestSuite.java b/src/main/java/eu/siacs/compliance/suites/EverythingTestSuite.java @@ -1,42 +0,0 @@ -package eu.siacs.compliance.suites; - -import eu.siacs.compliance.tests.*; -import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.session.XmppClient; - -import java.util.Arrays; -import java.util.List; - - -/** - * this test suite just tests for everything - */ -public class EverythingTestSuite extends AbstractTestSuite { - - public EverythingTestSuite(XmppClient client, Jid jid, String password) { - super(client, jid, password); - } - - @Override - List<Class<? extends AbstractTest>> getTests() { - return Arrays.asList( - RosterVersioning.class, - StreamManagement.class, - MessageCarbons.class, - Blocking.class, - MAM.class, - Push.class, - EntityCapabilities.class, - MultiUserChat.class, - HttpUpload.class, - PEP.class, - CSI.class, - Proxy65.class - ); - } - - @Override - public String getName() { - return "Relevant for Conversations"; - } -} diff --git a/src/main/java/eu/siacs/compliance/suites/TestSuiteFactory.java b/src/main/java/eu/siacs/compliance/suites/TestSuiteFactory.java @@ -1,24 +0,0 @@ -package eu.siacs.compliance.suites; - -import eu.siacs.compliance.extensions.csi.ClientStateIndication; -import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppClient; -import rocks.xmpp.core.session.XmppSessionConfiguration; - -public class TestSuiteFactory { - - public static AbstractTestSuite create(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) throws AbstractTestSuite.TestSuiteCreationException { - XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() - .extensions(Extension.of(ClientStateIndication.class)) - .build(); - final XmppClient client = XmppClient.create(jid.getDomain(),configuration); - try { - AbstractTestSuite testSuite = clazz.getDeclaredConstructor(XmppClient.class, Jid.class, String.class).newInstance(client, jid, password); - return testSuite; - } catch (Exception e) { - e.printStackTrace(); - throw new AbstractTestSuite.TestSuiteCreationException(); - } - } -} diff --git a/src/main/java/eu/siacs/compliance/tests/TestFactory.java b/src/main/java/eu/siacs/compliance/tests/TestFactory.java @@ -1,23 +0,0 @@ -package eu.siacs.compliance.tests; - -import rocks.xmpp.core.session.XmppClient; - -public class TestFactory { - - public static AbstractTest create(Class <? extends AbstractTest> clazz, XmppClient client) throws TestCreationException { - if (client == null) { - throw new TestCreationException(); - } - try { - AbstractTest test = clazz.getDeclaredConstructor(XmppClient.class).newInstance(client); - return test; - } catch (Exception e) { - e.printStackTrace(); - throw new TestCreationException(); - } - } - - public static class TestCreationException extends Exception { - - } -}