From a80b22638d8a60b32c67126d7aa41ca0350d4b32 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 3 Nov 2021 09:38:10 -0400 Subject: [PATCH] Start 6.0 version * Upgrade to Java 17, SF-6.0, Gradle 7.2 * Upgrade to Jakarta dependencies and respective namespaces * Fix some tests for Java 17 compatibility * Fix wrong Javadocs * Add some missed Javadocs * Fix more `jakarta` namespace * Fix WS & XML modules to use Jakarta EE * `--add-opens` in some modules for their reflection-based tests * Disable Kafka tests which does not work on Windows; see Apache Kafka `3.0.1` * Upgrade to JUnit `5.8.1` * Migrate JMS tests to Artemis * Remove RMI module as it was deprecated before * Fix `pr-build-workflow.yml` for Java 17 * Fix JavaDocs warnings using `Xdoclint:syntax` per module, not in the top-level `api` task * Move docs for version `6.0` --- .github/workflows/pr-build-workflow.yml | 2 +- build.gradle | 1601 +++++++++-------- gradle.properties | 4 +- .../json/Jackson2JsonObjectMapper.java | 2 +- ...aultOutboundChannelAdapterParserTests.java | 15 +- .../dsl/LambdaMessageProcessorTests.java | 2 + .../handler/DelayHandlerTests.java | 35 +- .../event/core/MessagingEvent.java | 12 +- ...licationEventListeningMessageProducer.java | 5 +- ...lAdapterParserTests-file-usage-context.xml | 2 +- .../FeedInboundChannelAdapterParserTests.java | 25 +- .../FileInboundChannelAdapterParserTests.java | 13 +- .../file/splitter/FileSplitterTests.java | 13 +- .../tail/FileTailingMessageProducerTests.java | 20 +- ...GroovyScriptExecutingMessageProcessor.java | 10 +- .../HttpRequestHandlingController.java | 6 +- .../HttpRequestHandlingEndpointSupport.java | 8 +- .../HttpRequestHandlingMessagingGateway.java | 6 +- ...tegrationRequestMappingHandlerMapping.java | 6 +- .../HttpInboundChannelAdapterParserTests.java | 2 +- .../config/HttpInboundGatewayParserTests.java | 13 +- .../HttpRequestHandlingControllerTests.java | 6 +- ...pRequestHandlingMessagingGatewayTests.java | 2 +- ...Int2312RequestMappingIntegrationTests.java | 27 +- .../inbound/MultipartAsRawByteArrayTests.java | 16 +- .../ip/dsl/IpIntegrationTests.java | 17 +- .../tcp/connection/TcpNioConnectionTests.java | 3 + ...BeanPropertySqlParameterSourceFactory.java | 10 +- ...onEvaluatingSqlParameterSourceFactory.java | 5 +- .../integration/jdbc/JdbcMessageHandler.java | 11 +- .../integration/jdbc/JdbcOutboundGateway.java | 43 +- .../jdbc/JdbcPollingChannelAdapter.java | 34 +- .../jdbc/MessagePreparedStatementSetter.java | 10 +- .../jdbc/lock/JdbcLockRegistry.java | 5 +- .../integration/jdbc/lock/LockRepository.java | 25 +- .../jdbc/store/JdbcChannelMessageStore.java | 8 + .../jdbc/store/channel/MessageRowMapper.java | 9 +- .../ChannelPublishingJmsMessageListener.java | 46 +- .../jms/DefaultJmsHeaderMapper.java | 18 +- .../integration/jms/DynamicJmsTemplate.java | 4 +- .../jms/JmsDestinationPollingSource.java | 12 +- .../integration/jms/JmsHeaderMapper.java | 4 +- .../integration/jms/JmsOutboundGateway.java | 106 +- .../jms/JmsSendingMessageHandler.java | 6 +- .../jms/SubscribableJmsChannel.java | 6 +- .../jms/config/JmsChannelFactoryBean.java | 8 +- .../jms/config/JmsChannelParser.java | 2 +- .../integration/jms/dsl/Jms.java | 10 +- .../jms/dsl/JmsDestinationAccessorSpec.java | 8 +- .../jms/dsl/JmsInboundChannelAdapterSpec.java | 6 +- .../jms/dsl/JmsInboundGatewaySpec.java | 2 +- .../jms/dsl/JmsListenerContainerSpec.java | 6 +- .../jms/dsl/JmsMessageChannelSpec.java | 2 +- .../JmsMessageDrivenChannelAdapterSpec.java | 4 +- .../dsl/JmsOutboundChannelAdapterSpec.java | 4 +- .../jms/dsl/JmsOutboundGatewaySpec.java | 8 +- .../dsl/JmsPollableMessageChannelSpec.java | 6 +- ...JmsPublishSubscribeMessageChannelSpec.java | 4 +- .../jms/config/spring-integration-jms.xsd | 34 +- .../jms/ActiveMQMultiContextTests.java | 38 +- ...nnelPublishingJmsMessageListenerTests.java | 18 +- .../jms/DefaultJmsHeaderMapperTests.java | 76 +- .../jms/JmsInboundChannelAdapterTests.java | 2 +- .../jms/JmsOutboundGatewayTests.java | 16 +- .../JmsOutboundInsideChainTests-context.xml | 4 +- .../jms/OutboundGatewayConnectionTests.java | 37 +- .../jms/OutboundGatewayFunctionTests.java | 34 +- .../jms/PollableJmsChannelTests.java | 13 +- .../integration/jms/StubConnection.java | 20 +- .../integration/jms/StubConsumer.java | 10 +- .../integration/jms/StubDestination.java | 4 +- .../integration/jms/StubMessageConverter.java | 8 +- .../integration/jms/StubProducer.java | 14 +- .../integration/jms/StubQueue.java | 6 +- .../integration/jms/StubSession.java | 38 +- .../integration/jms/StubTextMessage.java | 8 +- .../jms/SubscribableJmsChannelTests.java | 8 +- ...ceptionHandlingSiConsumerTests-context.xml | 10 +- .../ExceptionHandlingSiConsumerTests.java | 6 +- ...xtractRequestReplyPayloadTests-context.xml | 2 +- .../ExtractRequestReplyPayloadTests.java | 16 +- .../GlobalChannelInterceptorTests-context.xml | 2 +- .../InboundOneWayErrorTests-context.xml | 4 +- .../jms/config/InboundOneWayErrorTests.java | 4 +- .../config/JmsChannelHistoryTests-context.xml | 2 +- .../config/JmsChannelParserTests-context.xml | 8 +- .../jms/config/JmsChannelParserTests.java | 14 +- .../config/JmsDynamicDestinationTests.java | 6 +- .../jms/config/JmsHeaderEnricherTests.java | 4 +- .../config/JmsInboundGatewayParserTests.java | 35 +- .../config/JmsMessageDrivenEndpointTests.java | 4 +- .../jms/config/JmsMessageHistoryTests.java | 4 +- .../JmsOutboundChannelAdapterParserTests.java | 4 +- .../config/JmsOutboundGatewayParserTests.java | 11 +- .../jms/config/JmsPriorityTests.java | 20 +- ...rshallingMessageConverterTests-context.xml | 4 +- .../jms/config/TestJmsHeaderMapper.java | 4 +- .../jms/config/TestMessageConverter.java | 12 +- .../config/gatewayMaintainsReplyChannel.xml | 4 +- .../jms/config/jmsGatewayWithReplyChannel.xml | 4 +- .../integration/jms/dsl/JmsTests.java | 2 +- .../jms/request_reply/AsyncGatewayTests.java | 4 +- ...eplyScenariosWithCachedConsumersTests.java | 12 +- ...yScenariosWithNonCachedConsumersTests.java | 8 +- ...eplyScenariosWithTempReplyQueuesTests.java | 35 +- .../jms/request_reply/broken-broker.xml | 2 +- .../explicit-correlation-key.xml | 8 +- .../producer-cached-consumers.xml | 20 +- .../producer-no-cached-consumers.xml | 16 +- .../producer-temp-reply-consumers.xml | 2 +- .../integration/jms/dsl/JmsDslKotlinTests.kt | 2 +- .../src/test/resources/log4j2-test.xml | 3 +- .../NotificationListeningMessageProducer.java | 6 +- .../NotificationPublishingMessageHandler.java | 9 +- .../IntegrationMBeanExportConfiguration.java | 9 +- .../jpa/core/AbstractJpaOperations.java | 6 +- .../jpa/core/DefaultJpaOperations.java | 8 +- .../integration/jpa/core/JpaExecutor.java | 22 +- .../integration/jpa/core/JpaOperations.java | 26 +- .../integration/jpa/dsl/Jpa.java | 6 +- .../jpa/dsl/JpaInboundChannelAdapterSpec.java | 4 +- .../dsl/JpaRetrievingOutboundGatewaySpec.java | 6 +- .../dsl/JpaUpdatingOutboundEndpointSpec.java | 10 +- .../integration/jpa/support/JpaUtils.java | 6 +- .../jpa/config/spring-integration-jpa.xsd | 4 +- .../jpa/core/AbstractJpaOperationsTests.java | 4 +- .../jpa/core/JpaExecutorTests.java | 11 +- .../integration/jpa/dsl/JpaTests.java | 19 +- .../JpaPollingChannelAdapterTests.java | 2 +- .../JpaOutboundChannelAdapterTests.java | 20 +- .../JpaOutboundGatewayIntegrationTests.java | 18 +- .../jpa/test/TestHibernateJpaDialect.java | 13 +- .../jpa/test/entity/StudentDomain.java | 24 +- .../jpa/test/entity/StudentReadStatus.java | 14 +- .../kafka/channnel/ChannelTests.java | 5 +- .../kafka/config/xml/AllXmlTests.java | 5 +- .../integration/kafka/dsl/KafkaDslTests.java | 5 +- .../kafka/inbound/InboundGatewayTests.java | 5 +- .../inbound/MessageDrivenAdapterTests.java | 3 + .../MessageSourceIntegrationTests.java | 3 + .../KafkaProducerMessageHandlerTests.java | 3 + .../kafka/dsl/kotlin/KafkaDslKotlinTests.kt | 22 +- .../mail/AbstractMailReceiver.java | 28 +- .../mail/ImapIdleChannelAdapter.java | 12 +- .../integration/mail/ImapMailReceiver.java | 24 +- .../integration/mail/MailReceiver.java | 7 +- .../mail/MailSendingMessageHandler.java | 4 +- .../integration/mail/MailTransportUtils.java | 14 +- .../integration/mail/Pop3MailReceiver.java | 10 +- .../integration/mail/SearchTermStrategy.java | 6 +- .../mail/config/MailReceiverFactoryBean.java | 10 +- .../mail/dsl/ImapIdleChannelAdapterSpec.java | 18 +- .../dsl/MailInboundChannelAdapterSpec.java | 18 +- .../dsl/MailSendingMessageHandlerSpec.java | 4 +- .../mail/support/DefaultMailHeaderMapper.java | 4 +- .../integration/mail/support/MailUtils.java | 6 +- .../AbstractMailMessageTransformer.java | 10 +- .../transformer/MailToStringTransformer.java | 8 +- .../mail/config/spring-integration-mail.xsd | 10 +- .../mail/ImapMailReceiverTests.java | 32 +- .../mail/ImapMailSearchTermsTests.java | 14 +- .../integration/mail/MailReceiverTests.java | 10 +- .../mail/MailReceivingMessageSourceTests.java | 12 +- ...dingMessageHandlerContextTests-context.xml | 4 +- ...MailSendingMessageHandlerContextTests.java | 6 +- .../mail/MailSendingMessageHandlerTests.java | 8 +- .../mail/Pop3MailReceiverTests.java | 10 +- .../integration/mail/StubJavaMailSender.java | 2 +- .../DefaultConfigurationTests-context.xml | 4 +- .../ImapIdleChannelAdapterParserTests.java | 8 +- .../mail/config/ImapIdleIntegrationTests.java | 4 +- ...boundChannelAdapterParserTests-context.xml | 2 +- .../InboundChannelAdapterParserTests.java | 2 +- .../MailToStringTransformerParserTests.java | 6 +- .../config/MessageWithContentTypeTests.java | 4 +- .../config/PollingMailSourceParserTests.java | 2 +- .../integration/mail/config/Pop3Tests.java | 6 +- .../integration/mail/config/SmtpTests.java | 6 +- .../mailOutboundChannelAdapterParserTests.xml | 4 +- .../integration/mail/dsl/MailTests.java | 20 +- .../metadata/MongoDbMetadataStore.java | 1 - ...boundChannelAdapterParserTests-context.xml | 3 +- ...oundChannelAdapterParserTests-context.xml} | 3 +- ...goDbOutboundChannelAdapterParserTests.java | 73 +- ...goDbOutboundGatewayParserTests-context.xml | 3 +- ...MqttOutboundChannelAdapterParserTests.java | 3 +- ...edisOutboundChannelAdapterParserTests.java | 6 +- ...ueueOutboundChannelAdapterParserTests.java | 14 +- ...toreOutboundChannelAdapterParserTests.java | 14 +- .../integration/rmi/RmiInboundGateway.java | 153 -- .../integration/rmi/RmiOutboundGateway.java | 119 -- .../rmi/config/RmiInboundGatewayParser.java | 55 - .../rmi/config/RmiNamespaceHandler.java | 36 - .../rmi/config/RmiOutboundGatewayParser.java | 64 - .../integration/rmi/config/package-info.java | 4 - .../integration/rmi/package-info.java | 4 - .../main/resources/META-INF/spring.handlers | 1 - .../main/resources/META-INF/spring.schemas | 24 - .../main/resources/META-INF/spring.tooling | 4 - .../rmi/config/spring-integration-rmi.gif | Bin 569 -> 0 bytes .../rmi/config/spring-integration-rmi.xsd | 162 -- .../jsr223/Jsr223HeaderEnricherTests.java | 24 +- .../Jsr223InboundChannelAdapterTests.java | 14 +- .../config/jsr223/Jsr223TransformerTests.java | 17 +- .../client/StompServerIntegrationTests.java | 34 +- ...grationDynamicWebSocketHandlerMapping.java | 2 +- ...etIntegrationConfigurationInitializer.java | 4 +- .../websocket/dsl/WebSocketDslTests.java | 2 +- .../ws/DefaultSoapHeaderMapperTests.java | 11 +- .../SimpleWebServiceOutboundGatewayTests.java | 5 +- .../ws/config/UriVariableTests-context.xml | 2 +- .../ws/config/UriVariableTests.java | 18 +- .../xml/config/XPathSplitterParserTests.java | 16 +- .../jaxbmarshaling/JaxbAnnotatedPerson.java | 15 +- src/checkstyle/checkstyle.xml | 2 +- src/reference/asciidoc/changes-2.2-3.0.adoc | 6 - src/reference/asciidoc/changes-5.3-5.4.adoc | 7 - src/reference/asciidoc/changes-5.4-5.5.adoc | 113 ++ src/reference/asciidoc/endpoint-summary.adoc | 6 - src/reference/asciidoc/history.adoc | 2 + src/reference/asciidoc/http.adoc | 4 +- src/reference/asciidoc/index-single.adoc | 2 - src/reference/asciidoc/index.adoc | 1 - src/reference/asciidoc/preface.adoc | 4 +- src/reference/asciidoc/whats-new.adoc | 119 +- 225 files changed, 2196 insertions(+), 2628 deletions(-) rename spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/{outbound-adapter-parser-config.xml => MongoDbOutboundChannelAdapterParserTests-context.xml} (96%) delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiInboundGatewayParser.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiOutboundGatewayParser.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/package-info.java delete mode 100644 spring-integration-rmi/src/main/java/org/springframework/integration/rmi/package-info.java delete mode 100644 spring-integration-rmi/src/main/resources/META-INF/spring.handlers delete mode 100644 spring-integration-rmi/src/main/resources/META-INF/spring.schemas delete mode 100644 spring-integration-rmi/src/main/resources/META-INF/spring.tooling delete mode 100644 spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.gif delete mode 100644 spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.xsd create mode 100644 src/reference/asciidoc/changes-5.4-5.5.adoc diff --git a/.github/workflows/pr-build-workflow.yml b/.github/workflows/pr-build-workflow.yml index 6ca162f7ab..c116592e76 100644 --- a/.github/workflows/pr-build-workflow.yml +++ b/.github/workflows/pr-build-workflow.yml @@ -35,7 +35,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Run Gradle uses: burrunan/gradle-cache-action@v1 diff --git a/build.gradle b/build.gradle index 94ba927cbb..b9c55e9d8d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext.kotlinVersion = '1.5.32' repositories { mavenCentral() - maven { url 'https://plugins.gradle.org/m2' } + gradlePluginPortal() maven { url 'https://repo.spring.io/plugins-release-local' } } dependencies { @@ -24,30 +24,30 @@ plugins { } if (System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey')) { - apply plugin: 'io.spring.nohttp' + apply plugin: 'io.spring.nohttp' - nohttp { - allowlistFile = file('src/nohttp/allowlist.lines') - source.include '**/src/**' - source.exclude '**/*.gif', '**/*.jpg', '**/*.png', '**/*.svg', '**/*.ks' - } + nohttp { + allowlistFile = file('src/nohttp/allowlist.lines') + source.include '**/src/**' + source.exclude '**/*.gif', '**/*.jpg', '**/*.png', '**/*.svg', '**/*.ks' + } } description = 'Spring Integration' ext { - linkHomepage = 'https://projects.spring.io/spring-integration' - linkCi = 'https://build.spring.io/browse/INT' - linkIssue = 'https://github.com/spring-projects/spring-integration/issues' - linkScmUrl = 'https://github.com/spring-projects/spring-integration' - linkScmConnection = 'scm:git:git://github.com/spring-projects/spring-integration.git' - linkScmDevConnection = 'scm:git:ssh://git@github.com:spring-projects/spring-integration.git' + linkHomepage = 'https://projects.spring.io/spring-integration' + linkCi = 'https://build.spring.io/browse/INT' + linkIssue = 'https://github.com/spring-projects/spring-integration/issues' + linkScmUrl = 'https://github.com/spring-projects/spring-integration' + linkScmConnection = 'scm:git:git://github.com/spring-projects/spring-integration.git' + linkScmDevConnection = 'scm:git:ssh://git@github.com:spring-projects/spring-integration.git' - modifiedFiles = - files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } + modifiedFiles = + files(grgit.status().unstaged.modified).filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } - activeMqVersion = '5.16.3' apacheSshdVersion = '2.7.0' + artemisVersion = '2.19.0' aspectjVersion = '1.9.7' assertjVersion = '3.21.0' assertkVersion = '0.25' @@ -60,197 +60,199 @@ ext { derbyVersion = '10.14.2.0' ftpServerVersion = '1.1.1' googleJsr305Version = '3.0.2' - greenmailVersion = '1.6.5' + greenmailVersion = '2.0.0-alpha-2' groovyVersion = '3.0.9' hamcrestVersion = '2.2' hazelcastVersion = '4.2.3' - hibernateVersion = '5.5.9.Final' + hibernateVersion = '5.6.1.Final' hsqldbVersion = '2.6.0' h2Version = '1.4.200' - jacksonVersion = '2.12.6' - javaxActivationVersion = '1.2.0' - jaxbVersion = '2.3.4' + jacksonVersion = '2.13.0' + jaxbVersion = '3.0.2' jeroMqVersion = '0.5.2' - jmsApiVersion = '2.0.1' - jpaApiVersion = '2.7.7' + jmsApiVersion = '3.0.0' + jpaApiVersion = '3.0.2' jrubyVersion = '9.2.19.0' jschVersion = '0.1.55' jsonpathVersion = '2.6.0' junit4Version = '4.13.2' - junitJupiterVersion = '5.7.2' + junitJupiterVersion = '5.8.1' jythonVersion = '2.7.2' kryoShadedVersion = '4.0.2' lettuceVersion = '6.1.6.RELEASE' log4jVersion = '2.17.1' - mailVersion = '1.6.7' + mailVersion = '2.0.1' micrometerVersion = '1.7.8' - mockitoVersion = '3.12.4' - mongoDriverVersion = '4.3.2' + mockitoVersion = '4.0.0' + mongoDriverVersion = '4.4.0-beta2' mysqlVersion = '8.0.27' pahoMqttClientVersion = '1.2.5' postgresVersion = '42.2.23' r2dbch2Version='0.8.4.RELEASE' - reactorVersion = '2020.0.13' + reactorVersion = '2020.0.14' resilience4jVersion = '1.7.1' romeToolsVersion = '1.16.0' rsocketVersion = '1.1.1' - saajVersion = '1.5.2' - servletApiVersion = '4.0.1' + saajVersion = '2.0.1' + servletApiVersion = '5.0.0' smackVersion = '4.3.5' - soapVersion = '1.4.0' - springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.3.14' - springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2021.0.8' - springKafkaVersion = '2.7.10' + springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-SNAPSHOT' + springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.1.0-SNAPSHOT' + springKafkaVersion = '3.0.0-SNAPSHOT' springRetryVersion = '1.3.1' - springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.5.4' - springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.3.15' - springWsVersion = '3.1.2' - testcontainersVersion = '1.16.2' - tomcatVersion = '9.0.56' - xmlUnitVersion = '2.8.2' - xstreamVersion = '1.4.17' + springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-SNAPSHOT' + springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-SNAPSHOT' + springWsVersion = '4.0.0-SNAPSHOT' + tomcatVersion = '10.0.11' + xmlUnitVersion = '2.8.3' + xstreamVersion = '1.4.18' - javaProjects = subprojects - project(':spring-integration-bom') + javaProjects = subprojects - project(':spring-integration-bom') } allprojects { - group = 'org.springframework.integration' + group = 'org.springframework.integration' - repositories { - if (project.hasProperty('mavenLocal')) { - mavenLocal() - } - mavenCentral() - maven { url 'https://repo.spring.io/release' } - maven { url 'https://repo.spring.io/milestone' } - if (version.endsWith('SNAPSHOT')) { - maven { url 'https://repo.spring.io/snapshot' } - } + repositories { + if (project.hasProperty('mavenLocal')) { + mavenLocal() + } + mavenCentral() + maven { url 'https://repo.spring.io/release' } + maven { url 'https://repo.spring.io/milestone' } + if (version.endsWith('SNAPSHOT')) { + maven { url 'https://repo.spring.io/snapshot' } + } // maven { url 'https://repo.spring.io/libs-staging-local' } - } + } - ext.javadocLinks = [ - 'https://docs.oracle.com/en/java/javase/15/docs/api', - 'https://docs.spring.io/spring-framework/docs/current/javadoc-api', - 'https://docs.spring.io/spring-amqp/docs/current/api/', - 'https://docs.spring.io/spring-data-gemfire/docs/current/api/', - 'https://docs.spring.io/spring-data/data-mongo/docs/current/api/', - 'https://docs.spring.io/spring-data/data-redis/docs/current/api/', - 'https://docs.spring.io/spring-ws/docs/current/api/' - ] as String[] + ext.javadocLinks = [ + 'https://docs.oracle.com/en/java/javase/17/docs/api/', + 'https://jakarta.ee/specifications/platform/9/apidocs/', + 'https://docs.spring.io/spring-framework/docs/current/javadoc-api', + 'https://docs.spring.io/spring-amqp/docs/current/api/', + 'https://docs.spring.io/spring-data-gemfire/docs/current/api/', + 'https://docs.spring.io/spring-data/data-mongo/docs/current/api/', + 'https://docs.spring.io/spring-data/data-redis/docs/current/api/', + 'https://docs.spring.io/spring-ws/docs/current/api/' + ] as String[] - apply plugin: 'io.spring.dependency-management' + apply plugin: 'io.spring.dependency-management' - dependencyManagement { - resolutionStrategy { - cacheChangingModulesFor 0, 'seconds' - } - applyMavenExclusions = false - generatedPomCustomization { - enabled = false - } + dependencyManagement { + resolutionStrategy { + cacheChangingModulesFor 0, 'seconds' + } + applyMavenExclusions = false + generatedPomCustomization { + enabled = false + } - imports { - mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion" - mavenBom "org.junit:junit-bom:$junitJupiterVersion" - mavenBom "org.springframework:spring-framework-bom:$springVersion" - mavenBom "io.projectreactor:reactor-bom:$reactorVersion" - mavenBom "org.apache.logging.log4j:log4j-bom:$log4jVersion" - mavenBom "org.springframework.data:spring-data-bom:$springDataVersion" - } + imports { + mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion" + mavenBom "org.junit:junit-bom:$junitJupiterVersion" + mavenBom "org.springframework:spring-framework-bom:$springVersion" + mavenBom "io.projectreactor:reactor-bom:$reactorVersion" + mavenBom "org.apache.logging.log4j:log4j-bom:$log4jVersion" + mavenBom "org.springframework.data:spring-data-bom:$springDataVersion" + } - } + } } configure(javaProjects) { subproject -> - apply plugin: 'java-library' - apply plugin: 'eclipse' - apply plugin: 'idea' - apply plugin: 'jacoco' - apply plugin: 'checkstyle' - apply plugin: 'kotlin' - apply plugin: 'kotlin-spring' + apply plugin: 'java-library' + apply plugin: 'eclipse' + apply plugin: 'idea' + apply plugin: 'jacoco' + apply plugin: 'checkstyle' + apply plugin: 'kotlin' + apply plugin: 'kotlin-spring' - apply from: "${rootDir}/gradle/publish-maven.gradle" + apply from: "${rootDir}/gradle/publish-maven.gradle" - sourceSets { - test { - resources { - srcDirs = ['src/test/resources', 'src/test/java'] - } - } - } + sourceSets { + test { + resources { + srcDirs = ['src/test/resources', 'src/test/java'] + } + } + } - java { - withJavadocJar() - withSourcesJar() - registerFeature('optional') { - usingSourceSet(sourceSets.main) - } - registerFeature('provided') { - usingSourceSet(sourceSets.main) - } - } + java { + withJavadocJar() + withSourcesJar() + registerFeature('optional') { + usingSourceSet(sourceSets.main) + } + registerFeature('provided') { + usingSourceSet(sourceSets.main) + } + } - compileJava { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } + compileJava { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } - compileTestJava { - sourceCompatibility = 11 - targetCompatibility = 11 - options.encoding = 'UTF-8' - } + compileTestJava { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + options.encoding = 'UTF-8' + } - compileKotlin { - kotlinOptions { - apiVersion = '1.3' - jvmTarget = '1.8' - freeCompilerArgs = ['-Xjsr305=strict'] -// allWarningsAsErrors = true TODO bring it back after upgrading to Kotlin 1.5 language version - } - } - compileTestKotlin { - kotlinOptions { - jvmTarget = '11' - } - } + compileKotlin { + kotlinOptions { + jvmTarget = '16' + freeCompilerArgs = ['-Xjsr305=strict'] + allWarningsAsErrors = true + } + } + compileTestKotlin { + kotlinOptions { + jvmTarget = '16' + } + } - tasks.withType(JavaCompile).configureEach { - options.fork = true - } + tasks.withType(JavaCompile).configureEach { + options.fork = true + } - eclipse { - project { - natures += 'org.springframework.ide.eclipse.core.springnature' - } - } + tasks.withType(Javadoc) { + options.addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint + options.addBooleanOption('Werror', true) // fail build on Javadoc warnings + } - jacoco { - toolVersion = '0.8.7' - } + eclipse { + project { + natures += 'org.springframework.ide.eclipse.core.springnature' + } + } - // dependencies that are common across all java projects - dependencies { - if (!(subproject.name ==~ /.*-test.*/)) { - testImplementation(project(':spring-integration-test-support')) { - exclude group: 'org.hamcrest' - } - } + jacoco { + toolVersion = '0.8.7' + } - // JSR-305 only used for non-required meta-annotations - compileOnly "com.google.code.findbugs:jsr305:$googleJsr305Version" - testImplementation "com.google.code.findbugs:jsr305:$googleJsr305Version" - testImplementation("org.awaitility:awaitility:$awaitilityVersion") { - exclude group: 'org.hamcrest' - } - testImplementation ("junit:junit:$junit4Version") { - exclude group: 'org.hamcrest' - } - testImplementation 'org.junit.jupiter:junit-jupiter-api' - testImplementation ("com.willowtreeapps.assertk:assertk-jvm:$assertkVersion") { + // dependencies that are common across all java projects + dependencies { + if (!(subproject.name ==~ /.*-test.*/)) { + testImplementation(project(':spring-integration-test-support')) { + exclude group: 'org.hamcrest' + } + } + + // JSR-305 only used for non-required meta-annotations + compileOnly "com.google.code.findbugs:jsr305:$googleJsr305Version" + testImplementation "com.google.code.findbugs:jsr305:$googleJsr305Version" + testImplementation("org.awaitility:awaitility:$awaitilityVersion") { + exclude group: 'org.hamcrest' + } + testImplementation("junit:junit:$junit4Version") { + exclude group: 'org.hamcrest' + } + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation("com.willowtreeapps.assertk:assertk-jvm:$assertkVersion") { exclude group: 'org.jetbrains.kotlin' } testImplementation 'org.jetbrains.kotlin:kotlin-reflect' @@ -258,215 +260,235 @@ configure(javaProjects) { subproject -> testImplementation 'io.projectreactor:reactor-test' testImplementation "org.testcontainers:junit-jupiter:$testcontainersVersion" - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // To support JUnit 4 tests - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + // To support JUnit 4 tests + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' - testRuntimeOnly 'org.apache.logging.log4j:log4j-core' - testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl' - testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' - } + testRuntimeOnly 'org.apache.logging.log4j:log4j-core' + testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl' + testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' + } - // enable all compiler warnings; individual projects may customize further - ext.xLintArg = '-Xlint:all,-options,-processing' - [compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg, '-parameters'] + // enable all compiler warnings; individual projects may customize further + ext.xLintArg = '-Xlint:all,-options,-processing' + [compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg, '-parameters'] - task updateCopyrights { - onlyIf { !System.getenv('GITHUB_ACTION') && !System.getenv('bamboo_buildKey') } - inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) }) - outputs.dir('build/classes') + task updateCopyrights { + onlyIf { !System.getenv('GITHUB_ACTION') && !System.getenv('bamboo_buildKey') } + inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) }) + outputs.dir('build/classes') - doLast { - def now = Calendar.instance.get(Calendar.YEAR) as String - inputs.files.each { file -> - def line - file.withReader { reader -> - while (line = reader.readLine()) { - def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/ - if (matcher.count) { - def beginningYear = matcher[0][1] - if (now != beginningYear && now != matcher[0][2]) { - def years = "$beginningYear-$now" - def sourceCode = file.text - sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years) - file.text = sourceCode - println "Copyright updated for file: $file" - } - break - } - } - } - } - } - } + doLast { + def now = Calendar.instance.get(Calendar.YEAR) as String + inputs.files.each { file -> + def line + file.withReader { reader -> + while (line = reader.readLine()) { + def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/ + if (matcher.count) { + def beginningYear = matcher[0][1] + if (now != beginningYear && now != matcher[0][2]) { + def years = "$beginningYear-$now" + def sourceCode = file.text + sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years) + file.text = sourceCode + println "Copyright updated for file: $file" + } + break + } + } + } + } + } + } - compileKotlin.dependsOn updateCopyrights + compileKotlin.dependsOn updateCopyrights - jacocoTestReport { - reports { - xml.enabled true - csv.enabled false - html.enabled false - xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") - } - } + jacocoTestReport { + reports { + xml.enabled true + csv.enabled false + html.enabled false + xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") + } + } - test { - maxHeapSize = '2g' - jvmArgs '-XX:+HeapDumpOnOutOfMemoryError' - jacoco { - destinationFile = file("$buildDir/jacoco.exec") - } + test { + maxHeapSize = '2g' + jvmArgs '-XX:+HeapDumpOnOutOfMemoryError' + jacoco { + destinationFile = file("$buildDir/jacoco.exec") + } - if (System.properties['sonar.host.url']) { - finalizedBy jacocoTestReport - } - } + if (System.properties['sonar.host.url']) { + finalizedBy jacocoTestReport + } + } - task testAll(type: Test, dependsOn: [':checkAsciidocLinks', 'check']) + task testAll(type: Test, dependsOn: [':checkAsciidocLinks', 'check']) - gradle.taskGraph.whenReady { graph -> - if (graph.hasTask(testAll)) { - test.enabled = false - } - } + gradle.taskGraph.whenReady { graph -> + if (graph.hasTask(testAll)) { + test.enabled = false + } + } - tasks.withType(Test).all { - // suppress all console output during testing unless running `gradle -i` - logging.captureStandardOutput(LogLevel.INFO) + tasks.withType(Test).all { + // suppress all console output during testing unless running `gradle -i` + logging.captureStandardOutput(LogLevel.INFO) - if (name ==~ /(testAll)/) { - systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true' - } + if (name ==~ /(testAll)/) { + systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true' + } - environment 'SI_FATAL_WHEN_NO_BEANFACTORY', 'true' + environment 'SI_FATAL_WHEN_NO_BEANFACTORY', 'true' - useJUnitPlatform() + useJUnitPlatform() - enableAssertions = false - } + enableAssertions = false + } checkstyle { configDirectory.set(rootProject.file('src/checkstyle')) toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '9.2' } - jar { - manifest { - attributes( - 'Implementation-Version': project.version, - 'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})", - 'Implementation-Title': subproject.name, - 'Implementation-Vendor-Id': subproject.group, - 'Implementation-Vendor': 'Pivotal Software, Inc.', - 'Implementation-URL': linkHomepage, - 'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw - ) - } + jar { + manifest { + attributes( + 'Implementation-Version': project.version, + 'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})", + 'Implementation-Title': subproject.name, + 'Implementation-Vendor-Id': subproject.group, + 'Implementation-Vendor': 'Pivotal Software, Inc.', + 'Implementation-URL': linkHomepage, + 'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw + ) + } - from("${rootProject.projectDir}/src/dist") { - include 'notice.txt' - into 'META-INF' - expand(copyright: new Date().format('yyyy'), version: project.version) - } - from("${rootProject.projectDir}") { - include 'LICENSE.txt' - into 'META-INF' - } - } + from("${rootProject.projectDir}/src/dist") { + include 'notice.txt' + into 'META-INF' + expand(copyright: new Date().format('yyyy'), version: project.version) + } + from("${rootProject.projectDir}") { + include 'LICENSE.txt' + into 'META-INF' + } + } - check.dependsOn javadoc + check.dependsOn javadoc - publishing { - publications { - mavenJava(MavenPublication) { - suppressAllPomMetadataWarnings() - from components.java - pom.withXml { - def pomDeps = asNode().dependencies.first() - subproject.configurations.providedImplementation.allDependencies.each { dep -> - pomDeps.remove(pomDeps.'*'.find { it.artifactId.text() == dep.name }) - pomDeps.appendNode('dependency').with { - it.appendNode('groupId', dep.group) - it.appendNode('artifactId', dep.name) - it.appendNode('version', dep.version) - it.appendNode('scope', 'provided') - } - } - } - } - } - } + publishing { + publications { + mavenJava(MavenPublication) { + suppressAllPomMetadataWarnings() + from components.java + pom.withXml { + def pomDeps = asNode().dependencies.first() + subproject.configurations.providedImplementation.allDependencies.each { dep -> + pomDeps.remove(pomDeps.'*'.find { it.artifactId.text() == dep.name }) + pomDeps.appendNode('dependency').with { + it.appendNode('groupId', dep.group) + it.appendNode('artifactId', dep.name) + it.appendNode('version', dep.version) + it.appendNode('scope', 'provided') + } + } + } + } + } + } } project('spring-integration-test-support') { - description = 'Spring Integration Test Support - **No SI Dependencies Allowed**' - dependencies { - compileOnly 'org.apiguardian:apiguardian-api:1.0.0' - api "org.hamcrest:hamcrest-library:$hamcrestVersion" - api "org.mockito:mockito-core:$mockitoVersion" - api "org.assertj:assertj-core:$assertjVersion" - api 'org.springframework:spring-context' - api 'org.springframework:spring-messaging' - api 'org.springframework:spring-test' - optionalApi ("junit:junit:$junit4Version") { - exclude group: 'org.hamcrest' - } - optionalApi 'org.junit.jupiter:junit-jupiter-api' - optionalApi 'org.apache.logging.log4j:log4j-core' - } + description = 'Spring Integration Test Support - **No SI Dependencies Allowed**' + dependencies { + compileOnly 'org.apiguardian:apiguardian-api:1.0.0' + api "org.hamcrest:hamcrest-library:$hamcrestVersion" + api "org.mockito:mockito-core:$mockitoVersion" + api "org.assertj:assertj-core:$assertjVersion" + api 'org.springframework:spring-context' + api 'org.springframework:spring-messaging' + api 'org.springframework:spring-test' + optionalApi("junit:junit:$junit4Version") { + exclude group: 'org.hamcrest' + } + optionalApi 'org.junit.jupiter:junit-jupiter-api' + optionalApi 'org.apache.logging.log4j:log4j-core' + } } project('spring-integration-amqp') { - description = 'Spring Integration AMQP Support' - dependencies { - api project(':spring-integration-core') - api("org.springframework.amqp:spring-rabbit:$springAmqpVersion") { - exclude group: 'org.springframework' - } + description = 'Spring Integration AMQP Support' + dependencies { + api project(':spring-integration-core') + api("org.springframework.amqp:spring-rabbit:$springAmqpVersion") { + exclude group: 'org.springframework' + } - testImplementation("org.springframework.amqp:spring-rabbit-junit:$springAmqpVersion") { - exclude group: 'org.springframework' - } - testImplementation project(':spring-integration-stream') - testImplementation 'org.springframework:spring-web' - } + testImplementation("org.springframework.amqp:spring-rabbit-junit:$springAmqpVersion") { + exclude group: 'org.springframework' + } + testImplementation project(':spring-integration-stream') + testImplementation 'org.springframework:spring-web' + } } project('spring-integration-core') { - description = 'Spring Integration Core' + description = 'Spring Integration Core' - apply plugin: 'org.jetbrains.dokka' + apply plugin: 'org.jetbrains.dokka' - dependencies { - api 'org.springframework:spring-aop' - api 'org.springframework:spring-context' - api 'org.springframework:spring-messaging' - api 'org.springframework:spring-tx' - api ("org.springframework.retry:spring-retry:$springRetryVersion") { - exclude group: 'org.springframework' - } - api 'io.projectreactor:reactor-core' + dependencies { + api 'org.springframework:spring-aop' + api 'org.springframework:spring-context' + api 'org.springframework:spring-messaging' + api 'org.springframework:spring-tx' + api("org.springframework.retry:spring-retry:$springRetryVersion") { + exclude group: 'org.springframework' + } + api 'io.projectreactor:reactor-core' - optionalApi 'com.fasterxml.jackson.core:jackson-databind' - optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8' - optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' - optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda' - optionalApi ('com.fasterxml.jackson.module:jackson-module-kotlin') { - exclude group: 'org.jetbrains.kotlin' - } + optionalApi 'com.fasterxml.jackson.core:jackson-databind' + optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8' + optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' + optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda' + optionalApi('com.fasterxml.jackson.module:jackson-module-kotlin') { + exclude group: 'org.jetbrains.kotlin' + } - optionalApi "com.jayway.jsonpath:json-path:$jsonpathVersion" - optionalApi "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" - optionalApi "io.micrometer:micrometer-core:$micrometerVersion" - optionalApi "io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion" - optionalApi "org.apache.avro:avro:$avroVersion" - optionalApi 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' + optionalApi "com.jayway.jsonpath:json-path:$jsonpathVersion" + optionalApi "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" + optionalApi "io.micrometer:micrometer-core:$micrometerVersion" + optionalApi "io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion" + optionalApi "org.apache.avro:avro:$avroVersion" + optionalApi 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - testImplementation "org.aspectj:aspectjweaver:$aspectjVersion" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - } + testImplementation "org.aspectj:aspectjweaver:$aspectjVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + } + + dokkaHtmlPartial { + outputDirectory.set(new File(buildDir, 'docs/kdoc')) + dokkaSourceSets { + main { + sourceRoots.setFrom(file('src/main/kotlin')) + classpath.from(sourceSets['main'].runtimeClasspath) + externalDocumentationLink { + url.set(new URL("https://docs.spring.io/spring-integration/docs/$version/api/")) + packageListUrl.set(file("$buildDir/api/element-list").toURI().toURL()) + } + externalDocumentationLink { + url.set(new URL('https://projectreactor.io/docs/core/release/api/')) + } + externalDocumentationLink { + url.set(new URL('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) + } + } + } + } dokkaHtmlPartial { outputDirectory.set(new File(buildDir, 'docs/kdoc')) @@ -490,519 +512,533 @@ project('spring-integration-core') { } project('spring-integration-event') { - description = 'Spring Integration ApplicationEvent Support' - dependencies { - api project(':spring-integration-core') - } + description = 'Spring Integration ApplicationEvent Support' + dependencies { + api project(':spring-integration-core') + } } project('spring-integration-feed') { - description = 'Spring Integration RSS Feed Support' - dependencies { - api project(':spring-integration-core') - api "com.rometools:rome:$romeToolsVersion" - } + description = 'Spring Integration RSS Feed Support' + dependencies { + api project(':spring-integration-core') + api "com.rometools:rome:$romeToolsVersion" + } } project('spring-integration-file') { - description = 'Spring Integration File Support' - dependencies { - api project(':spring-integration-core') - api "commons-io:commons-io:$commonsIoVersion" + description = 'Spring Integration File Support' + dependencies { + api project(':spring-integration-core') + api "commons-io:commons-io:$commonsIoVersion" - testImplementation project(':spring-integration-redis') - testImplementation project(':spring-integration-redis').sourceSets.test.output - testImplementation project(':spring-integration-gemfire') - testImplementation project(':spring-integration-jdbc') - testImplementation "com.h2database:h2:$h2Version" - testImplementation "io.lettuce:lettuce-core:$lettuceVersion" - testImplementation "com.jayway.jsonpath:json-path:$jsonpathVersion" - } + testImplementation project(':spring-integration-redis') + testImplementation project(':spring-integration-redis').sourceSets.test.output + testImplementation project(':spring-integration-gemfire') + testImplementation project(':spring-integration-jdbc') + testImplementation "com.h2database:h2:$h2Version" + testImplementation "io.lettuce:lettuce-core:$lettuceVersion" + testImplementation "com.jayway.jsonpath:json-path:$jsonpathVersion" + } } project('spring-integration-ftp') { - description = 'Spring Integration FTP Support' - dependencies { - api project(':spring-integration-file') - api "commons-net:commons-net:$commonsNetVersion" - api 'org.springframework:spring-context-support' - optionalApi "org.apache.ftpserver:ftpserver-core:$ftpServerVersion" + description = 'Spring Integration FTP Support' + dependencies { + api project(':spring-integration-file') + api "commons-net:commons-net:$commonsNetVersion" + api 'org.springframework:spring-context-support' + optionalApi "org.apache.ftpserver:ftpserver-core:$ftpServerVersion" - testImplementation project(':spring-integration-file').sourceSets.test.output - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - } + testImplementation project(':spring-integration-file').sourceSets.test.output + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + } } project('spring-integration-gemfire') { - description = 'Spring Integration GemFire Support' - dependencies { - api project(':spring-integration-core') - api ('org.springframework.data:spring-data-geode') { - exclude group: 'org.springframework' - } - api "commons-io:commons-io:$commonsIoVersion" + description = 'Spring Integration GemFire Support' + dependencies { + api project(':spring-integration-core') + api('org.springframework.data:spring-data-geode') { + exclude group: 'org.springframework' + } + api "commons-io:commons-io:$commonsIoVersion" - testImplementation project(':spring-integration-stream') - } + testImplementation project(':spring-integration-stream') + } } project('spring-integration-groovy') { - description = 'Spring Integration Groovy Support' - dependencies { - api project(':spring-integration-scripting') - api "org.codehaus.groovy:groovy:$groovyVersion" - api 'org.springframework:spring-context-support' + description = 'Spring Integration Groovy Support' + dependencies { + api project(':spring-integration-scripting') + api "org.codehaus.groovy:groovy:$groovyVersion" + api 'org.springframework:spring-context-support' - testImplementation 'org.springframework:spring-web' + testImplementation 'org.springframework:spring-web' - testRuntimeOnly "org.codehaus.groovy:groovy-dateutil:$groovyVersion" - } + testRuntimeOnly "org.codehaus.groovy:groovy-dateutil:$groovyVersion" + } } project('spring-integration-http') { - description = 'Spring Integration HTTP Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-webmvc' - providedImplementation "javax.servlet:javax.servlet-api:$servletApiVersion" - optionalApi "com.rometools:rome:$romeToolsVersion" - optionalApi 'org.springframework:spring-webflux' + description = 'Spring Integration HTTP Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-webmvc' + providedImplementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion" + optionalApi "com.rometools:rome:$romeToolsVersion" + optionalApi 'org.springframework:spring-webflux' - testImplementation project(':spring-integration-security') - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testImplementation ("org.springframework.security:spring-security-config:$springSecurityVersion") { - exclude group: 'org.springframework' - } - testImplementation ("org.springframework.security:spring-security-test:$springSecurityVersion") { - exclude group: 'org.springframework' - } - testImplementation 'com.fasterxml.jackson.core:jackson-databind' + testImplementation project(':spring-integration-security') + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + testImplementation("org.springframework.security:spring-security-config:$springSecurityVersion") { + exclude group: 'org.springframework' + } + testImplementation("org.springframework.security:spring-security-test:$springSecurityVersion") { + exclude group: 'org.springframework' + } + testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testRuntimeOnly "com.jayway.jsonpath:json-path:$jsonpathVersion" - } + testRuntimeOnly "com.jayway.jsonpath:json-path:$jsonpathVersion" + } } project('spring-integration-ip') { - description = 'Spring Integration IP Support' - dependencies { - api project(':spring-integration-core') - testImplementation project(':spring-integration-stream') - testImplementation project(':spring-integration-event') - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + description = 'Spring Integration IP Support' + dependencies { + api project(':spring-integration-core') + testImplementation project(':spring-integration-stream') + testImplementation project(':spring-integration-event') + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testRuntimeOnly "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" - testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' - } + testRuntimeOnly "com.esotericsoftware:kryo-shaded:$kryoShadedVersion" + testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' + } + + tasks.withType(JavaForkOptions) { + jvmArgs '--add-opens', 'java.base/java.nio.channels.spi=ALL-UNNAMED' + } } project('spring-integration-jdbc') { - description = 'Spring Integration JDBC Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-jdbc' + description = 'Spring Integration JDBC Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-jdbc' - testImplementation "com.h2database:h2:$h2Version" - testImplementation "org.hsqldb:hsqldb:$hsqldbVersion" - testImplementation "org.apache.derby:derby:$derbyVersion" - testImplementation "org.apache.derby:derbyclient:$derbyVersion" - testImplementation "org.postgresql:postgresql:$postgresVersion" - testImplementation "mysql:mysql-connector-java:$mysqlVersion" - testImplementation "org.apache.commons:commons-dbcp2:$commonsDbcp2Version" + testImplementation "com.h2database:h2:$h2Version" + testImplementation "org.hsqldb:hsqldb:$hsqldbVersion" + testImplementation "org.apache.derby:derby:$derbyVersion" + testImplementation "org.apache.derby:derbyclient:$derbyVersion" + testImplementation "org.postgresql:postgresql:$postgresVersion" + testImplementation "mysql:mysql-connector-java:$mysqlVersion" + testImplementation "org.apache.commons:commons-dbcp2:$commonsDbcp2Version" testImplementation "org.testcontainers:mysql:$testcontainersVersion" - testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' - } + testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-jms') { - description = 'Spring Integration JMS Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-jms' - providedImplementation "javax.jms:javax.jms-api:$jmsApiVersion" + description = 'Spring Integration JMS Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-jms' + providedImplementation "jakarta.jms:jakarta.jms-api:$jmsApiVersion" - testImplementation "org.apache.activemq:activemq-broker:$activeMqVersion" - testImplementation 'org.springframework:spring-oxm' - } + testImplementation("org.apache.activemq:artemis-server:$artemisVersion") { + exclude group: 'org.jboss.logmanager' + } + testImplementation "org.apache.activemq:artemis-jakarta-client:$artemisVersion" + testImplementation 'org.springframework:spring-oxm' + testImplementation 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-jmx') { - description = 'Spring Integration JMX Support' - dependencies { - api project(':spring-integration-core') + description = 'Spring Integration JMX Support' + dependencies { + api project(':spring-integration-core') - testImplementation "org.aspectj:aspectjweaver:$aspectjVersion" - testImplementation "com.hazelcast:hazelcast:$hazelcastVersion" - } + testImplementation "org.aspectj:aspectjweaver:$aspectjVersion" + testImplementation "com.hazelcast:hazelcast:$hazelcastVersion" + } } project('spring-integration-jpa') { - description = 'Spring Integration JPA Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-orm' - optionalApi "org.eclipse.persistence:org.eclipse.persistence.jpa:$jpaApiVersion" + description = 'Spring Integration JPA Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-orm' + optionalApi "org.eclipse.persistence:org.eclipse.persistence.jpa:$jpaApiVersion" - testImplementation ('org.springframework.data:spring-data-jpa') { - exclude group: 'org.springframework' - } - testImplementation "com.h2database:h2:$h2Version" - testImplementation "org.hibernate:hibernate-entitymanager:$hibernateVersion" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - } + testImplementation('org.springframework.data:spring-data-jpa') { + exclude group: 'org.springframework' + } + testImplementation "com.h2database:h2:$h2Version" + testImplementation "org.hibernate:hibernate-core-jakarta:$hibernateVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + } } project('spring-integration-kafka') { - description = 'Spring Integration for Apache Kafka' - dependencies { - api project(':spring-integration-core') - api ("org.springframework.kafka:spring-kafka:$springKafkaVersion") { - exclude group: 'org.springframework' - } + description = 'Spring Integration for Apache Kafka' + dependencies { + api project(':spring-integration-core') + api("org.springframework.kafka:spring-kafka:$springKafkaVersion") { + exclude group: 'org.springframework' + } - testImplementation "org.springframework.kafka:spring-kafka-test:$springKafkaVersion" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - - testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' - } + testImplementation "org.springframework.kafka:spring-kafka-test:$springKafkaVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + testImplementation 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-mail') { - description = 'Spring Integration Mail Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-context-support' + description = 'Spring Integration Mail Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-context-support' - providedImplementation "com.sun.mail:jakarta.mail:$mailVersion" - testImplementation "com.icegreen:greenmail:$greenmailVersion" - testRuntimeOnly 'org.apache.logging.log4j:log4j-jul' - } + providedImplementation "com.sun.mail:jakarta.mail:$mailVersion" + testImplementation "com.icegreen:greenmail:$greenmailVersion" + testRuntimeOnly 'org.apache.logging.log4j:log4j-jul' + } } project('spring-integration-mongodb') { - description = 'Spring Integration MongoDB Support' - dependencies { - api project(':spring-integration-core') - api ('org.springframework.data:spring-data-mongodb') { - exclude group: 'org.springframework' - } - optionalApi "org.mongodb:mongodb-driver-sync:$mongoDriverVersion" - optionalApi "org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion" - } + description = 'Spring Integration MongoDB Support' + dependencies { + api project(':spring-integration-core') + api('org.springframework.data:spring-data-mongodb') { + exclude group: 'org.springframework' + } + optionalApi "org.mongodb:mongodb-driver-sync:$mongoDriverVersion" + optionalApi "org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion" + } } project('spring-integration-r2dbc') { - description = 'Spring Integration R2DBC Support' - dependencies { - api project(':spring-integration-core') - api ('org.springframework.data:spring-data-r2dbc') { - exclude group: 'org.springframework' - } - api 'org.springframework:spring-r2dbc' - testImplementation "io.r2dbc:r2dbc-h2:$r2dbch2Version" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - } + description = 'Spring Integration R2DBC Support' + dependencies { + api project(':spring-integration-core') + api('org.springframework.data:spring-data-r2dbc') { + exclude group: 'org.springframework' + } + api 'org.springframework:spring-r2dbc' + testImplementation "io.r2dbc:r2dbc-h2:$r2dbch2Version" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + } } project('spring-integration-mqtt') { - description = 'Spring Integration MQTT Support' - dependencies { - api project(':spring-integration-core') - api "org.eclipse.paho:org.eclipse.paho.client.mqttv3:$pahoMqttClientVersion" - optionalApi "org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion" + description = 'Spring Integration MQTT Support' + dependencies { + api project(':spring-integration-core') + api "org.eclipse.paho:org.eclipse.paho.client.mqttv3:$pahoMqttClientVersion" + optionalApi "org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion" - testImplementation project(':spring-integration-jmx') - testImplementation 'com.fasterxml.jackson.core:jackson-databind' - } + testImplementation project(':spring-integration-jmx') + testImplementation 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-redis') { - description = 'Spring Integration Redis Support' - dependencies { - api project(':spring-integration-core') - api ('org.springframework.data:spring-data-redis') { - exclude group: 'org.springframework' - } + description = 'Spring Integration Redis Support' + dependencies { + api project(':spring-integration-core') + api('org.springframework.data:spring-data-redis') { + exclude group: 'org.springframework' + } - testImplementation "io.lettuce:lettuce-core:$lettuceVersion" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testImplementation 'com.fasterxml.jackson.core:jackson-databind' - } -} - -project('spring-integration-rmi') { - description = 'Spring Integration RMI Support' - dependencies { - api project(':spring-integration-core') - } + testImplementation "io.lettuce:lettuce-core:$lettuceVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + testImplementation 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-rsocket') { - description = 'Spring Integration RSocket Support' - dependencies { - api project(':spring-integration-core') - api "io.rsocket:rsocket-transport-netty:$rsocketVersion" - } + description = 'Spring Integration RSocket Support' + dependencies { + api project(':spring-integration-core') + api "io.rsocket:rsocket-transport-netty:$rsocketVersion" + } } project('spring-integration-scripting') { - description = 'Spring Integration Scripting Support' - dependencies { - api project(':spring-integration-core') - optionalApi 'org.jetbrains.kotlin:kotlin-script-util' - optionalApi 'org.jetbrains.kotlin:kotlin-compiler-embeddable' + description = 'Spring Integration Scripting Support' + dependencies { + api project(':spring-integration-core') + optionalApi 'org.jetbrains.kotlin:kotlin-script-util' + optionalApi 'org.jetbrains.kotlin:kotlin-compiler-embeddable' - testImplementation "org.jruby:jruby-complete:$jrubyVersion" - testImplementation "org.codehaus.groovy:groovy:$groovyVersion" - testImplementation "org.codehaus.groovy:groovy-jsr223:$groovyVersion" - testImplementation "org.python:jython-standalone:$jythonVersion" + testImplementation "org.jruby:jruby-complete:$jrubyVersion" + testImplementation "org.codehaus.groovy:groovy:$groovyVersion" + testImplementation "org.codehaus.groovy:groovy-jsr223:$groovyVersion" + testImplementation "org.python:jython-standalone:$jythonVersion" - testRuntimeOnly 'org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable' - } + testRuntimeOnly 'org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable' + } } project('spring-integration-security') { - description = 'Spring Integration Security Support' - dependencies { - api project(':spring-integration-core') - api ("org.springframework.security:spring-security-core:$springSecurityVersion") { - exclude group: 'org.springframework' - } + description = 'Spring Integration Security Support' + dependencies { + api project(':spring-integration-core') + api("org.springframework.security:spring-security-core:$springSecurityVersion") { + exclude group: 'org.springframework' + } - testImplementation ("org.springframework.security:spring-security-config:$springSecurityVersion") { - exclude group: 'org.springframework' - } - } + testImplementation("org.springframework.security:spring-security-config:$springSecurityVersion") { + exclude group: 'org.springframework' + } + } } project('spring-integration-sftp') { - description = 'Spring Integration SFTP Support' - dependencies { - api project(':spring-integration-file') - api "com.jcraft:jsch:$jschVersion" - api 'org.springframework:spring-context-support' - optionalApi "org.apache.sshd:sshd-sftp:$apacheSshdVersion" + description = 'Spring Integration SFTP Support' + dependencies { + api project(':spring-integration-file') + api "com.jcraft:jsch:$jschVersion" + api 'org.springframework:spring-context-support' + optionalApi "org.apache.sshd:sshd-sftp:$apacheSshdVersion" - testImplementation "org.apache.sshd:sshd-core:$apacheSshdVersion" - testImplementation project(':spring-integration-event') - testImplementation project(':spring-integration-file').sourceSets.test.output - } + testImplementation "org.apache.sshd:sshd-core:$apacheSshdVersion" + testImplementation project(':spring-integration-event') + testImplementation project(':spring-integration-file').sourceSets.test.output + } } project('spring-integration-stomp') { - description = 'Spring Integration STOMP Support' - dependencies { - api project(':spring-integration-core') - optionalApi 'org.springframework:spring-websocket' - optionalApi 'io.projectreactor.netty:reactor-netty-core' + description = 'Spring Integration STOMP Support' + dependencies { + api project(':spring-integration-core') + optionalApi 'org.springframework:spring-websocket' + optionalApi 'io.projectreactor.netty:reactor-netty-core' - testImplementation project(':spring-integration-websocket') - testImplementation project(':spring-integration-websocket').sourceSets.test.output - testImplementation project(':spring-integration-event') - testImplementation "org.apache.activemq:activemq-stomp:$activeMqVersion" - testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion" + testImplementation project(':spring-integration-websocket') + testImplementation project(':spring-integration-websocket').sourceSets.test.output + testImplementation project(':spring-integration-event') + testImplementation("org.apache.activemq:artemis-stomp-protocol:$artemisVersion") { + exclude group: 'org.jboss.logmanager' + } + testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion" + testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testRuntimeOnly 'org.springframework:spring-webmvc' - } + testRuntimeOnly 'org.springframework:spring-webmvc' + } } project('spring-integration-stream') { - description = 'Spring Integration Stream Support' - dependencies { - api project(':spring-integration-core') - } + description = 'Spring Integration Stream Support' + dependencies { + api project(':spring-integration-core') + } + + tasks.withType(JavaForkOptions) { + jvmArgs '--add-opens', 'java.base/java.io=ALL-UNNAMED' + } } project('spring-integration-syslog') { - description = 'Spring Integration Syslog Support' - dependencies { - api project(':spring-integration-ip') - } + description = 'Spring Integration Syslog Support' + dependencies { + api project(':spring-integration-ip') + } } project('spring-integration-test') { - description = 'Spring Integration Testing Framework' - dependencies { - api project(':spring-integration-core') - api project(':spring-integration-test-support') - } + description = 'Spring Integration Testing Framework' + dependencies { + api project(':spring-integration-core') + api project(':spring-integration-test-support') + } } project('spring-integration-webflux') { - description = 'Spring Integration HTTP Support' - dependencies { - api (project(':spring-integration-http')) { - exclude group: 'org.springframework', module: 'spring-webmvc' - } - api 'org.springframework:spring-webflux' - optionalApi 'io.projectreactor.netty:reactor-netty-http' + description = 'Spring Integration HTTP Support' + dependencies { + api(project(':spring-integration-http')) { + exclude group: 'org.springframework', module: 'spring-webmvc' + } + api 'org.springframework:spring-webflux' + optionalApi 'io.projectreactor.netty:reactor-netty-http' - testImplementation "javax.servlet:javax.servlet-api:$servletApiVersion" - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testImplementation 'org.springframework:spring-webmvc' - testImplementation ("org.springframework.security:spring-security-config:$springSecurityVersion") { - exclude group: 'org.springframework' - } - testImplementation ("org.springframework.security:spring-security-test:$springSecurityVersion") { - exclude group: 'org.springframework' - } - testImplementation 'com.fasterxml.jackson.core:jackson-databind' + testImplementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + testImplementation 'org.springframework:spring-webmvc' + testImplementation("org.springframework.security:spring-security-config:$springSecurityVersion") { + exclude group: 'org.springframework' + } + testImplementation("org.springframework.security:spring-security-test:$springSecurityVersion") { + exclude group: 'org.springframework' + } + testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testRuntimeOnly "com.jayway.jsonpath:json-path:$jsonpathVersion" - } + testRuntimeOnly "com.jayway.jsonpath:json-path:$jsonpathVersion" + } } project('spring-integration-websocket') { - description = 'Spring Integration WebSockets Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-websocket' - optionalApi 'org.springframework:spring-webmvc' - providedImplementation "javax.servlet:javax.servlet-api:$servletApiVersion" + description = 'Spring Integration WebSockets Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-websocket' + optionalApi 'org.springframework:spring-webmvc' + providedImplementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion" - testImplementation project(':spring-integration-event') - testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion" + testImplementation project(':spring-integration-event') + testImplementation "org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion" - testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' - } + testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind' + } } project('spring-integration-ws') { - description = 'Spring Integration Web Services Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-oxm' - api 'org.springframework:spring-webmvc' - api ("org.springframework.ws:spring-ws-core:$springWsVersion") { - exclude group: 'org.springframework' - } + description = 'Spring Integration Web Services Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-oxm' + api 'org.springframework:spring-webmvc' + api("org.springframework.ws:spring-ws-core:$springWsVersion") { + exclude group: 'org.springframework' + } - optionalApi "javax.activation:javax.activation-api:$javaxActivationVersion" - providedImplementation "javax.xml.soap:javax.xml.soap-api:$soapVersion" - providedImplementation "com.sun.xml.bind:jaxb-impl:$jaxbVersion" - providedImplementation "com.sun.xml.messaging.saaj:saaj-impl:$saajVersion" + providedImplementation "com.sun.xml.bind:jaxb-impl:$jaxbVersion" + providedImplementation "com.sun.xml.messaging.saaj:saaj-impl:$saajVersion" - testImplementation "com.thoughtworks.xstream:xstream:$xstreamVersion" - testImplementation ("org.springframework.ws:spring-ws-support:$springWsVersion") { - exclude group: 'org.springframework' - } - testImplementation 'org.springframework:spring-jms' - testImplementation "javax.jms:javax.jms-api:$jmsApiVersion" - testImplementation "org.igniterealtime.smack:smack-tcp:$smackVersion" - testImplementation "org.igniterealtime.smack:smack-extensions:$smackVersion" - testImplementation "jakarta.mail:jakarta.mail-api:$mailVersion" + testImplementation "com.thoughtworks.xstream:xstream:$xstreamVersion" + testImplementation("org.springframework.ws:spring-ws-support:$springWsVersion") { + exclude group: 'org.springframework' + } + testImplementation 'org.springframework:spring-jms' + testImplementation "jakarta.jms:jakarta.jms-api:$jmsApiVersion" + testImplementation "org.igniterealtime.smack:smack-tcp:$smackVersion" + testImplementation "org.igniterealtime.smack:smack-extensions:$smackVersion" + testImplementation "jakarta.mail:jakarta.mail-api:$mailVersion" - testRuntimeOnly "com.sun.mail:mailapi:$mailVersion" - testRuntimeOnly "com.sun.mail:jakarta.mail:$mailVersion" - } + testRuntimeOnly "com.sun.mail:jakarta.mail:$mailVersion" + } } project('spring-integration-xml') { - description = 'Spring Integration XML Support' - dependencies { - api project(':spring-integration-core') - api 'org.springframework:spring-oxm' - api ("org.springframework.ws:spring-xml:$springWsVersion") { - exclude group: 'org.springframework' - } - optionalApi ("org.springframework.ws:spring-ws-core:$springWsVersion") { - exclude group: 'org.springframework' - } + description = 'Spring Integration XML Support' + dependencies { + api project(':spring-integration-core') + api 'org.springframework:spring-oxm' + api("org.springframework.ws:spring-xml:$springWsVersion") { + exclude group: 'org.springframework' + } + optionalApi("org.springframework.ws:spring-ws-core:$springWsVersion") { + exclude group: 'org.springframework' + } - testImplementation "com.sun.xml.bind:jaxb-impl:$jaxbVersion" - testImplementation "org.xmlunit:xmlunit-assertj3:$xmlUnitVersion" - } + testImplementation "com.sun.xml.bind:jaxb-impl:$jaxbVersion" + testImplementation "org.xmlunit:xmlunit-assertj3:$xmlUnitVersion" + } + + tasks.withType(JavaForkOptions) { + jvmArgs '--add-opens', 'java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED' + } } project('spring-integration-xmpp') { - description = 'Spring Integration XMPP Support' - dependencies { - api project(':spring-integration-core') - api "org.igniterealtime.smack:smack-tcp:$smackVersion" - api "org.igniterealtime.smack:smack-java7:$smackVersion" - api "org.igniterealtime.smack:smack-extensions:$smackVersion" + description = 'Spring Integration XMPP Support' + dependencies { + api project(':spring-integration-core') + api "org.igniterealtime.smack:smack-tcp:$smackVersion" + api "org.igniterealtime.smack:smack-java7:$smackVersion" + api "org.igniterealtime.smack:smack-extensions:$smackVersion" - testImplementation project(':spring-integration-stream') - testImplementation "org.igniterealtime.smack:smack-experimental:$smackVersion" - } + testImplementation project(':spring-integration-stream') + testImplementation "org.igniterealtime.smack:smack-experimental:$smackVersion" + } } project('spring-integration-zeromq') { - description = 'Spring Integration ZeroMQ Support' - dependencies { - api project(':spring-integration-core') - api "org.zeromq:jeromq:$jeroMqVersion" + description = 'Spring Integration ZeroMQ Support' + dependencies { + api project(':spring-integration-core') + api "org.zeromq:jeromq:$jeroMqVersion" - optionalApi 'com.fasterxml.jackson.core:jackson-databind' + optionalApi 'com.fasterxml.jackson.core:jackson-databind' - testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - } + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" + } } project('spring-integration-zookeeper') { - description = 'Spring Integration Zookeeper Support' - dependencies { - api project(':spring-integration-core') - api "org.apache.curator:curator-recipes:$curatorVersion" + description = 'Spring Integration Zookeeper Support' + dependencies { + api project(':spring-integration-core') + api "org.apache.curator:curator-recipes:$curatorVersion" - testImplementation "org.apache.curator:curator-test:$curatorVersion" - } + testImplementation "org.apache.curator:curator-test:$curatorVersion" + } } project('spring-integration-bom') { - description = 'Spring Integration (Bill of Materials)' + description = 'Spring Integration (Bill of Materials)' - apply plugin: 'java-platform' - apply from: "${rootDir}/gradle/publish-maven.gradle" + apply plugin: 'java-platform' + apply from: "${rootDir}/gradle/publish-maven.gradle" - dependencies { - constraints { - javaProjects.sort { "$it.name" }.each { - api it - } - } - } + dependencies { + constraints { + javaProjects.sort { "$it.name" }.each { + api it + } + } + } - publishing { - publications { - mavenJava(MavenPublication) { - from components.javaPlatform - } - } - } + publishing { + publications { + mavenJava(MavenPublication) { + from components.javaPlatform + } + } + } - sonarqube { - skipProject = true - } + sonarqube { + skipProject = true + } } sonarqube { - properties { - property 'sonar.links.homepage', linkHomepage - property 'sonar.links.ci', linkCi - property 'sonar.links.issue', linkIssue - property 'sonar.links.scm', linkScmUrl - property 'sonar.links.scm_dev', linkScmDevConnection - } + properties { + property 'sonar.links.homepage', linkHomepage + property 'sonar.links.ci', linkCi + property 'sonar.links.issue', linkIssue + property 'sonar.links.scm', linkScmUrl + property 'sonar.links.scm_dev', linkScmDevConnection + } } task api(type: Javadoc) { - group = 'Documentation' - description = 'Generates aggregated Javadoc API documentation.' - title = "${rootProject.description} ${version} API" - options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED - options.author = true - options.header = rootProject.description - options.overview = 'src/api/overview.html' - options.stylesheetFile = file('src/api/stylesheet.css') - options.links(project.ext.javadocLinks) - source javaProjects.collect { project -> - project.sourceSets.main.allJava - } - destinationDir = new File(buildDir, 'api') - classpath = files(javaProjects.collect { project -> - project.sourceSets.main.compileClasspath - }) + group = 'Documentation' + description = 'Generates aggregated Javadoc API documentation.' + title = "${rootProject.description} ${version} API" + options { + encoding = 'UTF-8' + memberLevel = JavadocMemberLevel.PROTECTED + author = true + header = rootProject.description + use = true + overview = 'src/api/overview.html' + splitIndex = true + links(project.ext.javadocLinks) + addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint + } + + source javaProjects.collect { project -> + project.sourceSets.main.allJava + } + destinationDir = new File(buildDir, 'api') + classpath = files(javaProjects.collect { project -> + project.sourceSets.main.compileClasspath + }) } dokkaHtmlMultiModule { @@ -1014,118 +1050,119 @@ dokkaHtmlMultiModule { apply from: "${rootDir}/gradle/docs.gradle" task schemaZip(type: Zip) { - group = 'Distribution' - archiveClassifier = 'schema' - description = "Builds -${archiveClassifier} archive containing all " + - "XSDs for deployment at static.springframework.org/schema." + group = 'Distribution' + archiveClassifier = 'schema' + description = "Builds -${archiveClassifier} archive containing all " + + "XSDs for deployment at static.springframework.org/schema." - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + duplicatesStrategy = DuplicatesStrategy.EXCLUDE - javaProjects.each { subproject -> - Properties schemas = new Properties(); - def shortName = subproject.name.replaceFirst("${rootProject.name}-", '') - if (subproject.name.endsWith('-core')) { - shortName = '' - } + javaProjects.each { subproject -> + Properties schemas = new Properties(); + def shortName = subproject.name.replaceFirst("${rootProject.name}-", '') + if (subproject.name.endsWith('-core')) { + shortName = '' + } - subproject.sourceSets.main.resources.find { - it.path.endsWith("META-INF${File.separator}spring.schemas") - }?.withInputStream { schemas.load(it) } + subproject.sourceSets.main.resources.find { + it.path.endsWith("META-INF${File.separator}spring.schemas") + }?.withInputStream { schemas.load(it) } - for (def key : schemas.keySet()) { - File xsdFile = subproject.sourceSets.main.resources.find { - it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key)) - } - assert xsdFile != null - into ("integration/$shortName") { - from xsdFile.path - rename { String fileName -> - String[] versionNumbers = project.version.split(/\./, 3) - fileName.replace('.xsd', "-${versionNumbers[0]}.${versionNumbers[1]}.xsd") - } - } - } - } + for (def key : schemas.keySet()) { + File xsdFile = subproject.sourceSets.main.resources.find { + it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key)) + } + assert xsdFile != null + into("integration/$shortName") { + from xsdFile.path + rename { String fileName -> + String[] versionNumbers = project.version.split(/\./, 3) + fileName.replace('.xsd', "-${versionNumbers[0]}.${versionNumbers[1]}.xsd") + } + } + } + } } -task docsZip(type: Zip, dependsOn: [reference, dokkaHtmlMultiModule]) { - group = 'Distribution' - archiveClassifier = 'docs' - description = "Builds -${archiveClassifier} archive containing api and reference " + - "for deployment at static.springframework.org/spring-integration/docs." +task docsZip(type: Zip, dependsOn: [reference, dokkaHtmlMultiModule]) { + group = 'Distribution' + archiveClassifier = 'docs' + description = "Builds -${archiveClassifier} archive containing api and reference " + + "for deployment at static.springframework.org/spring-integration/docs." - from('src/dist') { - include 'changelog.txt' - } + from('src/dist') { + include 'changelog.txt' + } - from (api) { - into 'api' - } + from(api) { + into 'api' + } - from ('build/docs/asciidoc') { - into 'reference/html' - } + from('build/docs/asciidoc') { + into 'reference/html' + } - from ('build/docs/asciidocPdf') { - include 'index-single.pdf' - rename 'index-single.pdf', 'spring-integration-reference.pdf' - into 'reference/pdf' - } - from(dokkaHtmlMultiModule.outputDirectory) { - into 'kdoc-api' - } + from('build/docs/asciidocPdf') { + include 'index-single.pdf' + rename 'index-single.pdf', 'spring-integration-reference.pdf' + into 'reference/pdf' + } + + from(dokkaHtmlMultiModule.outputDirectory) { + into 'kdoc-api' + } } task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { - group = 'Distribution' - archiveClassifier = 'dist' - description = "Builds -${archiveClassifier} archive, containing all jars and docs, " + - "suitable for community download page." + group = 'Distribution' + archiveClassifier = 'dist' + description = "Builds -${archiveClassifier} archive, containing all jars and docs, " + + "suitable for community download page." - ext.baseDir = "${project.name}-${project.version}"; + ext.baseDir = "${project.name}-${project.version}"; - from('src/dist') { - include 'readme.txt' - include 'notice.txt' - into "${baseDir}" - expand(copyright: new Date().format('yyyy'), version: project.version) - } + from('src/dist') { + include 'readme.txt' + include 'notice.txt' + into "${baseDir}" + expand(copyright: new Date().format('yyyy'), version: project.version) + } - from("$project.rootDir") { - include 'LICENSE.txt' - into "${baseDir}" - } + from("$project.rootDir") { + include 'LICENSE.txt' + into "${baseDir}" + } - from(zipTree(docsZip.archiveFile)) { - into "${baseDir}/docs" - } + from(zipTree(docsZip.archiveFile)) { + into "${baseDir}/docs" + } - from(zipTree(schemaZip.archiveFile)) { - into "${baseDir}/schema" - } + from(zipTree(schemaZip.archiveFile)) { + into "${baseDir}/schema" + } - javaProjects.each { subproject -> - into ("${baseDir}/libs") { - from subproject.jar - from subproject.sourcesJar - from subproject.javadocJar - } - } + javaProjects.each { subproject -> + into("${baseDir}/libs") { + from subproject.jar + from subproject.sourcesJar + from subproject.javadocJar + } + } } task dist(dependsOn: assemble) { - group = 'Distribution' - description = 'Builds -dist, -docs and -schema distribution archives.' + group = 'Distribution' + description = 'Builds -dist, -docs and -schema distribution archives.' } apply from: "${rootDir}/gradle/publish-maven.gradle" publishing { - publications { - mavenJava(MavenPublication) { - artifact docsZip - artifact schemaZip - artifact distZip - } - } + publications { + mavenJava(MavenPublication) { + artifact docsZip + artifact schemaZip + artifact distZip + } + } } diff --git a/gradle.properties b/gradle.properties index ce1ddc6055..8f46d09eab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -version=5.5.9-SNAPSHOT -org.gradle.jvmargs=-Xmx4g -Dkotlin.daemon.jvm.options="-Xmx1g --illegal-access=permit" -Dfile.encoding=UTF-8 +version=6.0.0-SNAPSHOT +org.gradle.jvmargs=-Xmx1536M -Dfile.encoding=UTF-8 org.gradle.caching=true org.gradle.parallel=true kotlin.stdlib.default.dependency=false diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java index 10af9a9305..c37519dafb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java @@ -236,7 +236,7 @@ public class Jackson2JsonObjectMapper extends AbstractJacksonJsonObjectMapper("foo")); QueueChannel recovery = context.getBean("recovery", QueueChannel.class); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/LambdaMessageProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/LambdaMessageProcessorTests.java index f48662301f..0eb035dbe5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/LambdaMessageProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/LambdaMessageProcessorTests.java @@ -22,6 +22,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.Objects; import java.util.function.Function; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; @@ -86,6 +87,7 @@ public class LambdaMessageProcessorTests { } @Test + @Disabled("Until https://github.com/spring-projects/spring-integration/issues/3660") public void testCustomConverter() { LambdaMessageProcessor lmp = new LambdaMessageProcessor(Function.identity(), TestPojo.class); lmp.setBeanFactory(this.beanFactory); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java index 9959324e6e..1471e5de5b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -17,6 +17,7 @@ package org.springframework.integration.handler; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.mock; import java.util.Calendar; @@ -24,13 +25,14 @@ import java.util.Date; import java.util.Map; import java.util.Queue; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.DirectFieldAccessor; @@ -84,7 +86,7 @@ public class DelayHandlerTests { private TestApplicationContext context = TestUtils.createTestApplicationContext(); - @Before + @BeforeEach public void setup() { input.setBeanName("input"); output.setBeanName("output"); @@ -97,7 +99,7 @@ public class DelayHandlerTests { output.subscribe(resultHandler); } - @After + @AfterEach public void tearDown() { this.context.close(); this.taskScheduler.destroy(); @@ -251,7 +253,7 @@ public class DelayHandlerTests { assertThat(resultHandler.lastThread).isSameAs(Thread.currentThread()); } - @Test(expected = TestTimedOutException.class) + @Test public void delayHeaderIsFutureDateAndTimesOut() { this.setDelayExpression(); startDelayerHandler(); @@ -259,7 +261,8 @@ public class DelayHandlerTests { Message message = MessageBuilder.withPayload("test") .setHeader("delay", future).build(); input.send(message); - waitForLatch(100); + assertThatExceptionOfType(TestTimedOutException.class) + .isThrownBy(() -> waitForLatch(100)); } @Test @@ -308,7 +311,7 @@ public class DelayHandlerTests { assertThat(this.latch.await(10, TimeUnit.SECONDS)).isTrue(); } - @Test(expected = MessageDeliveryException.class) + @Test public void handlerThrowsExceptionWithNoDelay() { startDelayerHandler(); output.unsubscribe(resultHandler); @@ -316,7 +319,8 @@ public class DelayHandlerTests { throw new UnsupportedOperationException("intentional test failure"); }); Message message = MessageBuilder.withPayload("test").build(); - input.send(message); + assertThatExceptionOfType(MessageDeliveryException.class) + .isThrownBy(() -> input.send(message)); } @Test @@ -409,7 +413,7 @@ public class DelayHandlerTests { } @Test //INT-1132 - @Ignore("Time-sensitive: no guarantee that message won't be released in between 'sleep' and 'destroy'") + @Disabled("Time-sensitive: no guarantee that message won't be released in between 'sleep' and 'destroy'") public void testReschedulePersistedMessagesOnStartup() throws Exception { MessageGroupStore messageGroupStore = new SimpleMessageStore(); this.delayHandler.setDefaultDelay(2000); @@ -464,12 +468,13 @@ public class DelayHandlerTests { ac.close(); } - @Test(expected = MessageHandlingException.class) + @Test public void testInt2243IgnoreExpressionFailuresAsFalse() { this.setDelayExpression(); this.delayHandler.setIgnoreExpressionFailures(false); startDelayerHandler(); - this.delayHandler.handleMessage(new GenericMessage<>("test")); + assertThatExceptionOfType(MessageHandlingException.class) + .isThrownBy(() -> this.delayHandler.handleMessage(new GenericMessage<>("test"))); } @Test //INT-3560 @@ -516,7 +521,7 @@ public class DelayHandlerTests { dfa.setPropertyValue("requestDate", requestDate.getTimeInMillis()); this.taskScheduler.afterPropertiesSet(); this.delayHandler.reschedulePersistedMessages(); - Queue works = TestUtils.getPropertyValue(this.taskScheduler, "scheduledExecutor.workQueue", Queue.class); + Queue works = ((ScheduledThreadPoolExecutor) this.taskScheduler.getScheduledExecutor()).getQueue(); int n = 0; while (n++ < 2000 && works.size() == 0) { Thread.sleep(10); diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/core/MessagingEvent.java b/spring-integration-event/src/main/java/org/springframework/integration/event/core/MessagingEvent.java index 37209b7af5..2f8230d555 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/core/MessagingEvent.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/core/MessagingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,6 +16,8 @@ package org.springframework.integration.event.core; +import java.io.Serial; + import org.springframework.context.ApplicationEvent; import org.springframework.messaging.Message; @@ -23,17 +25,23 @@ import org.springframework.messaging.Message; * A subclass of {@link ApplicationEvent} that wraps a {@link Message}. * * @author Mark Fisher + * @author Artem Bilan */ public class MessagingEvent extends ApplicationEvent { + @Serial private static final long serialVersionUID = -872581247155846293L; + /** + * Construct an instance based on the provided message. + * @param message the message for event. + */ public MessagingEvent(Message message) { super(message); } public Message getMessage() { - return (Message) this.getSource(); + return (Message) getSource(); } } diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java index c035926182..4a249c850c 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -54,6 +54,9 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP private volatile long stoppedAt; + /** + * Construct an instance. + */ public ApplicationEventListeningMessageProducer() { setPhase(Integer.MAX_VALUE / 2 - 1000); // NOSONAR magic number } diff --git a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests-file-usage-context.xml b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests-file-usage-context.xml index f6a4ff86d6..d6969b4c0b 100644 --- a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests-file-usage-context.xml +++ b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests-file-usage-context.xml @@ -21,7 +21,7 @@ + value="#{T (org.springframework.integration.feed.config.FeedInboundChannelAdapterParserTests).tempFolder.absolutePath}"/> diff --git a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java index a5b721a8cf..1b0234e953 100644 --- a/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java +++ b/spring-integration-feed/src/test/java/org/springframework/integration/feed/config/FeedInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -19,17 +19,16 @@ package org.springframework.integration.feed.config; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.io.File; import java.util.Properties; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.ClassRule; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; import org.springframework.context.ConfigurableApplicationContext; @@ -58,8 +57,8 @@ import com.rometools.rome.io.SyndFeedInput; */ public class FeedInboundChannelAdapterParserTests { - @ClassRule - public static final TemporaryFolder tempFolder = new TemporaryFolder(); + @TempDir + public static File tempFolder; private static CountDownLatch latch; @@ -91,20 +90,20 @@ public class FeedInboundChannelAdapterParserTests { @Test public void validateSuccessfulNewsRetrievalWithFileUrlAndMessageHistory() throws Exception { //Test file samples.rss has 3 news items - latch = spy(new CountDownLatch(3)); + latch = new CountDownLatch(3); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass()); latch.await(10, TimeUnit.SECONDS); - verify(latch, times(3)).countDown(); + assertThat(latch.getCount()).isEqualTo(0); context.close(); // since we are not deleting the persister file // in this iteration no new feeds will be received and the latch will timeout - latch = spy(new CountDownLatch(3)); + latch = new CountDownLatch(3); context = new ClassPathXmlApplicationContext( "FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass()); latch.await(500, TimeUnit.MILLISECONDS); - verify(latch, times(0)).countDown(); + assertThat(latch.getCount()).isEqualTo(3); SourcePollingChannelAdapter adapter = context.getBean("feedAdapterUsage", SourcePollingChannelAdapter.class); assertThat(TestUtils.getPropertyValue(adapter, "source.syndFeedInput.preserveWireFeed", Boolean.class)) @@ -114,7 +113,7 @@ public class FeedInboundChannelAdapterParserTests { } @Test - @Ignore // goes against the real feed + @Disabled("Goes against the real feed") public void validateSuccessfulNewsRetrievalWithHttpUrl() throws Exception { final CountDownLatch latch = new CountDownLatch(3); MessageHandler handler = spy(message -> latch.countDown()); diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java index 7666889525..38d1036bce 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -124,16 +124,7 @@ public class FileInboundChannelAdapterParserTests { Object priorityQueue = accessor.getPropertyValue("toBeReceived"); assertThat(priorityQueue).isInstanceOf(PriorityBlockingQueue.class); Object expected = context.getBean("testComparator"); - DirectFieldAccessor queueAccessor = new DirectFieldAccessor(priorityQueue); - Object innerQueue = queueAccessor.getPropertyValue("q"); - Object actual; - if (innerQueue != null) { - actual = new DirectFieldAccessor(innerQueue).getPropertyValue("comparator"); - } - else { - // probably running under JDK 7 - actual = queueAccessor.getPropertyValue("comparator"); - } + Object actual = ((PriorityBlockingQueue) priorityQueue).comparator(); assertThat(actual).as("comparator reference not set, ").isSameAs(expected); } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/splitter/FileSplitterTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/splitter/FileSplitterTests.java index e0a629d4fb..7d60f24fe3 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/splitter/FileSplitterTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/splitter/FileSplitterTests.java @@ -32,11 +32,11 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Date; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -380,14 +380,21 @@ public class FileSplitterTests { }); FileSplitter splitter = new FileSplitter(true, true); splitter.setOutputChannel(outputChannel); - FileReader fileReader = Mockito.spy(new FileReader(file)); + AtomicBoolean closeCalled = new AtomicBoolean(); + FileReader fileReader = new FileReader(file) { + + @Override public void close() throws IOException { + super.close(); + closeCalled.set(true); + } + }; try { splitter.handleMessage(new GenericMessage<>(fileReader)); } catch (RuntimeException e) { // ignore } - Mockito.verify(fileReader).close(); + assertThat(closeCalled.get()).isTrue(); } @Configuration diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java index 2912f33119..f3990036d4 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java @@ -18,10 +18,7 @@ package org.springframework.integration.file.tail; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; import java.io.File; import java.io.FileOutputStream; @@ -30,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -156,7 +154,19 @@ public class FileTailingMessageProducerTests { } }); - File file = spy(new File(this.testDir, "foo")); + AtomicBoolean existsCalled = new AtomicBoolean(); + File file = new File(this.testDir, "foo") { + + @Override + public boolean exists() { + try { + return super.exists(); + } + finally { + existsCalled.set(true); + } + } + }; file.delete(); adapter.setFile(file); @@ -169,7 +179,7 @@ public class FileTailingMessageProducerTests { assertThat(noFile).as("file does not exist event did not emit ").isTrue(); boolean noEvent = idleCountDownLatch.await(100, TimeUnit.MILLISECONDS); assertThat(noEvent).as("event should not emit when no file exit").isFalse(); - verify(file, atLeastOnce()).exists(); + assertThat(existsCalled.get()).isTrue(); file.createNewFile(); boolean eventRaised = idleCountDownLatch.await(10, TimeUnit.SECONDS); diff --git a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessor.java b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessor.java index cc176efa01..c5b176a36b 100644 --- a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessor.java +++ b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessor.java @@ -18,8 +18,6 @@ package org.springframework.integration.groovy; import java.io.IOException; import java.io.UncheckedIOException; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -74,9 +72,7 @@ public class GroovyScriptExecutingMessageProcessor extends AbstractScriptExecuti private ScriptSource scriptSource; - private GroovyClassLoader groovyClassLoader = - AccessController.doPrivileged((PrivilegedAction) - () -> new GroovyClassLoader(ClassUtils.getDefaultClassLoader())); + private GroovyClassLoader groovyClassLoader = new GroovyClassLoader(ClassUtils.getDefaultClassLoader()); private boolean compileStatic; @@ -160,9 +156,7 @@ public class GroovyScriptExecutingMessageProcessor extends AbstractScriptExecuti compilerConfig = this.compilerConfiguration; } - this.groovyClassLoader = - AccessController.doPrivileged((PrivilegedAction) - () -> new GroovyClassLoader(getBeanClassLoader(), compilerConfig)); + this.groovyClassLoader = new GroovyClassLoader(getBeanClassLoader(), compilerConfig); } @Override diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingController.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingController.java index f92642a915..e9eafe0fac 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingController.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -20,8 +20,8 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.expression.Expression; import org.springframework.expression.common.LiteralExpression; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingEndpointSupport.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingEndpointSupport.java index 41476d0367..c3e356dc4b 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingEndpointSupport.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingEndpointSupport.java @@ -22,10 +22,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; import javax.xml.transform.Source; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.core.ResolvableType; @@ -386,8 +387,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound for (Cookie requestCookie : requestCookies) { cookies.add(requestCookie.getName(), requestCookie); } - // TODO no toSingleValueMap() in the next major version - evaluationContext.setVariable("cookies", cookies.toSingleValueMap()); + evaluationContext.setVariable("cookies", cookies); } Map pathVariables = diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java index 990dc7d88f..5f02a9420e 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -20,8 +20,8 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java index 343d1caa22..88eebd3858 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2020 the original author or authors. + * Copyright 2013-2021 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. @@ -23,8 +23,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java index 41c5c62ba6..9df199f43d 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.junit.jupiter.api.Test; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java index 02b08b95ee..ea24711847 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -25,10 +25,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; @@ -51,8 +50,7 @@ import org.springframework.messaging.SubscribableChannel; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Mark Fisher @@ -63,8 +61,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Biju Kunjummen * @author Artem Bilan */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext public class HttpInboundGatewayParserTests { diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java index 66e4585263..7cd728694e 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingControllerTests.java @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import org.apache.commons.logging.LogFactory; import org.junit.jupiter.api.Test; @@ -330,7 +330,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests protected Object handleRequestMessage(Message requestMessage) { try { latch2.countDown(); - // hold up an active thread so we can verify the count and that it completes ok + // hold up an active thread, so we can verify the count and that it completes ok latch1.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { @@ -407,7 +407,7 @@ public class HttpRequestHandlingControllerTests extends AbstractHttpInboundTests controller.setViewName("foo"); controller.setReplyKey("cookiesReply"); controller.setExtractReplyPayload(true); - controller.setPayloadExpression(new SpelExpressionParser().parseExpression("#cookies['c1']?.value")); + controller.setPayloadExpression(new SpelExpressionParser().parseExpression("#cookies['c1'][0].value")); controller.setBeanFactory(mock(BeanFactory.class)); controller.afterPropertiesSet(); controller.start(); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java index 7951d65593..455798f676 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGatewayTests.java @@ -29,7 +29,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.junit.jupiter.api.Test; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/Int2312RequestMappingIntegrationTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/Int2312RequestMappingIntegrationTests.java index b4a8edeb45..e110e1f7f0 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/Int2312RequestMappingIntegrationTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/Int2312RequestMappingIntegrationTests.java @@ -17,12 +17,13 @@ package org.springframework.integration.http.inbound; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import org.junit.jupiter.api.Test; @@ -48,9 +49,9 @@ import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter; /** * @author Artem Bilan * @author Gary Russell + * * @since 3.0 */ -//INT-2312 @SpringJUnitConfig @DirtiesContext public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTests { @@ -129,9 +130,9 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe assertThat(requestParams).isNotNull(); assertThat(((HttpHeaders) requestHeaders).getContentType()).isEqualTo(MediaType.TEXT_PLAIN); - Map cookies = (Map) headers.get("cookies"); + MultiValueMap cookies = (MultiValueMap) headers.get("cookies"); assertThat(cookies.size()).isEqualTo(1); - Cookie foo = cookies.get("foo"); + Cookie foo = cookies.getFirst("foo"); assertThat(foo).isNotNull(); assertThat(foo).isEqualTo(cookie); }); @@ -148,22 +149,16 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe @Test public void testParams() throws Exception { - MockHttpServletRequest request = new MockHttpServletRequest("GET", "/params"); - Object handler = null; - try { - handler = this.handlerMapping.getHandler(request); - } - catch (Exception e) { - // There is no matching handlers and some default handler - //See org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping#handleNoMatch - assertThat(e instanceof UnsatisfiedServletRequestParameterException).isTrue(); - } + // There is no matching handlers and some default handler + //See org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping#handleNoMatch + assertThatExceptionOfType(UnsatisfiedServletRequestParameterException.class) + .isThrownBy(() -> this.handlerMapping.getHandler(new MockHttpServletRequest("GET", "/params"))); - request = new MockHttpServletRequest("GET", "/params"); + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/params"); request.addParameter("param1", "1"); request.addParameter("param2", "1"); - handler = this.handlerMapping.getHandler(request).getHandler(); + Object handler = this.handlerMapping.getHandler(request).getHandler(); MockHttpServletResponse response = new MockHttpServletResponse(); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/MultipartAsRawByteArrayTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/MultipartAsRawByteArrayTests.java index 16d53c53eb..cfbc15f9ac 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/MultipartAsRawByteArrayTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/inbound/MultipartAsRawByteArrayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2021 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. @@ -25,17 +25,16 @@ import static org.mockito.Mockito.when; import java.util.Collections; import java.util.Enumeration; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.springframework.beans.factory.BeanFactory; import org.springframework.http.converter.ByteArrayHttpMessageConverter; -import org.springframework.http.converter.HttpMessageConverter; import org.springframework.integration.channel.QueueChannel; import org.springframework.messaging.Message; import org.springframework.web.context.request.RequestAttributes; @@ -53,8 +52,7 @@ public class MultipartAsRawByteArrayTests { @Test public void testMultiPass() throws Exception { HttpRequestHandlingMessagingGateway gw = new HttpRequestHandlingMessagingGateway(false); - gw.setMessageConverters( - Collections.>singletonList(new ByteArrayHttpMessageConverter())); + gw.setMessageConverters(Collections.singletonList(new ByteArrayHttpMessageConverter())); gw.setMergeWithDefaultConverters(false); QueueChannel requestChannel = new QueueChannel(); gw.setRequestChannel(requestChannel); @@ -70,7 +68,7 @@ public class MultipartAsRawByteArrayTests { int done; @Override - public Integer answer(InvocationOnMock invocation) throws Throwable { + public Integer answer(InvocationOnMock invocation) { byte[] buff = invocation.getArgument(0); buff[0] = 'f'; buff[1] = 'o'; diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java index f33bf2d1de..65629f89f9 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/dsl/IpIntegrationTests.java @@ -18,7 +18,6 @@ package org.springframework.integration.ip.dsl; import static org.assertj.core.api.Assertions.assertThat; -import java.net.DatagramSocket; import java.util.Collections; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -181,8 +180,6 @@ public class IpIntegrationTests { Message received = this.udpIn.receive(10000); assertThat(received).isNotNull(); assertThat(Transformers.objectToString().transform(received).getPayload()).isEqualTo("foo"); - assertThat(TestUtils.getPropertyValue(this.udpOutbound, "socket", DatagramSocket.class).getTrafficClass()) - .isEqualTo(0x10); } @Test @@ -202,7 +199,7 @@ public class IpIntegrationTests { @Test void testCloseStream() throws InterruptedException { IntegrationFlow server = IntegrationFlows.from(Tcp.inboundGateway(Tcp.netServer(0) - .deserializer(new ByteArrayRawSerializer()))) + .deserializer(new ByteArrayRawSerializer()))) .transform(p -> "reply:" + new String(p).toUpperCase()) .get(); CountDownLatch latch = new CountDownLatch(1); @@ -223,8 +220,8 @@ public class IpIntegrationTests { assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); IntegrationFlow client = IntegrationFlows.from(MessageChannels.direct()) .handle(Tcp.outboundGateway(Tcp.netClient("localhost", port.get()) - .singleUseConnections(true) - .serializer(new ByteArrayRawSerializer())) + .singleUseConnections(true) + .serializer(new ByteArrayRawSerializer())) .remoteTimeout(20_000) .closeStreamAfterSend(true)) .transform(Transformers.objectToString()) @@ -262,10 +259,10 @@ public class IpIntegrationTests { @Bean public IntegrationFlow inTcpGateway() { return IntegrationFlows.from( - Tcp.inboundGateway(server1()) - .replyTimeout(1) - .errorOnTimeout(true) - .errorChannel("inTcpGatewayErrorFlow.input")) + Tcp.inboundGateway(server1()) + .replyTimeout(1) + .errorOnTimeout(true) + .errorChannel("inTcpGatewayErrorFlow.input")) .handle(this, "captureId") .transform(Transformers.objectToString()) .filter((payload) -> !"junk".equals(payload)) diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java index dae2934871..3ae5df8c1a 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java @@ -63,6 +63,7 @@ import javax.net.SocketFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; @@ -847,11 +848,13 @@ public class TcpNioConnectionTests { } @Test + @Disabled("Until https://github.com/spring-projects/spring-integration/issues/3666") public void testMultiAccept() throws InterruptedException, IOException { testMulti(true); } @Test + @Disabled("Until https://github.com/spring-projects/spring-integration/issues/3666") public void testNoMultiAccept() throws InterruptedException, IOException { testMulti(false); } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java index 69e54813e8..75a2f8f56f 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -30,15 +30,13 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource; * * @author Dave Syer * @author Gary Russell + * @author Artem Bilan + * * @since 2.0 */ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSourceFactory { - private volatile Map staticParameters; - - public BeanPropertySqlParameterSourceFactory() { - this.staticParameters = Collections.unmodifiableMap(new HashMap()); - } + private Map staticParameters = Collections.unmodifiableMap(new HashMap<>()); /** * If the input is a List or a Map, the output is a map parameter source, and in that case some static parameters diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/ExpressionEvaluatingSqlParameterSourceFactory.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/ExpressionEvaluatingSqlParameterSourceFactory.java index f017a61024..b11f660933 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/ExpressionEvaluatingSqlParameterSourceFactory.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/ExpressionEvaluatingSqlParameterSourceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -58,9 +58,6 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre */ private final Map parameterExpressions = new HashMap<>(); - public ExpressionEvaluatingSqlParameterSourceFactory() { - } - /** * Define some static parameter values. These take precedence over those defined as expressions in the * {@link #setParameterExpressions(Map) parameterExpressions}, so a parameter in the query will be filled from here diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java index e9b39d770f..5bb597cdce 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageHandler.java @@ -129,7 +129,10 @@ public class JdbcMessageHandler extends AbstractMessageHandler { this.keysGenerated = keysGenerated; } - + /** + * Configure an {@link SqlParameterSourceFactory}. + * @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use. + */ public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) { this.sqlParameterSourceFactory = sqlParameterSourceFactory; } @@ -178,6 +181,12 @@ public class JdbcMessageHandler extends AbstractMessageHandler { } } + /** + * Execute an update for the provided message and generated keys flag. + * @param message the message to use for update query params. + * @param keysGenerated generate key or not. + * @return a generated keys for udapte. + */ protected List> executeUpdateQuery(final Message message, boolean keysGenerated) { if (keysGenerated) { if (this.preparedStatementSetter != null) { diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java index 6e5d76a0a4..b31d5b8b5f 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -53,18 +53,40 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler { private Integer maxRows; + /** + * Construct an instance based on the provided {@link DataSource} and update SQL. + * @param dataSource the {@link DataSource} for execution. + * @param updateQuery the query to execute. + */ public JdbcOutboundGateway(DataSource dataSource, String updateQuery) { this(new JdbcTemplate(dataSource), updateQuery, null); } + /** + * Construct an instance based on the provided {@link DataSource}, select and update SQLs. + * @param dataSource the {@link DataSource} for execution. + * @param updateQuery the update to execute. + * @param selectQuery the select to execute. + */ public JdbcOutboundGateway(DataSource dataSource, String updateQuery, String selectQuery) { this(new JdbcTemplate(dataSource), updateQuery, selectQuery); } + /** + * Construct an instance based on the provided {@link JdbcOperations} and update SQL. + * @param jdbcOperations the {@link JdbcOperations} for execution. + * @param updateQuery the query to execute. + */ public JdbcOutboundGateway(JdbcOperations jdbcOperations, String updateQuery) { this(jdbcOperations, updateQuery, null); } + /** + * Construct an instance based on the provided {@link JdbcOperations}, select and update SQLs. + * @param jdbcOperations the {@link JdbcOperations} for execution. + * @param updateQuery the update to execute. + * @param selectQuery the select to execute. + */ public JdbcOutboundGateway(JdbcOperations jdbcOperations, String updateQuery, String selectQuery) { Assert.notNull(jdbcOperations, "'jdbcOperations' must not be null."); @@ -95,7 +117,7 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler { * The value is set on the underlying {@link JdbcPollingChannelAdapter}. * Also used to check before producing reply: * if result has only one item and {@code maxRows} is not set or configured to {@code 1}, - * only that item is returned. Otherwise the whole list. + * only that item is returned. Otherwise, the whole list. * If not specified this value will default to {@code 1}. * This parameter is only applicable if a selectQuery was provided. Null values * are not permitted. @@ -117,21 +139,38 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler { this.keysGenerated = keysGenerated; } + /** + * Set a {@link SqlParameterSourceFactory} for update query. + * @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use. + */ public void setRequestSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) { Assert.notNull(this.handler, "'handler' cannot be null"); this.handler.setSqlParameterSourceFactory(sqlParameterSourceFactory); } + /** + * Set a {@link MessagePreparedStatementSetter} for update query. + * @param requestPreparedStatementSetter the {@link MessagePreparedStatementSetter} to use. + */ public void setRequestPreparedStatementSetter(MessagePreparedStatementSetter requestPreparedStatementSetter) { Assert.notNull(this.handler, "'handler' cannot be null"); this.handler.setPreparedStatementSetter(requestPreparedStatementSetter); } + /** + /** + * Set a {@link SqlParameterSourceFactory} for select query. + * @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use. + */ public void setReplySqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) { this.sqlParameterSourceFactory = sqlParameterSourceFactory; this.sqlParameterSourceFactorySet = true; } + /** + * Set a select result {@link RowMapper}. + * @param rowMapper the {@link RowMapper} to use. + */ public void setRowMapper(RowMapper rowMapper) { this.poller.setRowMapper(rowMapper); } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java index 4a6eae773e..a83618f75f 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcPollingChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -108,6 +108,10 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource { this.rowMapper = new ColumnMapRowMapper(); } + /** + * Set a {@link RowMapper}. + * @param rowMapper the {@link RowMapper} to use. + */ public void setRowMapper(@Nullable RowMapper rowMapper) { this.rowMapper = rowMapper; if (rowMapper == null) { @@ -125,14 +129,26 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource { this.selectQuery = selectQuery; } + /** + * Set an update query. + * @param updateSql the update query to use. + */ public void setUpdateSql(String updateSql) { this.updateSql = updateSql; } + /** + * Set a flag to update per record or not. Defaults to false. + * @param updatePerRow the flag to control an update per record or whole batch. + */ public void setUpdatePerRow(boolean updatePerRow) { this.updatePerRow = updatePerRow; } + /** + * Set an {@link SqlParameterSourceFactory} for update query. + * @param sqlParameterSourceFactory the {@link SqlParameterSourceFactory} to use. + */ public void setUpdateSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) { Assert.notNull(sqlParameterSourceFactory, "'sqlParameterSourceFactory' must be null."); this.sqlParameterSourceFactory = sqlParameterSourceFactory; @@ -194,6 +210,11 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource { return payload; } + /** + * Perform a select against provided {@link SqlParameterSource}. + * @param sqlQueryParameterSource the {@link SqlParameterSource} to use. Optional. + * @return the result of the query. + */ protected List doPoll(@Nullable SqlParameterSource sqlQueryParameterSource) { if (sqlQueryParameterSource != null) { return this.jdbcOperations.query(this.selectQuery, sqlQueryParameterSource, this.rowMapper); @@ -207,18 +228,9 @@ public class JdbcPollingChannelAdapter extends AbstractMessageSource { this.jdbcOperations.update(this.updateSql, this.sqlParameterSourceFactory.createParameterSource(obj)); } - private static final class PreparedStatementCreatorWithMaxRows + private record PreparedStatementCreatorWithMaxRows(PreparedStatementCreator delegate, int maxRows) implements PreparedStatementCreator, PreparedStatementSetter, SqlProvider, ParameterDisposer { - private final PreparedStatementCreator delegate; - - private final int maxRows; - - private PreparedStatementCreatorWithMaxRows(PreparedStatementCreator delegate, int maxRows) { - this.delegate = delegate; - this.maxRows = maxRows; - } - @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement preparedStatement = this.delegate.createPreparedStatement(con); diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/MessagePreparedStatementSetter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/MessagePreparedStatementSetter.java index dfb2affee1..60b6f9873f 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/MessagePreparedStatementSetter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/MessagePreparedStatementSetter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2021 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. @@ -32,12 +32,20 @@ import org.springframework.messaging.Message; * * @author Artem Bilan * @author Gary Russell + * * @since 4.2 + * * @see org.springframework.jdbc.core.PreparedStatementSetter */ @FunctionalInterface public interface MessagePreparedStatementSetter { + /** + * Set parameter values on the given {@link PreparedStatement} and message context. + * @param ps the {@link PreparedStatement} to set value. + * @param requestMessage the message as a context for values. + * @throws SQLException if an SQLException is encountered + */ void setValues(PreparedStatement ps, Message requestMessage) throws SQLException; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java index 152242af2d..fc2a74e8e1 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java @@ -79,7 +79,10 @@ public class JdbcLockRegistry implements ExpirableLockRegistry, RenewableLockReg private int cacheCapacity = DEFAULT_CAPACITY; - public JdbcLockRegistry(LockRepository client) { + /** + * Construct an instance based on the provided {@link LockRepository}. + * @param client the {@link LockRepository} to rely on. + */ public JdbcLockRegistry(LockRepository client) { this.client = client; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/LockRepository.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/LockRepository.java index 947a4bd698..b0a6a902fd 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/LockRepository.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/LockRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 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. @@ -25,19 +25,42 @@ import java.io.Closeable; * * @author Dave Syer * @author Alexandre Strubel + * @author Artem Bilan * * @since 4.3 */ public interface LockRepository extends Closeable { + /** + * Check if a lock is held by this repository. + * @param lock the lock to check. + * @return acquired or not. + */ boolean isAcquired(String lock); + /** + * Remove a lock from this repository. + * @param lock the lock to remove. + */ void delete(String lock); + /** + * Remove all the expired locks. + */ void deleteExpired(); + /** + * Acquire a lock for a key. + * @param lock the key for lock to acquire. + * @return acquired or not. + */ boolean acquire(String lock); + /** + * Renew the lease for a lock. + * @param lock the lock to renew. + * @return renewed or not. + */ boolean renew(String lock); @Override diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java index 80f5efd2a1..c78dea0efa 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java @@ -336,6 +336,10 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto this.usingIdCache = usingIdCache; } + /** + * Enable a priority handling in this store. + * @param priorityEnabled the priority handling enabled or not. + */ public void setPriorityEnabled(boolean priorityEnabled) { this.priorityEnabled = priorityEnabled; } @@ -357,6 +361,10 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto this.messageGroupFactory = messageGroupFactory; } + /** + * Return the {@link MessageGroupFactory}. + * @return the {@link MessageGroupFactory} + */ protected MessageGroupFactory getMessageGroupFactory() { return this.messageGroupFactory; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java index 852f83fcec..631d2ce4e5 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -31,6 +31,7 @@ import org.springframework.messaging.Message; * * @author Gunnar Hillert * @author Gary Russell + * @author Artem Bilan * * @since 2.2 * @@ -41,6 +42,12 @@ public class MessageRowMapper implements RowMapper> { private final LobHandler lobHandler; + /** + * Construct an instance based on the provided {@link AllowListDeserializingConverter} + * and {@link LobHandler}. + * @param deserializer the {@link AllowListDeserializingConverter} to use. + * @param lobHandler the {@link LobHandler} to use. + */ public MessageRowMapper(AllowListDeserializingConverter deserializer, LobHandler lobHandler) { this.deserializer = deserializer; this.lobHandler = lobHandler; diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java index 107e1e3821..43f6a88a67 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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,12 +18,12 @@ package org.springframework.integration.jms; import java.util.Map; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.InvalidDestinationException; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Session; +import jakarta.jms.DeliveryMode; +import jakarta.jms.Destination; +import jakarta.jms.InvalidDestinationException; +import jakarta.jms.JMSException; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -61,7 +61,7 @@ import org.springframework.util.Assert; * @author Gary Russell */ public class ChannelPublishingJmsMessageListener - implements SessionAwareMessageListener, InitializingBean, + implements SessionAwareMessageListener, InitializingBean, TrackableComponent, BeanFactoryAware { protected final LogAccessor logger = new LogAccessor(getClass()); // NOSONAR final @@ -80,11 +80,11 @@ public class ChannelPublishingJmsMessageListener private String correlationKey; - private long replyTimeToLive = javax.jms.Message.DEFAULT_TIME_TO_LIVE; + private long replyTimeToLive = jakarta.jms.Message.DEFAULT_TIME_TO_LIVE; - private int replyPriority = javax.jms.Message.DEFAULT_PRIORITY; + private int replyPriority = jakarta.jms.Message.DEFAULT_PRIORITY; - private int replyDeliveryMode = javax.jms.Message.DEFAULT_DELIVERY_MODE; + private int replyDeliveryMode = jakarta.jms.Message.DEFAULT_DELIVERY_MODE; private boolean explicitQosEnabledForReplies; @@ -176,7 +176,7 @@ public class ChannelPublishingJmsMessageListener *

Alternatively, specify a JMS Destination object as "defaultReplyDestination". * @param destinationName The default reply destination name. * @see #setDestinationResolver - * @see #setDefaultReplyDestination(javax.jms.Destination) + * @see #setDefaultReplyDestination(jakarta.jms.Destination) */ public void setDefaultReplyQueueName(String destinationName) { this.defaultReplyDestination = new DestinationNameHolder(destinationName, false); @@ -189,7 +189,7 @@ public class ChannelPublishingJmsMessageListener *

Alternatively, specify a JMS Destination object as "defaultReplyDestination". * @param destinationName The default reply topic name. * @see #setDestinationResolver - * @see #setDefaultReplyDestination(javax.jms.Destination) + * @see #setDefaultReplyDestination(jakarta.jms.Destination) */ public void setDefaultReplyTopicName(String destinationName) { this.defaultReplyDestination = new DestinationNameHolder(destinationName, true); @@ -198,7 +198,7 @@ public class ChannelPublishingJmsMessageListener /** * Specify the time-to-live property for JMS reply Messages. * @param replyTimeToLive The reply time to live. - * @see javax.jms.MessageProducer#setTimeToLive(long) + * @see jakarta.jms.MessageProducer#setTimeToLive(long) */ public void setReplyTimeToLive(long replyTimeToLive) { this.replyTimeToLive = replyTimeToLive; @@ -207,7 +207,7 @@ public class ChannelPublishingJmsMessageListener /** * Specify the priority value for JMS reply Messages. * @param replyPriority The reply priority. - * @see javax.jms.MessageProducer#setPriority(int) + * @see jakarta.jms.MessageProducer#setPriority(int) */ public void setReplyPriority(int replyPriority) { this.replyPriority = replyPriority; @@ -216,7 +216,7 @@ public class ChannelPublishingJmsMessageListener /** * Specify the delivery mode for JMS reply Messages. * @param replyDeliveryPersistent true for a persistent reply message. - * @see javax.jms.MessageProducer#setDeliveryMode(int) + * @see jakarta.jms.MessageProducer#setDeliveryMode(int) */ public void setReplyDeliveryPersistent(boolean replyDeliveryPersistent) { this.replyDeliveryMode = replyDeliveryPersistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT; @@ -310,7 +310,7 @@ public class ChannelPublishingJmsMessageListener } @Override - public void onMessage(javax.jms.Message jmsMessage, Session session) throws JMSException { + public void onMessage(jakarta.jms.Message jmsMessage, Session session) throws JMSException { Message requestMessage; try { final Object result; @@ -358,7 +358,7 @@ public class ChannelPublishingJmsMessageListener replyResult = replyMessage; } try { - javax.jms.Message jmsReply = this.messageConverter.toMessage(replyResult, session); + jakarta.jms.Message jmsReply = this.messageConverter.toMessage(replyResult, session); // map SI Message Headers to JMS Message Properties/Headers this.headerMapper.fromHeaders(replyMessage.getHeaders(), jmsReply); copyCorrelationIdFromRequestToReply(jmsMessage, jmsReply); @@ -392,7 +392,7 @@ public class ChannelPublishingJmsMessageListener this.gatewayDelegate.stop(); } - private void copyCorrelationIdFromRequestToReply(javax.jms.Message requestMessage, javax.jms.Message replyMessage) + private void copyCorrelationIdFromRequestToReply(jakarta.jms.Message requestMessage, jakarta.jms.Message replyMessage) throws JMSException { if (this.correlationKey != null) { @@ -429,9 +429,9 @@ public class ChannelPublishingJmsMessageListener * @throws JMSException if thrown by JMS API methods * @throws InvalidDestinationException if no {@link Destination} can be determined * @see #setDefaultReplyDestination - * @see javax.jms.Message#getJMSReplyTo() + * @see jakarta.jms.Message#getJMSReplyTo() */ - private Destination getReplyDestination(javax.jms.Message request, Session session) throws JMSException { + private Destination getReplyDestination(jakarta.jms.Message request, Session session) throws JMSException { Destination replyTo = request.getJMSReplyTo(); if (replyTo == null) { replyTo = resolveDefaultReplyDestination(session); @@ -448,7 +448,7 @@ public class ChannelPublishingJmsMessageListener * listener's {@link DestinationResolver} in case of a destination name. * @param session The session. * @return the located {@link Destination} - * @throws javax.jms.JMSException if resolution failed + * @throws jakarta.jms.JMSException if resolution failed * @see #setDefaultReplyDestination * @see #setDefaultReplyQueueName * @see #setDefaultReplyTopicName @@ -465,7 +465,7 @@ public class ChannelPublishingJmsMessageListener return null; } - private void sendReply(javax.jms.Message replyMessage, Destination destination, Session session) + private void sendReply(jakarta.jms.Message replyMessage, Destination destination, Session session) throws JMSException { MessageProducer producer = session.createProducer(destination); diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java index 862aa7d881..1e0b054bef 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java @@ -23,9 +23,9 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -130,7 +130,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } @Override - public void fromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage) { + public void fromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage) { try { populateCorrelationIdPropertyFromHeaders(headers, jmsMessage); populateReplyToPropertyFromHeaders(headers, jmsMessage); @@ -155,7 +155,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } } - private void populateCorrelationIdPropertyFromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage) { + private void populateCorrelationIdPropertyFromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage) { Object jmsCorrelationId = headers.get(JmsHeaders.CORRELATION_ID); if (jmsCorrelationId instanceof Number) { jmsCorrelationId = jmsCorrelationId.toString(); @@ -170,7 +170,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } } - private void populateReplyToPropertyFromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage) { + private void populateReplyToPropertyFromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage) { Object jmsReplyTo = headers.get(JmsHeaders.REPLY_TO); if (jmsReplyTo instanceof Destination) { try { @@ -182,7 +182,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } } - private void populateTypePropertyFromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage) { + private void populateTypePropertyFromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage) { Object jmsType = headers.get(JmsHeaders.TYPE); if (jmsType instanceof String) { try { @@ -194,7 +194,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } } - private void populateArbitraryHeaderToProperty(javax.jms.Message jmsMessage, String headerName, Object value) + private void populateArbitraryHeaderToProperty(jakarta.jms.Message jmsMessage, String headerName, Object value) throws JMSException { if (SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) { @@ -222,7 +222,7 @@ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { } @Override - public Map toHeaders(javax.jms.Message jmsMessage) { + public Map toHeaders(jakarta.jms.Message jmsMessage) { Map headers = new HashMap<>(); try { mapMessageIdProperty(jmsMessage, headers); diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java index 6435086926..9560230f6f 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DynamicJmsTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms; -import javax.jms.ConnectionFactory; +import jakarta.jms.ConnectionFactory; import org.springframework.jms.connection.CachingConnectionFactory; import org.springframework.jms.core.JmsTemplate; diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsDestinationPollingSource.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsDestinationPollingSource.java index d6b23ab4f7..2676cc38d1 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsDestinationPollingSource.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsDestinationPollingSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,7 +18,7 @@ package org.springframework.integration.jms; import java.util.Map; -import javax.jms.Destination; +import jakarta.jms.Destination; import org.springframework.integration.endpoint.AbstractMessageSource; import org.springframework.integration.jms.util.JmsAdapterUtils; @@ -117,13 +117,13 @@ public class JmsDestinationPollingSource extends AbstractMessageSource { } /** - * Will receive a JMS {@link javax.jms.Message} converting and returning it as + * Will receive a JMS {@link jakarta.jms.Message} converting and returning it as * a Spring Integration {@link Message}. This method will also use the current * {@link JmsHeaderMapper} instance to map JMS properties to the MessageHeaders. */ @Override protected Object doReceive() { - javax.jms.Message jmsMessage = doReceiveJmsMessage(); + jakarta.jms.Message jmsMessage = doReceiveJmsMessage(); if (jmsMessage == null) { return null; } @@ -148,8 +148,8 @@ public class JmsDestinationPollingSource extends AbstractMessageSource { } } - private javax.jms.Message doReceiveJmsMessage() { - javax.jms.Message jmsMessage = null; + private jakarta.jms.Message doReceiveJmsMessage() { + jakarta.jms.Message jmsMessage = null; if (this.destination != null) { jmsMessage = this.jmsTemplate.receiveSelected(this.destination, this.messageSelector); } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsHeaderMapper.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsHeaderMapper.java index 32ae8491ce..080bb0e5ab 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsHeaderMapper.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms; -import javax.jms.Message; +import jakarta.jms.Message; import org.springframework.integration.mapping.HeaderMapper; diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java index 4b6bd4eb9b..2da9196858 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java @@ -28,18 +28,18 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TemporaryQueue; -import javax.jms.TemporaryTopic; -import javax.jms.Topic; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.DeliveryMode; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageListener; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; +import jakarta.jms.TemporaryQueue; +import jakarta.jms.TemporaryTopic; +import jakarta.jms.Topic; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -96,7 +96,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler private final String gatewayCorrelation = UUID.randomUUID().toString(); - private final Map> replies = new ConcurrentHashMap<>(); + private final Map> replies = new ConcurrentHashMap<>(); private final ConcurrentHashMap earlyOrLateReplies = new ConcurrentHashMap<>(); @@ -125,11 +125,11 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT; - private int deliveryMode = javax.jms.Message.DEFAULT_DELIVERY_MODE; + private int deliveryMode = jakarta.jms.Message.DEFAULT_DELIVERY_MODE; - private long timeToLive = javax.jms.Message.DEFAULT_TIME_TO_LIVE; + private long timeToLive = jakarta.jms.Message.DEFAULT_TIME_TO_LIVE; - private int defaultPriority = javax.jms.Message.DEFAULT_PRIORITY; + private int defaultPriority = jakarta.jms.Message.DEFAULT_PRIORITY; private boolean explicitQosEnabled; @@ -173,8 +173,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler * mode accordingly to either "PERSISTENT" (1) or "NON_PERSISTENT" (2). *

The default is "true", i.e. delivery mode "PERSISTENT". * @param deliveryPersistent true for a persistent delivery. - * @see javax.jms.DeliveryMode#PERSISTENT - * @see javax.jms.DeliveryMode#NON_PERSISTENT + * @see jakarta.jms.DeliveryMode#PERSISTENT + * @see jakarta.jms.DeliveryMode#NON_PERSISTENT */ public void setDeliveryPersistent(boolean deliveryPersistent) { this.deliveryMode = (deliveryPersistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT); @@ -749,8 +749,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - if (reply instanceof javax.jms.Message) { - return buildReply((javax.jms.Message) reply); + if (reply instanceof jakarta.jms.Message) { + return buildReply((jakarta.jms.Message) reply); } else { return reply; @@ -761,7 +761,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private AbstractIntegrationMessageBuilder buildReply(javax.jms.Message jmsReply) throws JMSException { + private AbstractIntegrationMessageBuilder buildReply(jakarta.jms.Message jmsReply) throws JMSException { Object result; if (this.extractReplyPayload) { result = this.messageConverter.fromMessage(jmsReply); @@ -797,7 +797,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler if (this.extractRequestPayload) { objectToSend = requestMessage.getPayload(); } - javax.jms.Message jmsRequest = this.messageConverter.toMessage(objectToSend, session); + jakarta.jms.Message jmsRequest = this.messageConverter.toMessage(objectToSend, session); // map headers this.headerMapper.fromHeaders(requestMessage.getHeaders(), jmsRequest); @@ -828,8 +828,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler * Remove the gateway's internal correlation Id to avoid conflicts with an upstream * gateway. */ - if (reply instanceof javax.jms.Message) { - ((javax.jms.Message) reply).setJMSCorrelationID(null); + if (reply instanceof jakarta.jms.Message) { + ((jakarta.jms.Message) reply).setJMSCorrelationID(null); } return reply; } @@ -839,7 +839,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private javax.jms.Message sendAndReceiveWithoutContainer(Message requestMessage) throws JMSException { + private jakarta.jms.Message sendAndReceiveWithoutContainer(Message requestMessage) throws JMSException { Connection connection = createConnection(); // NOSONAR - closed in ConnectionFactoryUtils. Session session = null; Destination replyTo = null; @@ -851,7 +851,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler if (this.extractRequestPayload) { objectToSend = requestMessage.getPayload(); } - javax.jms.Message jmsRequest = this.messageConverter.toMessage(objectToSend, session); + jakarta.jms.Message jmsRequest = this.messageConverter.toMessage(objectToSend, session); // map headers this.headerMapper.fromHeaders(requestMessage.getHeaders(), jmsRequest); @@ -866,7 +866,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler if (priority == null) { priority = this.defaultPriority; } - javax.jms.Message replyMessage; + jakarta.jms.Message replyMessage; Destination destination = determineRequestDestination(requestMessage, session); if (this.correlationKey != null) { replyMessage = doSendAndReceiveWithGeneratedCorrelationId(destination, jmsRequest, replyTo, @@ -893,8 +893,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler * Creates the MessageConsumer before sending the request Message since we are generating * our own correlationId value for the MessageSelector. */ - private javax.jms.Message doSendAndReceiveWithGeneratedCorrelationId(Destination reqDestination, - javax.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { + private jakarta.jms.Message doSendAndReceiveWithGeneratedCorrelationId(Destination reqDestination, + jakarta.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { MessageProducer messageProducer = null; try { messageProducer = session.createProducer(reqDestination); @@ -927,8 +927,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler /** * Creates the MessageConsumer before sending the request Message since we do not need any correlation. */ - private javax.jms.Message doSendAndReceiveWithTemporaryReplyToDestination(Destination reqDestination, - javax.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { + private jakarta.jms.Message doSendAndReceiveWithTemporaryReplyToDestination(Destination reqDestination, + jakarta.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { MessageProducer messageProducer = null; MessageConsumer messageConsumer = null; @@ -948,8 +948,8 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler * Creates the MessageConsumer after sending the request Message since we need * the MessageID for correlation with a MessageSelector. */ - private javax.jms.Message doSendAndReceiveWithMessageIdCorrelation(Destination reqDestination, - javax.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { + private jakarta.jms.Message doSendAndReceiveWithMessageIdCorrelation(Destination reqDestination, + jakarta.jms.Message jmsRequest, Destination replyTo, Session session, int priority) throws JMSException { if (replyTo instanceof Topic) { logger.warn("Relying on the MessageID for correlation is not recommended when using a Topic as the " + @@ -986,7 +986,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler * If the replyTo is not temporary, and the connection is lost while waiting for a reply, reconnect for * up to receiveTimeout. */ - private javax.jms.Message retryableReceiveReply(Session session, Destination replyTo, // NOSONAR + private jakarta.jms.Message retryableReceiveReply(Session session, Destination replyTo, // NOSONAR String messageSelector) throws JMSException { Connection consumerConnection = null; //NOSONAR @@ -1003,7 +1003,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler do { try { messageConsumer = consumerSession.createConsumer(replyTo, messageSelector); - javax.jms.Message reply = receiveReplyMessage(messageConsumer); + jakarta.jms.Message reply = receiveReplyMessage(messageConsumer); if (reply == null && replyTimeout > System.currentTimeMillis()) { throw new JMSException("Consumer closed before timeout"); } @@ -1050,7 +1050,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private Object doSendAndReceiveAsync(Destination reqDestination, javax.jms.Message jmsRequest, Session session, + private Object doSendAndReceiveAsync(Destination reqDestination, jakarta.jms.Message jmsRequest, Session session, int priority) throws JMSException { String correlation = null; @@ -1069,7 +1069,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler */ jmsRequest.setJMSCorrelationID(null); } - LinkedBlockingQueue replyQueue = null; + LinkedBlockingQueue replyQueue = null; String correlationToLog = correlation; logger.debug(() -> getComponentName() + " Sending message with correlationId " + correlationToLog); SettableListenableFuture> future = null; @@ -1099,15 +1099,15 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private javax.jms.Message doSendAndReceiveAsyncDefaultCorrelation(Destination reqDestination, - javax.jms.Message jmsRequest, Session session, int priority) throws JMSException { + private jakarta.jms.Message doSendAndReceiveAsyncDefaultCorrelation(Destination reqDestination, + jakarta.jms.Message jmsRequest, Session session, int priority) throws JMSException { String correlation = null; MessageProducer messageProducer = null; try { messageProducer = session.createProducer(reqDestination); - LinkedBlockingQueue replyQueue = new LinkedBlockingQueue<>(1); + LinkedBlockingQueue replyQueue = new LinkedBlockingQueue<>(1); this.sendRequestMessage(jmsRequest, messageProducer, priority); @@ -1137,10 +1137,10 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private javax.jms.Message obtainReplyFromContainer(String correlationId, - LinkedBlockingQueue replyQueue) { + private jakarta.jms.Message obtainReplyFromContainer(String correlationId, + LinkedBlockingQueue replyQueue) { - javax.jms.Message reply = null; + jakarta.jms.Message reply = null; if (this.receiveTimeout < 0) { reply = replyQueue.poll(); @@ -1154,7 +1154,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler logger.error(ex, "Interrupted while awaiting reply; treated as a timeout"); } } - javax.jms.Message replyToLog = reply; + jakarta.jms.Message replyToLog = reply; logger.debug(() -> { if (replyToLog == null) { return getComponentName() + " Timed out waiting for reply with CorrelationId " + correlationId; @@ -1193,7 +1193,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private void sendRequestMessage(javax.jms.Message jmsRequest, MessageProducer messageProducer, int priority) + private void sendRequestMessage(jakarta.jms.Message jmsRequest, MessageProducer messageProducer, int priority) throws JMSException { if (this.explicitQosEnabled) { @@ -1204,7 +1204,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private javax.jms.Message receiveReplyMessage(MessageConsumer messageConsumer) throws JMSException { + private jakarta.jms.Message receiveReplyMessage(MessageConsumer messageConsumer) throws JMSException { return (this.receiveTimeout >= 0) ? messageConsumer.receive(this.receiveTimeout) : messageConsumer.receive(); } @@ -1247,7 +1247,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } @Override - public void onMessage(javax.jms.Message message) { + public void onMessage(jakarta.jms.Message message) { String correlation = null; try { logger.trace(() -> getComponentName() + " Received " + message); @@ -1273,7 +1273,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private void onMessageAsync(javax.jms.Message message, String correlationId) throws JMSException { + private void onMessageAsync(jakarta.jms.Message message, String correlationId) throws JMSException { SettableListenableFuture> future = this.futures.remove(correlationId); if (future != null) { message.setJMSCorrelationID(null); @@ -1284,9 +1284,9 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler } } - private void onMessageSync(javax.jms.Message message, String correlationId) { + private void onMessageSync(jakarta.jms.Message message, String correlationId) { try { - LinkedBlockingQueue queue = this.replies.get(correlationId); + LinkedBlockingQueue queue = this.replies.get(correlationId); if (queue == null) { if (this.correlationKey != null) { Log debugLogger = LogFactory.getLog("si.jmsgateway.debug"); @@ -1411,9 +1411,9 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler private final long timeStamp = System.currentTimeMillis(); - private final javax.jms.Message reply; + private final jakarta.jms.Message reply; - TimedReply(javax.jms.Message reply) { + TimedReply(jakarta.jms.Message reply) { this.reply = reply; } @@ -1421,7 +1421,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler return this.timeStamp; } - private javax.jms.Message getReply() { + private jakarta.jms.Message getReply() { return this.reply; } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java index 675ad30c74..f0d0011a68 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsSendingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms; -import javax.jms.Destination; +import jakarta.jms.Destination; import org.springframework.core.convert.ConversionService; import org.springframework.expression.EvaluationContext; @@ -233,7 +233,7 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler { } @Override - public javax.jms.Message postProcessMessage(javax.jms.Message jmsMessage) { + public jakarta.jms.Message postProcessMessage(jakarta.jms.Message jmsMessage) { this.headerMapper.fromHeaders(this.integrationMessage.getHeaders(), jmsMessage); return jmsMessage; } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java index 3ed5de1aaf..a89ddb6dcc 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/SubscribableJmsChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms; -import javax.jms.MessageListener; +import jakarta.jms.MessageListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -213,7 +213,7 @@ public class SubscribableJmsChannel extends AbstractJmsChannel @Override - public void onMessage(javax.jms.Message message) { + public void onMessage(jakarta.jms.Message message) { Message messageToSend = null; try { MessageConverter converter = this.jmsTemplate.getMessageConverter(); diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java index 24d80bb3f3..531155d0de 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelFactoryBean.java @@ -19,10 +19,10 @@ package org.springframework.integration.jms.config; import java.util.List; import java.util.concurrent.Executor; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.Session; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.ExceptionListener; +import jakarta.jms.Session; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.BeanFactory; diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelParser.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelParser.java index 2a6c2046cf..d00099e1e3 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelParser.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsChannelParser.java @@ -16,7 +16,7 @@ package org.springframework.integration.jms.config; -import javax.jms.Session; +import jakarta.jms.Session; import org.w3c.dom.Element; diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java index a19c009889..4f6b330ab7 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-2021 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. @@ -16,8 +16,8 @@ package org.springframework.integration.jms.dsl; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; import org.springframework.integration.jms.PollableJmsChannel; import org.springframework.jms.core.JmsTemplate; @@ -41,7 +41,9 @@ public final class Jms { * @param connectionFactory the JMS ConnectionFactory to build on * @return the {@link JmsPollableMessageChannelSpec} instance */ - public static JmsPollableMessageChannelSpec pollableChannel(ConnectionFactory connectionFactory) { + public static JmsPollableMessageChannelSpec pollableChannel( + ConnectionFactory connectionFactory) { + return pollableChannel(null, connectionFactory); } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java index 58778b4480..d40296dc4d 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms.dsl; -import javax.jms.ConnectionFactory; +import jakarta.jms.ConnectionFactory; import org.springframework.integration.dsl.IntegrationComponentSpec; import org.springframework.jms.support.destination.DestinationResolver; @@ -75,7 +75,7 @@ public abstract class JmsDestinationAccessorSpec - + @@ -377,13 +377,13 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). - + @@ -544,13 +544,13 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). - + @@ -620,13 +620,13 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'request-destination-name' and 'request-pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). - + @@ -636,13 +636,13 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use either 'default-reply-queue-name' or 'default-reply-topic-name' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). - + @@ -900,7 +900,7 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'request-destination-name' and 'request-pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). This attribute is mutually exclusive with 'request-destination-name' and @@ -908,7 +908,7 @@ - + @@ -947,7 +947,7 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'reply-destination-name' and 'reply-pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). This attribute is mutually exclusive with @@ -955,7 +955,7 @@ - + @@ -1032,7 +1032,7 @@ ]]> - + @@ -1178,14 +1178,14 @@ - A reference to a javax.jms.Destination by bean name. As an alternative to a bean + A reference to a jakarta.jms.Destination by bean name. As an alternative to a bean reference, use 'destination-name' and 'pub-sub-domain' which will rely upon the DestinationResolver strategy (DynamicDestinationResolver by default). This attribute is mutually exclusive with 'destination-name' and 'destination-expression'. - + @@ -1491,7 +1491,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java index 28b5e64c85..a0502a9e67 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ActiveMQMultiContextTests.java @@ -16,15 +16,22 @@ package org.springframework.integration.jms; -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.activemq.transport.vm.VMTransport; +import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.api.core.TransportConfiguration; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; +import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; +import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.springframework.jms.connection.CachingConnectionFactory; /** - * Keeps an ActiveMQ {@link VMTransport} open for the duration of + * Keeps an ActiveMQ open for the duration of * all tests (avoids cycling the transport each time the last * connection is closed). * @@ -35,14 +42,32 @@ import org.springframework.jms.connection.CachingConnectionFactory; */ public abstract class ActiveMQMultiContextTests { - public static final ActiveMQConnectionFactory amqFactory = - new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false&broker.useJmx=false&broker.enableStatistics=false"); + public static final ActiveMQConnectionFactory amqFactory = new ActiveMQConnectionFactory("vm://0"); public static final CachingConnectionFactory connectionFactory = new CachingConnectionFactory(amqFactory); + private static final EmbeddedActiveMQ broker = new EmbeddedActiveMQ(); + + static { + amqFactory.setDeserializationWhiteList(ObjectInputStreamWithClassLoader.CATCH_ALL_WILDCARD); + amqFactory.setRetryInterval(0); + } + @BeforeAll public static void startUp() throws Exception { - amqFactory.setTrustAllPackages(true); + Configuration configuration = + new ConfigurationImpl() + .setName("embedded-server") + .setPersistenceEnabled(false) + .setSecurityEnabled(false) + .setJMXManagementEnabled(false) + .setJournalDatasync(false) + .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())) + .addAddressesSetting("#", + new AddressSettings() + .setDeadLetterAddress(SimpleString.toSimpleString("dla")) + .setExpiryAddress(SimpleString.toSimpleString("expiry"))); + broker.setConfiguration(configuration).start(); connectionFactory.setCacheConsumers(false); } @@ -50,6 +75,7 @@ public abstract class ActiveMQMultiContextTests { public static void shutDown() throws Exception { connectionFactory.destroy(); amqFactory.createConnection().close(); + broker.stop(); } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java index 3c8f10d09b..5e79012e28 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -24,9 +24,9 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; -import javax.jms.InvalidDestinationException; -import javax.jms.JMSException; -import javax.jms.Session; +import jakarta.jms.InvalidDestinationException; +import jakarta.jms.JMSException; +import jakarta.jms.Session; import org.junit.jupiter.api.Test; @@ -62,7 +62,7 @@ public class ChannelPublishingJmsMessageListenerTests { listener.setExpectReply(true); listener.setRequestChannel(requestChannel); listener.setMessageConverter(new TestMessageConverter()); - javax.jms.Message jmsMessage = session.createTextMessage("test"); + jakarta.jms.Message jmsMessage = session.createTextMessage("test"); listener.setBeanFactory(mock(BeanFactory.class)); listener.afterPropertiesSet(); assertThatExceptionOfType(InvalidDestinationException.class) @@ -83,13 +83,13 @@ public class ChannelPublishingJmsMessageListenerTests { listener.setMessageConverter(new TestMessageConverter() { @Override - public Object fromMessage(javax.jms.Message message) throws MessageConversionException { + public Object fromMessage(jakarta.jms.Message message) throws MessageConversionException { return null; } }); listener.afterPropertiesSet(); - javax.jms.Message jmsMessage = session.createTextMessage("test"); + jakarta.jms.Message jmsMessage = session.createTextMessage("test"); listener.onMessage(jmsMessage, mock(Session.class)); ErrorMessage received = (ErrorMessage) errorChannel.receive(0); assertThat(received).isNotNull(); @@ -108,12 +108,12 @@ public class ChannelPublishingJmsMessageListenerTests { private static class TestMessageConverter implements MessageConverter { @Override - public Object fromMessage(javax.jms.Message message) throws MessageConversionException { + public Object fromMessage(jakarta.jms.Message message) throws MessageConversionException { return "test-from"; } @Override - public javax.jms.Message toMessage(Object object, Session session) throws MessageConversionException { + public jakarta.jms.Message toMessage(Object object, Session session) throws MessageConversionException { return new StubTextMessage("test-to"); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/DefaultJmsHeaderMapperTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/DefaultJmsHeaderMapperTests.java index 6cbb1f8f50..55b113d78f 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/DefaultJmsHeaderMapperTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/DefaultJmsHeaderMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -21,9 +21,9 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Date; import java.util.Map; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Session; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Session; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -53,7 +53,7 @@ public class DefaultJmsHeaderMapperTests { Message message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.REPLY_TO, replyTo).build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSReplyTo()).isNotNull(); assertThat(jmsMessage.getJMSReplyTo()).isSameAs(replyTo); @@ -64,7 +64,7 @@ public class DefaultJmsHeaderMapperTests { Message message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.REPLY_TO, "not-a-destination").build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSReplyTo()).isNull(); } @@ -75,7 +75,7 @@ public class DefaultJmsHeaderMapperTests { Message message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.CORRELATION_ID, jmsCorrelationId).build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSCorrelationID()).isNotNull(); assertThat(jmsMessage.getJMSCorrelationID()).isEqualTo(jmsCorrelationId); @@ -86,7 +86,7 @@ public class DefaultJmsHeaderMapperTests { Message message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.CORRELATION_ID, 123).build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSCorrelationID()).isEqualTo("123"); } @@ -96,7 +96,7 @@ public class DefaultJmsHeaderMapperTests { Message message = MessageBuilder.withPayload("test") .setHeader(JmsHeaders.CORRELATION_ID, new Date()).build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSCorrelationID()).isNull(); } @@ -109,7 +109,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader(JmsHeaders.TYPE, jmsType) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSType()).isNotNull(); assertThat(jmsMessage.getJMSType()).isEqualTo(jmsType); @@ -122,7 +122,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader(JmsHeaders.TYPE, 123) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); assertThat(jmsMessage.getJMSType()).isNull(); } @@ -133,7 +133,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader(MessageHeaders.CONTENT_TYPE, "foo") .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); Object value = jmsMessage.getObjectProperty("content_type"); assertThat(value).isNotNull(); @@ -147,7 +147,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("foo", 123) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); Object value = jmsMessage.getObjectProperty("foo"); assertThat(value).isNotNull(); @@ -163,7 +163,7 @@ public class DefaultJmsHeaderMapperTests { .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); mapper.setOutboundPrefix("custom_"); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); Object value = jmsMessage.getObjectProperty("custom_foo"); assertThat(value).isNotNull(); @@ -180,7 +180,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("destination", destination) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); mapper.fromHeaders(message.getHeaders(), jmsMessage); Object value = jmsMessage.getObjectProperty("destination"); assertThat(value).isNull(); @@ -191,7 +191,7 @@ public class DefaultJmsHeaderMapperTests { Destination replyTo = new Destination() { }; - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSReplyTo(replyTo); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -203,7 +203,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsMessageIdMappedToHeader() throws JMSException { String messageId = "ID:ABC-123"; - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSMessageID(messageId); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -215,7 +215,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsCorrelationIdMappedToHeader() throws JMSException { String correlationId = "ABC-123"; - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSCorrelationID(correlationId); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -227,7 +227,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsTypeMappedToHeader() throws JMSException { String type = "testing"; - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSType(type); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -239,7 +239,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsTimestampMappedToHeader() throws JMSException { long timestamp = 123L; - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSTimestamp(timestamp); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -250,7 +250,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsPriorityMappedToHeader() throws JMSException { - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSPriority(5); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -261,7 +261,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testJmsPriorityNotMappedToHeader() throws JMSException { - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setJMSPriority(5); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); mapper.setMapInboundPriority(false); @@ -272,7 +272,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testContentTypePropertyMappedToHeader() throws JMSException { - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setStringProperty("content_type", "foo"); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -283,7 +283,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testUserDefinedPropertyMappedToHeader() throws JMSException { - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setIntProperty("foo", 123); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(jmsMessage); @@ -295,7 +295,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void testUserDefinedPropertyMappedToHeaderWithCustomPrefix() throws JMSException { - javax.jms.Message jmsMessage = new StubTextMessage(); + jakarta.jms.Message jmsMessage = new StubTextMessage(); jmsMessage.setIntProperty("foo", 123); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); mapper.setInboundPrefix("custom_"); @@ -315,7 +315,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("bar", 789) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setObjectProperty(String name, Object value) throws JMSException { @@ -343,7 +343,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("bar", 789) .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setObjectProperty(String name, Object value) throws JMSException { @@ -369,7 +369,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("foo", "bar") .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setJMSReplyTo(Destination replyTo) throws JMSException { @@ -389,7 +389,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("foo", "bar") .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setJMSType(String type) throws JMSException { @@ -409,7 +409,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("foo", "bar") .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setJMSCorrelationID(String correlationId) throws JMSException { @@ -429,7 +429,7 @@ public class DefaultJmsHeaderMapperTests { .setHeader("foo", "bar") .build(); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public void setJMSCorrelationID(String correlationId) throws JMSException { @@ -445,7 +445,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void attemptToReadDisallowedMessageIdPropertyIsNotFatal() throws JMSException { DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public String getJMSMessageID() throws JMSException { @@ -462,7 +462,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void attemptToReadDisallowedCorrelationIdPropertyIsNotFatal() throws JMSException { DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public String getJMSCorrelationID() throws JMSException { @@ -479,7 +479,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void attemptToReadDisallowedTypePropertyIsNotFatal() throws JMSException { DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public String getJMSType() throws JMSException { @@ -496,7 +496,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void attemptToReadDisallowedReplyToPropertyIsNotFatal() throws JMSException { DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public Destination getJMSReplyTo() throws JMSException { @@ -513,7 +513,7 @@ public class DefaultJmsHeaderMapperTests { @Test public void attemptToReadDisallowedRedeliveredPropertyIsNotFatal() throws JMSException { DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); - javax.jms.Message jmsMessage = new StubTextMessage() { + jakarta.jms.Message jmsMessage = new StubTextMessage() { @Override public boolean getJMSRedelivered() throws JMSException { @@ -540,12 +540,12 @@ public class DefaultJmsHeaderMapperTests { Mockito.doAnswer(invocation -> new StubTextMessage(invocation.getArgument(0))).when(session) .createTextMessage(Mockito.anyString()); - javax.jms.Message request = converter.toMessage(new Foo(), session); + jakarta.jms.Message request = converter.toMessage(new Foo(), session); DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper(); Map headers = mapper.toHeaders(request); - javax.jms.Message reply = converter.toMessage("foo", session); + jakarta.jms.Message reply = converter.toMessage("foo", session); mapper.fromHeaders(new MessageHeaders(headers), reply); Object result = converter.fromMessage(reply); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java index 2719e55edf..fce946b985 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsInboundChannelAdapterTests.java @@ -47,7 +47,7 @@ public class JmsInboundChannelAdapterTests extends ActiveMQMultiContextTests { assertThat(out.receive(20000)).isNotNull(); /* * INT-3288 - previously acknowledge="transacted" - * Caused by: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session + * Caused by: jakarta.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session */ } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java index 032fe83379..7c901a9668 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java @@ -30,14 +30,14 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; -import javax.jms.TemporaryQueue; -import javax.jms.TextMessage; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.Message; +import jakarta.jms.MessageConsumer; +import jakarta.jms.Session; +import jakarta.jms.TemporaryQueue; +import jakarta.jms.TextMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests-context.xml index 45893fb518..396dcd3182 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundInsideChainTests-context.xml @@ -38,11 +38,11 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayConnectionTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayConnectionTests.java index 67a95e961f..5ead7d7fb2 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayConnectionTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayConnectionTests.java @@ -26,12 +26,14 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; +import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.jms.client.ActiveMQQueue; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -66,9 +68,14 @@ public class OutboundGatewayConnectionTests { .thenReturn(scheduler); final JmsOutboundGateway gateway = new JmsOutboundGateway(); gateway.setBeanFactory(beanFactory); - BrokerService broker = new BrokerService(); - broker.addConnector("tcp://localhost:61616?broker.persistent=false"); - broker.start(); + Configuration configuration = + new ConfigurationImpl() + .addAcceptorConfiguration("jms", "tcp://localhost:61616") + .setPersistenceEnabled(false) + .setSecurityEnabled(false) + .setJMXManagementEnabled(false) + .setJournalDatasync(false); + EmbeddedActiveMQ broker = new EmbeddedActiveMQ().setConfiguration(configuration).start(); ActiveMQConnectionFactory amqConnectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); ConnectionFactory connectionFactory = new CachingConnectionFactory(amqConnectionFactory); gateway.setConnectionFactory(connectionFactory); @@ -78,7 +85,7 @@ public class OutboundGatewayConnectionTests { gateway.setUseReplyContainer(true); gateway.afterPropertiesSet(); gateway.start(); - final AtomicReference reply = new AtomicReference(); + final AtomicReference reply = new AtomicReference<>(); final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); ExecutorService exec = Executors.newSingleThreadExecutor(); @@ -95,16 +102,16 @@ public class OutboundGatewayConnectionTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(amqConnectionFactory); template.setReceiveTimeout(5000); - javax.jms.Message request = template.receive(requestQueue1); + jakarta.jms.Message request = template.receive(requestQueue1); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> jmsReply); assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(reply.get()).isNotNull(); broker.stop(); - broker = new BrokerService(); - broker.addConnector("tcp://localhost:61616?broker.persistent=false"); + + broker = new EmbeddedActiveMQ().setConfiguration(configuration).start(); broker.start(); final CountDownLatch latch3 = new CountDownLatch(1); @@ -112,7 +119,7 @@ public class OutboundGatewayConnectionTests { exec.execute(() -> { latch3.countDown(); try { - reply.set(gateway.handleRequestMessage(new GenericMessage("foo"))); + reply.set(gateway.handleRequestMessage(new GenericMessage<>("foo"))); } finally { latch4.countDown(); @@ -124,7 +131,7 @@ public class OutboundGatewayConnectionTests { template.setReceiveTimeout(5000); request = template.receive(requestQueue1); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply2 = request; + final jakarta.jms.Message jmsReply2 = request; template.send(request.getJMSReplyTo(), (MessageCreator) session -> jmsReply2); assertThat(latch4.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(reply.get()).isNotNull(); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayFunctionTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayFunctionTests.java index 9712095591..088a296fc9 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayFunctionTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/OutboundGatewayFunctionTests.java @@ -26,10 +26,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import javax.jms.Destination; -import javax.jms.JMSException; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; -import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.artemis.jms.client.ActiveMQQueue; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; @@ -105,9 +105,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue1); + jakarta.jms.Message request = template.receive(requestQueue1); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> jmsReply); assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(reply.get()).isNotNull(); @@ -150,9 +150,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue2); + jakarta.jms.Message request = template.receive(requestQueue2); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> { jmsReply.setJMSCorrelationID(jmsReply.getJMSMessageID()); return jmsReply; @@ -199,9 +199,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue3); + jakarta.jms.Message request = template.receive(requestQueue3); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> jmsReply); assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(reply.get()).isNotNull(); @@ -244,9 +244,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue4); + jakarta.jms.Message request = template.receive(requestQueue4); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> { jmsReply.setJMSCorrelationID(jmsReply.getJMSMessageID()); return jmsReply; @@ -293,9 +293,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue5); + jakarta.jms.Message request = template.receive(requestQueue5); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> jmsReply); assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(reply.get()).isNotNull(); @@ -337,9 +337,9 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(connectionFactory); template.setReceiveTimeout(10000); - javax.jms.Message request = template.receive(requestQueue6); + jakarta.jms.Message request = template.receive(requestQueue6); assertThat(request).isNotNull(); - final javax.jms.Message jmsReply = request; + final jakarta.jms.Message jmsReply = request; template.send(request.getJMSReplyTo(), session -> { jmsReply.setJMSCorrelationID(jmsReply.getJMSMessageID()); return jmsReply; @@ -399,8 +399,8 @@ public class OutboundGatewayFunctionTests extends ActiveMQMultiContextTests { } private void receiveAndSend(JmsTemplate template) { - javax.jms.Message request = template.receive(requestQueue7); - final javax.jms.Message jmsReply = request; + jakarta.jms.Message request = template.receive(requestQueue7); + final jakarta.jms.Message jmsReply = request; try { template.send(request.getJMSReplyTo(), session -> jmsReply); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java index 2a3cac9d44..a82fc5e432 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/PollableJmsChannelTests.java @@ -30,10 +30,11 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import javax.jms.Destination; -import javax.jms.TextMessage; +import jakarta.jms.DeliveryMode; +import jakarta.jms.Destination; +import jakarta.jms.TextMessage; -import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.artemis.jms.client.ActiveMQQueue; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -170,7 +171,7 @@ public class PollableJmsChannelTests extends ActiveMQMultiContextTests { final JmsTemplate receiver = new JmsTemplate(connectionFactory); boolean sent1 = channel.send(new GenericMessage<>("foo")); assertThat(sent1).isTrue(); - final AtomicReference message = new AtomicReference<>(); + final AtomicReference message = new AtomicReference<>(); final CountDownLatch latch1 = new CountDownLatch(1); ExecutorService exec = Executors.newSingleThreadExecutor(); exec.execute(() -> { @@ -181,7 +182,7 @@ public class PollableJmsChannelTests extends ActiveMQMultiContextTests { assertThat(message.get()).isNotNull(); assertThat(message.get().getJMSPriority()).isEqualTo(5); assertThat(message.get().getJMSExpiration() <= System.currentTimeMillis() + ttl).isTrue(); - assertThat(message.get().toString().contains("persistent = false")).isTrue(); + assertThat(message.get().getJMSDeliveryMode()).isEqualTo(DeliveryMode.NON_PERSISTENT); message.set(null); final CountDownLatch latch2 = new CountDownLatch(1); boolean sent2 = channel.send(MessageBuilder.withPayload("foo").setPriority(6).build()); @@ -194,7 +195,7 @@ public class PollableJmsChannelTests extends ActiveMQMultiContextTests { assertThat(message.get()).isNotNull(); assertThat(message.get().getJMSPriority()).isEqualTo(6); assertThat(message.get().getJMSExpiration() <= System.currentTimeMillis() + ttl).isTrue(); - assertThat(message.get().toString().contains("persistent = false")).isTrue(); + assertThat(message.get().getJMSDeliveryMode()).isEqualTo(DeliveryMode.NON_PERSISTENT); exec.shutdownNow(); } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConnection.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConnection.java index bebb3ea69c..265038f7ec 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConnection.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,15 +16,15 @@ package org.springframework.integration.jms; -import javax.jms.Connection; -import javax.jms.ConnectionConsumer; -import javax.jms.ConnectionMetaData; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.ServerSessionPool; -import javax.jms.Session; -import javax.jms.Topic; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionConsumer; +import jakarta.jms.ConnectionMetaData; +import jakarta.jms.Destination; +import jakarta.jms.ExceptionListener; +import jakarta.jms.JMSException; +import jakarta.jms.ServerSessionPool; +import jakarta.jms.Session; +import jakarta.jms.Topic; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConsumer.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConsumer.java index 6046efb043..8b7e163038 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConsumer.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,10 +16,10 @@ package org.springframework.integration.jms; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageListener; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubDestination.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubDestination.java index 4757e92228..9883acb2b5 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubDestination.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubDestination.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,7 +16,7 @@ package org.springframework.integration.jms; -import javax.jms.Destination; +import jakarta.jms.Destination; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubMessageConverter.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubMessageConverter.java index c333eadc0d..35fa2e688a 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubMessageConverter.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,9 +16,9 @@ package org.springframework.integration.jms; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.Session; import org.springframework.jms.support.converter.MessageConversionException; import org.springframework.jms.support.converter.MessageConverter; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubProducer.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubProducer.java index ae1a1a419b..bd4acb7090 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubProducer.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,12 +16,12 @@ package org.springframework.integration.jms; -import javax.jms.CompletionListener; -import javax.jms.Destination; -import javax.jms.InvalidDestinationException; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageProducer; +import jakarta.jms.CompletionListener; +import jakarta.jms.Destination; +import jakarta.jms.InvalidDestinationException; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.MessageProducer; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubQueue.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubQueue.java index a562f1a0d0..8dc4e52095 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubQueue.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubQueue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,8 +16,8 @@ package org.springframework.integration.jms; -import javax.jms.JMSException; -import javax.jms.Queue; +import jakarta.jms.JMSException; +import jakarta.jms.Queue; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubSession.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubSession.java index 7615f5fb1a..6903654624 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubSession.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,24 +18,24 @@ package org.springframework.integration.jms; import java.io.Serializable; -import javax.jms.BytesMessage; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.MapMessage; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Queue; -import javax.jms.QueueBrowser; -import javax.jms.Session; -import javax.jms.StreamMessage; -import javax.jms.TemporaryQueue; -import javax.jms.TemporaryTopic; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.jms.TopicSubscriber; +import jakarta.jms.BytesMessage; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.MapMessage; +import jakarta.jms.Message; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageListener; +import jakarta.jms.MessageProducer; +import jakarta.jms.ObjectMessage; +import jakarta.jms.Queue; +import jakarta.jms.QueueBrowser; +import jakarta.jms.Session; +import jakarta.jms.StreamMessage; +import jakarta.jms.TemporaryQueue; +import jakarta.jms.TemporaryTopic; +import jakarta.jms.TextMessage; +import jakarta.jms.Topic; +import jakarta.jms.TopicSubscriber; /** * @author Mark Fisher diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubTextMessage.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubTextMessage.java index ac30b051b9..45e2cf5ba6 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubTextMessage.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/StubTextMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -19,9 +19,9 @@ package org.springframework.integration.jms; import java.util.Enumeration; import java.util.concurrent.ConcurrentHashMap; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.TextMessage; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.TextMessage; /** * Stub JMS Message implementation intended for testing purposes only. diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java index b08d38a423..148f8d8694 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/SubscribableJmsChannelTests.java @@ -30,11 +30,11 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.jms.Destination; -import javax.jms.MessageListener; +import jakarta.jms.Destination; +import jakarta.jms.MessageListener; -import org.apache.activemq.command.ActiveMQQueue; -import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.artemis.jms.client.ActiveMQQueue; +import org.apache.activemq.artemis.jms.client.ActiveMQTopic; import org.apache.commons.logging.Log; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests-context.xml index c79cddfa8d..4a1d7aa603 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests-context.xml @@ -53,23 +53,23 @@ - + - + - + - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java index 45a682bb63..b9f7ec216b 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExceptionHandlingSiConsumerTests.java @@ -18,9 +18,9 @@ package org.springframework.integration.jms.config; import static org.assertj.core.api.Assertions.assertThat; -import javax.jms.Destination; -import javax.jms.Message; -import javax.jms.TextMessage; +import jakarta.jms.Destination; +import jakarta.jms.Message; +import jakarta.jms.TextMessage; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml index 43eba224d7..731c57a7b4 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests-context.xml @@ -31,7 +31,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java index 93d55da0a4..ba53744f4f 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/ExtractRequestReplyPayloadTests.java @@ -21,7 +21,7 @@ import static org.assertj.core.api.Assertions.fail; import java.util.concurrent.atomic.AtomicBoolean; -import javax.jms.JMSException; +import jakarta.jms.JMSException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -125,7 +125,7 @@ public class ExtractRequestReplyPayloadTests extends ActiveMQMultiContextTests { this.outboundChannel.send(new GenericMessage<>("Hello " + testInfo.getDisplayName())); Message replyMessage = this.replyChannel.receive(10000); - assertThat(replyMessage.getPayload()).isInstanceOf(javax.jms.TextMessage.class); + assertThat(replyMessage.getPayload()).isInstanceOf(jakarta.jms.TextMessage.class); this.jmsInputChannel.unsubscribe(handler); } @@ -189,7 +189,7 @@ public class ExtractRequestReplyPayloadTests extends ActiveMQMultiContextTests { this.jmsInputChannel.subscribe(handler); this.outboundChannel.send(new GenericMessage<>("Hello " + testInfo.getDisplayName())); Message replyMessage = this.replyChannel.receive(10000); - assertThat(replyMessage.getPayload()).isInstanceOf(javax.jms.Message.class); + assertThat(replyMessage.getPayload()).isInstanceOf(jakarta.jms.Message.class); this.jmsInputChannel.unsubscribe(handler); } @@ -221,7 +221,7 @@ public class ExtractRequestReplyPayloadTests extends ActiveMQMultiContextTests { this.jmsInputChannel.subscribe(handler); this.outboundChannel.send(new GenericMessage<>("Hello " + testInfo.getDisplayName())); Message replyMessage = this.replyChannel.receive(10000); - assertThat(replyMessage.getPayload()).isInstanceOf(javax.jms.Message.class); + assertThat(replyMessage.getPayload()).isInstanceOf(jakarta.jms.Message.class); this.jmsInputChannel.unsubscribe(handler); } @@ -236,12 +236,12 @@ public class ExtractRequestReplyPayloadTests extends ActiveMQMultiContextTests { private MessageHandler unwrapObjectMessageAndEchoHandler() { return message -> { - assertThat(message.getPayload()).isInstanceOf(javax.jms.ObjectMessage.class); + assertThat(message.getPayload()).isInstanceOf(jakarta.jms.ObjectMessage.class); MessagingTemplate template = new MessagingTemplate(); template.setDefaultDestination((MessageChannel) message.getHeaders().getReplyChannel()); Message origMessage = null; try { - origMessage = (Message) ((javax.jms.ObjectMessage) message.getPayload()).getObject(); + origMessage = (Message) ((jakarta.jms.ObjectMessage) message.getPayload()).getObject(); } catch (JMSException e) { fail("failed to deserialize message"); @@ -252,12 +252,12 @@ public class ExtractRequestReplyPayloadTests extends ActiveMQMultiContextTests { private MessageHandler unwrapTextMessageAndEchoHandler() { return message -> { - assertThat(message.getPayload()).isInstanceOf(javax.jms.TextMessage.class); + assertThat(message.getPayload()).isInstanceOf(jakarta.jms.TextMessage.class); MessagingTemplate template = new MessagingTemplate(); template.setDefaultDestination((MessageChannel) message.getHeaders().getReplyChannel()); String payload = null; try { - payload = ((javax.jms.TextMessage) message.getPayload()).getText(); + payload = ((jakarta.jms.TextMessage) message.getPayload()).getText(); } catch (JMSException e) { fail("failed to deserialize message"); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml index fe15eaf18e..6428def43b 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml @@ -28,7 +28,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests-context.xml index 32ec125108..c07e49cbd8 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests-context.xml @@ -22,11 +22,11 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java index 9c002714f3..ca4f1d11da 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/InboundOneWayErrorTests.java @@ -21,8 +21,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml index 7e83fd0969..0d980cedc7 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml @@ -19,7 +19,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests-context.xml index b7e8466ed0..7533572fde 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelParserTests-context.xml @@ -53,12 +53,12 @@ - - + + - - + + + new ClassPathXmlApplicationContext("jmsGatewayWithConnectionFactoryOnly.xml", getClass())) + .withMessageContaining("request-destination") + .withMessageContaining("request-destination-name"); } - @Test(expected = BeanDefinitionStoreException.class) + @Test public void testGatewayWithEmptyConnectionFactory() { - try { - new ClassPathXmlApplicationContext("jmsGatewayWithEmptyConnectionFactory.xml", this.getClass()).close(); - } - catch (BeanDefinitionStoreException e) { - assertThat(e.getMessage().contains("connection-factory")).isTrue(); - throw e; - } + assertThatExceptionOfType(BeanDefinitionStoreException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("jmsGatewayWithEmptyConnectionFactory.xml", getClass())) + .withMessageContaining("connection-factory"); } @Test diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageDrivenEndpointTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageDrivenEndpointTests.java index a115df322d..13df677c42 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageDrivenEndpointTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageDrivenEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2021 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. @@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.Mockito.mock; -import javax.jms.MessageListener; +import jakarta.jms.MessageListener; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java index 7613402f6f..b6db3fa7f0 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java @@ -93,7 +93,7 @@ public class JmsMessageHistoryTests extends ActiveMQMultiContextTests { public static class SampleHeaderMapper extends DefaultJmsHeaderMapper { - public void fromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage) { + public void fromHeaders(MessageHeaders headers, jakarta.jms.Message jmsMessage) { super.fromHeaders(headers, jmsMessage); String messageHistory = headers.get(MessageHistory.HEADER_NAME, MessageHistory.class).toString(); try { @@ -104,7 +104,7 @@ public class JmsMessageHistoryTests extends ActiveMQMultiContextTests { } } - public Map toHeaders(javax.jms.Message jmsMessage) { + public Map toHeaders(jakarta.jms.Message jmsMessage) { Map headers = super.toHeaders(jmsMessage); List history = new ArrayList(); String outboundHistory = (String) headers.get("outbound_history"); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java index 1fddbdbf6f..4ee75c548c 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,7 +18,7 @@ package org.springframework.integration.jms.config; import static org.assertj.core.api.Assertions.assertThat; -import javax.jms.DeliveryMode; +import jakarta.jms.DeliveryMode; import org.junit.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java index 9140eab036..e9bf6e7078 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsOutboundGatewayParserTests.java @@ -24,10 +24,10 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Method; import java.util.Properties; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.Queue; -import javax.jms.Session; +import jakarta.jms.DeliveryMode; +import jakarta.jms.Destination; +import jakarta.jms.Queue; +import jakarta.jms.Session; import org.junit.jupiter.api.Test; @@ -42,6 +42,7 @@ import org.springframework.integration.endpoint.PollingConsumer; import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor; import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice; import org.springframework.integration.history.MessageHistory; +import org.springframework.integration.jms.ActiveMQMultiContextTests; import org.springframework.integration.jms.JmsOutboundGateway; import org.springframework.integration.jms.StubMessageConverter; import org.springframework.integration.support.MessageBuilder; @@ -60,7 +61,7 @@ import org.springframework.messaging.support.GenericMessage; * @author Mark Fisher * @author Gary Russell */ -public class JmsOutboundGatewayParserTests { +public class JmsOutboundGatewayParserTests extends ActiveMQMultiContextTests { private static volatile int adviceCalled; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsPriorityTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsPriorityTests.java index 9b646d1b4f..03d90b24bc 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsPriorityTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsPriorityTests.java @@ -18,10 +18,10 @@ package org.springframework.integration.jms.config; import static org.assertj.core.api.Assertions.assertThat; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; +import jakarta.jms.JMSException; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; +import jakarta.jms.TextMessage; import org.junit.jupiter.api.Test; @@ -61,8 +61,8 @@ public class JmsPriorityTests extends ActiveMQMultiContextTests { channelAdapterChannel.send(message); Message result = channelAdapterResults.receive(5000); assertThat(result).isNotNull(); - assertThat(result.getPayload() instanceof javax.jms.Message).isTrue(); - javax.jms.Message jmsMessage = (javax.jms.Message) result.getPayload(); + assertThat(result.getPayload() instanceof jakarta.jms.Message).isTrue(); + jakarta.jms.Message jmsMessage = (jakarta.jms.Message) result.getPayload(); assertThat(jmsMessage.getJMSPriority()).isEqualTo(3); } @@ -72,8 +72,8 @@ public class JmsPriorityTests extends ActiveMQMultiContextTests { channelAdapterChannel.send(message); Message result = channelAdapterResults.receive(5000); assertThat(result).isNotNull(); - assertThat(result.getPayload() instanceof javax.jms.Message).isTrue(); - javax.jms.Message jmsMessage = (javax.jms.Message) result.getPayload(); + assertThat(result.getPayload() instanceof jakarta.jms.Message).isTrue(); + jakarta.jms.Message jmsMessage = (jakarta.jms.Message) result.getPayload(); assertThat(jmsMessage.getJMSPriority()).isEqualTo(7); } @@ -98,9 +98,9 @@ public class JmsPriorityTests extends ActiveMQMultiContextTests { } - public static class PriorityReader implements SessionAwareMessageListener { + public static class PriorityReader implements SessionAwareMessageListener { - public void onMessage(javax.jms.Message request, Session session) throws JMSException { + public void onMessage(jakarta.jms.Message request, Session session) throws JMSException { String text = "priority=" + request.getJMSPriority(); TextMessage reply = session.createTextMessage(text); MessageProducer producer = session.createProducer(request.getJMSReplyTo()); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests-context.xml index 2de05fbfd2..6b34f368df 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests-context.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsWithMarshallingMessageConverterTests-context.xml @@ -42,11 +42,11 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestJmsHeaderMapper.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestJmsHeaderMapper.java index a75f3ad0dc..bc129015b5 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestJmsHeaderMapper.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestJmsHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -19,7 +19,7 @@ package org.springframework.integration.jms.config; import java.util.HashMap; import java.util.Map; -import javax.jms.Message; +import jakarta.jms.Message; import org.springframework.integration.jms.JmsHeaderMapper; import org.springframework.messaging.MessageHeaders; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestMessageConverter.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestMessageConverter.java index c5fd200cf0..dd2feeae4c 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestMessageConverter.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/TestMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,10 +16,10 @@ package org.springframework.integration.jms.config; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.TextMessage; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.Session; +import jakarta.jms.TextMessage; import org.springframework.jms.support.converter.MessageConversionException; import org.springframework.jms.support.converter.MessageConverter; @@ -34,7 +34,7 @@ public class TestMessageConverter implements MessageConverter { return "converted-" + original; } - public javax.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { + public jakarta.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { return null; } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/gatewayMaintainsReplyChannel.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/gatewayMaintainsReplyChannel.xml index 9de8841bee..85e37ce873 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/gatewayMaintainsReplyChannel.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/gatewayMaintainsReplyChannel.xml @@ -62,11 +62,11 @@ --> - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/jmsGatewayWithReplyChannel.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/jmsGatewayWithReplyChannel.xml index 20c0e35892..579e947e10 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/jmsGatewayWithReplyChannel.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/jmsGatewayWithReplyChannel.xml @@ -25,10 +25,10 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java index b3c2670b8a..0ba9fd05fb 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java @@ -284,7 +284,7 @@ public class JmsTests extends ActiveMQMultiContextTests { @Bean(name = PollerMetadata.DEFAULT_POLLER) public PollerMetadata poller() { - return Pollers.fixedRate(500).get(); + return Pollers.fixedDelay(1000).get(); } @Bean diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/AsyncGatewayTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/AsyncGatewayTests.java index bd4d8afc31..0c026ecb13 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/AsyncGatewayTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/AsyncGatewayTests.java @@ -18,8 +18,8 @@ package org.springframework.integration.jms.request_reply; import static org.assertj.core.api.Assertions.assertThat; -import javax.jms.Message; -import javax.jms.TextMessage; +import jakarta.jms.Message; +import jakarta.jms.TextMessage; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java index 6e12921096..d8c3dad757 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithCachedConsumersTests.java @@ -21,12 +21,12 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.concurrent.CountDownLatch; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.TextMessage; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.MessageProducer; +import jakarta.jms.TextMessage; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java index 33f47cb161..f281d4147c 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithNonCachedConsumersTests.java @@ -19,10 +19,10 @@ package org.springframework.integration.jms.request_reply; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.Message; -import javax.jms.TextMessage; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.Message; +import jakarta.jms.TextMessage; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java index 6b8be1a19f..3b5de9d897 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/RequestReplyScenariosWithTempReplyQueuesTests.java @@ -26,15 +26,17 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.TextMessage; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.MessageProducer; +import jakarta.jms.TextMessage; -import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; +import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.jupiter.api.Test; @@ -167,12 +169,15 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti */ @Test public void brokenBrokerTest() throws Exception { - BrokerService broker = new BrokerService(); - broker.setPersistent(false); - broker.setUseJmx(false); - broker.setTransportConnectorURIs(new String[]{ "tcp://localhost:61623" }); - broker.setDeleteAllMessagesOnStartup(true); - broker.start(); + Configuration configuration = + new ConfigurationImpl() + .addAcceptorConfiguration("jms", "tcp://localhost:61623") + .setPersistenceEnabled(false) + .setSecurityEnabled(false) + .setJMXManagementEnabled(false) + .setJournalDatasync(false); + + EmbeddedActiveMQ broker = new EmbeddedActiveMQ().setConfiguration(configuration).start(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("broken-broker.xml", this.getClass()); @@ -194,7 +199,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti Object replyDestination = TestUtils .getPropertyValue(context.getBean("jog"), "handler.replyDestination"); if (replyDestination != null) { - broker.removeDestination((ActiveMQDestination) replyDestination); + broker.getActiveMQServer().destroyQueue(((ActiveMQDestination) replyDestination).getSimpleAddress()); } } } diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/broken-broker.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/broken-broker.xml index 01059ace66..eb79bc6c2d 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/broken-broker.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/broken-broker.xml @@ -31,7 +31,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/explicit-correlation-key.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/explicit-correlation-key.xml index e06bee5c2c..52a0f7c65b 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/explicit-correlation-key.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/explicit-correlation-key.xml @@ -16,7 +16,7 @@ request-destination="explicitCorrelationJmsOut" correlation-key="bar"/> - + @@ -36,7 +36,7 @@ request-destination="explicitCorrelationJmsOutB" correlation-key="JMSCorrelationID"/> - + @@ -56,7 +56,7 @@ request-destination="existingCorrelationJmsOutB" correlation-key="JMSCorrelationID*"/> - + @@ -83,7 +83,7 @@ correlation-key="foo" receive-timeout="100"/> - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-cached-consumers.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-cached-consumers.xml index ca0f069e99..ae6b83c0a9 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-cached-consumers.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-cached-consumers.xml @@ -18,11 +18,11 @@ - + - + @@ -38,11 +38,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -79,11 +79,11 @@ - + - + @@ -100,11 +100,11 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-no-cached-consumers.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-no-cached-consumers.xml index 72c449deaa..1bdcaaba67 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-no-cached-consumers.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-no-cached-consumers.xml @@ -20,11 +20,11 @@ - + - + @@ -40,11 +40,11 @@ - + - + @@ -61,11 +61,11 @@ - + - + @@ -81,11 +81,11 @@ - + - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-temp-reply-consumers.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-temp-reply-consumers.xml index c796a8fcc8..7e76ff741e 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-temp-reply-consumers.xml +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/producer-temp-reply-consumers.xml @@ -15,7 +15,7 @@ - + diff --git a/spring-integration-jms/src/test/kotlin/org/springframework/integration/jms/dsl/JmsDslKotlinTests.kt b/spring-integration-jms/src/test/kotlin/org/springframework/integration/jms/dsl/JmsDslKotlinTests.kt index 29304295f9..e1d38f6558 100644 --- a/spring-integration-jms/src/test/kotlin/org/springframework/integration/jms/dsl/JmsDslKotlinTests.kt +++ b/spring-integration-jms/src/test/kotlin/org/springframework/integration/jms/dsl/JmsDslKotlinTests.kt @@ -22,6 +22,7 @@ import assertk.assertions.contains import assertk.assertions.isEqualTo import assertk.assertions.isGreaterThan import assertk.assertions.isNotNull +import jakarta.jms.DeliveryMode import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Qualifier @@ -41,7 +42,6 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.junit.jupiter.SpringJUnitConfig import java.util.concurrent.Executors -import javax.jms.DeliveryMode /** * @author Artem Bilan diff --git a/spring-integration-jms/src/test/resources/log4j2-test.xml b/spring-integration-jms/src/test/resources/log4j2-test.xml index c68405e4cb..d37e124b72 100644 --- a/spring-integration-jms/src/test/resources/log4j2-test.xml +++ b/spring-integration-jms/src/test/resources/log4j2-test.xml @@ -6,8 +6,9 @@ - + + diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationListeningMessageProducer.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationListeningMessageProducer.java index c7b7b4c2f7..f003962412 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationListeningMessageProducer.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationListeningMessageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -190,6 +190,10 @@ public class NotificationListeningMessageProducer extends MessageProducerSupport } } + /** + * Return a collection of {@link ObjectName} ofr provided {@link #mBeanObjectNames}. + * @return the collection of {@link ObjectName} ofr provided {@link #mBeanObjectNames}. + */ protected Collection retrieveMBeanNames() { List objectNames = new ArrayList<>(); for (ObjectName pattern : this.mBeanObjectNames) { diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java index 2480ac21fa..8a4b1e27b9 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java @@ -61,12 +61,19 @@ public class NotificationPublishingMessageHandler extends AbstractMessageHandler private OutboundMessageMapper notificationMapper; - + /** + * Construct an instance based on the provided object name. + * @param objectName the {@link ObjectName} to use for notification. + */ public NotificationPublishingMessageHandler(ObjectName objectName) { Assert.notNull(objectName, "JMX ObjectName is required"); this.objectName = objectName; } + /** + * Construct an instance based on the provided object name. + * @param objectName the object name to use for notification. + */ public NotificationPublishingMessageHandler(String objectName) { Assert.notNull(objectName, "JMX ObjectName is required"); try { diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java index 74f331cd7c..101116e87d 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/IntegrationMBeanExportConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-2021 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. @@ -34,7 +34,6 @@ import org.springframework.context.EnvironmentAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportAware; -import org.springframework.context.annotation.MBeanExportConfiguration.SpecificPlatform; import org.springframework.context.annotation.Role; import org.springframework.context.expression.StandardBeanExpressionResolver; import org.springframework.core.annotation.AnnotationAttributes; @@ -131,12 +130,6 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ } exporter.setServer(bean); } - else { - SpecificPlatform specificPlatform = SpecificPlatform.get(); - if (specificPlatform != null) { - exporter.setServer(specificPlatform.getMBeanServer()); - } - } } private void setupComponentNamePatterns(IntegrationMBeanExporter exporter) { diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java index c39d27ed80..8b45dfa2dc 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,8 +16,8 @@ package org.springframework.integration.jpa.core; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.orm.jpa.SharedEntityManagerCreator; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java index d115b632c9..f8954a0a10 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -22,9 +22,9 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import javax.persistence.EntityManager; -import javax.persistence.Parameter; -import javax.persistence.Query; +import jakarta.persistence.EntityManager; +import jakarta.persistence.Parameter; +import jakarta.persistence.Query; import org.springframework.core.log.LogAccessor; import org.springframework.integration.jpa.support.JpaUtils; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java index 8ba6b2a646..90b422199d 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java @@ -18,8 +18,8 @@ package org.springframework.integration.jpa.core; import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -221,7 +221,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#flush()} will be called + * If set to {@code true} the {@link jakarta.persistence.EntityManager#flush()} will be called * after persistence operation. * Has the same effect, if the {@link #flushSize} is specified to {@code 1}. * For convenience in cases when the provided entity to persist is not an instance of {@link Iterable}. @@ -232,7 +232,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { } /** - * If the provided value is greater than {@code 0}, then {@link javax.persistence.EntityManager#flush()} + * If the provided value is greater than {@code 0}, then {@link jakarta.persistence.EntityManager#flush()} * will be called after persistence operations as well as within batch operations. * This property has precedence over the {@link #flush}, if it is specified to a value greater than {@code 0}. * If the entity to persist is not an instance of {@link Iterable} and this property is greater than {@code 0}, @@ -245,8 +245,8 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#clear()} will be called, - * and only if the {@link javax.persistence.EntityManager#flush()} was called after performing persistence + * If set to {@code true} the {@link jakarta.persistence.EntityManager#clear()} will be called, + * and only if the {@link jakarta.persistence.EntityManager#flush()} was called after performing persistence * operations. * @param clearOnFlush defaults to 'false'. * @see #setFlush(boolean) @@ -258,10 +258,10 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { /** * If not set, this property defaults to false, which means that - * deletion occurs on a per object basis if a collection of entities is being + * deletion occurs on a per-object basis if a collection of entities is being * deleted. *

If set to 'true' the elements of the payload are deleted as a batch - * operation. Be aware that this exhibits issues in regards to cascaded deletes. + * operation. Be aware that this exhibits issues in regard to cascaded deletes. *

The specification 'JSR 317: Java Persistence API, Version 2.0' does not * support cascaded deletes in batch operations. The specification states in * chapter 4.10: @@ -322,7 +322,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { * Set the expression that will be evaluated to get the first result in the query executed. * If a null expression is set, all the results in the result set will be retrieved * @param firstResultExpression The first result expression. - * @see javax.persistence.Query#setFirstResult(int) + * @see jakarta.persistence.Query#setFirstResult(int) */ public void setFirstResultExpression(Expression firstResultExpression) { this.firstResultExpression = firstResultExpression; @@ -330,7 +330,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { /** * Set the expression that will be evaluated to get the {@code primaryKey} for - * {@link javax.persistence.EntityManager#find(Class, Object)}. + * {@link EntityManager#find(Class, Object)}. * @param idExpression the SpEL expression for entity {@code primaryKey}. * @since 4.0 */ @@ -352,7 +352,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { * Set the max number of results to retrieve from the database. Defaults to * 0, which means that all possible objects shall be retrieved. * @param maxNumberOfResults Must not be negative. - * @see javax.persistence.Query#setMaxResults(int) + * @see jakarta.persistence.Query#setMaxResults(int) */ public void setMaxNumberOfResults(int maxNumberOfResults) { this.setMaxResultsExpression(new ValueExpression<>(maxNumberOfResults)); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java index 09a5159e68..1513513afd 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java @@ -148,11 +148,11 @@ public interface JpaOperations { Object getSingleResultForQuery(String query, ParameterSource source); /** - * The entity to be merged with the {@link javax.persistence.EntityManager}. + * The entity to be merged with the {@link jakarta.persistence.EntityManager}. * The provided object can * also be an {@link Iterable} in which case each object of the {@link Iterable} * is treated as an entity and merged with the - * {@link javax.persistence.EntityManager}. {@code Null} + * {@link jakarta.persistence.EntityManager}. {@code Null} * values returned while iterating over the {@link Iterable} are ignored. * @param entity Must not be null. * @return The merged managed instance of the entity. @@ -160,16 +160,16 @@ public interface JpaOperations { Object merge(Object entity); /** - * The entity to be merged with the {@link javax.persistence.EntityManager}. + * The entity to be merged with the {@link jakarta.persistence.EntityManager}. * The provided object can * also be an {@link Iterable} in which case each object of the {@link Iterable} * is treated as an entity and merged with the - * {@link javax.persistence.EntityManager}. - * In addition the {@link javax.persistence.EntityManager#flush()} is called after the merge + * {@link jakarta.persistence.EntityManager}. + * In addition the {@link jakarta.persistence.EntityManager#flush()} is called after the merge * and after each batch, as it is specified using {@code flushSize} parameter and if * provided object is {@link Iterable}. - * {@code clearOnFlush}parameter specifies, if the {@link javax.persistence.EntityManager#clear()} - * should be called after each {@link javax.persistence.EntityManager#flush()}. + * {@code clearOnFlush} parameter specifies, if the {@link jakarta.persistence.EntityManager#clear()} + * should be called after each {@link jakarta.persistence.EntityManager#flush()}. * @param entity The entity. * @param flushSize The flush size. * @param clearOnFlush true to clear after flushing. @@ -181,7 +181,7 @@ public interface JpaOperations { /** * Persists the entity. The provided object can also be an {@link Iterable} * in which case each object of the {@link Iterable} is treated as an entity - * and persisted with the {@link javax.persistence.EntityManager}. + * and persisted with the {@link jakarta.persistence.EntityManager}. * {@code Null} values returned * while iterating over the {@link Iterable} are ignored. * @param entity Must not be null @@ -191,14 +191,14 @@ public interface JpaOperations { /** * Persists the entity. The provided object can also be an {@link Iterable} * in which case each object of the {@link Iterable} is treated as an entity - * and persisted with the {@link javax.persistence.EntityManager}. + * and persisted with the {@link jakarta.persistence.EntityManager}. * {@code Null} values returned * while iterating over the {@link Iterable} are ignored. - * In addition the {@link javax.persistence.EntityManager#flush()} is called after the persist + * In addition the {@link jakarta.persistence.EntityManager#flush()} is called after the persist * and after each batch, as it is specified using {@code flushSize} parameter and if * provided object is {@link Iterable}. - * {@code clearOnFlush}parameter specifies, if the {@link javax.persistence.EntityManager#clear()} - * should be called after each {@link javax.persistence.EntityManager#flush()}. + * {@code clearOnFlush}parameter specifies, if the {@link jakarta.persistence.EntityManager#clear()} + * should be called after each {@link jakarta.persistence.EntityManager#flush()}. * @param entity The entity. * @param flushSize The flush size. * @param clearOnFlush true to clear after flushing. @@ -206,7 +206,7 @@ public interface JpaOperations { void persist(Object entity, int flushSize, boolean clearOnFlush); /** - * Executes {@link javax.persistence.EntityManager#flush()}. + * Executes {@link jakarta.persistence.EntityManager#flush()}. */ void flush(); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java index aaa2be629e..37ae234b14 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2021 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. @@ -16,8 +16,8 @@ package org.springframework.integration.jpa.dsl; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import org.springframework.integration.jpa.core.JpaExecutor; import org.springframework.integration.jpa.core.JpaOperations; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaInboundChannelAdapterSpec.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaInboundChannelAdapterSpec.java index d2592e8697..de75c7b23c 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaInboundChannelAdapterSpec.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 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. @@ -116,7 +116,7 @@ public class JpaInboundChannelAdapterSpec } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#flush()} will be called + * If set to {@code true} the {@link jakarta.persistence.EntityManager#flush()} will be called * after persistence operation. * Has the same effect, if the {@code flushSize} is specified to {@code 1}. * For convenience in cases when the provided entity to persist is not an instance of {@link Iterable}. diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java index 6257b04350..ef058bca55 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java @@ -81,7 +81,7 @@ public class JpaRetrievingOutboundGatewaySpec extends JpaBaseOutboundEndpointSpe /** * Specify a SpEL expression that will be evaluated to get the {@code primaryKey} for - * {@link javax.persistence.EntityManager#find(Class, Object)}. + * {@link jakarta.persistence.EntityManager#find(Class, Object)}. * @param idExpression the SpEL expression for entity {@code primaryKey}. * @return the spec */ @@ -91,7 +91,7 @@ public class JpaRetrievingOutboundGatewaySpec extends JpaBaseOutboundEndpointSpe /** * Specify a SpEL expression that will be evaluated to get the {@code primaryKey} for - * {@link javax.persistence.EntityManager#find(Class, Object)}. + * {@link jakarta.persistence.EntityManager#find(Class, Object)}. * @param idExpression the SpEL expression for entity {@code primaryKey}. * @return the spec */ @@ -162,7 +162,7 @@ public class JpaRetrievingOutboundGatewaySpec extends JpaBaseOutboundEndpointSpe } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#flush()} will be called + * If set to {@code true} the {@link jakarta.persistence.EntityManager#flush()} will be called * after persistence operation. * Has the same effect, if the {@code flushSize} is specified to {@code 1}. * For convenience in cases when the provided entity to persist is not an instance of {@link Iterable}. diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaUpdatingOutboundEndpointSpec.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaUpdatingOutboundEndpointSpec.java index ef6ce62766..aa94b98c3c 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaUpdatingOutboundEndpointSpec.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaUpdatingOutboundEndpointSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 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. @@ -54,7 +54,7 @@ public class JpaUpdatingOutboundEndpointSpec extends JpaBaseOutboundEndpointSpec } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#flush()} will be called + * If set to {@code true} the {@link jakarta.persistence.EntityManager#flush()} will be called * after persistence operation. * Has the same effect, if the {@link #flushSize} is specified to {@code 1}. * For convenience in cases when the provided entity to persist is not an instance of {@link Iterable}. @@ -67,7 +67,7 @@ public class JpaUpdatingOutboundEndpointSpec extends JpaBaseOutboundEndpointSpec } /** - * If the provided value is greater than {@code 0}, then {@link javax.persistence.EntityManager#flush()} + * If the provided value is greater than {@code 0}, then {@link jakarta.persistence.EntityManager#flush()} * will be called after persistence operations as well as within batch operations. * This property has precedence over the {@link #flush}, if it is specified to a value greater than {@code 0}. * If the entity to persist is not an instance of {@link Iterable} and this property is greater than {@code 0}, @@ -81,8 +81,8 @@ public class JpaUpdatingOutboundEndpointSpec extends JpaBaseOutboundEndpointSpec } /** - * If set to {@code true} the {@link javax.persistence.EntityManager#clear()} will be called, - * and only if the {@link javax.persistence.EntityManager#flush()} + * If set to {@code true} the {@link jakarta.persistence.EntityManager#clear()} will be called, + * and only if the {@link jakarta.persistence.EntityManager#flush()} * was called after performing persistence operations. * @param clearOnFlush defaults to {@code false}. * @return the spec diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java index 5166057a66..59c4f2b60d 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -20,8 +20,8 @@ import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.persistence.EntityManager; -import javax.persistence.Query; +import jakarta.persistence.EntityManager; +import jakarta.persistence.Query; import org.springframework.util.Assert; diff --git a/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/spring-integration-jpa.xsd b/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/spring-integration-jpa.xsd index ab932233bb..1eab335209 100644 --- a/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/spring-integration-jpa.xsd +++ b/spring-integration-jpa/src/main/resources/org/springframework/integration/jpa/config/spring-integration-jpa.xsd @@ -583,7 +583,7 @@ - + @@ -599,7 +599,7 @@ - + diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/AbstractJpaOperationsTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/AbstractJpaOperationsTests.java index 52250dbceb..e99096d2cc 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/AbstractJpaOperationsTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/AbstractJpaOperationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -25,7 +25,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/JpaExecutorTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/JpaExecutorTests.java index 8f2b18d12d..b9223cd15c 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/JpaExecutorTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/JpaExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -25,10 +25,9 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -41,7 +40,7 @@ import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.transaction.annotation.Transactional; /** @@ -52,7 +51,7 @@ import org.springframework.transaction.annotation.Transactional; * * @since 2.2 */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class JpaExecutorTests { diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java index 9ab0e16681..dd08629556 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 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. @@ -22,12 +22,11 @@ import java.util.Calendar; import java.util.Date; import java.util.List; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManagerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -56,7 +55,7 @@ import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.interceptor.TransactionInterceptor; @@ -65,7 +64,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor; * * @since 5.0 */ -@RunWith(SpringRunner.class) +@SpringJUnitConfig @DirtiesContext public class JpaTests { @@ -93,7 +92,7 @@ public class JpaTests { @Autowired private PollableChannel retrieveResults; - @BeforeClass + @BeforeAll public static void init() { dataSource = new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) @@ -104,7 +103,7 @@ public class JpaTests { .build(); } - @AfterClass + @AfterAll public static void destroy() { dataSource.shutdown(); } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapterTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapterTests.java index 1fbdcd5e03..6f798f7d9d 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapterTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapterTests.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.junit.jupiter.api.Test; diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java index 2eb7a258b1..66b9427741 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -21,11 +21,10 @@ import static org.mockito.Mockito.mock; import java.util.List; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -38,8 +37,7 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallbackWithoutResult; @@ -50,11 +48,11 @@ import org.springframework.transaction.support.TransactionTemplate; * @author Gunnar Hillert * @author Artem Bilan * @author Gary Russell + * * @since 2.2 * */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext public class JpaOutboundChannelAdapterTests { @@ -70,13 +68,13 @@ public class JpaOutboundChannelAdapterTests { @Autowired private MessageChannel jpaOutboundChannelAdapterWithinChain; - @Before + @BeforeEach public void cleanUp() { this.jdbcTemplate.execute("delete from Student where rollNumber > 1003 or rollNumber < 1001"); } @Test - public void saveEntityWithMerge() throws InterruptedException { + public void saveEntityWithMerge() { List results1 = this.jdbcTemplate.queryForList("Select * from Student"); assertThat(results1).isNotNull(); diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayIntegrationTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayIntegrationTests.java index 5fbf4104fb..d9cd6977fb 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayIntegrationTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -21,12 +21,11 @@ import static org.assertj.core.api.Assertions.fail; import java.util.List; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.hibernate.TypeMismatchException; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -39,8 +38,7 @@ import org.springframework.messaging.MessageHandlingException; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.SubscribableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * The test cases for testing out a complete flow of the JPA gateways/adapters with all @@ -53,8 +51,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @since 3.0 * */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class JpaOutboundGatewayIntegrationTests { @@ -91,7 +88,7 @@ public class JpaOutboundGatewayIntegrationTests { private volatile MessageHandler handler; - @After + @AfterEach public void tearDown() { if (this.handler != null) { responseChannel.unsubscribe(this.handler); @@ -101,7 +98,6 @@ public class JpaOutboundGatewayIntegrationTests { /** * Sends a message with the payload as a integer representing the start number in the result * set and a header with value maxResults to get the max number of results - * @throws Exception */ @Test public void retrieveFromSecondRecordAndMaximumOneRecord() { diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/TestHibernateJpaDialect.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/TestHibernateJpaDialect.java index f42d16aec4..25842f0e95 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/TestHibernateJpaDialect.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/TestHibernateJpaDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2021 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. @@ -16,21 +16,24 @@ package org.springframework.integration.jpa.test; -import javax.persistence.EntityManager; -import javax.persistence.FlushModeType; -import javax.persistence.PersistenceException; +import jakarta.persistence.EntityManager; +import jakarta.persistence.FlushModeType; +import jakarta.persistence.PersistenceException; import org.springframework.orm.jpa.vendor.HibernateJpaDialect; /** * @author Artem Bilan + * * @since 3.0 */ @SuppressWarnings("serial") public class TestHibernateJpaDialect extends HibernateJpaDialect { @Override - public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name) throws PersistenceException { + public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name) + throws PersistenceException { + entityManager.setFlushMode(FlushModeType.COMMIT); return super.prepareTransaction(entityManager, readOnly, name); } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java index 3cfd448ed2..855b0248f6 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentDomain.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,17 +18,17 @@ package org.springframework.integration.jpa.test.entity; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.NamedNativeQuery; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.NamedNativeQuery; +import jakarta.persistence.NamedQueries; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.SequenceGenerator; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; /** diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java index 15bc1cbacd..519c122438 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/test/entity/StudentReadStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,12 +18,12 @@ package org.springframework.integration.jpa.test.entity; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Temporal; +import jakarta.persistence.TemporalType; /** * The Entity for Student read status diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/channnel/ChannelTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/channnel/ChannelTests.java index 16f475dce2..f5f7c21636 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/channnel/ChannelTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/channnel/ChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2021 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. @@ -25,6 +25,8 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -57,6 +59,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * @since 5.4 * */ +@DisabledOnOs(OS.WINDOWS) @SpringJUnitConfig @EmbeddedKafka(topics = { "channel.1", "channel.2", "channel.3" }, partitions = 1) public class ChannelTests { diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/AllXmlTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/AllXmlTests.java index 1660205ebb..d1e4108f23 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/AllXmlTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/AllXmlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2021 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. @@ -19,6 +19,8 @@ package org.springframework.integration.kafka.config.xml; import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; @@ -34,6 +36,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * @since 5.4 * */ +@DisabledOnOs(OS.WINDOWS) @SpringJUnitConfig @DirtiesContext @EmbeddedKafka(topics = { "one", "two", "three", "four" }) diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java index 965b3cdff8..90f24f34c6 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 the original author or authors. + * Copyright 2015-2021 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. @@ -32,6 +32,8 @@ import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.TopicPartition; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -93,6 +95,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; * * @since 5.4 */ +@DisabledOnOs(OS.WINDOWS) @SpringJUnitConfig @DirtiesContext @EmbeddedKafka(topics = { KafkaDslTests.TEST_TOPIC1, KafkaDslTests.TEST_TOPIC2, KafkaDslTests.TEST_TOPIC3, diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java index 68adf82bc8..2b1b02fe03 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 the original author or authors. + * Copyright 2018-2021 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. @@ -32,6 +32,8 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.beans.factory.BeanFactory; import org.springframework.integration.IntegrationMessageHeaderAccessor; @@ -76,6 +78,7 @@ import org.springframework.retry.support.RetryTemplate; * @since 5.4 * */ +@DisabledOnOs(OS.WINDOWS) class InboundGatewayTests { private static String topic1 = "testTopic1"; diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java index f0f6e98441..d579dd65cf 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java @@ -52,6 +52,8 @@ import org.apache.kafka.common.header.internals.RecordHeaders; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.StaticMessageHeaderAccessor; @@ -109,6 +111,7 @@ import org.springframework.retry.support.RetryTemplate; * @since 5.4 * */ +@DisabledOnOs(OS.WINDOWS) class MessageDrivenAdapterTests { private static String topic1 = "testTopic1"; diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java index e3c3997d7c..41fb21c240 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java @@ -29,6 +29,8 @@ import org.apache.kafka.common.TopicPartition; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.springframework.kafka.core.DefaultKafkaConsumerFactory; import org.springframework.kafka.core.DefaultKafkaProducerFactory; @@ -46,6 +48,7 @@ import org.springframework.messaging.Message; * @since 5.4 * */ +@DisabledOnOs(OS.WINDOWS) class MessageSourceIntegrationTests { private static final String TOPIC1 = "MessageSourceIntegrationTests1"; diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java index c79b132e91..e9e2a8fbc8 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java @@ -62,6 +62,8 @@ import org.apache.kafka.common.TopicPartition; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; @@ -118,6 +120,7 @@ import org.springframework.util.concurrent.SettableListenableFuture; * * @since 5.4 */ +@DisabledOnOs(OS.WINDOWS) class KafkaProducerMessageHandlerTests { private static String topic1 = "testTopic1out"; diff --git a/spring-integration-kafka/src/test/kotlin/org/springframework/integration/kafka/dsl/kotlin/KafkaDslKotlinTests.kt b/spring-integration-kafka/src/test/kotlin/org/springframework/integration/kafka/dsl/kotlin/KafkaDslKotlinTests.kt index 975c4591ff..f4056043f3 100644 --- a/spring-integration-kafka/src/test/kotlin/org/springframework/integration/kafka/dsl/kotlin/KafkaDslKotlinTests.kt +++ b/spring-integration-kafka/src/test/kotlin/org/springframework/integration/kafka/dsl/kotlin/KafkaDslKotlinTests.kt @@ -17,17 +17,14 @@ package org.springframework.integration.kafka.dsl.kotlin import assertk.assertThat -import assertk.assertions.isEqualTo -import assertk.assertions.isInstanceOf -import assertk.assertions.isNotNull -import assertk.assertions.isNull -import assertk.assertions.isSameAs -import assertk.assertions.isTrue +import assertk.assertions.* import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.clients.consumer.ConsumerRebalanceListener import org.apache.kafka.clients.producer.ProducerConfig import org.apache.kafka.common.TopicPartition import org.junit.jupiter.api.Test +import org.junit.jupiter.api.condition.DisabledOnOs +import org.junit.jupiter.api.condition.OS import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Qualifier import org.springframework.context.annotation.Bean @@ -47,16 +44,8 @@ import org.springframework.integration.kafka.support.RawRecordHeaderErrorMessage import org.springframework.integration.support.MessageBuilder import org.springframework.integration.test.util.TestUtils import org.springframework.kafka.annotation.EnableKafka -import org.springframework.kafka.core.ConsumerFactory -import org.springframework.kafka.core.DefaultKafkaConsumerFactory -import org.springframework.kafka.core.DefaultKafkaProducerFactory -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.core.ProducerFactory -import org.springframework.kafka.listener.ConsumerProperties -import org.springframework.kafka.listener.ContainerProperties -import org.springframework.kafka.listener.GenericMessageListenerContainer -import org.springframework.kafka.listener.KafkaMessageListenerContainer -import org.springframework.kafka.listener.MessageListenerContainer +import org.springframework.kafka.core.* +import org.springframework.kafka.listener.* import org.springframework.kafka.requestreply.ReplyingKafkaTemplate import org.springframework.kafka.support.Acknowledgment import org.springframework.kafka.support.DefaultKafkaHeaderMapper @@ -85,6 +74,7 @@ import java.util.stream.Stream * @since 5.4 */ +@DisabledOnOs(OS.WINDOWS) @SpringJUnitConfig @DirtiesContext @EmbeddedKafka(topics = [KafkaDslKotlinTests.TEST_TOPIC1, KafkaDslKotlinTests.TEST_TOPIC2, diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java index 587c75f0ef..abe4a275cd 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java @@ -28,18 +28,18 @@ import java.util.Properties; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import javax.mail.Authenticator; -import javax.mail.FetchProfile; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.Part; -import javax.mail.Session; -import javax.mail.Store; -import javax.mail.URLName; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Authenticator; +import jakarta.mail.FetchProfile; +import jakarta.mail.Flags; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.MessagingException; +import jakarta.mail.Multipart; +import jakarta.mail.Part; +import jakarta.mail.Session; +import jakarta.mail.Store; +import jakarta.mail.URLName; +import jakarta.mail.internet.MimeMessage; import org.springframework.beans.factory.DisposableBean; import org.springframework.expression.Expression; @@ -359,7 +359,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl } @Override - public Object[] receive() throws javax.mail.MessagingException { + public Object[] receive() throws jakarta.mail.MessagingException { this.folderReadLock.lock(); // NOSONAR - guarded with the getReadHoldCount() try { try { @@ -574,7 +574,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl /** * Fetches the specified messages from this receiver's folder. Default * implementation {@link Folder#fetch(Message[], FetchProfile) fetches} - * every {@link javax.mail.FetchProfile.Item}. + * every {@link jakarta.mail.FetchProfile.Item}. * @param messages the messages to fetch * @throws MessagingException in case of JavaMail errors */ diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java index 3c75b3e757..59656b1831 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -23,9 +23,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.MessagingException; import org.aopalliance.aop.Advice; @@ -50,7 +50,7 @@ import org.springframework.util.CollectionUtils; * An event-driven Channel Adapter that receives mail messages from a mail * server that supports the IMAP "idle" command (see RFC 2177). Received mail * messages will be converted and sent as Spring Integration Messages to the - * output channel. The Message payload will be the {@link javax.mail.Message} + * output channel. The Message payload will be the {@link jakarta.mail.Message} * instance that was received. * * @author Arjen Poutsma @@ -116,7 +116,7 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be /** * Specify whether the IDLE task should reconnect automatically after - * catching a {@link javax.mail.FolderClosedException} while waiting for messages. The + * catching a {@link jakarta.mail.FolderClosedException} while waiting for messages. The * default value is true. * @param shouldReconnectAutomatically true to reconnect. */ diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java index 359cd72380..293f0d2a43 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java @@ -22,15 +22,15 @@ import java.util.Objects; import java.util.Properties; import java.util.concurrent.ScheduledFuture; -import javax.mail.Flags; -import javax.mail.Flags.Flag; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.search.AndTerm; -import javax.mail.search.FlagTerm; -import javax.mail.search.NotTerm; -import javax.mail.search.SearchTerm; +import jakarta.mail.Flags; +import jakarta.mail.Flags.Flag; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.MessagingException; +import jakarta.mail.search.AndTerm; +import jakarta.mail.search.FlagTerm; +import jakarta.mail.search.NotTerm; +import jakarta.mail.search.SearchTerm; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; @@ -201,9 +201,9 @@ public class ImapMailReceiver extends AbstractMailReceiver { /** * Retrieves new messages from this receiver's folder. This implementation * creates a {@link SearchTerm} that searches for all messages in the - * folder that are {@link javax.mail.Flags.Flag#RECENT RECENT}, not - * {@link javax.mail.Flags.Flag#ANSWERED ANSWERED}, and not - * {@link javax.mail.Flags.Flag#DELETED DELETED}. The search term is used + * folder that are {@link jakarta.mail.Flags.Flag#RECENT RECENT}, not + * {@link jakarta.mail.Flags.Flag#ANSWERED ANSWERED}, and not + * {@link jakarta.mail.Flags.Flag#DELETED DELETED}. The search term is used * to {@link Folder#search(SearchTerm) search} for new messages. * @return the new messages * @throws MessagingException in case of JavaMail errors diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java index 970744a11d..df7f14c0b8 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -17,13 +17,14 @@ package org.springframework.integration.mail; /** - * Strategy interface for receiving mail {@link javax.mail.Message Messages}. + * Strategy interface for receiving mail {@link jakarta.mail.Message Messages}. * * @author Mark Fisher * @author Gary Russell + * @author Artem Bilan */ public interface MailReceiver { - Object[] receive() throws javax.mail.MessagingException; + Object[] receive() throws jakarta.mail.MessagingException; } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java index 750a1c4e70..c60f2eb6d4 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailSendingMessageHandler.java @@ -16,8 +16,8 @@ package org.springframework.integration.mail; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; import org.springframework.core.io.ByteArrayResource; import org.springframework.integration.handler.AbstractMessageHandler; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailTransportUtils.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailTransportUtils.java index bd2e5dc97d..4712f65391 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailTransportUtils.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailTransportUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2007-2020 the original author or authors. + * Copyright 2007-2021 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. @@ -16,10 +16,10 @@ package org.springframework.integration.mail; -import javax.mail.Folder; -import javax.mail.MessagingException; -import javax.mail.Service; -import javax.mail.URLName; +import jakarta.mail.Folder; +import jakarta.mail.MessagingException; +import jakarta.mail.Service; +import jakarta.mail.URLName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,8 +43,8 @@ public abstract class MailTransportUtils { * finally * blocks in manual JavaMail code. * @param service the JavaMail Service to close (may be null) - * @see javax.mail.Transport - * @see javax.mail.Store + * @see jakarta.mail.Transport + * @see jakarta.mail.Store */ public static void closeService(Service service) { if (service != null) { diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java index cdfb579003..af19da54f8 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java @@ -16,11 +16,11 @@ package org.springframework.integration.mail; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.URLName; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.MessagingException; +import jakarta.mail.URLName; +import jakarta.mail.internet.MimeMessage; import org.springframework.util.Assert; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/SearchTermStrategy.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/SearchTermStrategy.java index 0f471c945d..6f29483480 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/SearchTermStrategy.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/SearchTermStrategy.java @@ -16,9 +16,9 @@ package org.springframework.integration.mail; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.search.SearchTerm; +import jakarta.mail.Flags; +import jakarta.mail.Folder; +import jakarta.mail.search.SearchTerm; /** * Strategy to be used to generate a {@link SearchTerm}. diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java index ce6ec72fcd..169085b7a8 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,10 +18,10 @@ package org.springframework.integration.mail.config; import java.util.Properties; -import javax.mail.Authenticator; -import javax.mail.Session; -import javax.mail.URLName; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Authenticator; +import jakarta.mail.Session; +import jakarta.mail.URLName; +import jakarta.mail.internet.MimeMessage; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.DisposableBean; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapIdleChannelAdapterSpec.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapIdleChannelAdapterSpec.java index 72372e302f..91f814fcee 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapIdleChannelAdapterSpec.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/ImapIdleChannelAdapterSpec.java @@ -26,9 +26,9 @@ import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Function; -import javax.mail.Authenticator; -import javax.mail.Session; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Authenticator; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeMessage; import org.aopalliance.aop.Advice; @@ -83,7 +83,7 @@ public class ImapIdleChannelAdapterSpec /** * Configure a SpEL expression to select messages. The root object for the expression - * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean + * evaluation is a {@link jakarta.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. @@ -94,7 +94,7 @@ public class ImapIdleChannelAdapterSpec /** * Configure an {@link Expression} to select messages. The root object for the expression - * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean + * evaluation is a {@link jakarta.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. @@ -112,7 +112,7 @@ public class ImapIdleChannelAdapterSpec /** * Configure a {@link Function} to select messages. The argument for the function - * is a {@link javax.mail.internet.MimeMessage}; {@code apply} returns a boolean + * is a {@link jakarta.mail.internet.MimeMessage}; {@code apply} returns a boolean * result (true means select the message). * @param selectorFunction the selectorFunction. * @return the spec. @@ -252,9 +252,9 @@ public class ImapIdleChannelAdapterSpec /** * When a header mapper is provided determine whether an embedded - * {@link javax.mail.Part} (e.g {@link javax.mail.Message} or - * {@link javax.mail.Multipart} content is rendered as a byte[] in the payload. - * Otherwise, leave as a {@link javax.mail.Part}. These objects are not suitable for + * {@link jakarta.mail.Part} (e.g {@link jakarta.mail.Message} or + * {@link jakarta.mail.Multipart} content is rendered as a byte[] in the payload. + * Otherwise, leave as a {@link jakarta.mail.Part}. These objects are not suitable for * downstream serialization. Default: true. *

* This has no effect if there is no header mapper, in that case the payload is the diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailInboundChannelAdapterSpec.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailInboundChannelAdapterSpec.java index dfb06d3011..e66577b8a3 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailInboundChannelAdapterSpec.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailInboundChannelAdapterSpec.java @@ -22,9 +22,9 @@ import java.util.Properties; import java.util.function.Consumer; import java.util.function.Function; -import javax.mail.Authenticator; -import javax.mail.Session; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Authenticator; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeMessage; import org.springframework.expression.Expression; import org.springframework.integration.dsl.ComponentsRegistration; @@ -70,7 +70,7 @@ MailInboundChannelAdapterSpec, R e /** * Configure a SpEL expression to select messages. The root object for the expression - * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean + * evaluation is a {@link jakarta.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. @@ -88,7 +88,7 @@ MailInboundChannelAdapterSpec, R e /** * Configure a SpEL expression to select messages. The root object for the expression - * evaluation is a {@link javax.mail.internet.MimeMessage} which should return a boolean + * evaluation is a {@link jakarta.mail.internet.MimeMessage} which should return a boolean * result (true means select the message). * @param selectorExpression the selectorExpression. * @return the spec. @@ -101,7 +101,7 @@ MailInboundChannelAdapterSpec, R e /** * Configure a {@link Function} to select messages. The argument for the function - * is a {@link javax.mail.internet.MimeMessage}; {@code apply} returns a boolean + * is a {@link jakarta.mail.internet.MimeMessage}; {@code apply} returns a boolean * result (true means select the message). * @param selectorFunction the selectorFunction. * @return the spec. @@ -225,9 +225,9 @@ MailInboundChannelAdapterSpec, R e /** * When a header mapper is provided determine whether an embedded - * {@link javax.mail.Part} (e.g {@link javax.mail.Message} or - * {@link javax.mail.Multipart} content is rendered as a byte[] in the payload. - * Otherwise, leave as a {@link javax.mail.Part}. These objects are not suitable for + * {@link jakarta.mail.Part} (e.g {@link jakarta.mail.Message} or + * {@link jakarta.mail.Multipart} content is rendered as a byte[] in the payload. + * Otherwise, leave as a {@link jakarta.mail.Part}. These objects are not suitable for * downstream serialization. Default: true. *

This has no effect if there is no header mapper, in that case the payload is the * {@link MimeMessage}. diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailSendingMessageHandlerSpec.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailSendingMessageHandlerSpec.java index 14a2c7d0e9..58f6a2d7df 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailSendingMessageHandlerSpec.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailSendingMessageHandlerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-2021 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. @@ -19,7 +19,7 @@ package org.springframework.integration.mail.dsl; import java.util.Properties; import java.util.function.Consumer; -import javax.activation.FileTypeMap; +import jakarta.activation.FileTypeMap; import org.springframework.integration.dsl.MessageHandlerSpec; import org.springframework.integration.mail.MailSendingMessageHandler; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/DefaultMailHeaderMapper.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/DefaultMailHeaderMapper.java index 2a99aa3beb..50f801d85b 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/DefaultMailHeaderMapper.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/DefaultMailHeaderMapper.java @@ -20,8 +20,8 @@ import java.util.Date; import java.util.Enumeration; import java.util.Map; -import javax.mail.Header; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Header; +import jakarta.mail.internet.MimeMessage; import org.springframework.integration.mail.MailHeaders; import org.springframework.integration.mapping.HeaderMapper; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java index 91999a11b7..f302d56fd4 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/support/MailUtils.java @@ -19,9 +19,9 @@ package org.springframework.integration.mail.support; import java.util.HashMap; import java.util.Map; -import javax.mail.Address; -import javax.mail.Message; -import javax.mail.Message.RecipientType; +import jakarta.mail.Address; +import jakarta.mail.Message; +import jakarta.mail.Message.RecipientType; import org.springframework.integration.mail.MailHeaders; import org.springframework.messaging.MessagingException; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/AbstractMailMessageTransformer.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/AbstractMailMessageTransformer.java index 1f07e59686..1ee8d4dd7a 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/AbstractMailMessageTransformer.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/AbstractMailMessageTransformer.java @@ -67,11 +67,11 @@ public abstract class AbstractMailMessageTransformer implements Transformer, @Override public Message transform(Message message) { Object payload = message.getPayload(); - if (!(payload instanceof javax.mail.Message)) { + if (!(payload instanceof jakarta.mail.Message)) { throw new MessageTransformationException(message, getClass().getSimpleName() - + " requires a javax.mail.Message payload"); + + " requires a jakarta.mail.Message payload"); } - javax.mail.Message mailMessage = (javax.mail.Message) payload; + jakarta.mail.Message mailMessage = (jakarta.mail.Message) payload; AbstractIntegrationMessageBuilder builder; try { builder = this.doTransform(mailMessage); @@ -86,11 +86,11 @@ public abstract class AbstractMailMessageTransformer implements Transformer, return builder.build(); } - protected abstract AbstractIntegrationMessageBuilder doTransform(javax.mail.Message mailMessage) + protected abstract AbstractIntegrationMessageBuilder doTransform(jakarta.mail.Message mailMessage) throws Exception; // NOSONAR - private static Map extractHeaderMapFromMailMessage(javax.mail.Message mailMessage) { + private static Map extractHeaderMapFromMailMessage(jakarta.mail.Message mailMessage) { return MailUtils.extractStandardHeaders(mailMessage); } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java index 1bf3c227a6..c2c2b042d7 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/transformer/MailToStringTransformer.java @@ -19,14 +19,14 @@ package org.springframework.integration.mail.transformer; import java.io.ByteArrayOutputStream; import java.nio.charset.Charset; -import javax.mail.Multipart; -import javax.mail.Part; +import jakarta.mail.Multipart; +import jakarta.mail.Part; import org.springframework.integration.support.AbstractIntegrationMessageBuilder; import org.springframework.util.Assert; /** - * Transforms a Message payload of type {@link javax.mail.Message} to a String. If the + * Transforms a Message payload of type {@link jakarta.mail.Message} to a String. If the * mail message's content is a String, it will be the payload of the result Message. If * the content is a Part or Multipart, a String will be created from an output stream of * bytes using the provided charset (or UTF-8 by default). @@ -51,7 +51,7 @@ public class MailToStringTransformer extends AbstractMailMessageTransformer doTransform(javax.mail.Message mailMessage) + protected AbstractIntegrationMessageBuilder doTransform(jakarta.mail.Message mailMessage) throws Exception { // NOSONAR Object content = mailMessage.getContent(); diff --git a/spring-integration-mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail.xsd b/spring-integration-mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail.xsd index 2bc156b0ff..8ef3ea2ae6 100644 --- a/spring-integration-mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail.xsd +++ b/spring-integration-mail/src/main/resources/org/springframework/integration/mail/config/spring-integration-mail.xsd @@ -213,12 +213,12 @@ - Specify the javax.mail.Session reference. + Specify the jakarta.mail.Session reference. NOTE: if this is provided, then 'java-mail-properties' should not be. - + @@ -239,12 +239,12 @@ - Specify the javax.mail.Authenticator. + Specify the jakarta.mail.Authenticator. NOTE: if this is provided, then 'session' should not be. - + @@ -309,7 +309,7 @@ Defines a Transformer ('org.springframework.integration.mail.transformer.MailToStringTransformer') - that converts a javax.mail.Message payload to a String. + that converts a jakarta.mail.Message payload to a String. diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java index e2a3664697..b422136bc7 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java @@ -45,21 +45,21 @@ import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.LogRecord; -import javax.mail.Flags; -import javax.mail.Flags.Flag; -import javax.mail.Folder; -import javax.mail.FolderClosedException; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.Store; -import javax.mail.URLName; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.mail.search.AndTerm; -import javax.mail.search.FlagTerm; -import javax.mail.search.FromTerm; +import jakarta.mail.Flags; +import jakarta.mail.Flags.Flag; +import jakarta.mail.Folder; +import jakarta.mail.FolderClosedException; +import jakarta.mail.Message; +import jakarta.mail.MessagingException; +import jakarta.mail.Multipart; +import jakarta.mail.Store; +import jakarta.mail.URLName; +import jakarta.mail.internet.AddressException; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.search.AndTerm; +import jakarta.mail.search.FlagTerm; +import jakarta.mail.search.FromTerm; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -797,7 +797,7 @@ public class ImapMailReceiverTests { try { receiver.receive(); } - catch (javax.mail.MessagingException e) { + catch (jakarta.mail.MessagingException e) { if (e.getCause() instanceof NullPointerException) { failed.getAndIncrement(); } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailSearchTermsTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailSearchTermsTests.java index c666ca35e1..c3e2e3eec6 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailSearchTermsTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailSearchTermsTests.java @@ -24,13 +24,13 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import javax.mail.Flags; -import javax.mail.Flags.Flag; -import javax.mail.Folder; -import javax.mail.search.AndTerm; -import javax.mail.search.FlagTerm; -import javax.mail.search.NotTerm; -import javax.mail.search.SearchTerm; +import jakarta.mail.Flags; +import jakarta.mail.Flags.Flag; +import jakarta.mail.Folder; +import jakarta.mail.search.AndTerm; +import jakarta.mail.search.FlagTerm; +import jakarta.mail.search.NotTerm; +import jakarta.mail.search.SearchTerm; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java index 0cf899d4da..d74cb4f4fe 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java @@ -26,11 +26,11 @@ import static org.mockito.Mockito.when; import java.util.Properties; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.Session; -import javax.mail.Store; -import javax.mail.URLName; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.Session; +import jakarta.mail.Store; +import jakarta.mail.URLName; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java index 82432f4f33..391c8ade08 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java @@ -21,8 +21,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; -import javax.mail.Message; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Message; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -43,9 +43,9 @@ public class MailReceivingMessageSourceTests { MimeMessage message3 = Mockito.mock(MimeMessage.class); MimeMessage message4 = Mockito.mock(MimeMessage.class); - mailReceiver.messages.add(new javax.mail.Message[]{ message1 }); - mailReceiver.messages.add(new javax.mail.Message[]{ message2, message3 }); - mailReceiver.messages.add(new javax.mail.Message[]{ message4 }); + mailReceiver.messages.add(new jakarta.mail.Message[]{ message1 }); + mailReceiver.messages.add(new jakarta.mail.Message[]{ message2, message3 }); + mailReceiver.messages.add(new jakarta.mail.Message[]{ message4 }); MailReceivingMessageSource source = new MailReceivingMessageSource(mailReceiver); assertThat(source.receive().getPayload()).as("Wrong message for number 1").isEqualTo(message1); @@ -66,7 +66,7 @@ public class MailReceivingMessageSourceTests { } @Override - public javax.mail.Message[] receive() { + public jakarta.mail.Message[] receive() { return messages.poll(); } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests-context.xml b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests-context.xml index 94a8341852..4205aee3be 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests-context.xml +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests-context.xml @@ -9,8 +9,8 @@ - - + + diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests.java index 1a7d2aa9e5..53823d3fd7 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerContextTests.java @@ -21,9 +21,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.io.DataInputStream; -import javax.mail.Message; -import javax.mail.Multipart; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Message; +import jakarta.mail.Multipart; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java index 70722a50d3..f1f9bd7ec8 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java @@ -20,10 +20,10 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.DataInputStream; -import javax.mail.Message; -import javax.mail.Multipart; -import javax.mail.Session; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Message; +import jakarta.mail.Multipart; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java index e3627b2a62..50e2ed6d09 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/Pop3MailReceiverTests.java @@ -25,11 +25,11 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Field; -import javax.mail.Flags; -import javax.mail.Flags.Flag; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Flags; +import jakarta.mail.Flags.Flag; +import jakarta.mail.Folder; +import jakarta.mail.Message; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/StubJavaMailSender.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/StubJavaMailSender.java index e4b09d57b9..165d5aca93 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/StubJavaMailSender.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/StubJavaMailSender.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMessage; import org.springframework.mail.MailException; import org.springframework.mail.SimpleMailMessage; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml index 9f4665935d..7e215f6d2c 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/DefaultConfigurationTests-context.xml @@ -11,8 +11,8 @@ - - + + diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParserTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParserTests.java index fa93763971..a27994a9ad 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParserTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleChannelAdapterParserTests.java @@ -20,10 +20,10 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Properties; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.URLName; -import javax.mail.search.SearchTerm; +import jakarta.mail.Flags; +import jakarta.mail.Folder; +import jakarta.mail.URLName; +import jakarta.mail.search.SearchTerm; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleIntegrationTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleIntegrationTests.java index 86c6ab3ba3..f0960c622b 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleIntegrationTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleIntegrationTests.java @@ -29,8 +29,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import javax.mail.Folder; -import javax.mail.Message; +import jakarta.mail.Folder; +import jakarta.mail.Message; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests-context.xml b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests-context.xml index 50435f6650..16c27602ed 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests-context.xml +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests-context.xml @@ -113,7 +113,7 @@ store-uri="imap:test" session="testSession" channel="testChannel" should-delete-messages="false" auto-startup="false" /> - + bar diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java index 9c712ed38f..814d3edc3c 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/InboundChannelAdapterParserTests.java @@ -19,7 +19,7 @@ package org.springframework.integration.mail.config; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import javax.mail.Authenticator; +import jakarta.mail.Authenticator; import org.junit.jupiter.api.Test; import org.xml.sax.SAXParseException; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MailToStringTransformerParserTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MailToStringTransformerParserTests.java index 21f80f55b3..2bf02ea50a 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MailToStringTransformerParserTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MailToStringTransformerParserTests.java @@ -19,7 +19,7 @@ package org.springframework.integration.mail.config; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import javax.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -49,7 +49,7 @@ class MailToStringTransformerParserTests { (PollableChannel) new BeanFactoryChannelResolver(context).resolveDestination("output"); MimeMessage mimeMessage = Mockito.mock(MimeMessage.class); Mockito.when(mimeMessage.getContent()).thenReturn("hello"); - input.send(new GenericMessage(mimeMessage)); + input.send(new GenericMessage(mimeMessage)); Message result = output.receive(10_000); assertThat(result).isNotNull(); assertThat(result.getPayload()).isEqualTo("hello"); @@ -67,7 +67,7 @@ class MailToStringTransformerParserTests { (PollableChannel) new BeanFactoryChannelResolver(context).resolveDestination("output"); MimeMessage mimeMessage = Mockito.mock(MimeMessage.class); Mockito.when(mimeMessage.getContent()).thenReturn("foo"); - input.send(new GenericMessage(mimeMessage)); + input.send(new GenericMessage(mimeMessage)); Message result = output.receive(0); assertThat(result).isNotNull(); assertThat(result.getPayload()).isEqualTo("FOO!!!"); diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java index 79e67b75c5..5e22f744ce 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/MessageWithContentTypeTests.java @@ -27,8 +27,8 @@ import java.io.FileReader; import java.io.StringWriter; import java.util.Properties; -import javax.mail.Session; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/PollingMailSourceParserTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/PollingMailSourceParserTests.java index 70e073e910..4acf940933 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/PollingMailSourceParserTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/PollingMailSourceParserTests.java @@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Properties; -import javax.mail.URLName; +import jakarta.mail.URLName; import org.junit.jupiter.api.Test; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/Pop3Tests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/Pop3Tests.java index bc68ee17bb..18adcdc2ba 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/Pop3Tests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/Pop3Tests.java @@ -20,9 +20,9 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; -import javax.mail.Message.RecipientType; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Message.RecipientType; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/SmtpTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/SmtpTests.java index e1a46ffb1d..36f0a06aae 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/SmtpTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/SmtpTests.java @@ -18,9 +18,9 @@ package org.springframework.integration.mail.config; import static org.assertj.core.api.Assertions.assertThat; -import javax.mail.Message.RecipientType; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; +import jakarta.mail.Message.RecipientType; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/mailOutboundChannelAdapterParserTests.xml b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/mailOutboundChannelAdapterParserTests.xml index c40e7921a9..f146a7e451 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/mailOutboundChannelAdapterParserTests.xml +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/config/mailOutboundChannelAdapterParserTests.xml @@ -26,8 +26,8 @@ - - + + diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java index 409fc02276..43f4cbe4da 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java @@ -21,16 +21,16 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.Closeable; import java.util.Properties; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMessage.RecipientType; -import javax.mail.search.AndTerm; -import javax.mail.search.FlagTerm; -import javax.mail.search.FromTerm; -import javax.mail.search.SearchTerm; +import jakarta.mail.Flags; +import jakarta.mail.Folder; +import jakarta.mail.internet.AddressException; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMessage.RecipientType; +import jakarta.mail.search.AndTerm; +import jakarta.mail.search.FlagTerm; +import jakarta.mail.search.FromTerm; +import jakarta.mail.search.SearchTerm; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java index d5d0fc3457..622440ea2d 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java @@ -161,7 +161,6 @@ public class MongoDbMetadataStore implements ConcurrentMetadataStore { * return map.get(key); * } * except that the action is performed atomically. - *

* @param key the metadata entry key * @param value the metadata entry value to store * @return null if successful, the old value otherwise. diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml index 7c9c896850..a0ace56857 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml @@ -8,7 +8,8 @@ http://www.springframework.org/schema/integration/mongodb https://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd"> - + + - + + diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java index 283d6cf9f3..9ed02e16fc 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -17,13 +17,15 @@ package org.springframework.integration.mongodb.config; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import java.util.List; - -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; +import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.expression.common.LiteralExpression; import org.springframework.expression.spel.standard.SpelExpression; @@ -33,105 +35,100 @@ import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice; import org.springframework.integration.mongodb.outbound.MongoDbStoringMessageHandler; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageHandler; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + /** * @author Oleg Zhurakousky * @author Artem Bilan * @author Gary Russell */ +@SpringJUnitConfig public class MongoDbOutboundChannelAdapterParserTests { + @Autowired + ApplicationContext context; + @Test public void minimalConfig() { - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = - TestUtils.getPropertyValue(context.getBean("minimalConfig.adapter"), "handler", MongoDbStoringMessageHandler.class); + TestUtils.getPropertyValue(context.getBean("minimalConfig.adapter"), "handler", + MongoDbStoringMessageHandler.class); assertThat(TestUtils.getPropertyValue(handler, "componentName")).isEqualTo("minimalConfig.adapter"); assertThat(TestUtils.getPropertyValue(handler, "shouldTrack")).isEqualTo(false); assertThat(TestUtils.getPropertyValue(handler, "mongoTemplate")).isNotNull(); assertThat(TestUtils.getPropertyValue(handler, "mongoDbFactory")).isEqualTo(context.getBean("mongoDbFactory")); assertThat(TestUtils.getPropertyValue(handler, "evaluationContext")).isNotNull(); - assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression) - .isTrue(); + assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression")).isInstanceOf(LiteralExpression.class); assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue")).isEqualTo("data"); - context.close(); } @Test public void fullConfigWithCollectionExpression() { - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = - TestUtils.getPropertyValue(context.getBean("fullConfigWithCollectionExpression.adapter"), "handler", MongoDbStoringMessageHandler.class); + TestUtils.getPropertyValue(context.getBean("fullConfigWithCollectionExpression.adapter"), "handler", + MongoDbStoringMessageHandler.class); assertThat(TestUtils.getPropertyValue(handler, "componentName")) .isEqualTo("fullConfigWithCollectionExpression.adapter"); assertThat(TestUtils.getPropertyValue(handler, "shouldTrack")).isEqualTo(false); assertThat(TestUtils.getPropertyValue(handler, "mongoTemplate")).isNotNull(); assertThat(TestUtils.getPropertyValue(handler, "mongoDbFactory")).isEqualTo(context.getBean("mongoDbFactory")); assertThat(TestUtils.getPropertyValue(handler, "evaluationContext")).isNotNull(); - assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof SpelExpression).isTrue(); + assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression")).isInstanceOf(SpelExpression.class); assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression.expression")) .isEqualTo("headers.collectionName"); - context.close(); } @Test public void fullConfigWithCollection() { - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = - TestUtils.getPropertyValue(context.getBean("fullConfigWithCollection.adapter"), "handler", MongoDbStoringMessageHandler.class); + TestUtils.getPropertyValue(context.getBean("fullConfigWithCollection.adapter"), "handler", + MongoDbStoringMessageHandler.class); assertThat(TestUtils.getPropertyValue(handler, "componentName")).isEqualTo("fullConfigWithCollection.adapter"); assertThat(TestUtils.getPropertyValue(handler, "shouldTrack")).isEqualTo(false); assertThat(TestUtils.getPropertyValue(handler, "mongoTemplate")).isNotNull(); assertThat(TestUtils.getPropertyValue(handler, "mongoDbFactory")).isEqualTo(context.getBean("mongoDbFactory")); assertThat(TestUtils.getPropertyValue(handler, "evaluationContext")).isNotNull(); - assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression) - .isTrue(); + assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression")).isInstanceOf(LiteralExpression.class); assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue")).isEqualTo("foo"); - context.close(); } @Test public void fullConfigWithMongoTemplate() { - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass()); MongoDbStoringMessageHandler handler = - TestUtils.getPropertyValue(context.getBean("fullConfigWithMongoTemplate.adapter"), "handler", MongoDbStoringMessageHandler.class); + TestUtils.getPropertyValue(context.getBean("fullConfigWithMongoTemplate.adapter"), "handler", + MongoDbStoringMessageHandler.class); assertThat(TestUtils.getPropertyValue(handler, "componentName")) .isEqualTo("fullConfigWithMongoTemplate.adapter"); assertThat(TestUtils.getPropertyValue(handler, "shouldTrack")).isEqualTo(false); assertThat(TestUtils.getPropertyValue(handler, "mongoTemplate")).isNotNull(); assertThat(TestUtils.getPropertyValue(handler, "evaluationContext")).isNotNull(); - assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression) - .isTrue(); + assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression")).isInstanceOf(LiteralExpression.class); assertThat(TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue")).isEqualTo("foo"); - context.close(); } - @Test(expected = BeanDefinitionParsingException.class) + @Test public void templateAndFactoryFail() { - new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-factory-config.xml", this.getClass()) - .close(); + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-factory-config.xml", + getClass())); } - @Test(expected = BeanDefinitionParsingException.class) + @Test public void templateAndConverterFail() { - new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml", - this.getClass()).close(); + assertThatExceptionOfType(BeanDefinitionParsingException.class) + .isThrownBy(() -> + new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml", + getClass())); } @Test public void testInt3024PollerAndRequestHandlerAdviceChain() { - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( - "outbound-adapter-parser-config.xml", this.getClass()); AbstractEndpoint endpoint = context.getBean("pollableAdapter", AbstractEndpoint.class); assertThat(endpoint).isInstanceOf(PollingConsumer.class); MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class); assertThat(AopUtils.isAopProxy(handler)).isTrue(); - List advisors = TestUtils.getPropertyValue(handler, "h.advised.advisors", List.class); - assertThat(TestUtils.getPropertyValue(advisors.get(0), "advice")).isInstanceOf(RequestHandlerRetryAdvice.class); - context.close(); + assertThat(((Advised) handler).getAdvisors()[0].getAdvice()).isInstanceOf(RequestHandlerRetryAdvice.class); } } diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml index 484e61c199..f579a32276 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbOutboundGatewayParserTests-context.xml @@ -62,7 +62,8 @@ - + + null, and it must have a name. - */ - @Override - public void setRequestChannel(MessageChannel requestChannel) { - Assert.notNull(requestChannel, "requestChannel must not be null"); - Assert.isTrue(requestChannel instanceof NamedComponent && - StringUtils.hasText(((NamedComponent) requestChannel).getComponentName()), - "RmiGateway's request channel must have a name."); - this.requestChannelName = ((NamedComponent) requestChannel).getComponentName(); - super.setRequestChannel(requestChannel); - } - - @Override - public void setRequestChannelName(String requestChannelName) { - this.requestChannelName = requestChannelName; - super.setRequestChannelName(requestChannelName); - } - - /** - * Specify whether the gateway should be expected to return a reply. - * The default is 'true'. - * @param expectReply true when a reply is expected. - */ - public void setExpectReply(boolean expectReply) { - this.expectReply = expectReply; - } - - public void setRegistryHost(String registryHost) { - this.registryHost = registryHost; - } - - public void setRegistryPort(int registryPort) { - this.registryPort = registryPort; - } - - public void setRemoteInvocationExecutor(RemoteInvocationExecutor remoteInvocationExecutor) { - this.remoteInvocationExecutor = remoteInvocationExecutor; - } - - @Override - public String getComponentType() { - return "rmi:inbound-gateway"; - } - - @Override - protected void onInit() { - super.onInit(); - - if (this.registryHost != null) { - this.exporter.setRegistryHost(this.registryHost); - } - this.exporter.setRegistryPort(this.registryPort); - if (this.remoteInvocationExecutor != null) { - this.exporter.setRemoteInvocationExecutor(this.remoteInvocationExecutor); - } - this.exporter.setService(this); - this.exporter.setServiceInterface(RequestReplyExchanger.class); - this.exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName); - try { - this.exporter.afterPropertiesSet(); - } - catch (RemoteException e) { - throw new IllegalStateException(e); - } - } - - @Override - @Nullable - public Message exchange(Message message) { - if (this.expectReply) { - return sendAndReceiveMessage(message); - } - else { - send(message); - return null; - } - } - - @Override - public void destroy() { - try { - super.destroy(); - this.exporter.destroy(); - } - catch (Exception e) { - throw new IllegalStateException(e); - } - } - -} diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java deleted file mode 100644 index c3f5adf434..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2002-2020 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.rmi; - -import java.io.Serializable; - -import org.springframework.integration.gateway.RequestReplyExchanger; -import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; -import org.springframework.messaging.MessageHandlingException; - -/** - * An outbound Messaging Gateway for RMI-based remoting. - * - * @author Mark Fisher - * @author Gary Russell - * @author Artem Bilan - * - * @deprecated since 5.4 with no replacement. - */ -@Deprecated -public class RmiOutboundGateway extends AbstractReplyProducingMessageHandler { - - private final RequestReplyExchanger proxy; - - private final RmiProxyFactoryBeanConfigurer configurer; - - /** - * Construct an instance with a `RequestReplyExchanger` built from the - * default {@link org.springframework.remoting.rmi.RmiProxyFactoryBean}. - * @param url the url. - */ - public RmiOutboundGateway(String url) { - this(url, null); - } - - /** - * Construct an instance with a `RequestReplyExchanger` built from the - * default {@link org.springframework.remoting.rmi.RmiProxyFactoryBean} which can be modified by the - * configurer. - * @param url the url. - * @param configurer the {@link RmiProxyFactoryBeanConfigurer}. - * @since 4.3.2 - */ - public RmiOutboundGateway(String url, RmiProxyFactoryBeanConfigurer configurer) { - this.configurer = configurer; - this.proxy = createProxy(url); - } - - - public void setReplyChannel(MessageChannel replyChannel) { - setOutputChannel(replyChannel); - } - - @Override - public String getComponentType() { - return "rmi:outbound-gateway"; - } - - @Override - public final Object handleRequestMessage(Message requestMessage) { - if (!(requestMessage.getPayload() instanceof Serializable)) { - throw new IllegalStateException( - "Expected a Serializable payload type " + - "but encountered [" + requestMessage.getPayload().getClass().getName() + "]"); - } - try { - return this.proxy.exchange(requestMessage); - } - catch (Exception ex) { - throw new MessageHandlingException(requestMessage, "Remote failure in the [" + this + ']', ex); - } - } - - private RequestReplyExchanger createProxy(String url) { - org.springframework.remoting.rmi.RmiProxyFactoryBean proxyFactory = - new org.springframework.remoting.rmi.RmiProxyFactoryBean(); - proxyFactory.setServiceInterface(RequestReplyExchanger.class); - proxyFactory.setServiceUrl(url); - proxyFactory.setLookupStubOnStartup(false); - proxyFactory.setRefreshStubOnConnectFailure(true); - if (this.configurer != null) { - this.configurer.configure(proxyFactory); - } - proxyFactory.afterPropertiesSet(); - return (RequestReplyExchanger) proxyFactory.getObject(); - } - - /** - * Allows configuration of the proxy factory bean before the RMI proxy is created. - * @since 4.3.2 - */ - public interface RmiProxyFactoryBeanConfigurer { - - /** - * Perform additional configuration of the factory bean before the - * {@code RequestReplyExchanger} is created. - * @param factoryBean the factory bean. - */ - void configure(org.springframework.remoting.rmi.RmiProxyFactoryBean factoryBean); - - } - -} diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiInboundGatewayParser.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiInboundGatewayParser.java deleted file mode 100644 index bedeb9fbc4..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiInboundGatewayParser.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2002-2020 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.rmi.config; - -import org.w3c.dom.Element; - -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.integration.config.xml.AbstractInboundGatewayParser; -import org.springframework.integration.config.xml.IntegrationNamespaceUtils; - -/** - * Parser for the <inbound-gateway/> element of the 'rmi' namespace. - * - * @author Mark Fisher - * @author Gary Russell - * - * @deprecated since 5.4 with no replacement. - */ -@Deprecated -public class RmiInboundGatewayParser extends AbstractInboundGatewayParser { - - private static final String REMOTE_INVOCATION_EXECUTOR_ATTRIBUTE = "remote-invocation-executor"; - - - @Override - protected String getBeanClassName(Element element) { - return org.springframework.integration.rmi.RmiInboundGateway.class.getName(); - } - - @Override - protected boolean isEligibleAttribute(String attributeName) { - return !attributeName.equals(REMOTE_INVOCATION_EXECUTOR_ATTRIBUTE) - && super.isEligibleAttribute(attributeName); - } - - @Override - protected void doPostProcess(BeanDefinitionBuilder builder, Element element) { - IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, REMOTE_INVOCATION_EXECUTOR_ATTRIBUTE); - } - -} diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java deleted file mode 100644 index 123c254274..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiNamespaceHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2002-2020 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.rmi.config; - -import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; - -/** - * Namespace handler for Spring Integration's rmi namespace. - * - * @author Mark Fisher - * - * @deprecated since 5.4 with no replacement. - */ -@Deprecated -public class RmiNamespaceHandler extends AbstractIntegrationNamespaceHandler { - - public void init() { - this.registerBeanDefinitionParser("inbound-gateway", new RmiInboundGatewayParser()); - this.registerBeanDefinitionParser("outbound-gateway", new RmiOutboundGatewayParser()); - } - -} diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiOutboundGatewayParser.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiOutboundGatewayParser.java deleted file mode 100644 index ef035b06bf..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/RmiOutboundGatewayParser.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2020 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.rmi.config; - -import java.rmi.registry.Registry; - -import org.w3c.dom.Element; - -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.integration.config.xml.AbstractOutboundGatewayParser; -import org.springframework.util.StringUtils; - -/** - * Parser for the <outbound-gateway/> element of the 'rmi' namespace. - * - * @author Mark Fisher - * - * @deprecated since 5.4 with no replacement. - */ -@Deprecated -public class RmiOutboundGatewayParser extends AbstractOutboundGatewayParser { - - @Override - protected String getGatewayClassName(Element element) { - return org.springframework.integration.rmi.RmiOutboundGateway.class.getName(); - } - - @Override - protected String parseUrl(Element element, ParserContext parserContext) { - String host = element.getAttribute("host"); - String remoteChannel = element.getAttribute("remote-channel"); - if (!StringUtils.hasText(host) || !StringUtils.hasText(remoteChannel)) { - parserContext.getReaderContext().error( - "The 'host' and 'remote-channel' attributes are both required", element); - } - String portAttribute = element.getAttribute("port"); - String port = StringUtils.hasText(portAttribute) ? portAttribute : "" + Registry.REGISTRY_PORT; - return "rmi://" + host + ":" + port + "/" - + org.springframework.integration.rmi.RmiInboundGateway.SERVICE_NAME_PREFIX + remoteChannel; - } - - @Override - protected void postProcessGateway(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) { - if (StringUtils.hasText(element.getAttribute("configurer"))) { - builder.addConstructorArgReference(element.getAttribute("configurer")); - } - } - -} diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/package-info.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/package-info.java deleted file mode 100644 index fd3bc101db..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/config/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Provides classes for configuration - parsers, namespace handlers. - */ -package org.springframework.integration.rmi.config; diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/package-info.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/package-info.java deleted file mode 100644 index 4dca05d881..0000000000 --- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Base package for RMI support. - */ -package org.springframework.integration.rmi; diff --git a/spring-integration-rmi/src/main/resources/META-INF/spring.handlers b/spring-integration-rmi/src/main/resources/META-INF/spring.handlers deleted file mode 100644 index 0d5e3711c6..0000000000 --- a/spring-integration-rmi/src/main/resources/META-INF/spring.handlers +++ /dev/null @@ -1 +0,0 @@ -http\://www.springframework.org/schema/integration/rmi=org.springframework.integration.rmi.config.RmiNamespaceHandler \ No newline at end of file diff --git a/spring-integration-rmi/src/main/resources/META-INF/spring.schemas b/spring-integration-rmi/src/main/resources/META-INF/spring.schemas deleted file mode 100644 index e7b8a6443b..0000000000 --- a/spring-integration-rmi/src/main/resources/META-INF/spring.schemas +++ /dev/null @@ -1,24 +0,0 @@ -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-3.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.3.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-2.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-3.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-4.3.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.1.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-5.2.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd -https\://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd=org/springframework/integration/rmi/config/spring-integration-rmi.xsd diff --git a/spring-integration-rmi/src/main/resources/META-INF/spring.tooling b/spring-integration-rmi/src/main/resources/META-INF/spring.tooling deleted file mode 100644 index 43f71d2245..0000000000 --- a/spring-integration-rmi/src/main/resources/META-INF/spring.tooling +++ /dev/null @@ -1,4 +0,0 @@ -# Tooling related information for the integration rmi namespace -http\://www.springframework.org/schema/integration/rmi@name=integration rmi Namespace -http\://www.springframework.org/schema/integration/rmi@prefix=int-rmi -http\://www.springframework.org/schema/integration/rmi@icon=org/springframework/integration/rmi/config/spring-integration-rmi.gif diff --git a/spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.gif b/spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.gif deleted file mode 100644 index f3f87fa00b6c443a46917f5ae675ce0bd697fb37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 569 zcmZ?wbhEHb6krfwc*Xz%|NsB*n7VH6iaomzU!1q&X8n?LD-PWDZ`qMN`AFHqbB!x5 zPTq2T#?CwQcVFLq;pxd+Z%*HSbL;5`*Sf7?U3+3D>`$GvXTrwwYmePKdHZ!h$M$7M z?mc_=<;>ph8%O#s?(cbdZNa{UVKg8?T%R2*B^#niI zTs$G$vNzMBHNmJc*03kdyfRe#)PjOsPt`(S^+I3GCyNvBElMr$RO?H!xIQD{=A4w7 zg+5uX8WR(2rX<^4ofNybD|uaG{PC8MxveEf8$yrN2G37(-BucKtRZ4&ZA_M(`qq-* zHQ9cf@*-B|M9qu|oE8!U^fK7%15YUaWMO1r2x8CyIRz9a4D8byf|{CJTHD$?f;4sY zG&-B?%@wrWOgps{Z2XO^Jd8VZ%+&Oq939+U+70}y)hzM_kRjf=5)&S!Jyg&c| diff --git a/spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.xsd b/spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.xsd deleted file mode 100644 index cfc6095d04..0000000000 --- a/spring-integration-rmi/src/main/resources/org/springframework/integration/rmi/config/spring-integration-rmi.xsd +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - Configures a Messaging Gateway Endpoint for the - 'org.springframework.integration.rmi.RmiInboundGateway' to receive RMI - requests and produce RMI responses. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If a downstream exception is thrown and an error-channel is specified, - the MessagingException will be sent to this channel. Otherwise, any such exception - will be propagated to the calling system. - - - - - - - - - - - - - Configures a Consumer Endpoint for the - 'org.springframework.integration.rmi.RmiOutboundGateway' to send RMI requests and wait for - RMI replies. - - - - - - - - - - - - - - - - - - - - - - - - - Specifies the order for invocation when this endpoint is connected as a - subscriber to a SubscribableChannel. - - - - - - - Specify whether this outbound gateway must return a non-null value. This value is - 'true' by default, and a ReplyRequiredException will be thrown when - the underlying service returns a null value. - - - - - - - Specify a 'RmiProxyFactoryBeanConfigurer' to further configure the RmiProxyFactoryBean - before it creates the proxy - use this, for example, - to customize the RemoteInvocationFactory. - - - - - - - - - - - - - - - - - Defines common configuration for gateway adapters. - - - - - - - - - - - - - - - - - - - diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java index 7b5a44f220..9fc9f5a5dc 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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,24 +18,25 @@ package org.springframework.integration.scripting.config.jsr223; import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.channel.QueueChannel; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.GenericMessage; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Oleg Zhurakousky * @author David Turanski * @author Gunnar Hillert + * @author Artem Bilan + * * @since 2.1 */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$") +@SpringJUnitConfig public class Jsr223HeaderEnricherTests { @Autowired @@ -51,14 +52,15 @@ public class Jsr223HeaderEnricherTests { private QueueChannel outputB; @Test - public void referencedScript() throws Exception { - inputA.send(new GenericMessage("Hello")); + public void referencedScript() { + inputA.send(new GenericMessage<>("Hello")); assertThat(outputA.receive(20000).getHeaders().get("TEST_HEADER")).isEqualTo("jruby"); } @Test - public void inlineScript() throws Exception { - inputB.send(new GenericMessage("Hello")); + public void inlineScript() { + inputB.send(new GenericMessage<>("Hello")); assertThat(outputB.receive(20000).getHeaders().get("TEST_HEADER")).isEqualTo("js"); } + } diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java index e3b6940028..f5162ccdb6 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2021 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. @@ -20,24 +20,24 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.Date; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Artem Bilan * @author Gary Russell + * * @since 2.0 */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$") +@SpringJUnitConfig @DirtiesContext public class Jsr223InboundChannelAdapterTests { diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223TransformerTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223TransformerTests.java index ff4fa730c1..ed585d1e44 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223TransformerTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223TransformerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -21,8 +21,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.HashSet; import java.util.Set; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.channel.QueueChannel; @@ -31,16 +31,16 @@ import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.support.GenericMessage; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * @author Mark Fisher * @author Artem Bilan + * * @since 2.0 */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$") +@SpringJUnitConfig public class Jsr223TransformerTests { @Autowired @@ -90,7 +90,7 @@ public class Jsr223TransformerTests { this.int3162InputChannel.send(new GenericMessage(i)); } - Set result = new HashSet(); + Set result = new HashSet<>(); for (int i = 0; i < 100; i++) { Message message = this.int3162OutputChannel.receive(10000); @@ -101,5 +101,4 @@ public class Jsr223TransformerTests { } - } diff --git a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java index d66474f0ad..c169671bf7 100644 --- a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java +++ b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java @@ -19,7 +19,10 @@ package org.springframework.integration.stomp.client; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; +import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -64,21 +67,26 @@ import org.springframework.util.SocketUtils; */ public class StompServerIntegrationTests { - private static BrokerService activeMQBroker; + private static final EmbeddedActiveMQ broker = new EmbeddedActiveMQ(); private static ReactorNettyTcpStompClient stompClient; @BeforeAll public static void setup() throws Exception { int port = SocketUtils.findAvailableTcpPort(61613); - activeMQBroker = new BrokerService(); - activeMQBroker.addConnector("stomp://127.0.0.1:" + port); - activeMQBroker.setPersistent(false); - activeMQBroker.setUseJmx(false); - activeMQBroker.setEnableStatistics(false); - activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); - activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); - activeMQBroker.start(); + ConfigurationImpl configuration = + new ConfigurationImpl() + .setName("embedded-server") + .setPersistenceEnabled(false) + .setSecurityEnabled(false) + .setJMXManagementEnabled(false) + .setJournalDatasync(false) + .addAcceptorConfiguration("stomp", "tcp://127.0.0.1:" + port) + .addAddressesSetting("#", + new AddressSettings() + .setDeadLetterAddress(SimpleString.toSimpleString("dla")) + .setExpiryAddress(SimpleString.toSimpleString("expiry"))); + broker.setConfiguration(configuration).start(); stompClient = new ReactorNettyTcpStompClient("127.0.0.1", port); stompClient.setMessageConverter(new PassThruMessageConverter()); @@ -91,7 +99,7 @@ public class StompServerIntegrationTests { @AfterAll public static void teardown() throws Exception { stompClient.shutdown(); - activeMQBroker.stop(); + broker.stop(); } @Test @@ -191,7 +199,7 @@ public class StompServerIntegrationTests { assertThat(receive24).isNotNull(); assertThat((byte[]) receive24.getPayload()).isEqualTo("???".getBytes()); - activeMQBroker.stop(); + broker.stop(); n = 0; do { @@ -205,7 +213,7 @@ public class StompServerIntegrationTests { .isThrownBy(() -> stompOutputChannel1.send(new GenericMessage<>("foo".getBytes()))) .withMessageContaining("could not deliver message"); - activeMQBroker.start(false); + broker.start(); n = 0; do { diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/IntegrationDynamicWebSocketHandlerMapping.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/IntegrationDynamicWebSocketHandlerMapping.java index 8e70534ee5..40298ea0e9 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/IntegrationDynamicWebSocketHandlerMapping.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/IntegrationDynamicWebSocketHandlerMapping.java @@ -22,7 +22,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.server.PathContainer; import org.springframework.http.server.RequestPath; diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java index 40ddf26065..647a3f2c81 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java @@ -49,7 +49,7 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration private static final Log LOGGER = LogFactory.getLog(WebSocketIntegrationConfigurationInitializer.class); - private static final boolean SERVLET_PRESENT = ClassUtils.isPresent("javax.servlet.Servlet", null); + private static final boolean SERVLET_PRESENT = ClassUtils.isPresent("jakarta.servlet.Servlet", null); private static final String WEB_SOCKET_HANDLER_MAPPING_BEAN_NAME = "integrationWebSocketHandlerMapping"; @@ -68,7 +68,7 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration * Register a {@link WebSocketHandlerMappingFactoryBean} which could also be overridden * by the user by simply using {@link org.springframework.web.socket.config.annotation.EnableWebSocket} *

