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`
This commit is contained in:
2
.github/workflows/pr-build-workflow.yml
vendored
2
.github/workflows/pr-build-workflow.yml
vendored
@@ -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
|
||||
|
||||
1601
build.gradle
1601
build.gradle
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -236,7 +236,7 @@ public class Jackson2JsonObjectMapper extends AbstractJacksonJsonObjectMapper<Js
|
||||
private static final class KotlinModuleProvider {
|
||||
|
||||
static final com.fasterxml.jackson.databind.Module MODULE =
|
||||
new com.fasterxml.jackson.module.kotlin.KotlinModule();
|
||||
new com.fasterxml.jackson.module.kotlin.KotlinModule.Builder().build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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,9 +18,9 @@ package org.springframework.integration.config.xml;
|
||||
|
||||
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.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -36,16 +36,14 @@ import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
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
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class DefaultOutboundChannelAdapterParserTests {
|
||||
|
||||
@@ -77,8 +75,7 @@ public class DefaultOutboundChannelAdapterParserTests {
|
||||
assertThat(TestUtils.getPropertyValue(adapter, "autoStartup")).isEqualTo(Boolean.FALSE);
|
||||
MessageHandler handler = TestUtils.getPropertyValue(adapter, "handler", MessageHandler.class);
|
||||
assertThat(AopUtils.isAopProxy(handler)).isTrue();
|
||||
assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors[0].advice"))
|
||||
.isInstanceOf(RequestHandlerRetryAdvice.class);
|
||||
assertThat(((Advised) handler).getAdvisors()[0].getAdvice()).isInstanceOf(RequestHandlerRetryAdvice.class);
|
||||
|
||||
handler.handleMessage(new GenericMessage<>("foo"));
|
||||
QueueChannel recovery = context.getBean("recovery", QueueChannel.class);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<bean id="metadataStore" class="org.springframework.integration.metadata.PropertiesPersistingMetadataStore">
|
||||
<property name="baseDirectory"
|
||||
value="#{T (org.springframework.integration.feed.config.FeedInboundChannelAdapterParserTests).tempFolder.root.absolutePath}"/>
|
||||
value="#{T (org.springframework.integration.feed.config.FeedInboundChannelAdapterParserTests).tempFolder.absolutePath}"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<GroovyClassLoader>)
|
||||
() -> 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<GroovyClassLoader>)
|
||||
() -> new GroovyClassLoader(getBeanClassLoader(), compilerConfig));
|
||||
this.groovyClassLoader = new GroovyClassLoader(getBeanClassLoader(), compilerConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<String, Cookie> cookies = (Map<String, Cookie>) headers.get("cookies");
|
||||
MultiValueMap<String, Cookie> cookies = (MultiValueMap<String, Cookie>) 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();
|
||||
|
||||
|
||||
@@ -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.<HttpMessageConverter<?>>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';
|
||||
|
||||
@@ -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())))
|
||||
.<byte[], String>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())
|
||||
.<String>filter((payload) -> !"junk".equals(payload))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<String, Object> staticParameters;
|
||||
|
||||
public BeanPropertySqlParameterSourceFactory() {
|
||||
this.staticParameters = Collections.unmodifiableMap(new HashMap<String, Object>());
|
||||
}
|
||||
private Map<String, Object> 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
|
||||
|
||||
@@ -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<String, Expression[]> 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
|
||||
|
||||
@@ -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<? extends Map<String, Object>> executeUpdateQuery(final Message<?> message, boolean keysGenerated) {
|
||||
if (keysGenerated) {
|
||||
if (this.preparedStatementSetter != null) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Object> {
|
||||
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<Object> {
|
||||
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<Object> {
|
||||
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<Object> {
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<Message<?>> {
|
||||
|
||||
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;
|
||||
|
||||
@@ -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<javax.jms.Message>, InitializingBean,
|
||||
implements SessionAwareMessageListener<jakarta.jms.Message>, 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
|
||||
* <p>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
|
||||
* <p>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);
|
||||
|
||||
@@ -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<String, Object> toHeaders(javax.jms.Message jmsMessage) {
|
||||
public Map<String, Object> toHeaders(jakarta.jms.Message jmsMessage) {
|
||||
Map<String, Object> headers = new HashMap<>();
|
||||
try {
|
||||
mapMessageIdProperty(jmsMessage, headers);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<String, LinkedBlockingQueue<javax.jms.Message>> replies = new ConcurrentHashMap<>();
|
||||
private final Map<String, LinkedBlockingQueue<jakarta.jms.Message>> replies = new ConcurrentHashMap<>();
|
||||
|
||||
private final ConcurrentHashMap<String, TimedReply> 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).
|
||||
* <p>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<javax.jms.Message> replyQueue = null;
|
||||
LinkedBlockingQueue<jakarta.jms.Message> replyQueue = null;
|
||||
String correlationToLog = correlation;
|
||||
logger.debug(() -> getComponentName() + " Sending message with correlationId " + correlationToLog);
|
||||
SettableListenableFuture<AbstractIntegrationMessageBuilder<?>> 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<javax.jms.Message> replyQueue = new LinkedBlockingQueue<>(1);
|
||||
LinkedBlockingQueue<jakarta.jms.Message> 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<javax.jms.Message> replyQueue) {
|
||||
private jakarta.jms.Message obtainReplyFromContainer(String correlationId,
|
||||
LinkedBlockingQueue<jakarta.jms.Message> 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<AbstractIntegrationMessageBuilder<?>> 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<javax.jms.Message> queue = this.replies.get(correlationId);
|
||||
LinkedBlockingQueue<jakarta.jms.Message> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import javax.jms.Session;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
@@ -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<?, PollableJmsChannel> pollableChannel(ConnectionFactory connectionFactory) {
|
||||
public static JmsPollableMessageChannelSpec<?, PollableJmsChannel> pollableChannel(
|
||||
ConnectionFactory connectionFactory) {
|
||||
|
||||
return pollableChannel(null, connectionFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<S extends JmsDestinationAccesso
|
||||
* A session acknowledgement mode.
|
||||
* @param sessionAcknowledgeMode the acknowledgement mode constant
|
||||
* @return the spec
|
||||
* @see javax.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
* @see jakarta.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
* @see JmsDestinationAccessor#setSessionAcknowledgeMode
|
||||
*/
|
||||
public S sessionAcknowledgeMode(int sessionAcknowledgeMode) {
|
||||
@@ -85,7 +85,7 @@ public abstract class JmsDestinationAccessorSpec<S extends JmsDestinationAccesso
|
||||
|
||||
/**
|
||||
* A session acknowledgement mode name.
|
||||
* @param constantName the name of the {@link javax.jms.Session} acknowledge mode constant.
|
||||
* @param constantName the name of the {@link jakarta.jms.Session} acknowledge mode constant.
|
||||
* @return the spec.
|
||||
* @see JmsDestinationAccessor#setSessionAcknowledgeModeName
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
@@ -20,8 +20,8 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.integration.dsl.ComponentsRegistration;
|
||||
import org.springframework.integration.dsl.MessageSourceSpec;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.jms.dsl;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.integration.dsl.MessagingGatewaySpec;
|
||||
import org.springframework.integration.jms.ChannelPublishingJmsMessageListener;
|
||||
|
||||
@@ -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,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.jms.dsl;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.ExceptionListener;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.ExceptionListener;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.jms.dsl;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
|
||||
import org.springframework.integration.jms.AbstractJmsChannel;
|
||||
import org.springframework.integration.jms.config.JmsChannelFactoryBean;
|
||||
|
||||
@@ -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.
|
||||
@@ -20,7 +20,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.integration.dsl.ComponentsRegistration;
|
||||
import org.springframework.integration.dsl.MessageProducerSpec;
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.integration.dsl.ComponentsRegistration;
|
||||
import org.springframework.integration.dsl.MessageHandlerSpec;
|
||||
|
||||
@@ -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.
|
||||
@@ -20,8 +20,8 @@ import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.integration.dsl.IntegrationComponentSpec;
|
||||
import org.springframework.integration.dsl.MessageHandlerSpec;
|
||||
@@ -325,7 +325,7 @@ public class JmsOutboundGatewaySpec extends MessageHandlerSpec<JmsOutboundGatewa
|
||||
/**
|
||||
* @param sessionAcknowledgeMode the acknowledgement mode constant
|
||||
* @return the current {@link ReplyContainerSpec}.
|
||||
* @see javax.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
* @see jakarta.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
*/
|
||||
public ReplyContainerSpec sessionAcknowledgeMode(Integer sessionAcknowledgeMode) {
|
||||
this.target.setSessionAcknowledgeMode(sessionAcknowledgeMode);
|
||||
|
||||
@@ -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.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
@@ -199,7 +199,7 @@ public class JmsPollableMessageChannelSpec<S extends JmsPollableMessageChannelSp
|
||||
/**
|
||||
* @param sessionAcknowledgeMode the acknowledgement mode constant
|
||||
* @return the current {@link MessageChannelSpec}.
|
||||
* @see javax.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
* @see jakarta.jms.Session#AUTO_ACKNOWLEDGE etc.
|
||||
*/
|
||||
public S sessionAcknowledgeMode(int sessionAcknowledgeMode) {
|
||||
this.jmsChannelFactoryBean.setSessionAcknowledgeMode(sessionAcknowledgeMode);
|
||||
|
||||
@@ -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.jms.SubscribableJmsChannel;
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.ConnectionFactory"/>
|
||||
<tool:expected-type type="jakarta.jms.ConnectionFactory"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -377,13 +377,13 @@
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -544,13 +544,13 @@
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -620,13 +620,13 @@
|
||||
<xsd:attribute name="request-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -636,13 +636,13 @@
|
||||
<xsd:attribute name="default-reply-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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).
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -900,7 +900,7 @@
|
||||
<xsd:attribute name="request-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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 @@
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -947,7 +947,7 @@
|
||||
<xsd:attribute name="reply-destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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 @@
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -1032,7 +1032,7 @@
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.ConnectionFactory"/>
|
||||
<tool:expected-type type="jakarta.jms.ConnectionFactory"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -1178,14 +1178,14 @@
|
||||
<xsd:attribute name="destination" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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'.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.Destination"/>
|
||||
<tool:expected-type type="jakarta.jms.Destination"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
@@ -1491,7 +1491,7 @@
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="javax.jms.ConnectionFactory"/>
|
||||
<tool:expected-type type="jakarta.jms.ConnectionFactory"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> 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<String> 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<String> 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<String> 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<String> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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);
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
<int:service-activator expression="@jmsRequiresReplyFlag.getAndIncrement() % 2 == 0 ? payload : null"/>
|
||||
</int:chain>
|
||||
|
||||
<bean id="testQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="testQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="test.queue"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testQueue2" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="testQueue2" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="test.queue2"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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<Object> reply = new AtomicReference<Object>();
|
||||
final AtomicReference<Object> 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<String>("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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<javax.jms.Message> message = new AtomicReference<>();
|
||||
final AtomicReference<jakarta.jms.Message> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -53,23 +53,23 @@
|
||||
<bean class="org.springframework.integration.jms.config.ExceptionHandlingSiConsumerTests$SampleService"/>
|
||||
</int:service-activator>
|
||||
|
||||
<bean id="requestQueueA" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueueA" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue.a"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueueA" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="replyQueueA" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="reply.queue.a"/>
|
||||
</bean>
|
||||
|
||||
<bean id="requestQueueB" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueueB" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue.b"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueueB" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="replyQueueB" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="reply.queue.b"/>
|
||||
</bean>
|
||||
|
||||
<bean id="requestQueueC" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueueC" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue.c"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<int:channel id="jmsInputChannel"/>
|
||||
|
||||
<bean id="extractRecRepQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="extractRecRepQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue.req.rep"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<util:constant id="jmsConnectionFactory"
|
||||
static-field="org.springframework.integration.jms.ActiveMQMultiContextTests.connectionFactory"/>
|
||||
|
||||
<bean id="jmsQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="jmsQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="jmsQueue.queue"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="queueA" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="queueA" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="oneway.a"/>
|
||||
</bean>
|
||||
|
||||
<bean id="queueB" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="queueB" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="oneway.b"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue."/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -53,12 +53,12 @@
|
||||
<jms:channel id="pollableWithSelectorChannel" queue="testQueue" message-driven="false"
|
||||
selector="foo='bar'" />
|
||||
|
||||
<bean id="testQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<property name="physicalName" value="test.queue"/>
|
||||
<bean id="testQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="test.queue"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testTopic" class="org.apache.activemq.command.ActiveMQTopic">
|
||||
<property name="physicalName" value="test.topic"/>
|
||||
<bean id="testTopic" class="org.apache.activemq.artemis.jms.client.ActiveMQTopic">
|
||||
<constructor-arg value="test.topic"/>
|
||||
</bean>
|
||||
|
||||
<bean id="destinationResolver"
|
||||
|
||||
@@ -20,12 +20,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.jms.DeliveryMode;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.Topic;
|
||||
import jakarta.jms.DeliveryMode;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Queue;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.Topic;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -276,7 +276,7 @@ public class JmsChannelParserTests extends ActiveMQMultiContextTests {
|
||||
public void withPlaceholders() {
|
||||
DefaultMessageListenerContainer container = TestUtils.getPropertyValue(withPlaceholders, "container",
|
||||
DefaultMessageListenerContainer.class);
|
||||
assertThat(container.getDestination().toString()).isEqualTo("queue://test.queue");
|
||||
assertThat(container.getDestination().toString()).isEqualTo("ActiveMQQueue[test.queue]");
|
||||
assertThat(container.getConcurrentConsumers()).isEqualTo(5);
|
||||
assertThat(container.getMaxConcurrentConsumers()).isEqualTo(25);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.jms.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.jms.TextMessage;
|
||||
import jakarta.jms.TextMessage;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -67,9 +67,9 @@ public class JmsDynamicDestinationTests extends ActiveMQMultiContextTests {
|
||||
TextMessage jmsResult1 = (TextMessage) result1.getPayload();
|
||||
TextMessage jmsResult2 = (TextMessage) result2.getPayload();
|
||||
assertThat(jmsResult1.getText()).isEqualTo("test-1");
|
||||
assertThat(jmsResult1.getJMSDestination().toString()).isEqualTo("queue://queue.test.dynamic.adapter.1");
|
||||
assertThat(jmsResult1.getJMSDestination().toString()).isEqualTo("ActiveMQQueue[queue.test.dynamic.adapter.1]");
|
||||
assertThat(jmsResult2.getText()).isEqualTo("test-2");
|
||||
assertThat(jmsResult2.getJMSDestination().toString()).isEqualTo("queue://queue.test.dynamic.adapter.2");
|
||||
assertThat(jmsResult2.getJMSDestination().toString()).isEqualTo("ActiveMQQueue[queue.test.dynamic.adapter.2]");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.Destination;
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.DeliveryMode;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.DeliveryMode;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.NotReadablePropertyException;
|
||||
@@ -130,27 +131,21 @@ public class JmsInboundGatewayParserTests extends ActiveMQMultiContextTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanDefinitionStoreException.class)
|
||||
@Test
|
||||
public void testGatewayWithConnectionFactoryOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("jmsGatewayWithConnectionFactoryOnly.xml", this.getClass()).close();
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertThat(e.getMessage().contains("request-destination")).isTrue();
|
||||
assertThat(e.getMessage().contains("request-destination-name")).isTrue();
|
||||
throw e;
|
||||
}
|
||||
assertThatExceptionOfType(BeanDefinitionStoreException.class)
|
||||
.isThrownBy(() ->
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<String, Object> toHeaders(javax.jms.Message jmsMessage) {
|
||||
public Map<String, Object> toHeaders(jakarta.jms.Message jmsMessage) {
|
||||
Map<String, Object> headers = super.toHeaders(jmsMessage);
|
||||
List<Properties> history = new ArrayList<Properties>();
|
||||
String outboundHistory = (String) headers.get("outbound_history");
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<javax.jms.Message> {
|
||||
public static class PriorityReader implements SessionAwareMessageListener<jakarta.jms.Message> {
|
||||
|
||||
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());
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queue"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="replyQueue" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="reply.queue"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
|
||||
<int:channel id="badOutputChannel"/>
|
||||
-->
|
||||
<bean id="requestQueueA" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="requestQueueA" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="request.queueA"/>
|
||||
</bean>
|
||||
|
||||
<bean id="replyQueueB" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="replyQueueB" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="reply.queueB"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
<si:service-activator input-channel="requests" output-channel="replies" expression="payload"/>
|
||||
|
||||
|
||||
<bean id="testDestination" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="testDestination" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="testDestination"/>
|
||||
</bean>
|
||||
<bean id="testReplyDestination" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<bean id="testReplyDestination" class="org.apache.activemq.artemis.jms.client.ActiveMQQueue">
|
||||
<constructor-arg value="testReplyDestination"/>
|
||||
</bean>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user