@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "Error by reading the property file '.*invalid.properties'") public void testAddPropertiesFromFileRuntimeException() throws Exception { Properties props = new Properties(); testling.addPropertiesFromFile(props, "invalid.properties", true); }
protected void addPropertiesFromFile(Properties props, String filePath, boolean active) { if (active) { logger.info("read in properties from '{}'", filePath); try { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath); Iterator<String> keyIt = propertiesConfiguration.getKeys(); while (keyIt.hasNext()) { String key = keyIt.next(); Object value = propertiesConfiguration.getProperty(key); props.put(key, value); } } catch (ConfigurationException | NullPointerException e) { throw new RuntimeException("Error by reading the property file '" + filePath + "'", e); } } }
SakuliPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { protected void addPropertiesFromFile(Properties props, String filePath, boolean active) { if (active) { logger.info("read in properties from '{}'", filePath); try { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath); Iterator<String> keyIt = propertiesConfiguration.getKeys(); while (keyIt.hasNext()) { String key = keyIt.next(); Object value = propertiesConfiguration.getProperty(key); props.put(key, value); } } catch (ConfigurationException | NullPointerException e) { throw new RuntimeException("Error by reading the property file '" + filePath + "'", e); } } } }
SakuliPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { protected void addPropertiesFromFile(Properties props, String filePath, boolean active) { if (active) { logger.info("read in properties from '{}'", filePath); try { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath); Iterator<String> keyIt = propertiesConfiguration.getKeys(); while (keyIt.hasNext()) { String key = keyIt.next(); Object value = propertiesConfiguration.getProperty(key); props.put(key, value); } } catch (ConfigurationException | NullPointerException e) { throw new RuntimeException("Error by reading the property file '" + filePath + "'", e); } } } SakuliPropertyPlaceholderConfigurer(); }
SakuliPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { protected void addPropertiesFromFile(Properties props, String filePath, boolean active) { if (active) { logger.info("read in properties from '{}'", filePath); try { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath); Iterator<String> keyIt = propertiesConfiguration.getKeys(); while (keyIt.hasNext()) { String key = keyIt.next(); Object value = propertiesConfiguration.getProperty(key); props.put(key, value); } } catch (ConfigurationException | NullPointerException e) { throw new RuntimeException("Error by reading the property file '" + filePath + "'", e); } } } SakuliPropertyPlaceholderConfigurer(); static void assignEncryptionProperties(Properties props); Properties getPropsRef(); @PreDestroy void restoreProperties(); boolean isLoadSakuliDefaultProperties(); void setLoadSakuliDefaultProperties(boolean loadSakuliDefaultProperties); boolean isLoadSakuliProperties(); void setLoadSakuliProperties(boolean loadSakuliProperties); boolean isLoadTestSuiteProperties(); void setLoadTestSuiteProperties(boolean loadTestSuiteProperties); boolean isWritePropertiesToSahiConfig(); void setWritePropertiesToSahiConfig(boolean writePropertiesToSahiConfig); }
SakuliPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { protected void addPropertiesFromFile(Properties props, String filePath, boolean active) { if (active) { logger.info("read in properties from '{}'", filePath); try { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath); Iterator<String> keyIt = propertiesConfiguration.getKeys(); while (keyIt.hasNext()) { String key = keyIt.next(); Object value = propertiesConfiguration.getProperty(key); props.put(key, value); } } catch (ConfigurationException | NullPointerException e) { throw new RuntimeException("Error by reading the property file '" + filePath + "'", e); } } } SakuliPropertyPlaceholderConfigurer(); static void assignEncryptionProperties(Properties props); Properties getPropsRef(); @PreDestroy void restoreProperties(); boolean isLoadSakuliDefaultProperties(); void setLoadSakuliDefaultProperties(boolean loadSakuliDefaultProperties); boolean isLoadSakuliProperties(); void setLoadSakuliProperties(boolean loadSakuliProperties); boolean isLoadTestSuiteProperties(); void setLoadTestSuiteProperties(boolean loadTestSuiteProperties); boolean isWritePropertiesToSahiConfig(); void setWritePropertiesToSahiConfig(boolean writePropertiesToSahiConfig); static String ENCRYPTION_KEY_VALUE; static String TEST_SUITE_FOLDER_VALUE; static String SAKULI_HOME_FOLDER_VALUE; static String SAHI_HOME_VALUE; static String TEST_SUITE_BROWSER; static String ENCRYPTION_INTERFACE_VALUE; }