From f4f072c4cb8d7bb2247b7a09c3fe21d29a441d62 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 9 May 2018 18:10:11 +0200 Subject: [PATCH] Create sinntest configuration to connection configuration method This also fixes the bug that only low level integration tests handled the debugger sinttest setting. --- .../SmackIntegrationTestFramework.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java index dab2d9514..8634ef91f 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java @@ -559,16 +559,11 @@ public class SmackIntegrationTestFramework { if (StringUtils.isNullOrEmpty(accountPassword)) { accountPassword = StringUtils.insecureRandomString(16); } - // @formatter:off - Builder builder = XMPPTCPConnectionConfiguration.builder() - .setXmppDomain(config.service) - .setUsernameAndPassword(accountUsername, accountPassword) - .setResource(middlefix + '-' + testRunResult.testRunId) - .setSecurityMode(config.securityMode); - // @formatter:on - if (config.tlsContext != null) { - builder.setCustomSSLContext(config.tlsContext); - } + + Builder builder = getConnectionConfigurationBuilder(config); + builder.setUsernameAndPassword(accountUsername, accountPassword) + .setResource(middlefix + '-' + testRunResult.testRunId); + XMPPTCPConnection connection = new XMPPTCPConnection(builder.build()); connection.connect(); if (config.isAccountRegistrationPossible()) { @@ -588,10 +583,7 @@ public class SmackIntegrationTestFramework { return connection; } - static XMPPTCPConnection getConnectedConnection(SmackIntegrationTestEnvironment environment, int connectionId) - throws KeyManagementException, NoSuchAlgorithmException, InterruptedException, - SmackException, IOException, XMPPException { - Configuration config = environment.configuration; + static XMPPTCPConnectionConfiguration.Builder getConnectionConfigurationBuilder(Configuration config) { XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder(); if (config.tlsContext != null) { builder.setCustomSSLContext(config.tlsContext); @@ -611,6 +603,15 @@ public class SmackIntegrationTestFramework { break; } + return builder; + } + + static XMPPTCPConnection getConnectedConnection(SmackIntegrationTestEnvironment environment, int connectionId) + throws KeyManagementException, NoSuchAlgorithmException, InterruptedException, + SmackException, IOException, XMPPException { + Configuration config = environment.configuration; + XMPPTCPConnectionConfiguration.Builder builder = getConnectionConfigurationBuilder(config); + XMPPTCPConnection connection = new XMPPTCPConnection(builder.build()); connection.connect(); UsernameAndPassword uap = IntTestUtil.registerAccount(connection, environment, connectionId);