Move main to version 6.0
* Upgrade to the latest dependencies * Migrate samples to `jakarta` namespace * Rework `cafe-scripted` to RSocket instead of already removed RMI * Migrate JMS samples to Apache Artemis for Jakarta EE 9 * Disables mails tests since there is a requirement to migrate to Greenmail for Jakarta EE 9 support * Rework `generatePom` task to a new `maven-publish` plugin style
This commit is contained in:
@@ -1,31 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
https://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<property name="targetConnectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="sessionCacheSize" value="10"/>
|
||||
<property name="cacheConsumers" value="false"/>
|
||||
</bean>
|
||||
<util:constant id="jmsConnectionFactory"
|
||||
static-field="org.springframework.integration.samples.jms.ActiveMQMultiContextTests.connectionFactory"/>
|
||||
|
||||
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="queue.demo"/>
|
||||
</bean>
|
||||
|
||||
<bean id="requestTopic" class="org.apache.activemq.command.ActiveMQTopic">
|
||||
<bean id="requestTopic" class="org.apache.activemq.artemis.jms.client.ActiveMQTopic">
|
||||
<constructor-arg value="topic.demo"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="replyQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="queue.reply"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.samples.jms;
|
||||
|
||||
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 open for the duration of
|
||||
* all tests (avoids cycling the transport each time the last
|
||||
* connection is closed).
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public abstract class ActiveMQMultiContextTests {
|
||||
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void shutDown() throws Exception {
|
||||
connectionFactory.destroy();
|
||||
amqFactory.createConnection().close();
|
||||
broker.stop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,8 +19,8 @@ package org.springframework.integration.samples.jms;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -34,7 +34,7 @@ import org.springframework.messaging.MessageChannel;
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class AggregatorDemoTest {
|
||||
public class AggregatorDemoTest extends ActiveMQMultiContextTests {
|
||||
|
||||
private final static String[] configFilesGatewayDemo = {
|
||||
"/META-INF/spring/integration/common.xml",
|
||||
@@ -42,7 +42,7 @@ public class AggregatorDemoTest {
|
||||
};
|
||||
|
||||
@Test
|
||||
public void testGatewayDemo() throws InterruptedException {
|
||||
public void testGatewayDemo() {
|
||||
|
||||
System.setProperty("spring.profiles.active", "testCase");
|
||||
|
||||
@@ -74,10 +74,10 @@ public class AggregatorDemoTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<List<String>> reply = (Message<List<String>>) queueChannel.receive(20_000);
|
||||
Assert.assertNotNull(reply);
|
||||
Assertions.assertNotNull(reply);
|
||||
List<String> out = reply.getPayload();
|
||||
|
||||
Assert.assertEquals("[JMS TEST, JMS TEST]", out.toString());
|
||||
Assertions.assertEquals("[JMS TEST, JMS TEST]", out.toString());
|
||||
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.samples.jms;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class ChannelAdapterDemoTest {
|
||||
public class ChannelAdapterDemoTest extends ActiveMQMultiContextTests {
|
||||
|
||||
private final static String[] configFilesChannelAdapterDemo = {
|
||||
"/META-INF/spring/integration/common.xml",
|
||||
@@ -51,9 +51,9 @@ public class ChannelAdapterDemoTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<String> reply = (Message<String>) queueChannel.receive(20000);
|
||||
Assert.assertNotNull(reply);
|
||||
Assertions.assertNotNull(reply);
|
||||
String out = reply.getPayload();
|
||||
Assert.assertEquals("jms test", out);
|
||||
Assertions.assertEquals("jms test", out);
|
||||
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
package org.springframework.integration.samples.jms;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -28,7 +29,7 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class GatewayDemoTest {
|
||||
public class GatewayDemoTest extends ActiveMQMultiContextTests {
|
||||
|
||||
private final static String[] configFilesGatewayDemo = {
|
||||
"/META-INF/spring/integration/common.xml",
|
||||
@@ -37,7 +38,7 @@ public class GatewayDemoTest {
|
||||
};
|
||||
|
||||
@Test
|
||||
public void testGatewayDemo() throws InterruptedException {
|
||||
public void testGatewayDemo() {
|
||||
|
||||
System.setProperty("spring.profiles.active", "testCase");
|
||||
|
||||
@@ -51,10 +52,10 @@ public class GatewayDemoTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<String> reply = (Message<String>) queueChannel.receive(20000);
|
||||
Assert.assertNotNull(reply);
|
||||
Assertions.assertNotNull(reply);
|
||||
String out = reply.getPayload();
|
||||
|
||||
Assert.assertEquals("JMS response: JMS TEST", out);
|
||||
Assertions.assertEquals("JMS response: JMS TEST", out);
|
||||
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user