use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentRepositoryTests method defaultRepoTwice.
@Test
public void defaultRepoTwice() {
this.repository.findOne("bar", "staging", "master");
Environment environment = this.repository.findOne("bar", "staging", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals(this.repository.getUri() + "/bar.properties", environment.getPropertySources().get(0).getName());
assertVersion(environment);
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentRepositoryTests method defaultRepoNested.
@Test
public void defaultRepoNested() throws IOException {
String uri = ConfigServerTestUtils.prepareLocalRepo("another-config-repo");
this.repository.setUri(uri);
this.repository.setSearchPaths(new String[] { "sub" });
this.repository.findOne("bar", "staging", "master");
Environment environment = this.repository.findOne("bar", "staging", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals(this.repository.getUri() + "/sub/application.yml", environment.getPropertySources().get(0).getName());
assertVersion(environment);
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class JdbcEnvironmentRepositoryTests method basicProperties.
@Test
public void basicProperties() {
Environment env = new JdbcEnvironmentRepository(new JdbcTemplate(dataSource), new JdbcEnvironmentProperties()).findOne("foo", "bar", "");
assertThat(env.getName()).isEqualTo("foo");
assertThat(env.getProfiles()).isEqualTo(new String[] { "default", "bar" });
assertThat(env.getLabel()).isEqualTo("master");
assertThat(env.getPropertySources()).isNotEmpty();
assertThat(env.getPropertySources().get(0).getName()).isEqualTo("foo-bar");
assertThat(env.getPropertySources().get(0).getSource().get("a.b.c")).isEqualTo("x");
assertThat(env.getPropertySources().get(1).getName()).isEqualTo("application-default");
assertThat(env.getPropertySources().get(1).getSource().get("a.b")).isEqualTo("y");
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class JdbcEnvironmentRepositoryTests method defaults.
@Test
public void defaults() {
Environment env = new JdbcEnvironmentRepository(new JdbcTemplate(dataSource), new JdbcEnvironmentProperties()).findOne("application", "", "");
assertThat(env.getName()).isEqualTo("application");
assertThat(env.getProfiles()).isEqualTo(new String[] { "default" });
assertThat(env.getLabel()).isEqualTo("master");
assertThat(env.getPropertySources()).isNotEmpty();
assertThat(env.getPropertySources().get(0).getSource().get("a.b")).isEqualTo("y");
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentLabelPlaceholderRepositoryTests method defaultLabelRepo.
@Test
public void defaultLabelRepo() {
Environment environment = this.repository.findOne("bar", "staging", null);
assertEquals(1, environment.getPropertySources().size());
assertEquals(this.defaultUri + "application.yml", environment.getPropertySources().get(0).getName());
assertVersion(environment);
}
Aggregations