Skip to content

Commit

Permalink
readsTypicalSpringApplicationProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Apr 12, 2024
1 parent 2e3ee98 commit 84bd780
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,28 @@ public void readsFlowSequenceOneLine() throws IOException {
);
}

/**
* We can read a typical application.yml from Spring.
* @throws IOException If something goes wrong.
*/
@Test
public void readsTypicalSpringApplicationProperties() throws IOException {
final YamlInput input = Yaml.createYamlInput(
new FileReader(
"src/test/resources/typicalSpringApplicationProperties.yml"
)
);
final YamlMapping read = input.readYamlMapping();
MatcherAssert.assertThat(
read.toString(),
Matchers.equalTo(
this.readTestResource(
"typicalSpringApplicationProperties_printed.yml"
)
)
);
}

/**
* Read a test resource file's contents.
* @param fileName File to read.
Expand Down
31 changes: 31 additions & 0 deletions src/test/resources/typicalSpringApplicationProperties.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
logging:
level:
com:
selfxdsd: DEBUG
file:
name: ${self_logging_path}self-web-xdsd.log
spring:
security:
oauth2:
client:
registration:
github:
client-id: ${gh_client_id}
client-secret: ${gh_client_secret}
scope: repo
gitlab:
client-id: ${gl_client_id}
client-secret: ${gl_client_secret}
authorization-grant-type: authorization_code
redirect-uri: ${self_xdsd_base_url}/login/oauth2/code/gitlab
client-authentication-method: 'basic'
scope: [api, read_user]
mail:
host: mailhog.keycloak.svc.cluster.local
port: 1025
cloud:
kubernetes:
enabled: true
leader:
config-map-name: self-leader-election

32 changes: 32 additions & 0 deletions src/test/resources/typicalSpringApplicationProperties_printed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
logging:
level:
com:
selfxdsd: DEBUG
file:
name: "${self_logging_path}self-web-xdsd.log"
spring:
security:
oauth2:
client:
registration:
github:
"client-id": "${gh_client_id}"
"client-secret": "${gh_client_secret}"
scope: repo
gitlab:
"client-id": "${gl_client_id}"
"client-secret": "${gl_client_secret}"
"authorization-grant-type": authorization_code
"redirect-uri": "${self_xdsd_base_url}/login/oauth2/code/gitlab"
"client-authentication-method": basic
scope:
- api
- read_user
mail:
host: mailhog.keycloak.svc.cluster.local
port: 1025
cloud:
kubernetes:
enabled: true
leader:
"config-map-name": "self-leader-election"

0 comments on commit 84bd780

Please sign in to comment.