use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentRepositoryIntegrationTests method mappingRepoWithProfileDefaultPatterns.
@Test
public void mappingRepoWithProfileDefaultPatterns() throws IOException {
String defaultRepoUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");
String test1RepoUri = ConfigServerTestUtils.prepareLocalRepo("test1-config-repo");
Map<String, Object> repoMapping = new LinkedHashMap<String, Object>();
repoMapping.put("spring.cloud.config.server.git.repos[test1].pattern", "*/staging");
repoMapping.put("spring.cloud.config.server.git.repos[test1].uri", test1RepoUri);
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).properties("spring.cloud.config.server.git.uri:" + defaultRepoUri).properties(repoMapping).run();
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("test1-svc", "staging", "master");
Environment environment = repository.findOne("test1-svc", "staging,cloud", "master");
assertEquals(2, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentRepositoryIntegrationTests method defaultRepo.
@Test
public void defaultRepo() throws IOException {
String defaultRepoUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).properties("spring.cloud.config.server.git.uri:" + defaultRepoUri).run();
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("bar", "staging", "master");
Environment environment = repository.findOne("bar", "staging", "master");
assertEquals(2, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentRepositoryIntegrationTests method mappingRepoWithJustUri.
@Test
public void mappingRepoWithJustUri() throws IOException {
String defaultRepoUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");
String test1RepoUri = ConfigServerTestUtils.prepareLocalRepo("test1-config-repo");
Map<String, Object> repoMapping = new LinkedHashMap<String, Object>();
repoMapping.put("spring.cloud.config.server.git.repos.test1-svc.uri", test1RepoUri);
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).properties("spring.cloud.config.server.git.uri:" + defaultRepoUri).properties(repoMapping).run();
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("test1-svc", "staging", "master");
Environment environment = repository.findOne("test1-svc", "staging", "master");
assertEquals(2, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class NativeEnvironmentRepositoryTests method placeholdersProfiles.
@Test
public void placeholdersProfiles() {
this.repository.setSearchLocations("classpath:/test/{profile}/");
Environment environment = this.repository.findOne("foo", "dev,mysql", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals("mysql", environment.getPropertySources().get(0).getSource().get("foo"));
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class NativeEnvironmentRepositoryTests method prefixedWithFile.
@Test
public void prefixedWithFile() {
this.repository.setSearchLocations("file:./src/test/resources/test");
Environment environment = this.repository.findOne("foo", "development", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals("version was wrong", "myversion", environment.getVersion());
}
Aggregations