added unit test for svn label fix

This commit is contained in:
jmandawg
2016-08-23 21:23:33 -04:00
parent 67989c78db
commit 16bc9d38b9
2 changed files with 24 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.config.server.environment;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileNotFoundException;
@@ -143,6 +144,20 @@ public class SVNKitEnvironmentRepositoryIntegrationTests {
assertEquals(0, environment.getPropertySources().size());
}
@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(false)
.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());
}
@Configuration
@Import({ PropertyPlaceholderAutoConfiguration.class, EnvironmentRepositoryConfiguration.class })
protected static class TestConfiguration {

View File

@@ -103,6 +103,15 @@ public class SVNKitEnvironmentRepositoryTests {
.contains("bar.properties"));
}
@Test
public void branch_no_folder() {
Environment environment = this.repository.findOne("bar", "staging",
"demobranch");
assertEquals(1, environment.getPropertySources().size());
assertTrue(environment.getPropertySources().get(0).getName()
.contains("bar.properties"));
}
@Test
public void vanilla_with_update() {
this.findOne();