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 d76a16c4d5d72d9014c55d6fcc5977310f939e3c
parent 93d3649f57964ab08e41fcd9c1b2c8700614381d
Author: Daniel Gultsch <daniel@gultsch.de>
Date:   Sun, 20 Nov 2016 11:10:40 +0100

automatically retry after policy violation

Diffstat:
Msrc/main/java/eu/siacs/ComplianceTester.java | 20++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/main/java/eu/siacs/ComplianceTester.java b/src/main/java/eu/siacs/ComplianceTester.java @@ -5,6 +5,8 @@ import eu.siacs.compliance.TestSuiteFactory; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; import rocks.xmpp.core.sasl.AuthenticationException; +import rocks.xmpp.core.stream.StreamErrorException; +import rocks.xmpp.core.stream.model.errors.Condition; import java.util.Arrays; import java.util.List; @@ -56,6 +58,10 @@ public class ComplianceTester { } private static void runTestSuite(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) { + runTestSuite(clazz, jid, password, false); + } + + private static void runTestSuite(Class <? extends AbstractTestSuite> clazz, Jid jid, String password, boolean rerun) { try { try { AbstractTestSuite testSuite = TestSuiteFactory.create(clazz, jid, password); @@ -67,8 +73,18 @@ public class ComplianceTester { System.out.println("Test suite creation failed"); } } catch(AuthenticationException e) { - System.err.println("username or password wrong"); - System.exit(1); + System.err.println("username or password wrong"); + System.exit(1); + } catch (StreamErrorException e) { + if (e.getCondition() == Condition.POLICY_VIOLATION && !rerun) { + System.err.println("Policy violation. Waiting 61s"); + runTestSuite(clazz, jid, password, true); + try { + Thread.sleep(61000); + } catch (InterruptedException ie) { + System.err.println("interrupted"); + } + } } catch (XmppException e) { e.printStackTrace(); }