Skip to content

Commit edce302

Browse files
committed
Remove tests for Kotlin Script Templates
Closes gh-34030
1 parent 3eb5b82 commit edce302

File tree

27 files changed

+28
-423
lines changed

27 files changed

+28
-423
lines changed

spring-webflux/spring-webflux.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ dependencies {
5353
testImplementation("org.eclipse.jetty:jetty-reactive-httpclient")
5454
testImplementation("org.eclipse.jetty:jetty-server")
5555
testImplementation("org.hibernate:hibernate-validator")
56-
testImplementation("org.jetbrains.kotlin:kotlin-script-runtime")
5756
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
5857
testRuntimeOnly("com.sun.xml.bind:jaxb-core")
5958
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
6059
testRuntimeOnly("com.sun.activation:jakarta.activation")
6160
testRuntimeOnly("io.netty:netty5-buffer")
6261
testRuntimeOnly("org.glassfish:jakarta.el")
63-
testRuntimeOnly("org.jetbrains.kotlin:kotlin-scripting-jsr223")
6462
testRuntimeOnly("org.jruby:jruby")
6563
testRuntimeOnly("org.python:jython-standalone")
6664
testRuntimeOnly("org.webjars:underscorejs")

spring-webflux/src/test/java/org/springframework/web/reactive/result/view/FragmentViewResolutionResultHandlerTests.java

+5-12
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3434
import org.springframework.context.annotation.Bean;
3535
import org.springframework.context.annotation.Configuration;
36-
import org.springframework.context.support.ResourceBundleMessageSource;
3736
import org.springframework.core.MethodParameter;
3837
import org.springframework.http.MediaType;
3938
import org.springframework.web.reactive.BindingContext;
@@ -53,6 +52,7 @@
5352
* Tests for {@link Fragment} rendering through {@link ViewResolutionResultHandler}.
5453
*
5554
* @author Rossen Stoyanchev
55+
* @author Sebastien Deleuze
5656
*/
5757
public class FragmentViewResolutionResultHandlerTests {
5858

@@ -138,8 +138,8 @@ private ViewResolutionResultHandler initHandler() {
138138
AnnotationConfigApplicationContext context =
139139
new AnnotationConfigApplicationContext(ScriptTemplatingConfiguration.class);
140140

141-
String prefix = "org/springframework/web/reactive/result/view/script/kotlin/";
142-
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".kts");
141+
String prefix = "org/springframework/web/reactive/result/view/script/jython/";
142+
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".html");
143143
viewResolver.setApplicationContext(context);
144144
viewResolver.setSupportedMediaTypes(List.of(MediaType.TEXT_HTML, MediaType.TEXT_EVENT_STREAM));
145145

@@ -166,18 +166,11 @@ static class ScriptTemplatingConfiguration {
166166
@Bean
167167
public ScriptTemplateConfigurer kotlinScriptConfigurer() {
168168
ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
169-
configurer.setEngineName("kotlin");
170-
configurer.setScripts("org/springframework/web/reactive/result/view/script/kotlin/render.kts");
169+
configurer.setEngineName("jython");
170+
configurer.setScripts("org/springframework/web/reactive/result/view/script/jython/render.py");
171171
configurer.setRenderFunction("render");
172172
return configurer;
173173
}
174-
175-
@Bean
176-
public ResourceBundleMessageSource messageSource() {
177-
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
178-
messageSource.setBasename("org/springframework/web/reactive/result/view/script/messages");
179-
return messageSource;
180-
}
181174
}
182175

183176
}

spring-webflux/src/test/java/org/springframework/web/reactive/result/view/script/KotlinScriptTemplateTests.java

-131
This file was deleted.

spring-webflux/src/test/kotlin/org/springframework/web/reactive/result/view/script/ScriptTemplateWithBindingsExtensions.kt

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Hello $foo
3+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Hello $bar
3+
</p>

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/eval.kts

-4
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/footer.html

-1
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/fragment1.kts

-6
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/fragment2.kts

-6
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/header.html

-1
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/render.kts

-16
This file was deleted.

spring-webflux/src/test/resources/org/springframework/web/reactive/result/view/script/kotlin/template.kts

-5
This file was deleted.

