private static void loadGemFirePropertiesFromClassPath(Properties properties) { try { properties .load(AbstractLauncher.class.getResourceAsStream(DistributedSystem.getPropertiesFile())); } catch (IOException | NullPointerException handled) { // leave the properties empty } }
/** * Gets an <code>URL</code> for the properties file, if one can be found, that the connect method * will use as its properties file. * <p> * See {@link #PROPERTIES_FILE_PROPERTY} for information on the name of the properties file and * what locations it will be looked for in. * * @return a <code>URL</code> that names the GemFire property file. Null is returned if no * property file was found. * @see #PROPERTIES_FILE_PROPERTY * @see #PROPERTIES_FILE_DEFAULT * @see #getPropertiesFile() * @since Geode 1.0 */ public static URL getPropertiesFileURL() { return getFileURL(getPropertiesFile()); }
@Test public void getPropertiesFileShouldUseSystemProperty() throws Exception { String propertiesFileName = "test.properties"; System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFileName); assertThat(DistributedSystem.getPropertiesFile()).isEqualTo(propertiesFileName); }
@Test public void getPropertiesFileShouldUseDefault() throws Exception { assertThat(DistributedSystem.getPropertiesFile()) .isEqualTo(DistributedSystem.PROPERTIES_FILE_DEFAULT); }
@Test public void getPropertiesFileShouldUseSystemPropertyPath() throws Exception { String propertiesFileName = "/home/test.properties"; System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY, propertiesFileName); assertThat(DistributedSystem.getPropertiesFile()).isEqualTo(propertiesFileName); }