use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class NativeEnvironmentRepositoryTests method placeholdersApplicationAndProfile.
@Test
public void placeholdersApplicationAndProfile() {
this.repository.setSearchLocations("classpath:/test/{profile}/{application}/");
Environment environment = this.repository.findOne("app", "dev", "master");
assertEquals(1, environment.getPropertySources().size());
assertEquals("app", 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 ignoresExistingProfile.
@Test
public void ignoresExistingProfile() {
System.setProperty("spring.profiles.active", "cloud");
Environment environment = this.repository.findOne("foo", "main", "master");
assertEquals(1, environment.getPropertySources().size());
assertEquals("version was wrong", "myversion", environment.getVersion());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class NativeEnvironmentRepositoryTests method placeholdersLabel.
@Test
public void placeholdersLabel() {
this.repository.setSearchLocations("classpath:/test/{label}/");
Environment environment = this.repository.findOne("foo", "development", "dev");
assertEquals(1, environment.getPropertySources().size());
assertEquals("dev_bar", 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 locationDontAddLabelLocations.
@Test
public void locationDontAddLabelLocations() {
this.repository.setSearchLocations("classpath:/test/dev/");
this.repository.setAddLabelLocations(false);
Environment environment = this.repository.findOne("foo", "development", "ignore");
assertEquals(1, environment.getPropertySources().size());
assertEquals("dev_bar", 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 vanilla.
@Test
public void vanilla() {
Environment environment = this.repository.findOne("foo", "development", "master");
assertEquals(2, environment.getPropertySources().size());
assertEquals("version was wrong", "myversion", environment.getVersion());
}
Aggregations