Skip to content

Commit d09ab41

Browse files
committed
Add tests for Joran
Signed-off-by: Dmitry Sulman <[email protected]>
1 parent 101bfee commit d09ab41

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

logback-access-reactor-netty-spring-boot-starter/src/test/kotlin/io/github/dmitrysulman/logback/access/reactor/netty/joran/LogbackAccessJoranConfiguratorTests.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ import reactor.netty.http.server.logging.AccessLogArgProvider
1919
class LogbackAccessJoranConfiguratorTests {
2020
@ParameterizedTest
2121
@CsvSource(
22-
"dev, logback-access-springprofile-dev.xml",
23-
"'dev,prod',logback-access-springprofile-dev.xml",
24-
"dev, logback-access-springprofile-included.xml",
25-
"'dev,prod',logback-access-springprofile-included.xml",
22+
"dev, logback-access-springprofile-dev.xml",
23+
"'dev,prod', logback-access-springprofile-dev.xml",
24+
"dev, logback-access-springprofile-included.xml",
25+
"'dev,prod', logback-access-springprofile-included.xml",
26+
"dev, logback-access-springprofile-dev-prod.xml",
27+
"prod, logback-access-springprofile-dev-prod.xml",
28+
"'dev,prod', logback-access-springprofile-dev-prod.xml",
29+
"'dev,prod,stg',logback-access-springprofile-dev-prod.xml",
30+
"'dev,stg', logback-access-springprofile-dev-prod.xml",
31+
"'prod,stg', logback-access-springprofile-dev-prod.xml",
2632
)
2733
fun `should log event with springProfile configuration`(
2834
profile: String,
@@ -49,12 +55,13 @@ class LogbackAccessJoranConfiguratorTests {
4955
strings = [
5056
"logback-access-springprofile-dev.xml",
5157
"logback-access-springprofile-included.xml",
58+
"logback-access-springprofile-dev-prod.xml",
5259
],
5360
)
5461
fun `should not log event with prod springProfile configuration`(filename: String) {
5562
ReactiveWebApplicationContextRunner()
5663
.withConfiguration(AutoConfigurations.of(ReactorNettyAccessLogFactoryAutoConfiguration::class.java))
57-
.withPropertyValues("spring.profiles.active=prod")
64+
.withPropertyValues("spring.profiles.active=stg")
5865
.withPropertyValues("logback.access.reactor.netty.config=classpath:$filename")
5966
.run { context ->
6067
val factory = context.getBean<ReactorNettyAccessLogFactory>()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<configuration>
2+
<springProfile name="dev,prod">
3+
<appender name="CAPTURE" class="io.github.dmitrysulman.logback.access.reactor.netty.EventCaptureAppender"/>
4+
<appender-ref ref="CAPTURE"/>
5+
</springProfile>
6+
</configuration>

0 commit comments

Comments
 (0)