|
|
@ -62,8 +62,10 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void severalRepositoriesNoConflict() throws IOException {
|
|
|
|
public void severalRepositoriesNoConflict() throws IOException {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo")) {
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build();
|
|
|
|
try (InputStream bar = getInputStreamFor("bar")) {
|
|
|
|
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar)
|
|
|
|
|
|
|
|
.build();
|
|
|
|
validateFoo(repo);
|
|
|
|
validateFoo(repo);
|
|
|
|
validateBar(repo);
|
|
|
|
validateBar(repo);
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(2);
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(2);
|
|
|
@ -72,11 +74,14 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(6);
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void repositoryWithRoot() throws IOException {
|
|
|
|
public void repositoryWithRoot() throws IOException {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo")) {
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build();
|
|
|
|
try (InputStream root = getInputStreamFor("root")) {
|
|
|
|
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root)
|
|
|
|
|
|
|
|
.build();
|
|
|
|
validateFoo(repo);
|
|
|
|
validateFoo(repo);
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(2);
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(2);
|
|
|
|
|
|
|
|
|
|
|
@ -85,11 +90,14 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(5);
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void severalRepositoriesIdenticalGroups() throws IOException {
|
|
|
|
public void severalRepositoriesIdenticalGroups() throws IOException {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo")) {
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build();
|
|
|
|
try (InputStream foo2 = getInputStreamFor("foo2")) {
|
|
|
|
|
|
|
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2)
|
|
|
|
|
|
|
|
.build();
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(1);
|
|
|
|
assertThat(repo.getAllGroups()).hasSize(1);
|
|
|
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
|
|
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
|
|
|
contains(group.getSources(), "org.acme.Foo", "org.acme.Foo2", "org.springframework.boot.FooProperties");
|
|
|
|
contains(group.getSources(), "org.acme.Foo", "org.acme.Foo2", "org.springframework.boot.FooProperties");
|
|
|
@ -102,6 +110,7 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(5);
|
|
|
|
assertThat(repo.getAllProperties()).hasSize(5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void emptyGroups() throws IOException {
|
|
|
|
public void emptyGroups() throws IOException {
|
|
|
@ -116,8 +125,10 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void builderInstancesAreIsolated() throws IOException {
|
|
|
|
public void builderInstancesAreIsolated() throws IOException {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
|
|
|
|
try (InputStream foo = getInputStreamFor("foo")) {
|
|
|
|
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
|
|
|
|
try (InputStream bar = getInputStreamFor("bar")) {
|
|
|
|
|
|
|
|
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder
|
|
|
|
|
|
|
|
.create();
|
|
|
|
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
|
|
|
|
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
|
|
|
|
validateFoo(firstRepo);
|
|
|
|
validateFoo(firstRepo);
|
|
|
|
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
|
|
|
|
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
|
|
|
@ -131,6 +142,7 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
|
|
|
|
assertThat(secondRepo.getAllProperties()).hasSize(6);
|
|
|
|
assertThat(secondRepo.getAllProperties()).hasSize(6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void validateFoo(ConfigurationMetadataRepository repo) {
|
|
|
|
private void validateFoo(ConfigurationMetadataRepository repo) {
|
|
|
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
|
|
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
|
|
|