Skip to content

Commit

Permalink
Upgrade dependencies; fix problems
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
artembilan committed Jun 21, 2023
1 parent a147040 commit 8abd72d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 60 deletions.
65 changes: 30 additions & 35 deletions build.gradle
@@ -1,5 +1,5 @@
buildscript {
ext.kotlinVersion = '1.8.10'
ext.kotlinVersion = '1.8.20'
ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey')
repositories {
gradlePluginPortal()
Expand All @@ -15,11 +15,11 @@ buildscript {
}

plugins {
id 'org.sonarqube' version '4.2.0.3129'
id 'org.sonarqube' version '4.2.1.3168'
id 'io.spring.nohttp' version '0.0.11' apply false
id 'org.ajoberstar.grgit' version '4.1.1'
id 'io.spring.dependency-management' version '1.1.0'
id 'com.jfrog.artifactory' version '4.31.9' apply false
id 'com.jfrog.artifactory' version '4.32.0' apply false
id 'org.jetbrains.dokka' version "$kotlinVersion"
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.asciidoctor.jvm.gems' version '3.3.2'
Expand Down Expand Up @@ -48,32 +48,32 @@ ext {
modifiedFiles =
files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }

apacheSshdVersion = '2.9.2'
artemisVersion = '2.28.0'
apacheSshdVersion = '2.10.0'
artemisVersion = '2.29.0'
aspectjVersion = '1.9.19'
assertjVersion = '3.24.2'
assertkVersion = '0.26'
assertkVersion = '0.26.1'
avroVersion = '1.11.1'
awaitilityVersion = '4.2.0'
camelVersion = '3.20.4'
camelVersion = '3.20.6'
commonsDbcp2Version = '2.9.0'
commonsIoVersion = '2.11.0'
commonsNetVersion = '3.9.0'
curatorVersion = '5.5.0'
debeziumVersion = '2.3.0.CR1'
debeziumVersion = '2.3.0.Final'
derbyVersion = '10.16.1.1'
findbugsVersion = '3.0.1'
ftpServerVersion = '1.2.0'
graalvmVersion = '22.3.2'
graalvmVersion = '23.0.0'
greenmailVersion = '2.1.0-alpha-1'
groovyVersion = '4.0.12'
hamcrestVersion = '2.2'
hazelcastVersion = '5.2.3'
hibernateVersion = '6.2.2.Final'
hsqldbVersion = '2.7.1'
hazelcastVersion = '5.3.1'
hibernateVersion = '6.2.5.Final'
hsqldbVersion = '2.7.2'
h2Version = '2.1.214'
jacksonVersion = '2.15.0'
jaxbVersion = '4.0.2'
jacksonVersion = '2.15.2'
jaxbVersion = '4.0.3'
jcifsVersion = '2.1.34'
jeroMqVersion = '0.5.3'
jmsApiVersion = '3.1.0'
Expand All @@ -88,31 +88,31 @@ ext {
lettuceVersion = '6.2.4.RELEASE'
log4jVersion = '2.20.0'
mailVersion = '2.0.2'
micrometerTracingVersion = '1.1.1'
micrometerVersion = '1.11.0'
mockitoVersion = '5.3.1'
micrometerTracingVersion = '1.1.2'
micrometerVersion = '1.11.1'
mockitoVersion = '5.4.0'
mongoDriverVersion = '4.9.1'
mysqlVersion = '8.0.33'
pahoMqttClientVersion = '1.2.5'
postgresVersion = '42.6.0'
protobufVersion = '3.23.0'
protobufVersion = '3.23.3'
r2dbch2Version = '1.0.0.RELEASE'
reactorVersion = '2022.0.7'
reactorVersion = '2022.0.8'
resilience4jVersion = '2.0.2'
romeToolsVersion = '2.1.0'
rsocketVersion = '1.1.3'
rsocketVersion = '1.1.4'
servletApiVersion = '6.0.0'
smackVersion = '4.4.6'
springAmqpVersion = '3.0.4'
springDataVersion = '2023.0.0'
springGraphqlVersion = '1.2.0'
springKafkaVersion = '3.0.7'
springRetryVersion = '2.0.1'
springSecurityVersion = '6.1.0'
springAmqpVersion = '3.0.5'
springDataVersion = '2023.0.1'
springGraphqlVersion = '1.2.1'
springKafkaVersion = '3.0.8'
springRetryVersion = '2.0.2'
springSecurityVersion = '6.1.1'
springVersion = '6.1.0-SNAPSHOT'
springWsVersion = '4.0.4'
testcontainersVersion = '1.18.1'
tomcatVersion = '10.1.8'
testcontainersVersion = '1.18.3'
tomcatVersion = '10.1.10'
xmlUnitVersion = '2.9.1'
xstreamVersion = '1.4.20'
ztZipVersion = '1.15'
Expand Down Expand Up @@ -366,7 +366,7 @@ configure(javaProjects) { subproject ->

checkstyle {
configDirectory.set(rootProject.file('src/checkstyle'))
toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '10.11.0'
toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '10.12.0'
}

jar {
Expand Down Expand Up @@ -884,18 +884,13 @@ project('spring-integration-scripting') {
description = 'Spring Integration Scripting Support'
dependencies {
api project(':spring-integration-core')
optionalApi ('org.jetbrains.kotlin:kotlin-script-util') {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-daemon-client'
}
optionalApi 'org.jetbrains.kotlin:kotlin-compiler-embeddable'
optionalApi 'org.jetbrains.kotlin:kotlin-scripting-jsr223'
providedImplementation "org.graalvm.sdk:graal-sdk:$graalvmVersion"
providedImplementation "org.graalvm.js:js:$graalvmVersion"

testImplementation "org.jruby:jruby-complete:$jrubyVersion"
testImplementation 'org.apache.groovy:groovy-jsr223'
testImplementation "org.python:jython-standalone:$jythonVersion"

testRuntimeOnly 'org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable'
}

tasks.withType(JavaForkOptions) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
Expand Down Expand Up @@ -44,7 +44,6 @@
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

Expand Down Expand Up @@ -96,7 +95,6 @@ public static class Config {
public CachingConnectionFactory cf() throws Exception {
ConnectionFactory cf = mock(ConnectionFactory.class);
cf.setHost("localhost");
cf = spy(cf);
willAnswer(i -> {
this.connection = mock(Connection.class);
willAnswer(ii -> {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
Expand Down Expand Up @@ -576,7 +576,7 @@ void testNackWithLaterInflight() {
ack1.acknowledge(AcknowledgmentCallback.Status.REQUEUE);
assertThat(received2.getHeaders().get(KafkaHeaders.OFFSET)).isEqualTo(1L);
AcknowledgmentCallback ack2 = StaticMessageHeaderAccessor.getAcknowledgmentCallback(received2);
Log log2 = spy(KafkaTestUtils.getPropertyValue(ack1, "logger.log", Log.class));
Log log2 = spy(KafkaTestUtils.getPropertyValue(ack2, "logger.log", Log.class));
new DirectFieldAccessor(ack2).setPropertyValue("logger.log", log2);
given(log2.isWarnEnabled()).willReturn(true);
willDoNothing().given(log2).warn(any());
Expand Down
@@ -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.
Expand All @@ -18,29 +18,24 @@

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
Expand Down
@@ -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.
Expand Down Expand Up @@ -40,9 +40,6 @@ public static ScriptExecutor getScriptExecutor(String language) {
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");
}
Expand Down
@@ -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.
Expand Down Expand Up @@ -48,7 +48,7 @@ public void testParseLanguage() {
RubyScriptExecutor.class,
DefaultScriptExecutor.class,
PythonScriptExecutor.class,
KotlinScriptExecutor.class
DefaultScriptExecutor.class
};

Map<String, ScriptExecutingMessageProcessor> scriptProcessors =
Expand Down
Expand Up @@ -61,7 +61,6 @@
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.springframework.integration.test.mock.MockIntegration.mockMessageHandler;

Expand Down Expand Up @@ -187,7 +186,7 @@ public void testMockMessageHandlerPojoService() {
public void testMockRawHandler() {
ArgumentCaptor<Message<?>> messageArgumentCaptor = MockIntegration.messageArgumentCaptor();
MessageHandler mockMessageHandler =
spy(mockMessageHandler(messageArgumentCaptor))
mockMessageHandler(messageArgumentCaptor)
.handleNext(m -> {
});

Expand Down

0 comments on commit 8abd72d

Please sign in to comment.