spring-webmvc/spring-webmvc.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ dependencies {
6060
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
6161
}
6262
testImplementation("org.hibernate:hibernate-validator")
63-
testImplementation("org.jetbrains.kotlin:kotlin-script-runtime")
6463
testImplementation("org.mozilla:rhino")
6564
testImplementation("org.skyscreamer:jsonassert")
6665
testImplementation("org.xmlunit:xmlunit-assertj")
@@ -70,7 +69,6 @@ dependencies {
7069
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
7170
testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5")
7271
testRuntimeOnly("org.glassfish:jakarta.el")
73-
testRuntimeOnly("org.jetbrains.kotlin:kotlin-scripting-jsr223")
7472
testRuntimeOnly("org.jruby:jruby")
7573
testRuntimeOnly("org.python:jython-standalone")
7674
testRuntimeOnly("org.webjars:underscorejs")

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/FragmentRenderingStreamTests.java

+6-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2727
import org.springframework.context.annotation.Bean;
2828
import org.springframework.context.annotation.Configuration;
29-
import org.springframework.context.support.ResourceBundleMessageSource;
3029
import org.springframework.core.MethodParameter;
3130
import org.springframework.core.ReactiveAdapterRegistry;
3231
import org.springframework.core.task.SyncTaskExecutor;
@@ -50,7 +49,9 @@
5049

5150
/**
5251
* Tests for streaming of {@link ModelAndView} fragments.
52+
*
5353
* @author Rossen Stoyanchev
54+
* @author Sebastien Deleuze
5455
*/
5556
public class FragmentRenderingStreamTests {
5657

@@ -72,8 +73,8 @@ void setUp() {
7273
AnnotationConfigApplicationContext context =
7374
new AnnotationConfigApplicationContext(ScriptTemplatingConfiguration.class);
7475

75-
String prefix = "org/springframework/web/servlet/view/script/kotlin/";
76-
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".kts");
76+
String prefix = "org/springframework/web/servlet/view/script/jython/";
77+
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".html");
7778
viewResolver.setApplicationContext(context);
7879

7980
this.handler = new ResponseBodyEmitterReturnValueHandler(
@@ -165,18 +166,12 @@ static class ScriptTemplatingConfiguration {
165166
@Bean
166167
ScriptTemplateConfigurer kotlinScriptConfigurer() {
167168
ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
168-
configurer.setEngineName("kotlin");
169-
configurer.setScripts("org/springframework/web/servlet/view/script/kotlin/render.kts");
169+
configurer.setEngineName("jython");
170+
configurer.setScripts("org/springframework/web/servlet/view/script/jython/render.py");
170171
configurer.setRenderFunction("render");
171172
return configurer;
172173
}
173174

174-
@Bean
175-
ResourceBundleMessageSource messageSource() {
176-
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
177-
messageSource.setBasename("org/springframework/web/servlet/view/script/messages");
178-
return messageSource;
179-
}
180175
}
181176

182177
}

spring-webmvc/src/test/java/org/springframework/web/servlet/view/DefaultFragmentsRenderingTests.java

+5-14
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,23 @@
2121
import java.util.Map;
2222

2323
import org.junit.jupiter.api.Test;
24-
import org.junit.jupiter.api.condition.DisabledForJreRange;
2524

2625
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2726
import org.springframework.context.annotation.Bean;
2827
import org.springframework.context.annotation.Configuration;
29-
import org.springframework.context.support.ResourceBundleMessageSource;
3028
import org.springframework.web.servlet.view.script.ScriptTemplateConfigurer;
3129
import org.springframework.web.servlet.view.script.ScriptTemplateViewResolver;
3230
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
3331
import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
3432

3533
import static org.assertj.core.api.Assertions.assertThat;
36-
import static org.junit.jupiter.api.condition.JRE.JAVA_21;
3734

3835
/**
3936
* Tests for rendering through {@link DefaultFragmentsRendering}.
4037
*
4138
* @author Rossen Stoyanchev
39+
* @author Sebastien Deleuze
4240
*/
43-
@DisabledForJreRange(min = JAVA_21, disabledReason = "Kotlin doesn't support Java 21+ yet")
4441
public class DefaultFragmentsRenderingTests {
4542

4643
@Test
@@ -49,8 +46,8 @@ void render() throws Exception {
4946
AnnotationConfigApplicationContext context =
5047
new AnnotationConfigApplicationContext(ScriptTemplatingConfiguration.class);
5148

52-
String prefix = "org/springframework/web/servlet/view/script/kotlin/";
53-
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".kts");
49+
String prefix = "org/springframework/web/servlet/view/script/jython/";
50+
ScriptTemplateViewResolver viewResolver = new ScriptTemplateViewResolver(prefix, ".html");
5451
viewResolver.setApplicationContext(context);
5552

5653
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -82,18 +79,12 @@ static class ScriptTemplatingConfiguration {
8279
@Bean
8380
ScriptTemplateConfigurer kotlinScriptConfigurer() {
8481
ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
85-
configurer.setEngineName("kotlin");
86-
configurer.setScripts("org/springframework/web/servlet/view/script/kotlin/render.kts");
82+
configurer.setEngineName("jython");
83+
configurer.setScripts("org/springframework/web/servlet/view/script/jython/render.py");
8784
configurer.setRenderFunction("render");
8885
return configurer;
8986
}
9087

91-
@Bean
92-
ResourceBundleMessageSource messageSource() {
93-
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
94-
messageSource.setBasename("org/springframework/web/servlet/view/script/messages");
95-
return messageSource;
96-
}
9788
}
9889

9990
}

0 commit comments

Comments
 (0)