From 67a2040e96048e164b592fab4b0e8f123a7dd68f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 20 Sep 2019 00:07:44 +0200 Subject: add supportsPluggableTransports() to Provider class including Tests --- .../testutils/TestSetupHelper.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'app/src/sharedTest') 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 02a575ea..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; @@ -50,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; -- cgit v1.2.3