Skip to content

Commit

Permalink
[CYB-3] Deprecated Nashorn and fully switched to GraalJS. TODO fix 1.…
Browse files Browse the repository at this point in the history
…0->1 issue (refer to tests)
  • Loading branch information
stas-panasiuk committed Mar 11, 2024
1 parent 241a37e commit 2dd87dc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
import java.util.concurrent.TimeUnit;

public enum RuleType {
JS(new JavaScriptNashornEngineBuilder()),
JS_NEW(new JavaScriptGraaljsEngineBuilder()),
JS(new JavaScriptGraaljsEngineBuilder()),
@Deprecated
JS_NASHORN(new JavaScriptNashornEngineBuilder()),
PYTHON(new PythonEngineBuilder()),
STELLAR(new StellarEngineBuilder());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


@Slf4j
@Deprecated
public class JavaScriptNashornEngine extends JavaScriptEngine {
private static final String ENGINE_NAME = "javascript";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@Getter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Deprecated
public class JavaScriptNashornEngineBuilder extends RuleEngineBuilder<JavaScriptNashornEngine> {
@Override
public JavaScriptNashornEngine build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ public void testJavascriptWithErrors(RuleEngineBuilder<? extends JavaScriptEngin
assertThat(validEngine.validate(), equalTo(true));
}

//FIXME resolve GraalJS 1.0 -> 1 conversion problem
// @ParameterizedTest
// @MethodSource("jsBuilders")
@ParameterizedTest
@MethodSource("jsBuilders")
public void testProperNumberConversion(RuleEngineBuilder<? extends JavaScriptEngine> jsBuilder) {
RuleEngine engine = jsBuilder.script("return { testInt: 1, testDouble: 1.0 }").build();
Map<String, Object> result = engine.feed(createMessage(Message.builder()
Expand Down

0 comments on commit 2dd87dc

Please sign in to comment.