|
|
@@ -13,10 +13,15 @@ import cn.yunzhixue.ability.center.examsprint.infrastructure.report.rendering.ou
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
+import org.springframework.boot.context.properties.bind.Binder;
|
|
|
+import org.springframework.boot.env.YamlPropertySourceLoader;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
+import org.springframework.core.env.StandardEnvironment;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.time.Duration;
|
|
|
import java.time.Instant;
|
|
|
|
|
|
@@ -59,6 +64,21 @@ class ExamSprintReportRuntimeConfigurationTest {
|
|
|
assertThat(properties.getPdf().getPageMaxRenderCount()).isEqualTo(123);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void productionYamlExposesPdfPageReuseSettingsForOperationsOverride() throws IOException {
|
|
|
+ StandardEnvironment environment = new StandardEnvironment();
|
|
|
+ YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
|
|
|
+ loader.load("application-prod", new ClassPathResource("application-prod.yml"))
|
|
|
+ .forEach(propertySource -> environment.getPropertySources().addLast(propertySource));
|
|
|
+
|
|
|
+ ExamSprintReportRuntimeConfiguration.BoundExamSprintReportProperties bound = Binder.get(environment)
|
|
|
+ .bind("ability.exam-sprint.report", ExamSprintReportRuntimeConfiguration.BoundExamSprintReportProperties.class)
|
|
|
+ .orElseThrow(IllegalStateException::new);
|
|
|
+
|
|
|
+ assertThat(bound.getPdf().isPageReuseEnabled()).isTrue();
|
|
|
+ assertThat(bound.getPdf().getPageMaxRenderCount()).isEqualTo(200);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void examSprintReportWarmupRunnerIsRegisteredAndWiredBySpringContext() {
|
|
|
new ApplicationContextRunner()
|