TestSuiteFactory.java (1158B)
1 package eu.siacs.compliance; 2 3 import eu.siacs.extensions.csi.ClientStateIndication; 4 import eu.siacs.compliance.suites.AbstractTestSuite; 5 import rocks.xmpp.addr.Jid; 6 import rocks.xmpp.core.session.Extension; 7 import rocks.xmpp.core.session.XmppClient; 8 import rocks.xmpp.core.session.XmppSessionConfiguration; 9 10 public class TestSuiteFactory { 11 12 public static AbstractTestSuite create(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) throws AbstractTestSuite.TestSuiteCreationException { 13 XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() 14 .extensions(Extension.of(ClientStateIndication.class)) 15 .initialPresence(null) 16 .build(); 17 final XmppClient client = XmppClient.create(jid.getDomain(),configuration); 18 try { 19 AbstractTestSuite testSuite = clazz.getDeclaredConstructor(XmppClient.class, Jid.class, String.class).newInstance(client, jid, password); 20 return testSuite; 21 } catch (Exception e) { 22 e.printStackTrace(); 23 throw new AbstractTestSuite.TestSuiteCreationException(); 24 } 25 } 26 }