1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Create sinntest configuration to connection configuration method

This also fixes the bug that only low level integration tests handled
the debugger sinttest setting.
This commit is contained in:
Florian Schmaus 2018-05-09 18:10:11 +02:00
parent 96f75a1857
commit f4f072c4cb

View file

@ -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);