Upgrade dependencies; fix problems

* Mockito doesn't allow to `spy()` mocks any more or "overspy"
* Deprecate `KotlinScriptExecutor` if favor of fully supported JSR223
service loaded via `DefaultScriptExecutor`
* Use only one `kotlin-scripting-jsr223` dependency
This commit is contained in:
abilan
2023-06-21 17:39:55 -04:00
parent a147040072
commit 8abd72d7c0
7 changed files with 44 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,29 +18,24 @@ package org.springframework.integration.scripting.jsr223;
import javax.script.Bindings;
import javax.script.ScriptEngine;
import org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory;
import javax.script.ScriptEngineManager;
/**
* An {@link AbstractScriptExecutor} for the Kotlin scripts support.
* Uses {@link KotlinJsr223JvmLocalScriptEngineFactory} directly since there is
* no {@code META-INF/services/javax.script.ScriptEngineFactory} file in CLASSPATH.
* Also sets an {@code idea.use.native.fs.for.win} system property to {@code false}
* to disable a native engine discovery for Windows: bay be resolved in the future Kotlin versions.
*
* @author Artem Bilan
*
* @since 5.2
*
* @deprecated since 6.2 in favor of {@link DefaultScriptExecutor} with {@code kotlin}
* as an argument.
*/
@Deprecated(since = "6.2", forRemoval = true)
public class KotlinScriptExecutor extends AbstractScriptExecutor {
static {
System.setProperty("idea.use.native.fs.for.win", "false");
}
public KotlinScriptExecutor() {
super(new KotlinJsr223JvmLocalScriptEngineFactory().getScriptEngine());
super(new ScriptEngineManager().getEngineByName("kotlin"));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,9 +40,6 @@ public final class ScriptExecutorFactory {
else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) {
return new RubyScriptExecutor();
}
else if (language.equalsIgnoreCase("kotlin")) {
return new KotlinScriptExecutor();
}
else if (language.equalsIgnoreCase("js") || language.equalsIgnoreCase("javascript")) {
return new PolyglotScriptExecutor("js");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class DeriveLanguageFromExtensionTests {
RubyScriptExecutor.class,
DefaultScriptExecutor.class,
PythonScriptExecutor.class,
KotlinScriptExecutor.class
DefaultScriptExecutor.class
};
Map<String, ScriptExecutingMessageProcessor> scriptProcessors =