From 84bd78074052bdeb00570c48d83af325c69571d5 Mon Sep 17 00:00:00 2001 From: amihaiemil Date: Fri, 12 Apr 2024 17:30:08 +0300 Subject: [PATCH] readsTypicalSpringApplicationProperties --- .../amihaiemil/eoyaml/RtYamlInputTest.java | 22 +++++++++++++ .../typicalSpringApplicationProperties.yml | 31 ++++++++++++++++++ ...calSpringApplicationProperties_printed.yml | 32 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/test/resources/typicalSpringApplicationProperties.yml create mode 100644 src/test/resources/typicalSpringApplicationProperties_printed.yml diff --git a/src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java b/src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java index 3a8e2f21..b7b9a71e 100644 --- a/src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java +++ b/src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java @@ -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. diff --git a/src/test/resources/typicalSpringApplicationProperties.yml b/src/test/resources/typicalSpringApplicationProperties.yml new file mode 100644 index 00000000..79605916 --- /dev/null +++ b/src/test/resources/typicalSpringApplicationProperties.yml @@ -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 + diff --git a/src/test/resources/typicalSpringApplicationProperties_printed.yml b/src/test/resources/typicalSpringApplicationProperties_printed.yml new file mode 100644 index 00000000..402eb8bc --- /dev/null +++ b/src/test/resources/typicalSpringApplicationProperties_printed.yml @@ -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" \ No newline at end of file