mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Merge pull request #597 from guusdk/sint_add-host-config
[sinttest] Add new config option: 'host'
This commit is contained in:
commit
4f09244253
2 changed files with 18 additions and 0 deletions
|
@ -72,6 +72,8 @@ public final class Configuration {
|
||||||
|
|
||||||
public final DomainBareJid service;
|
public final DomainBareJid service;
|
||||||
|
|
||||||
|
public final String host;
|
||||||
|
|
||||||
public final String serviceTlsPin;
|
public final String serviceTlsPin;
|
||||||
|
|
||||||
public final SslContextFactory sslContextFactory;
|
public final SslContextFactory sslContextFactory;
|
||||||
|
@ -138,6 +140,7 @@ public final class Configuration {
|
||||||
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'.");
|
||||||
|
host = builder.host;
|
||||||
serviceTlsPin = builder.serviceTlsPin;
|
serviceTlsPin = builder.serviceTlsPin;
|
||||||
if (serviceTlsPin != null) {
|
if (serviceTlsPin != null) {
|
||||||
SSLContext sslContext = Java7Pinning.forPin(serviceTlsPin);
|
SSLContext sslContext = Java7Pinning.forPin(serviceTlsPin);
|
||||||
|
@ -197,6 +200,9 @@ public final class Configuration {
|
||||||
}
|
}
|
||||||
b.setSecurityMode(securityMode);
|
b.setSecurityMode(securityMode);
|
||||||
b.setXmppDomain(service);
|
b.setXmppDomain(service);
|
||||||
|
if (host != null) {
|
||||||
|
b.setHost(host);
|
||||||
|
}
|
||||||
|
|
||||||
if (debuggerFactory != null) {
|
if (debuggerFactory != null) {
|
||||||
b.setDebuggerFactory(debuggerFactory);
|
b.setDebuggerFactory(debuggerFactory);
|
||||||
|
@ -222,6 +228,8 @@ public final class Configuration {
|
||||||
|
|
||||||
private DomainBareJid service;
|
private DomainBareJid service;
|
||||||
|
|
||||||
|
private String host;
|
||||||
|
|
||||||
private String serviceTlsPin;
|
private String serviceTlsPin;
|
||||||
|
|
||||||
private SecurityMode securityMode;
|
private SecurityMode securityMode;
|
||||||
|
@ -287,6 +295,11 @@ public final class Configuration {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Builder setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder addEnabledTest(Class<? extends AbstractSmackIntTest> enabledTest) {
|
public Builder addEnabledTest(Class<? extends AbstractSmackIntTest> enabledTest) {
|
||||||
if (enabledTests == null) {
|
if (enabledTests == null) {
|
||||||
enabledTests = new HashSet<>();
|
enabledTests = new HashSet<>();
|
||||||
|
@ -521,6 +534,7 @@ public final class Configuration {
|
||||||
|
|
||||||
Builder builder = builder();
|
Builder builder = builder();
|
||||||
builder.setService(properties.getProperty("service"));
|
builder.setService(properties.getProperty("service"));
|
||||||
|
builder.setHost(properties.getProperty("host"));
|
||||||
builder.setServiceTlsPin(properties.getProperty("serviceTlsPin"));
|
builder.setServiceTlsPin(properties.getProperty("serviceTlsPin"));
|
||||||
builder.setSecurityMode(properties.getProperty("securityMode"));
|
builder.setSecurityMode(properties.getProperty("securityMode"));
|
||||||
builder.setReplyTimeout(properties.getProperty("replyTimeout", "47000"));
|
builder.setReplyTimeout(properties.getProperty("replyTimeout", "47000"));
|
||||||
|
|
|
@ -80,6 +80,10 @@
|
||||||
* <td>XMPP service to run the tests on</td>
|
* <td>XMPP service to run the tests on</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <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>serviceTlsPin</td>
|
||||||
* <td>TLS Pin (used by <a href="https://github.com/Flowdalic/java-pinning">java-pinning</a>)</td>
|
* <td>TLS Pin (used by <a href="https://github.com/Flowdalic/java-pinning">java-pinning</a>)</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
|
|
Loading…
Reference in a new issue