Skip to content

Commit

Permalink
Don't require a properties file
Browse files Browse the repository at this point in the history
when running the integration tests.
  • Loading branch information
Flowdalic committed Mar 23, 2015
1 parent f4d76fa commit 7cefe63
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Set;

import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.impl.JidCreate;
Expand Down Expand Up @@ -64,7 +65,8 @@ private Configuration(DomainBareJid service, String serviceTlsPin, SecurityMode
boolean debug, String accountOneUsername, String accountOnePassword, String accountTwoUsername,
String accountTwoPassword, Set<String> enabledTests, Set<String> disabledTests,
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.securityMode = securityMode;
this.replyTimeout = replyTimeout;
Expand Down Expand Up @@ -214,11 +216,13 @@ public Configuration build() {
private static final String SINTTEST = "sinttest.";

public static Configuration newConfiguration() throws IOException {
File propertiesFile = findPropertiesFile();
Properties properties = new Properties();

try (FileInputStream in = new FileInputStream(propertiesFile)) {
properties.load(in);
File propertiesFile = findPropertiesFile();
if (propertiesFile != null) {
try (FileInputStream in = new FileInputStream(propertiesFile)) {
properties.load(in);
}
}

// Properties set via the system override the file properties
Expand Down Expand Up @@ -266,7 +270,7 @@ private static File findPropertiesFile() throws IOException {
if (res.isFile())
return res;
}
throw new IOException("Could not find properties file");
return null;
}

private static Set<String> getTestSetFrom(String string) {
Expand Down

0 comments on commit 7cefe63

Please sign in to comment.