- * In addition, checks if the {@code javax.servlet.Servlet} class is present on the classpath. + * In addition, checks if the {@code jakarta.servlet.Servlet} class is present on the classpath. * When Spring Integration WebSocket support is used only as a WebSocket client, * there is no reason to use and register the Spring WebSocket server components. *

diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java index 8cdf2c7cf9..56131293d4 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java @@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.awaitility.Awaitility.await; -import javax.websocket.DeploymentException; +import jakarta.websocket.DeploymentException; import org.junit.jupiter.api.Test; diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/DefaultSoapHeaderMapperTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/DefaultSoapHeaderMapperTests.java index 81fce44ad0..a4f6dda590 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/DefaultSoapHeaderMapperTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/DefaultSoapHeaderMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -26,13 +26,14 @@ import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; -import javax.xml.soap.MessageFactory; -import javax.xml.soap.MimeHeaders; -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.MimeHeaders; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; + import org.junit.Test; import org.w3c.dom.NodeList; diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java index 5ebba21468..694654712a 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -26,11 +26,12 @@ import java.net.URI; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import javax.xml.soap.MessageFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; +import jakarta.xml.soap.MessageFactory; + import org.junit.Test; import org.mockito.Mockito; diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests-context.xml b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests-context.xml index e362ffc882..fd8e7bb7bc 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests-context.xml +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests-context.xml @@ -36,7 +36,7 @@ - + diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java index 995229366a..15e2720367 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -26,14 +26,14 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.concurrent.atomic.AtomicReference; -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.DeliveryMode; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; +import jakarta.jms.BytesMessage; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.DeliveryMode; +import jakarta.jms.JMSException; +import jakarta.jms.MessageProducer; +import jakarta.jms.Queue; +import jakarta.jms.Session; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.Stanza; diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java index 577741d7c9..5a9fffae23 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/config/XPathSplitterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2021 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. @@ -21,8 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import java.util.Properties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -32,16 +31,14 @@ import org.springframework.integration.support.SmartLifecycleRoleController; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageHandler; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.MultiValueMap; /** * @author Artem Bilan * @author Gary Russell */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@SpringJUnitConfig @DirtiesContext public class XPathSplitterParserTests { @@ -66,8 +63,7 @@ public class XPathSplitterParserTests { assertThat(TestUtils.getPropertyValue(this.xpathSplitter, "applySequence", Boolean.class)).isFalse(); assertThat(TestUtils.getPropertyValue(this.xpathSplitter, "returnIterator", Boolean.class)).isFalse(); assertThat(TestUtils.getPropertyValue(this.xpathSplitter, "outputProperties")).isSameAs(this.outputProperties); - assertThat(TestUtils.getPropertyValue(this.xpathSplitter, - "xpathExpression.xpathExpression.xpath.m_patternString", String.class)) + assertThat(TestUtils.getPropertyValue(this.xpathSplitter, "xpathExpression").toString()) .isEqualTo("/orders/order"); assertThat(TestUtils.getPropertyValue(xpathSplitter, "order")).isEqualTo(2); assertThat(TestUtils.getPropertyValue(xpathSplitter, "messagingTemplate.sendTimeout")).isEqualTo(123L); @@ -77,7 +73,7 @@ public class XPathSplitterParserTests { @SuppressWarnings("unchecked") List list = (List) TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class).get("foo"); - assertThat(list).containsExactly((SmartLifecycle) consumer); + assertThat(list).containsExactly(consumer); } } diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java index 448eb52047..be979072af 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbAnnotatedPerson.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 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. @@ -16,13 +16,15 @@ package org.springframework.integration.xml.transformer.jaxbmarshaling; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; @XmlType @XmlRootElement(name = "person") public class JaxbAnnotatedPerson { + private String firstName; + @XmlElement(name = "firstname") public String getFirstName() { return firstName; @@ -32,9 +34,4 @@ public class JaxbAnnotatedPerson { this.firstName = firstName; } - - private String firstName; - - - } diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 19d80b6458..2bc77f9e69 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -103,7 +103,7 @@ - + diff --git a/src/reference/asciidoc/changes-2.2-3.0.adoc b/src/reference/asciidoc/changes-2.2-3.0.adoc index ad9c9ff919..7f250bf9c3 100644 --- a/src/reference/asciidoc/changes-2.2-3.0.adoc +++ b/src/reference/asciidoc/changes-2.2-3.0.adoc @@ -417,12 +417,6 @@ Previously, when configuring a ``, if you wishe We added the `task-executor`, letting it be set directly on the adapter. This is in addition to several other container attributes that were already available. -[[x3.0-rmi-ec]] -===== RMI Inbound Gateway - -The RMI Inbound Gateway now supports an `error-channel` attribute. -See <<./rmi.adoc#rmi-inbound,Inbound RMI>>. - [[x3.0-xslt-transformer]] ===== `XsltPayloadTransformer` diff --git a/src/reference/asciidoc/changes-5.3-5.4.adoc b/src/reference/asciidoc/changes-5.3-5.4.adoc index 44c7759c90..e76d9677e3 100644 --- a/src/reference/asciidoc/changes-5.3-5.4.adoc +++ b/src/reference/asciidoc/changes-5.3-5.4.adoc @@ -66,13 +66,6 @@ See <<./ip.adoc#ip-collaborating-adapters,Collaborating Channel Adapters>> and < The UDP channel adapters can now be configured with a `SocketCustomizer` which allows the setting of socket properties that are not directly supported by the adapters. See <<./ip.adoc#udp-adapters,UDP Adapters>> for more information. -[[x5.4-rmi]] -=== RMI Changes - -The `spring-integration-rmi` module is deprecated with no replacement and is going to be removed in the next major version. -See <<./rmi.adoc#rmi, RMI Support>> for more information. - - [[x5.4-amqp]] === AMQP Changes diff --git a/src/reference/asciidoc/changes-5.4-5.5.adoc b/src/reference/asciidoc/changes-5.4-5.5.adoc new file mode 100644 index 0000000000..6d838c7213 --- /dev/null +++ b/src/reference/asciidoc/changes-5.4-5.5.adoc @@ -0,0 +1,113 @@ +[[migration-5.4-5.5]] +=== Changes between 5.4 and 5.5 + +[[x5.5-new-components]] +=== New Components + +[[x5.5-file-aggregator]] +==== File Aggregator + +A `FileSplitter.FileMaker`-based implementation of `CorrelationStrategy`, `ReleaseStrategy` and `MessageGroupProcessor` as a `FileAggregator` component was introduced. +See <<./file.adoc#file-aggregator, File Aggregator>> for more information. + +[[x5.5-mqtt-v5]] +==== MQTT v5 Support + +The `Mqttv5PahoMessageDrivenChannelAdapter` and `Mqttv5PahoMessageHandler` (including respective `MqttHeaderMapper`) were introduced to support MQTT v5 protocol communication. +See <<./mqtt.adoc#mqtt-v5, MQTT v5 Support>> for more information. + +[[x5.5-general]] +=== General Changes + +All the persistent `MessageGroupStore` implementation provide a `streamMessagesForGroup(Object groupId)` contract based on the target database streaming API. +See <<./message-store.adoc#message-store,Message Store>> for more information. + +The `integrationGlobalProperties` bean (if declared) must be now an instance of `org.springframework.integration.context.IntegrationProperties` instead of `java.util.Properties`, which support is deprecated for backward compatibility. +The `spring.integration.channels.error.requireSubscribers=true` global property is added to indicate that the global default `errorChannel` must be configured with the `requireSubscribers` option (or not). +The `spring.integration.channels.error.ignoreFailures=true` global property is added to indicate that the global default `errorChannel` must ignore (or not) dispatching errors and pass the message to the next handler. +See <<./configuration.adoc#global-properties,Global Properties>> for more information. + +An `AbstractPollingEndpoint` (source polling channel adapter and polling consumer) treats `maxMessagesPerPoll == 0` as to skip calling the source. +It can be changed to different value later on, e.g. via a Control Bus. +See <<./endpoint.adoc#endpoint-pollingconsumer,Polling Consumer>> for more information. + +The `ConsumerEndpointFactoryBean` now accept a `reactiveCustomizer` `Function` to any input channel as reactive stream source and use a `ReactiveStreamsConsumer` underneath. +This is covered as a `ConsumerEndpointSpec.reactive()` option in Java DSL and as a `@Reactive` nested annotation for the messaging annotations. +See <<./reactive-streams.adoc#reactive-streams,Reactive Streams Support>> for more information. + +The `groupTimeoutExpression` for a correlation message handler (an `Aggregator` and `Resequencer`) can now be evaluated to a `java.util.Date` for some fine-grained scheduling use-cases. +Also the `BiFunction groupConditionSupplier` option is added to the `AbstractCorrelatingMessageHandler` to supply a `MessageGroup` condition against a message to be added to the group. +See <<./aggregator.adoc#aggregator,Aggregator>> for more information. + +The `MessageGroup` abstraction can be supplied with a `condition` to evaluate later on to make a decision for the group. +See <<./message-store.adoc#message-group-condition,Message Group Condition>> for more information. + +[[x5.5-integration-flows-composition]] +==== Integration Flows Composition + +The new `IntegrationFlows.from(IntegrationFlow)` factory method has been added to allow starting the current `IntegrationFlow` from the output of an existing flow. +In addition, the `IntegrationFlowDefinition` has added a `to(IntegrationFlow)` terminal operator to continue the current flow at the input channel of some other flow. +See <<./dsl.adoc#integration-flows-composition,Integration Flows Composition>> for more information. + +[[x5.5-amqp]] +==== AMQP Changes + +The `AmqpInboundChannelAdapter` and `AmqpInboundGateway` (and the respective Java DSL builders) now support an `org.springframework.amqp.rabbit.retry.MessageRecoverer` as an AMQP-specific alternative to the general purpose `RecoveryCallback`. +See <<./amqp.adoc#amqp,AMQP Support>> for more information. + +[[x5.5-redis]] +==== Redis Changes + +The `ReactiveRedisStreamMessageProducer` has now setters for all the `StreamReceiver.StreamReceiverOptionsBuilder` options, including an `onErrorResume` function. +See <<./redis.adoc#redis,Redis Support>> for more information. + +[[x5.5-http]] +==== HTTP Changes + +The `HttpRequestExecutingMessageHandler` doesn't fallback to the `application/x-java-serialized-object` content type any more and lets the `RestTemplate` make the final decision for the request body conversion based on the `HttpMessageConverter` provided. +It also has now an `extractResponseBody` flag (which is `true` by default) to return just the response body, or to return the whole `ResponseEntity` as the reply message payload, independently of the provided `expectedResponseType`. +Same option is presented for the `WebFluxRequestExecutingMessageHandler`, too. +See <<./http.adoc#http,HTTP Support>> for more information. + +[[x5.5-file]] +==== File/FTP/SFTP Changes + +The persistent file list filters now have a boolean property `forRecursion`. +Setting this property to `true`, also sets `alwaysAcceptDirectories`, which means that the recursive operation on the outbound gateways (`ls` and `mget`) will now always traverse the full directory tree each time. +This is to solve a problem where changes deep in the directory tree were not detected. +In addition, `forRecursion=true` causes the full path to files to be used as the metadata store keys; this solves a problem where the filter did not work properly if a file with the same name appears multiple times in different directories. +IMPORTANT: This means that existing keys in a persistent metadata store will not be found for files beneath the top level directory. +For this reason, the property is `false` by default; this may change in a future release. + +The `FileInboundChannelAdapterSpec` has now a convenient `recursive(boolean)` option instead of requiring an explicit reference to the `RecursiveDirectoryScanner`. + +The `remoteDirectoryExpression` can now be used in the `mv` command for convenience. + +[[x5.5-mongodb]] +==== MongoDb Changes + +The `MongoDbMessageSourceSpec` was added into MongoDd Java DSL. +An `update` option is now exposed on both the `MongoDbMessageSource` and `ReactiveMongoDbMessageSource` implementations. + +See <<./mongodb.adoc#mongodb,MongoDb Support>> for more information. + +[[x5.5-websocket]] +==== WebSockets Changes + +The WebSocket channel adapters based on `ServerWebSocketContainer` can now be registered and removed at runtime. + +See <<./web-sockets.adoc#web-sockets,WebSockets Support>> for more information. + +[[x5.5-jpa]] +==== JPA Changes + +The `JpaOutboundGateway` now supports an `Iterable` message payload for a `PersistMode.DELETE`. + +See <<./jpa.adoc#jpa-outbound-channel-adapter,Outbound Channel Adapter>> for more information. + +[[x55-gw]] +==== Gateway Changes + +Previously, when using XML configuration, `@Gateway.payloadExpression` was ignored for no-argument methods. +There is one possible breaking change - if the method is annotated with `@Payload` as well as `@Gateway` (with a different expression) previously, the `@Payload` would be applied, now the `@Gateway.payloadExpression` is applied. +See <<./gateway.adoc#gateway-configuration-annotations,Gateway Configuration with Annotations and XML>> and <<./gateway.adoc#gateway-calling-no-argument-methods,Invoking No-Argument Methods>> for more information. diff --git a/src/reference/asciidoc/endpoint-summary.adoc b/src/reference/asciidoc/endpoint-summary.adoc index 4a39ce6ad8..b1b0544b12 100644 --- a/src/reference/asciidoc/endpoint-summary.adoc +++ b/src/reference/asciidoc/endpoint-summary.adoc @@ -156,12 +156,6 @@ The following table summarizes the various endpoints with quick links to the app | N | N -| *RMI* -| N -| N -| <<./rmi.adoc#rmi-inbound,Inbound RMI>> -| <<./rmi.adoc#rmi-outbound,Outbound RMI>> - | *RSocket* | N | N diff --git a/src/reference/asciidoc/history.adoc b/src/reference/asciidoc/history.adoc index c1ae7bc036..bbc08046c0 100644 --- a/src/reference/asciidoc/history.adoc +++ b/src/reference/asciidoc/history.adoc @@ -2,6 +2,8 @@ == Change History // BE SURE TO PRECEDE ALL include:: with a blank line - see https://github.com/asciidoctor/asciidoctor/issues/1297 +include::./changes-5.4-5.5.adoc[] + include::./changes-5.3-5.4.adoc[] include::./changes-5.2-5.3.adoc[] diff --git a/src/reference/asciidoc/http.adoc b/src/reference/asciidoc/http.adoc index e08355d2c0..0506e1fe31 100644 --- a/src/reference/asciidoc/http.adoc +++ b/src/reference/asciidoc/http.adoc @@ -24,7 +24,7 @@ compile "org.springframework.integration:spring-integration-http:{project-versio ---- ==== -The `javax.servlet:javax.servlet-api` dependency must be provided on the target Servlet container. +The `jakarta.servlet:jakarta.servlet-api` dependency must be provided on the target Servlet container. [[http-inbound]] === Http Inbound Components @@ -478,7 +478,7 @@ Since Spring Integration 3.0, in addition to the existing `#pathVariables` and ` Note that `#matrixVariables` requires Spring MVC 3.2 or higher. * `#requestAttributes`: The `org.springframework.web.context.request.RequestAttributes` associated with the current request. * `#requestHeaders`: The `org.springframework.http.HttpHeaders` object from the current request. -* `#cookies`: The `Map` of `javax.servlet.http.Cookie` instances from the current request. +* `#cookies`: The `MultiValueMap` of `jakarta.servlet.http.Cookie` instances from the current request. Note that all these values (and others) can be accessed within expressions in the downstream message flow through the `ThreadLocal` `org.springframework.web.context.request.RequestAttributes` variable, if that message flow is single-threaded and lives within the request thread. The following example configures a transformer that uses an `expression` attribute: diff --git a/src/reference/asciidoc/index-single.adoc b/src/reference/asciidoc/index-single.adoc index ad73b627bd..39f5b67577 100644 --- a/src/reference/asciidoc/index-single.adoc +++ b/src/reference/asciidoc/index-single.adoc @@ -65,8 +65,6 @@ include::./redis.adoc[] include::./resource.adoc[] -include::./rmi.adoc[] - include::./rsocket.adoc[] include::./sftp.adoc[] diff --git a/src/reference/asciidoc/index.adoc b/src/reference/asciidoc/index.adoc index af0aede8f9..a40c608a94 100644 --- a/src/reference/asciidoc/index.adoc +++ b/src/reference/asciidoc/index.adoc @@ -42,7 +42,6 @@ This documentation is also available as single searchable link:index-single.html <<./r2dbc.adoc#r2dbc,R2DBC Support>> :: <<./redis.adoc#redis,Redis Support>> :: <<./resource.adoc#resource,Resource Support>> :: -<<./rmi.adoc#rmi,RMI Support>> :: <<./rsocket.adoc#rsocket,RSocket Support>> :: <<./sftp.adoc#sftp,SFTP Adapters>> :: <<./stomp.adoc#stomp,STOMP Support>> :: diff --git a/src/reference/asciidoc/preface.adoc b/src/reference/asciidoc/preface.adoc index be4f770a45..2110ebd1f6 100644 --- a/src/reference/asciidoc/preface.adoc +++ b/src/reference/asciidoc/preface.adoc @@ -15,13 +15,13 @@ This section details the compatible https://www.oracle.com/technetwork/java/java [[supported-java-versions]] === Compatible Java Versions -For Spring Integration 5.5.x, the minimum compatible Java version is Java SE 8. +For Spring Integration 6.0.x, the minimum compatible Java version is Java SE 17. Older versions of Java are not supported. [[supported-spring-versions]] === Compatible Versions of the Spring Framework -Spring Integration 5.5.x requires Spring Framework 5.3 or later. +Spring Integration 6.0.x requires Spring Framework 6.0 or later. [[code-conventions]] == Code Conventions diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index f4dc30d219..8b36be2736 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -2,123 +2,32 @@ = What's New? [[spring-integration-intro-new]] -For those who are already familiar with Spring Integration, this chapter provides a brief overview of the new features of version 5.5. +For those who are already familiar with Spring Integration, this chapter provides a brief overview of the new features of version 6.0. If you are interested in the changes and features that were introduced in earlier versions, see the <<./history.adoc#history,Change History>>. [[whats-new]] -== What's New in Spring Integration 5.5? +== What's New in Spring Integration 6.0? -If you are interested in more details, see the Issue Tracker tickets that were resolved as part of the 5.5 development process. +If you are interested in more details, see the Issue Tracker tickets that were resolved as part of the 6.0 development process. -[[x5.5-new-components]] +In general the project has been moved to Java 17 base line and migrated from Java EE to Jakarta EE. + +[[x6.0-new-components]] === New Components -[[x5.5-file-aggregator]] -==== File Aggregator - -A `FileSplitter.FileMaker`-based implementation of `CorrelationStrategy`, `ReleaseStrategy` and `MessageGroupProcessor` as a `FileAggregator` component was introduced. -See <<./file.adoc#file-aggregator, File Aggregator>> for more information. - -[[x5.5-mqtt-v5]] -==== MQTT v5 Support - -The `Mqttv5PahoMessageDrivenChannelAdapter` and `Mqttv5PahoMessageHandler` (including respective `MqttHeaderMapper`) were introduced to support MQTT v5 protocol communication. -See <<./mqtt.adoc#mqtt-v5, MQTT v5 Support>> for more information. - -[[x5.5-general]] +[[x6.0-general]] === General Changes -All the persistent `MessageGroupStore` implementation provide a `streamMessagesForGroup(Object groupId)` contract based on the target database streaming API. -See <<./message-store.adoc#message-store,Message Store>> for more information. +[[x6.0-http]] +=== HTTP Changes -The `integrationGlobalProperties` bean (if declared) must be now an instance of `org.springframework.integration.context.IntegrationProperties` instead of `java.util.Properties`, which support is deprecated for backward compatibility. -The `spring.integration.channels.error.requireSubscribers=true` global property is added to indicate that the global default `errorChannel` must be configured with the `requireSubscribers` option (or not). -The `spring.integration.channels.error.ignoreFailures=true` global property is added to indicate that the global default `errorChannel` must ignore (or not) dispatching errors and pass the message to the next handler. -See <<./configuration.adoc#global-properties,Global Properties>> for more information. - -An `AbstractPollingEndpoint` (source polling channel adapter and polling consumer) treats `maxMessagesPerPoll == 0` as to skip calling the source. -It can be changed to different value later on, e.g. via a Control Bus. -See <<./endpoint.adoc#endpoint-pollingconsumer,Polling Consumer>> for more information. - -The `ConsumerEndpointFactoryBean` now accept a `reactiveCustomizer` `Function` to any input channel as reactive stream source and use a `ReactiveStreamsConsumer` underneath. -This is covered as a `ConsumerEndpointSpec.reactive()` option in Java DSL and as a `@Reactive` nested annotation for the messaging annotations. -See <<./reactive-streams.adoc#reactive-streams,Reactive Streams Support>> for more information. - -The `groupTimeoutExpression` for a correlation message handler (an `Aggregator` and `Resequencer`) can now be evaluated to a `java.util.Date` for some fine-grained scheduling use-cases. -Also the `BiFunction groupConditionSupplier` option is added to the `AbstractCorrelatingMessageHandler` to supply a `MessageGroup` condition against a message to be added to the group. -See <<./aggregator.adoc#aggregator,Aggregator>> for more information. - -The `MessageGroup` abstraction can be supplied with a `condition` to evaluate later on to make a decision for the group. -See <<./message-store.adoc#message-group-condition,Message Group Condition>> for more information. - -[[x5.5-integration-flows-composition]] -==== Integration Flows Composition - -The new `IntegrationFlows.from(IntegrationFlow)` factory method has been added to allow starting the current `IntegrationFlow` from the output of an existing flow. -In addition, the `IntegrationFlowDefinition` has added a `to(IntegrationFlow)` terminal operator to continue the current flow at the input channel of some other flow. -See <<./dsl.adoc#integration-flows-composition,Integration Flows Composition>> for more information. - -[[x5.5-amqp]] -==== AMQP Changes - -The `AmqpInboundChannelAdapter` and `AmqpInboundGateway` (and the respective Java DSL builders) now support an `org.springframework.amqp.rabbit.retry.MessageRecoverer` as an AMQP-specific alternative to the general purpose `RecoveryCallback`. -See <<./amqp.adoc#amqp,AMQP Support>> for more information. - -[[x5.5-redis]] -==== Redis Changes - -The `ReactiveRedisStreamMessageProducer` has now setters for all the `StreamReceiver.StreamReceiverOptionsBuilder` options, including an `onErrorResume` function. -See <<./redis.adoc#redis,Redis Support>> for more information. - -[[x5.5-http]] -==== HTTP Changes - -The `HttpRequestExecutingMessageHandler` doesn't fallback to the `application/x-java-serialized-object` content type any more and lets the `RestTemplate` make the final decision for the request body conversion based on the `HttpMessageConverter` provided. -It also has now an `extractResponseBody` flag (which is `true` by default) to return just the response body, or to return the whole `ResponseEntity` as the reply message payload, independently of the provided `expectedResponseType`. -Same option is presented for the `WebFluxRequestExecutingMessageHandler`, too. +The `#cookies` variable for expression evaluation context, exposed in the `HttpRequestHandlingEndpointSupport`, is now a `MultiValueMap` to carry all the values for cookies set by the client. See <<./http.adoc#http,HTTP Support>> for more information. -[[x5.5-file]] -==== File/FTP/SFTP Changes +[[x6.0-rmi]] +=== RMI Removal -The persistent file list filters now have a boolean property `forRecursion`. -Setting this property to `true`, also sets `alwaysAcceptDirectories`, which means that the recursive operation on the outbound gateways (`ls` and `mget`) will now always traverse the full directory tree each time. -This is to solve a problem where changes deep in the directory tree were not detected. -In addition, `forRecursion=true` causes the full path to files to be used as the metadata store keys; this solves a problem where the filter did not work properly if a file with the same name appears multiple times in different directories. -IMPORTANT: This means that existing keys in a persistent metadata store will not be found for files beneath the top level directory. -For this reason, the property is `false` by default; this may change in a future release. - -The `FileInboundChannelAdapterSpec` has now a convenient `recursive(boolean)` option instead of requiring an explicit reference to the `RecursiveDirectoryScanner`. - -The `remoteDirectoryExpression` can now be used in the `mv` command for convenience. - -[[x5.5-mongodb]] -==== MongoDb Changes - -The `MongoDbMessageSourceSpec` was added into MongoDd Java DSL. -An `update` option is now exposed on both the `MongoDbMessageSource` and `ReactiveMongoDbMessageSource` implementations. - -See <<./mongodb.adoc#mongodb,MongoDb Support>> for more information. - -[[x5.5-websocket]] -==== WebSockets Changes - -The WebSocket channel adapters based on `ServerWebSocketContainer` can now be registered and removed at runtime. - -See <<./web-sockets.adoc#web-sockets,WebSockets Support>> for more information. - -[[x5.5-jpa]] -==== JPA Changes - -The `JpaOutboundGateway` now supports an `Iterable` message payload for a `PersistMode.DELETE`. - -See <<./jpa.adoc#jpa-outbound-channel-adapter,Outbound Channel Adapter>> for more information. - -[[x55-gw]] -==== Gateway Changes - -Previously, when using XML configuration, `@Gateway.payloadExpression` was ignored for no-argument methods. -There is one possible breaking change - if the method is annotated with `@Payload` as well as `@Gateway` (with a different expression) previously, the `@Payload` would be applied, now the `@Gateway.payloadExpression` is applied. -See <<./gateway.adoc#gateway-configuration-annotations,Gateway Configuration with Annotations and XML>> and <<./gateway.adoc#gateway-calling-no-argument-methods,Invoking No-Argument Methods>> for more information. +The `spring-integration-rmi` module has been removed altogether after being deprecated in previous versions. +There is no replacement: it is recommended to migrate to more secure network and application protocols, such as WebSockets, RSockets, gRPC or REST. \ No newline at end of file