summaryrefslogtreecommitdiff
path: root/app/src/sharedTest/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-10-01 00:25:54 +0200
committercyBerta <cyberta@riseup.net>2019-10-01 00:25:54 +0200
commitfca6c9dcff1b5b5400a61b7411a7f72460fbfbfa (patch)
treec8efd8b964d495467619000fa7435c2a5527efa1 /app/src/sharedTest/java
parent7820e8c0819a10c5b4729678607681fcfe30cbae (diff)
parent685da193ea29f3e7a8a42d55747dfb2f956f23b6 (diff)
Merge branch 'pluggableTransports2'
Diffstat (limited to 'app/src/sharedTest/java')
-rw-r--r--app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
index 8835b75d..669abc84 100644
--- a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
+++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
@@ -18,6 +18,7 @@
package se.leap.bitmaskclient.testutils;
import org.json.JSONException;
+import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
@@ -40,6 +41,9 @@ public class TestSetupHelper {
while (line != null) {
sb.append(line);
line = br.readLine();
+ if (line != null) {
+ sb.append("\n");
+ }
}
return sb.toString();
@@ -47,25 +51,32 @@ public class TestSetupHelper {
public static Provider getConfiguredProvider() throws IOException, JSONException {
- return getProvider(null, null, null);
+ return getProvider(null, null, null, null);
}
- public static Provider getProvider(String domain, String caCertFile, String jsonFile) {
+ public static Provider getProvider(String domain, String caCertFile, String providerJson, String eipServiceJson) {
if (domain == null)
domain = "https://riseup.net";
if (caCertFile == null)
caCertFile = "riseup.net.pem";
- if (jsonFile == null)
- jsonFile = "riseup.net.json";
+ if (providerJson == null)
+ providerJson = "riseup.net.json";
+ if (eipServiceJson == null) {
+ eipServiceJson = "riseup.service.json";
+ }
try {
- return new Provider(
+ Provider p = new Provider(
new URL(domain),
getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(caCertFile)),
- getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(jsonFile))
+ getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(providerJson))
);
- } catch (IOException e) {
+ JSONObject eipServiceJsonObject = new JSONObject(
+ getInputAsString(TestSetupHelper.class.getClassLoader().getResourceAsStream(eipServiceJson)));
+ p.setEipServiceJson(eipServiceJsonObject);
+ return p;
+ } catch (IOException | JSONException e) {
e.printStackTrace();
}
return null;