1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

Merge pull request #597 from guusdk/sint_add-host-config

[sinttest] Add new config option: 'host'
This commit is contained in:
Florian Schmaus 2024-06-09 17:32:37 +00:00 committed by GitHub
commit 4f09244253
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -72,6 +72,8 @@ public final class Configuration {
public final DomainBareJid service;
public final String host;
public final String serviceTlsPin;
public final SslContextFactory sslContextFactory;
@ -138,6 +140,7 @@ public final class Configuration {
private Configuration(Configuration.Builder builder) throws KeyManagementException, NoSuchAlgorithmException {
service = Objects.requireNonNull(builder.service,
"'service' must be set. Either via 'properties' files or via system property 'sinttest.service'.");
host = builder.host;
serviceTlsPin = builder.serviceTlsPin;
if (serviceTlsPin != null) {
SSLContext sslContext = Java7Pinning.forPin(serviceTlsPin);
@ -197,6 +200,9 @@ public final class Configuration {
}
b.setSecurityMode(securityMode);
b.setXmppDomain(service);
if (host != null) {
b.setHost(host);
}
if (debuggerFactory != null) {
b.setDebuggerFactory(debuggerFactory);
@ -222,6 +228,8 @@ public final class Configuration {
private DomainBareJid service;
private String host;
private String serviceTlsPin;
private SecurityMode securityMode;
@ -287,6 +295,11 @@ public final class Configuration {
return this;
}
private Builder setHost(String host) {
this.host = host;
return this;
}
public Builder addEnabledTest(Class<? extends AbstractSmackIntTest> enabledTest) {
if (enabledTests == null) {
enabledTests = new HashSet<>();
@ -521,6 +534,7 @@ public final class Configuration {
Builder builder = builder();
builder.setService(properties.getProperty("service"));
builder.setHost(properties.getProperty("host"));
builder.setServiceTlsPin(properties.getProperty("serviceTlsPin"));
builder.setSecurityMode(properties.getProperty("securityMode"));
builder.setReplyTimeout(properties.getProperty("replyTimeout", "47000"));

View file

@ -80,6 +80,10 @@
* <td>XMPP service to run the tests on</td>
* </tr>
* <tr>
* <td>host</td>
* <td>IP address or DNS name of the XMPP service to run the tests on</td>
* </tr>
* <tr>
* <td>serviceTlsPin</td>
* <td>TLS Pin (used by <a href="https://github.com/Flowdalic/java-pinning">java-pinning</a>)</td>
* </tr>