mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-24 23:32:05 +01:00
sinttest: add 'dnsResolver' setting
This commit is contained in:
parent
5b805336ce
commit
a564620383
4 changed files with 46 additions and 0 deletions
|
@ -80,6 +80,7 @@ debugger=console
|
||||||
| disabledConnections | List of disabled connection's nicknames |
|
| disabledConnections | List of disabled connection's nicknames |
|
||||||
| testPackages | List of packages with tests |
|
| testPackages | List of packages with tests |
|
||||||
| verbose | If `true` set output to verbose |
|
| verbose | If `true` set output to verbose |
|
||||||
|
| dnsResolver | One of 'minidns', 'javax' or 'dnsjava'. Defaults to 'minidns'. |
|
||||||
|
|
||||||
### Where to place the properties file
|
### Where to place the properties file
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ applicationDefaultJvmArgs = ["-enableassertions"]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':smack-java8-full')
|
api project(':smack-java8-full')
|
||||||
|
api project(':smack-resolver-dnsjava')
|
||||||
compile 'org.reflections:reflections:0.9.11'
|
compile 'org.reflections:reflections:0.9.11'
|
||||||
compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
|
compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
|
||||||
compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
||||||
|
|
|
@ -62,6 +62,12 @@ public final class Configuration {
|
||||||
enhanced,
|
enhanced,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum DnsResolver {
|
||||||
|
minidns,
|
||||||
|
javax,
|
||||||
|
dnsjava,
|
||||||
|
}
|
||||||
|
|
||||||
public final DomainBareJid service;
|
public final DomainBareJid service;
|
||||||
|
|
||||||
public final String serviceTlsPin;
|
public final String serviceTlsPin;
|
||||||
|
@ -108,6 +114,8 @@ public final class Configuration {
|
||||||
|
|
||||||
public final boolean verbose;
|
public final boolean verbose;
|
||||||
|
|
||||||
|
public final DnsResolver dnsResolver;
|
||||||
|
|
||||||
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
|
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
|
||||||
service = Objects.requireNonNull(builder.service,
|
service = Objects.requireNonNull(builder.service,
|
||||||
"'service' must be set. Either via 'properties' files or via system property 'sinttest.service'.");
|
"'service' must be set. Either via 'properties' files or via system property 'sinttest.service'.");
|
||||||
|
@ -180,6 +188,8 @@ public final class Configuration {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.verbose = builder.verbose;
|
this.verbose = builder.verbose;
|
||||||
|
|
||||||
|
this.dnsResolver = builder.dnsResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccountRegistrationPossible() {
|
public boolean isAccountRegistrationPossible() {
|
||||||
|
@ -232,6 +242,8 @@ public final class Configuration {
|
||||||
|
|
||||||
private boolean verbose;
|
private boolean verbose;
|
||||||
|
|
||||||
|
private DnsResolver dnsResolver = DnsResolver.minidns;
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +411,20 @@ public final class Configuration {
|
||||||
return setVerbose(verbose);
|
return setVerbose(verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setDnsResolver(DnsResolver dnsResolver) {
|
||||||
|
this.dnsResolver = Objects.requireNonNull(dnsResolver);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDnsResolver(String dnsResolverString) {
|
||||||
|
if (dnsResolverString == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
DnsResolver dnsResolver = DnsResolver.valueOf(dnsResolverString);
|
||||||
|
return setDnsResolver(dnsResolver);
|
||||||
|
}
|
||||||
|
|
||||||
public Configuration build() throws KeyManagementException, NoSuchAlgorithmException {
|
public Configuration build() throws KeyManagementException, NoSuchAlgorithmException {
|
||||||
return new Configuration(this);
|
return new Configuration(this);
|
||||||
}
|
}
|
||||||
|
@ -470,6 +496,8 @@ public final class Configuration {
|
||||||
|
|
||||||
builder.setVerbose(properties.getProperty("verbose"));
|
builder.setVerbose(properties.getProperty("verbose"));
|
||||||
|
|
||||||
|
builder.setDnsResolver(properties.getProperty("dnsResolver"));
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,9 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
|
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.TLSUtils;
|
import org.jivesoftware.smack.util.TLSUtils;
|
||||||
|
import org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver;
|
||||||
|
import org.jivesoftware.smack.util.dns.javax.JavaxResolver;
|
||||||
|
import org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||||
import org.jivesoftware.smackx.iqregister.AccountManager;
|
import org.jivesoftware.smackx.iqregister.AccountManager;
|
||||||
|
@ -149,6 +152,19 @@ public class SmackIntegrationTestFramework {
|
||||||
public synchronized TestRunResult run()
|
public synchronized TestRunResult run()
|
||||||
throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException,
|
throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException,
|
||||||
InterruptedException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
InterruptedException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||||
|
// The DNS resolver is not really a per sinttest run setting. It is not even a per connection setting. Instead
|
||||||
|
// it is a global setting, but we treat it like a per sinttest run setting.
|
||||||
|
switch (config.dnsResolver) {
|
||||||
|
case minidns:
|
||||||
|
MiniDnsResolver.setup();
|
||||||
|
break;
|
||||||
|
case javax:
|
||||||
|
JavaxResolver.setup();
|
||||||
|
break;
|
||||||
|
case dnsjava:
|
||||||
|
DNSJavaResolver.setup();
|
||||||
|
break;
|
||||||
|
}
|
||||||
testRunResult = new TestRunResult();
|
testRunResult = new TestRunResult();
|
||||||
|
|
||||||
// Create a connection manager *after* we created the testRunId (in testRunResult).
|
// Create a connection manager *after* we created the testRunId (in testRunResult).
|
||||||
|
|
Loading…
Reference in a new issue