|
16 | 16 |
|
17 | 17 | package com.netflix.graphql.dgs.springgraphql.autoconfig |
18 | 18 |
|
| 19 | +import com.netflix.graphql.dgs.DgsDataLoaderReloadController |
19 | 20 | import com.netflix.graphql.dgs.DgsQueryExecutor |
20 | 21 | import com.netflix.graphql.dgs.autoconfig.DgsConfigurationProperties |
| 22 | +import com.netflix.graphql.dgs.internal.DefaultDgsDataLoaderProvider |
| 23 | +import com.netflix.graphql.dgs.internal.DgsDataLoaderProvider |
21 | 24 | import com.netflix.graphql.dgs.internal.DgsSchemaProvider |
| 25 | +import com.netflix.graphql.dgs.internal.ReloadableDgsDataLoaderProvider |
22 | 26 | import com.netflix.graphql.dgs.mvc.internal.method.HandlerMethodArgumentResolverAdapter |
23 | 27 | import com.netflix.graphql.dgs.reactive.DgsReactiveQueryExecutor |
24 | 28 | import com.netflix.graphql.dgs.reactive.internal.DefaultDgsReactiveGraphQLContextBuilder |
@@ -179,6 +183,44 @@ class DgsSpringGraphQlAutoConfigurationTest { |
179 | 183 | } |
180 | 184 | } |
181 | 185 |
|
| 186 | + @Test |
| 187 | + fun supportsReloadableDataLoaders() { |
| 188 | + // when dgs reload is disabled |
| 189 | + ApplicationContextRunner() |
| 190 | + .withConfiguration(autoConfigurations) |
| 191 | + .withPropertyValues("dgs.reload=false") |
| 192 | + .run { context -> |
| 193 | + assertThat(context) |
| 194 | + .doesNotHaveBean(DgsSpringGraphQLAutoConfiguration.DgsDataLoaderReloadAutoConfiguration::class.java) |
| 195 | + assertThat(context) |
| 196 | + .doesNotHaveBean(ReloadableDgsDataLoaderProvider::class.java) |
| 197 | + assertThat(context) |
| 198 | + .doesNotHaveBean(DgsDataLoaderReloadController::class.java) |
| 199 | + assertThat(context) |
| 200 | + .getBean(DgsDataLoaderProvider::class.java) |
| 201 | + .describedAs { "The primary DgsDataLoaderProvider " } |
| 202 | + .isNotNull |
| 203 | + .isInstanceOf(DefaultDgsDataLoaderProvider::class.java) |
| 204 | + } |
| 205 | + // when dgs reload is enabled |
| 206 | + ApplicationContextRunner() |
| 207 | + .withConfiguration(autoConfigurations) |
| 208 | + .withPropertyValues("dgs.reload=true") |
| 209 | + .run { context -> |
| 210 | + assertThat(context) |
| 211 | + .hasSingleBean(DgsSpringGraphQLAutoConfiguration.DgsDataLoaderReloadAutoConfiguration::class.java) |
| 212 | + assertThat(context) |
| 213 | + .hasSingleBean(ReloadableDgsDataLoaderProvider::class.java) |
| 214 | + assertThat(context) |
| 215 | + .hasSingleBean(DgsDataLoaderReloadController::class.java) |
| 216 | + assertThat(context) |
| 217 | + .getBean(DgsDataLoaderProvider::class.java) |
| 218 | + .describedAs { "The primary DgsDataLoaderProvider " } |
| 219 | + .isNotNull |
| 220 | + .isInstanceOf(ReloadableDgsDataLoaderProvider::class.java) |
| 221 | + } |
| 222 | + } |
| 223 | + |
182 | 224 | @Test |
183 | 225 | fun introspectionDefaultPropertyTest() { |
184 | 226 | ApplicationContextRunner() |
|
0 commit comments