Skip to content

Commit bf270c1

Browse files
committed
spring-cloudGH-370: Enable ScriptProcessor tests back
Fixes spring-cloud#370 * Update dependencies for `script-processor` * Add `maven-surefire-plugin` to `script-processor` POM and specify `--add-opens` for Ruby requirements * Mark all JavaScript tests with `@EnabledIfSystemProperty` against `org.graalvm.language.js.home` which is available only if GraalVM with `js` component enabled * Fix `NewlineAtEndOfFile` rule for Checkstyle since on Windows the line end is `crlf` * Add `components: 'js'` to GraalVM installation steps for all the GH action scripts
1 parent 570a8ec commit bf270c1

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

Diff for: .github/workflows/ci-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
version: 'latest'
3636
java-version: '17'
37-
# components: 'native-image' # add when starting native builds.
37+
components: 'js'
3838
github-token: ${{ secrets.GITHUB_TOKEN }}
3939
- name: 'Configure: cache for maven dependencies'
4040
uses: actions/cache@v3

Diff for: .github/workflows/common.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
with:
187187
version: 'latest'
188188
java-version: ${{ needs.parameters.outputs.jdk_build }}
189-
# components: 'native-image' # add when starting native builds.
189+
components: 'js'
190190
github-token: ${{ secrets.GITHUB_TOKEN }}
191191
- name: 'Configure: cache for maven dependencies'
192192
uses: actions/cache@v3
@@ -277,7 +277,7 @@ jobs:
277277
with:
278278
version: 'latest'
279279
java-version: ${{ needs.parameters.outputs.jdk_build }}
280-
# components: 'native-image' # add when starting native builds.
280+
components: 'js'
281281
github-token: ${{ secrets.GITHUB_TOKEN }}
282282
- name: 'Configure: cache for maven dependencies'
283283
uses: actions/cache@v3
@@ -357,7 +357,7 @@ jobs:
357357
with:
358358
version: 'latest'
359359
java-version: ${{ needs.parameters.outputs.jdk_build }}
360-
# components: 'native-image' # add when starting native builds.
360+
components: 'js'
361361
github-token: ${{ secrets.GITHUB_TOKEN }}
362362
- name: 'Configure: cache for maven dependencies'
363363
uses: actions/cache@v3
@@ -437,7 +437,7 @@ jobs:
437437
with:
438438
version: 'latest'
439439
java-version: ${{ needs.parameters.outputs.jdk_build }}
440-
# components: 'native-image' # add when starting native builds.
440+
components: 'js'
441441
github-token: ${{ secrets.GITHUB_TOKEN }}
442442
- name: 'Configure: cache for maven dependencies'
443443
uses: actions/cache@v3
@@ -514,7 +514,7 @@ jobs:
514514
with:
515515
version: 'latest'
516516
java-version: ${{ needs.parameters.outputs.jdk_build }}
517-
# components: 'native-image' # add when starting native builds.
517+
components: 'js'
518518
github-token: ${{ secrets.GITHUB_TOKEN }}
519519
- name: 'Configure: cache for maven dependencies'
520520
uses: actions/cache@v3

Diff for: applications/processor/script-processor/pom.xml

+13-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</parent>
1616

1717
<properties>
18-
<jruby-complete.version>9.0.5.0</jruby-complete.version>
19-
<jython-standalone.version>2.7.2</jython-standalone.version>
18+
<jruby-complete.version>9.3.9.0</jruby-complete.version>
19+
<jython-standalone.version>2.7.3</jython-standalone.version>
2020
<apache-ivy.version>2.5.1</apache-ivy.version>
2121
</properties>
2222

@@ -78,6 +78,17 @@
7878

7979
<build>
8080
<plugins>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-surefire-plugin</artifactId>
84+
<configuration>
85+
<argLine>
86+
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
87+
--add-opens java.base/java.io=ALL-UNNAMED
88+
</argLine>
89+
</configuration>
90+
</plugin>
91+
8192
<plugin>
8293
<groupId>org.apache.maven.plugins</groupId>
8394
<artifactId>maven-deploy-plugin</artifactId>

Diff for: applications/processor/script-processor/src/test/java/org/springframework/cloud/stream/app/processor/script/ScriptProcessorIntegrationTests.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2022 the original author or authors.
2+
* Copyright 2015-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
1919
import java.io.IOException;
2020

2121
import com.fasterxml.jackson.databind.ObjectMapper;
22-
import org.junit.jupiter.api.Disabled;
2322
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
2424

2525
import org.springframework.boot.WebApplicationType;
2626
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -46,7 +46,7 @@
4646
*/
4747
public class ScriptProcessorIntegrationTests {
4848

49-
@Disabled
49+
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
5050
@Test
5151
public void testJavascriptFunctions() throws IOException {
5252
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -68,7 +68,7 @@ public void testJavascriptFunctions() throws IOException {
6868
}
6969
}
7070

71-
@Disabled
71+
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
7272
@Test
7373
public void testJavascriptVariableTake1() {
7474
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -88,7 +88,7 @@ public void testJavascriptVariableTake1() {
8888
}
8989
}
9090

91-
@Disabled
91+
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
9292
@Test
9393
public void testJavascriptVariableTake2() {
9494
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -104,7 +104,7 @@ public void testJavascriptVariableTake2() {
104104

105105
processorInput.send(new GenericMessage<>(9));
106106
Message<byte[]> sourceMessage = processorOutput.receive(10000, "scriptProcessorFunction-out-0");
107-
assertThat(new String(sourceMessage.getPayload())).isEqualTo("45.0");
107+
assertThat(new String(sourceMessage.getPayload())).isEqualTo("45");
108108
}
109109
}
110110

@@ -146,7 +146,6 @@ public void testGroovyComplex() {
146146
}
147147
}
148148

149-
@Disabled
150149
@Test
151150
public void testRubyScript() {
152151
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -165,7 +164,6 @@ public void testRubyScript() {
165164
}
166165
}
167166

168-
@Disabled
169167
@Test
170168
public void testRubyScriptComplex() {
171169
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -220,7 +218,7 @@ public void testPythonComplex() {
220218
}
221219
}
222220

223-
@Disabled
221+
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
224222
@Test
225223
public void testGroovyToJavascript() {
226224
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
@@ -241,7 +239,8 @@ public void testGroovyToJavascript() {
241239
}
242240

243241
@EnableAutoConfiguration
244-
@Import({ScriptProcessorConfiguration.class})
242+
@Import(ScriptProcessorConfiguration.class)
245243
public static class ScriptProcessorTestConfiguration {
246244
}
245+
247246
}

Diff for: etc/checkstyle/checkstyle.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
<property name="headerFile" value="${checkstyle.header.file}"/>
2121
<property name="fileExtensions" value="java,groovy"/>
2222
</module>
23-
<module name="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck">
24-
<property name="lineSeparator" value="lf"/>
25-
</module>
23+
24+
<module name="NewlineAtEndOfFile"/>
2625

2726
<!-- TreeWalker Checks -->
2827
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">

0 commit comments

Comments
 (0)