Allow patterns in repository search paths

User can now specify spring.cloud.config.server.git.searchPaths as
a list of patterns (instead of a list of subdirectory names).

See gh-97
This commit is contained in:
Dave Syer
2015-03-16 11:01:21 +00:00
parent 4ae639c351
commit ee4717bbab
6 changed files with 30 additions and 14 deletions

View File

@@ -72,6 +72,18 @@ public class JGitEnvironmentRepositoryTests {
.getPropertySources().get(0).getName());
}
@Test
public void nestedPattern() throws IOException {
String uri = ConfigServerTestUtils.prepareLocalRepo("another-config-repo");
repository.setUri(uri);
repository.setSearchPaths(new String[] {"sub*"});
repository.findOne("bar", "staging", "master");
Environment environment = repository.findOne("bar", "staging", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals(repository.getUri() + "/sub/application.yml", environment
.getPropertySources().get(0).getName());
}
@Test
public void branch() {
repository.setBasedir(basedir);

View File

@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.cloud.config.server.ConfigServerTestUtils;
import org.springframework.cloud.config.server.SVNKitEnvironmentRepository;
import org.springframework.cloud.config.server.SvnKitEnvironmentRepository;
import org.springframework.core.env.StandardEnvironment;
import static org.junit.Assert.assertTrue;
@@ -36,7 +36,7 @@ import static org.junit.Assert.assertEquals;
public class SVNKitEnvironmentRepositoryTests {
private StandardEnvironment environment = new StandardEnvironment();
private SVNKitEnvironmentRepository repository = new SVNKitEnvironmentRepository(
private SvnKitEnvironmentRepository repository = new SvnKitEnvironmentRepository(
environment);
private File basedir = new File("target/config");