mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Don't require a properties file
when running the integration tests.
This commit is contained in:
parent
f4d76fa85e
commit
7cefe63175
1 changed files with 9 additions and 5 deletions
|
@ -27,6 +27,7 @@ import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
|
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
|
||||||
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jxmpp.jid.DomainBareJid;
|
import org.jxmpp.jid.DomainBareJid;
|
||||||
import org.jxmpp.jid.impl.JidCreate;
|
import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
@ -64,7 +65,8 @@ public class Configuration {
|
||||||
boolean debug, String accountOneUsername, String accountOnePassword, String accountTwoUsername,
|
boolean debug, String accountOneUsername, String accountOnePassword, String accountTwoUsername,
|
||||||
String accountTwoPassword, Set<String> enabledTests, Set<String> disabledTests,
|
String accountTwoPassword, Set<String> enabledTests, Set<String> disabledTests,
|
||||||
Set<String> testPackages) {
|
Set<String> testPackages) {
|
||||||
this.service = service;
|
this.service = Objects.requireNonNull(service,
|
||||||
|
"'service' must be set. Either via 'properties' files or via system property 'sinttest.service'.");
|
||||||
this.serviceTlsPin = serviceTlsPin;
|
this.serviceTlsPin = serviceTlsPin;
|
||||||
this.securityMode = securityMode;
|
this.securityMode = securityMode;
|
||||||
this.replyTimeout = replyTimeout;
|
this.replyTimeout = replyTimeout;
|
||||||
|
@ -214,12 +216,14 @@ public class Configuration {
|
||||||
private static final String SINTTEST = "sinttest.";
|
private static final String SINTTEST = "sinttest.";
|
||||||
|
|
||||||
public static Configuration newConfiguration() throws IOException {
|
public static Configuration newConfiguration() throws IOException {
|
||||||
File propertiesFile = findPropertiesFile();
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
|
File propertiesFile = findPropertiesFile();
|
||||||
|
if (propertiesFile != null) {
|
||||||
try (FileInputStream in = new FileInputStream(propertiesFile)) {
|
try (FileInputStream in = new FileInputStream(propertiesFile)) {
|
||||||
properties.load(in);
|
properties.load(in);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Properties set via the system override the file properties
|
// Properties set via the system override the file properties
|
||||||
Properties systemProperties = System.getProperties();
|
Properties systemProperties = System.getProperties();
|
||||||
|
@ -266,7 +270,7 @@ public class Configuration {
|
||||||
if (res.isFile())
|
if (res.isFile())
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
throw new IOException("Could not find properties file");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<String> getTestSetFrom(String string) {
|
private static Set<String> getTestSetFrom(String string) {
|
||||||
|
|
Loading…
Reference in a new issue