File findCloudPropertiesFile() { File file = findCloudPropertiesFileFromSystem(); if (file != null) { logger.info("using configuration file from system properties"); return file; } file = findCloudPropertiesFileFromClasspath(); if (file != null) logger.info("using configuration file derived from " + classpathPropertiesFilename); else logger.info("did not find any Spring Cloud configuration file"); return file; }
File findCloudPropertiesFile() { File file = findCloudPropertiesFileFromSystem(); if (file != null) { logger.info("using configuration file from system properties"); return file; } file = findCloudPropertiesFileFromClasspath(); if (file != null) logger.info("using configuration file derived from " + classpathPropertiesFilename); else logger.info("did not find any Spring Cloud configuration file"); return file; }
@Test public void testLiteral() { resolver = new PropertiesFileResolver(env, "spring-cloud-literal.properties"); assertEquals(PROPERTIES_FILE_NAME, resolver.findCloudPropertiesFileFromClasspath().getPath()); }
@Test public void testNoClasspathFile() { resolver = new PropertiesFileResolver(env, "bazquux.properties"); assertNull(resolver.findCloudPropertiesFileFromClasspath()); }
@Test public void testClasspathFileWithoutKey() { resolver = new PropertiesFileResolver(env, "localconfig.testuris.properties"); assertNull(resolver.findCloudPropertiesFileFromClasspath()); }
@Test public void testTemplate() { resolver = new PropertiesFileResolver(env, "spring-cloud-template.properties"); env.setSystemProperty("user.home", "/foo"); assertEquals(PROPERTIES_FILE_NAME, resolver.findCloudPropertiesFileFromClasspath().getPath()); }