-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop support for full YAML content in parent property names
- Loading branch information
Showing
2 changed files
with
0 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,34 +26,6 @@ | |
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
class YamlConfigSourceTest { | ||
@Test | ||
void flatten() { | ||
String yaml = "admin:\n" + | ||
" users:\n" + | ||
" -\n" + | ||
" email: \"[email protected]\"\n" + | ||
" username: \"joe\"\n" + | ||
" password: \"123456\"\n" + | ||
" roles:\n" + | ||
" - \"Moderator\"\n" + | ||
" - \"Admin\"\n" + | ||
" -\n" + | ||
" email: \"[email protected]\"\n" + | ||
" username: \"jack\"\n" + | ||
" password: \"654321\"\n" + | ||
" roles:\n" + | ||
" - \"Moderator\"\n"; | ||
|
||
YamlConfigSource source = new YamlConfigSource("yaml", yaml); | ||
String value = source.getValue("admin.users"); | ||
Users users = new UserConverter().convert(value); | ||
assertEquals(2, users.getUsers().size()); | ||
assertEquals(users.users.get(0).getEmail(), "[email protected]"); | ||
assertEquals(users.users.get(0).getRoles(), Stream.of("Moderator", "Admin").collect(toList())); | ||
|
||
assertEquals("[email protected]", source.getValue("admin.users[0].email")); | ||
} | ||
|
||
@Test | ||
void profiles() { | ||
String yaml = "---\n" + | ||
|
@@ -149,37 +121,6 @@ void indentSpaces() { | |
assertEquals("smallrye", config.getRawValue("greeting.name")); | ||
} | ||
|
||
@Test | ||
void config() { | ||
String yaml = "admin:\n" + | ||
" users:\n" + | ||
" -\n" + | ||
" email: \"[email protected]\"\n" + | ||
" username: \"joe\"\n" + | ||
" password: \"123456\"\n" + | ||
" roles:\n" + | ||
" - \"Moderator\"\n" + | ||
" - \"Admin\"\n" + | ||
" -\n" + | ||
" email: \"[email protected]\"\n" + | ||
" username: \"jack\"\n" + | ||
" password: \"654321\"\n" + | ||
" roles:\n" + | ||
" - \"Moderator\"\n"; | ||
|
||
SmallRyeConfig config = new SmallRyeConfigBuilder() | ||
.withSources(new YamlConfigSource("yaml", yaml)) | ||
.withConverter(Users.class, 100, new UserConverter()) | ||
.build(); | ||
|
||
Users users = config.getValue("admin.users", Users.class); | ||
assertEquals(2, users.getUsers().size()); | ||
assertEquals(users.users.get(0).getEmail(), "[email protected]"); | ||
assertEquals(users.users.get(0).getRoles(), Stream.of("Moderator", "Admin").collect(toList())); | ||
|
||
assertEquals("[email protected]", config.getRawValue("admin.users[0].email")); | ||
} | ||
|
||
@Test | ||
void propertyNames() { | ||
String yaml = "quarkus:\n" + | ||
|