use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class SVNKitEnvironmentRepositoryIntegrationTests method update.
@Test
public void update() throws Exception {
String uri = ConfigServerTestUtils.prepareLocalSvnRepo("src/test/resources/svn-config-repo", "target/config");
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).profiles("subversion").run("--spring.cloud.config.server.svn.uri=" + uri);
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("bar", "staging", "trunk");
Environment environment = repository.findOne("bar", "staging", "trunk");
assertEquals("bar", environment.getPropertySources().get(0).getSource().get("foo"));
updateRepoForUpdate(uri);
environment = repository.findOne("bar", "staging", "trunk");
assertEquals("foo", 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 SVNKitEnvironmentRepositoryIntegrationTests method invalidLabel.
@Test(expected = NoSuchLabelException.class)
public void invalidLabel() throws Exception {
String uri = ConfigServerTestUtils.prepareLocalSvnRepo("src/test/resources/svn-config-repo", "target/config");
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).profiles("subversion").run("--spring.cloud.config.server.svn.uri=" + uri);
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("bar", "staging", "unknownlabel");
Environment environment = repository.findOne("bar", "staging", "unknownlabel");
assertEquals(0, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class SVNKitEnvironmentRepositoryIntegrationTests method branchLabel.
@Test
public void branchLabel() throws Exception {
String uri = ConfigServerTestUtils.prepareLocalSvnRepo("src/test/resources/svn-config-repo", "target/config");
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).profiles("subversion").run("--spring.cloud.config.server.svn.uri=" + uri);
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
Environment environment = repository.findOne("bar", "staging", "demobranch");
assertTrue(environment.getPropertySources().get(0).getName().contains("bar.properties"));
assertEquals(1, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class SVNKitEnvironmentRepositoryIntegrationTests method vanilla.
@Test
public void vanilla() throws Exception {
String uri = ConfigServerTestUtils.prepareLocalSvnRepo("src/test/resources/svn-config-repo", "target/config");
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE).profiles("subversion").run("--spring.cloud.config.server.svn.uri=" + uri);
EnvironmentRepository repository = this.context.getBean(EnvironmentRepository.class);
repository.findOne("bar", "staging", "trunk");
Environment environment = repository.findOne("bar", "staging", "trunk");
assertEquals(2, environment.getPropertySources().size());
}
use of org.springframework.cloud.config.environment.Environment in project spring-cloud-config by spring-cloud.
the class MultipleJGitEnvironmentLabelPlaceholderRepositoryTests method missingRepo.
@Test
public void missingRepo() {
Environment environment = this.repository.findOne("missing-config-repo", "staging", "master");
assertEquals("Wrong property sources: " + environment, 1, environment.getPropertySources().size());
assertEquals(this.defaultUri + "application.yml", environment.getPropertySources().get(0).getName());
assertVersion(environment);
}
Aggregations