CalabashNodeConfiguration { public static CalabashNodeConfiguration readFromFile(File driverConfigurationFile) throws CalabashConfigurationException { if (driverConfigurationFile == null) { throw new InvalidParameterException( "Calabash-Driver Configuration-File is missing. Pls specifiy name like: calabashNode.json"); } String driverConfiguration; try { driverConfiguration = FileUtils.readFileToString(driverConfigurationFile); } catch (IOException e1) { throw new CalabashConfigurationException( "Error reading file content. Did you have specified the right file name and path?", e1); } try { return new CalabashNodeConfiguration(new JSONObject(driverConfiguration)); } catch (JSONException e) { throw new CalabashConfigurationException("Error occured during parsing json file: '" + driverConfigurationFile + "'. Pls make sure you are using a valid JSON file!", e); } } protected  CalabashNodeConfiguration(); protected  CalabashNodeConfiguration(JSONObject config); static CalabashNodeConfiguration readFromFile(File driverConfigurationFile); static CalabashNodeConfiguration readFromURI(URI driverConfigFileURI); List<CalabashCapabilities> getCapabilities(); String getProxy(); String getDriverHost(); int getDriverMaxSession(); int getDriverPort(); String getMobileAppPath(); String getMobileTestAppPath(); String getHubHost(); int getHubPort(); boolean isInstallApksEnabled(); boolean isCleanSavedUserDataEnabled(); boolean isDriverRegistrationEnabled(); static final String CAPABILITIES; static final String CONFIGURATION; }
@Test public void testReadConfigByFile() throws Exception { CalabashNodeConfiguration config = CalabashNodeConfiguration.readFromFile(new File(CONFIG_FILE)); assertNodeConfig(config); }
@Test(expectedExceptions = {CalabashConfigurationException.class}) public void testReadConfigByFileInvalidFilePath() throws Exception { CalabashNodeConfiguration.readFromFile(new File("")); }
@Test(expectedExceptions = {InvalidParameterException.class}) public void testReadConfigByFileNullInput() throws Exception { CalabashNodeConfiguration.readFromFile(null); }