File Cleanup - Event to JMX
This commit is contained in:
@@ -1 +1 @@
|
||||
event.types=org.springframework.integration.event.config.EventInboundChannelAdapterParserTests$AnotherSampleEvent, org.springframework.integration.event.config.EventInboundChannelAdapterParserTests$SampleEvent
|
||||
event.types=org.springframework.integration.event.config.EventInboundChannelAdapterParserTests$AnotherSampleEvent, org.springframework.integration.event.config.EventInboundChannelAdapterParserTests$SampleEvent
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd">
|
||||
|
||||
<feed:inbound-channel-adapter id="autoChannel"
|
||||
auto-startup="false"
|
||||
auto-startup="false"
|
||||
url="file:dummy.rss">
|
||||
<int:poller fixed-rate="10000" max-messages-per-poll="100" />
|
||||
</feed:inbound-channel-adapter>
|
||||
|
||||
<int:bridge input-channel="autoChannel" output-channel="nullChannel" />
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd">
|
||||
|
||||
<int-feed:inbound-channel-adapter id="feedAdapter"
|
||||
channel="feedChannel"
|
||||
|
||||
<int-feed:inbound-channel-adapter id="feedAdapter"
|
||||
channel="feedChannel"
|
||||
url="http://feeds.bbci.co.uk/news/rss.xml"
|
||||
auto-startup="false">
|
||||
<int:poller fixed-rate="10000" max-messages-per-poll="100" />
|
||||
</int-feed:inbound-channel-adapter>
|
||||
|
||||
|
||||
<int:channel id="feedChannel" />
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration.feed.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
@@ -34,7 +35,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
@@ -81,7 +82,7 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
assertEquals(metadataStore, context.getBean("customMetadataStore"));
|
||||
Object fetcher = TestUtils.getPropertyValue(source, "feedFetcher");
|
||||
assertEquals("FileUrlFeedFetcher", fetcher.getClass().getSimpleName());
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +93,10 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
"FeedInboundChannelAdapterParserTests-http-context.xml", this.getClass());
|
||||
SourcePollingChannelAdapter adapter = context.getBean("feedAdapter", SourcePollingChannelAdapter.class);
|
||||
FeedEntryMessageSource source = (FeedEntryMessageSource) TestUtils.getPropertyValue(adapter, "source");
|
||||
MetadataStore metadataStore = (MetadataStore) TestUtils.getPropertyValue(source, "metadataStore");
|
||||
assertNotNull(TestUtils.getPropertyValue(source, "metadataStore"));
|
||||
Object fetcher = TestUtils.getPropertyValue(source, "feedFetcher");
|
||||
assertTrue(fetcher instanceof com.rometools.fetcher.impl.HttpURLFeedFetcher);
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,7 +112,7 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
|
||||
latch.await(10, TimeUnit.SECONDS);
|
||||
verify(latch, times(3)).countDown();
|
||||
context.destroy();
|
||||
context.close();
|
||||
|
||||
// since we are not deleting the persister file
|
||||
// in this iteration no new feeds will be received and the latch will timeout
|
||||
@@ -120,7 +121,7 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
"FeedInboundChannelAdapterParserTests-file-usage-context.xml", this.getClass());
|
||||
latch.await(500, TimeUnit.MILLISECONDS);
|
||||
verify(latch, times(0)).countDown();
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -128,16 +129,18 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
public void validateSuccessfulNewsRetrievalWithHttpUrl() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(3);
|
||||
MessageHandler handler = spy(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"FeedInboundChannelAdapterParserTests-http-context.xml", this.getClass());
|
||||
DirectChannel feedChannel = context.getBean("feedChannel", DirectChannel.class);
|
||||
feedChannel.subscribe(handler);
|
||||
latch.await(10, TimeUnit.SECONDS);
|
||||
verify(handler, atLeast(3)).handleMessage(Mockito.any(Message.class));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -147,7 +150,7 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
MessageChannel autoChannel = context.getBean("autoChannel", MessageChannel.class);
|
||||
SourcePollingChannelAdapter adapter = context.getBean("autoChannel.adapter", SourcePollingChannelAdapter.class);
|
||||
assertSame(autoChannel, TestUtils.getPropertyValue(adapter, "outputChannel"));
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
|
||||
public static class SampleService {
|
||||
@@ -182,9 +185,11 @@ public class FeedInboundChannelAdapterParserTests {
|
||||
|
||||
public static class SampleMetadataStore implements MetadataStore {
|
||||
|
||||
@Override
|
||||
public void put(String key, String value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class CompositeFileListFilterTests {
|
||||
assertEquals(returnedFiles, compositeFileFilter.filterFiles(new File[] { fileMock }));
|
||||
verify(fileFilterMock1).filterFiles(isA(File[].class));
|
||||
verify(fileFilterMock2).filterFiles(isA(File[].class));
|
||||
compositeFileFilter.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,6 +72,7 @@ public class CompositeFileListFilterTests {
|
||||
assertEquals(returnedFiles, compositeFileFilter.filterFiles(new File[] { fileMock }));
|
||||
verify(fileFilterMock1).filterFiles(isA(File[].class));
|
||||
verify(fileFilterMock2).filterFiles(isA(File[].class));
|
||||
compositeFileFilter.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -82,5 +84,6 @@ public class CompositeFileListFilterTests {
|
||||
when(fileFilterMock2.filterFiles(isA(File[].class))).thenReturn(new ArrayList<File>());
|
||||
when(fileFilterMock1.filterFiles(isA(File[].class))).thenReturn(new ArrayList<File>());
|
||||
assertTrue(compositeFileFilter.filterFiles(new File[] { fileMock }).isEmpty());
|
||||
compositeFileFilter.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -28,11 +28,10 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
@@ -41,6 +40,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
* //INT-2275
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -62,9 +62,6 @@ public class FileOutboundChannelAdapterInsideChainTests {
|
||||
@Autowired
|
||||
private MessageChannel outboundChainChannel;
|
||||
|
||||
@Autowired
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
private static File workDir;
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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,57 +32,58 @@ import org.springframework.integration.file.filters.RegexPatternFileListFilter;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class PatternMatchingFileListFilterTests {
|
||||
|
||||
@Test
|
||||
public void matchSingleFile() {
|
||||
File[] files = new File[]{new File("/some/path/test.txt")};
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(1, accepted.size());
|
||||
}
|
||||
@Test
|
||||
public void matchSingleFile() {
|
||||
File[] files = new File[] { new File("/some/path/test.txt") };
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(1, accepted.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noMatchWithSingleFile() {
|
||||
File[] files = new File[]{new File("/some/path/Test.txt")};
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(0, accepted.size());
|
||||
}
|
||||
@Test
|
||||
public void noMatchWithSingleFile() {
|
||||
File[] files = new File[] { new File("/some/path/Test.txt") };
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(0, accepted.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchSubset() {
|
||||
File[] files = new File[]{
|
||||
new File("/some/path/foo.txt"),
|
||||
new File("/some/path/foo.not"),
|
||||
new File("/some/path/bar.txt"),
|
||||
new File("/some/path/bar.not")
|
||||
};
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(2, accepted.size());
|
||||
assertTrue(accepted.contains(new File("/some/path/foo.txt")));
|
||||
assertTrue(accepted.contains(new File("/some/path/bar.txt")));
|
||||
}
|
||||
@Test
|
||||
public void matchSubset() {
|
||||
File[] files = new File[] {
|
||||
new File("/some/path/foo.txt"),
|
||||
new File("/some/path/foo.not"),
|
||||
new File("/some/path/bar.txt"),
|
||||
new File("/some/path/bar.not") };
|
||||
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
|
||||
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(2, accepted.size());
|
||||
assertTrue(accepted.contains(new File("/some/path/foo.txt")));
|
||||
assertTrue(accepted.contains(new File("/some/path/bar.txt")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void patternEditorInContext() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"patternMatchingFileListFilterTests.xml", this.getClass());
|
||||
FileListFilter<File> filter = (FileListFilter<File>) context.getBean("filter");
|
||||
File[] files = new File[] { new File("/some/path/foo.txt") };
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(1, accepted.size());
|
||||
}
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void patternEditorInContext() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"patternMatchingFileListFilterTests.xml", this.getClass());
|
||||
FileListFilter<File> filter = (FileListFilter<File>) context.getBean("filter");
|
||||
File[] files = new File[] { new File("/some/path/foo.txt") };
|
||||
List<File> accepted = filter.filterFiles(files);
|
||||
assertEquals(1, accepted.size());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void invalidPatternSyntax() throws Throwable {
|
||||
new ClassPathXmlApplicationContext("invalidPatternMatchingFileListFilterTests.xml", this.getClass());
|
||||
}
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void invalidPatternSyntax() throws Throwable {
|
||||
new ClassPathXmlApplicationContext("invalidPatternMatchingFileListFilterTests.xml", this.getClass()).close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@
|
||||
|
||||
<context:property-placeholder location="classpath:org/springframework/integration/file/config/test.properties" />
|
||||
|
||||
</beans:beans>
|
||||
</beans:beans>
|
||||
|
||||
@@ -16,16 +16,18 @@
|
||||
|
||||
package org.springframework.integration.file.config;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class FileOutboundChannelAdapterParserWithErrorsTests {
|
||||
@@ -34,7 +36,8 @@ public class FileOutboundChannelAdapterParserWithErrorsTests {
|
||||
public void testSettingDirectoryAndDirectoryExpression() {
|
||||
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("FileOutboundChannelAdapterParserWithErrorsTests-context.xml", getClass());
|
||||
new ClassPathXmlApplicationContext("FileOutboundChannelAdapterParserWithErrorsTests-context.xml",
|
||||
getClass()).close();
|
||||
}
|
||||
catch (BeanDefinitionParsingException e) {
|
||||
assertEquals("Configuration problem: Either directory or " +
|
||||
@@ -53,7 +56,8 @@ public class FileOutboundChannelAdapterParserWithErrorsTests {
|
||||
public void testNotSettingBothDirectoryAndDirectoryExpression() {
|
||||
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("FileOutboundChannelAdapterParserWithErrors2Tests-context.xml", getClass());
|
||||
new ClassPathXmlApplicationContext("FileOutboundChannelAdapterParserWithErrors2Tests-context.xml",
|
||||
getClass()).close();
|
||||
}
|
||||
catch (BeanDefinitionParsingException e) {
|
||||
assertEquals("Configuration problem: directory or directory-expression " +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -67,9 +67,6 @@ public class FileTailInboundChannelAdapterParserTests {
|
||||
@Autowired
|
||||
private TaskScheduler sched;
|
||||
|
||||
@Autowired
|
||||
private TaskScheduler taskScheduler;
|
||||
|
||||
@Autowired
|
||||
private MessageChannel tailErrorChannel;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
files.delete=true
|
||||
files.delete=true
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
inputdir=classpath:
|
||||
outputdir=classpath:
|
||||
outputdir=classpath:
|
||||
|
||||
@@ -128,6 +128,7 @@ public class PersistentAcceptOnceFileListFilterExternalStoreTests extends RedisA
|
||||
assertEquals(Integer.valueOf(0), theResult); // lost the race, key changed
|
||||
|
||||
file.delete();
|
||||
filter.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@
|
||||
|
||||
<si:poller default="true" fixed-delay="100000000"/>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.messaging.MessagingException;
|
||||
public class AbstractRemoteFileSynchronizerTests {
|
||||
|
||||
@Test
|
||||
public void testRollback() {
|
||||
public void testRollback() throws Exception {
|
||||
final AtomicBoolean failWhenCopyingBar = new AtomicBoolean(true);
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
SessionFactory<String> sf = new StringSessionFactory();
|
||||
@@ -91,6 +91,7 @@ public class AbstractRemoteFileSynchronizerTests {
|
||||
}
|
||||
sync.synchronizeToLocalDirectory(mock(File.class));
|
||||
assertEquals(3, count.get());
|
||||
sync.close();
|
||||
}
|
||||
|
||||
private class StringSessionFactory implements SessionFactory<String> {
|
||||
|
||||
@@ -19,20 +19,24 @@ package org.springframework.integration.ftp;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class FtpMessageHistoryTests {
|
||||
@Test
|
||||
public void testMessageHistory() throws Exception {
|
||||
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("ftp-message-history-context.xml",
|
||||
this.getClass());
|
||||
SourcePollingChannelAdapter adapter = ac.getBean("adapterFtp", SourcePollingChannelAdapter.class);
|
||||
assertEquals("adapterFtp", adapter.getComponentName());
|
||||
assertEquals("ftp:inbound-channel-adapter", adapter.getComponentType());
|
||||
ac.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FtpParserInboundTests {
|
||||
@Test
|
||||
public void testLocalFilesAutoCreationTrue() throws Exception {
|
||||
assertTrue(!new File("target/foo").exists());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-context.xml", this.getClass()).close();
|
||||
assertTrue(new File("target/foo").exists());
|
||||
assertTrue(!new File("target/bar").exists());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class FtpParserInboundTests {
|
||||
public void testLocalFilesAutoCreationFalse() throws Exception {
|
||||
assertTrue(!new File("target/bar").exists());
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-fail-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("FtpParserInboundTests-fail-context.xml", this.getClass()).close();
|
||||
fail("BeansException expected.");
|
||||
}
|
||||
catch (BeansException e) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.io.File;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
@@ -31,6 +30,7 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class FtpInboundOutboundSanitySample {
|
||||
|
||||
@@ -55,18 +55,20 @@ public class FtpInboundOutboundSanitySample {
|
||||
fileB.delete();
|
||||
}
|
||||
|
||||
new ClassPathXmlApplicationContext("FtpInboundChannelAdapterSample-context.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"FtpInboundChannelAdapterSample-context.xml", this.getClass());
|
||||
Thread.sleep(3000);
|
||||
fileA = new File("local-test-dir/b.test");
|
||||
fileB = new File("local-test-dir/b.test");
|
||||
assertTrue(fileA.exists());
|
||||
assertTrue(fileB.exists());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testFtpOutboundChannelAdapter() throws Exception {
|
||||
ApplicationContext ac =
|
||||
ClassPathXmlApplicationContext ac =
|
||||
new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterSample-context.xml", this.getClass());
|
||||
File fileA = new File("local-test-dir/a.test");
|
||||
File fileB = new File("local-test-dir/b.test");
|
||||
@@ -78,6 +80,7 @@ public class FtpInboundOutboundSanitySample {
|
||||
fileB = new File("remote-target-dir/b.test");
|
||||
assertTrue(fileA.exists());
|
||||
assertTrue(fileB.exists());
|
||||
ac.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.integration.metadata.SimpleMetadataStore;
|
||||
public class FtpPersistentAcceptOnceFileListFilterTests {
|
||||
|
||||
@Test
|
||||
public void testRollback() {
|
||||
public void testRollback() throws Exception {
|
||||
FtpPersistentAcceptOnceFileListFilter filter = new FtpPersistentAcceptOnceFileListFilter(
|
||||
new SimpleMetadataStore(), "rollback:");
|
||||
FTPFile ftpFile1 = new FTPFile();
|
||||
@@ -60,6 +60,7 @@ public class FtpPersistentAcceptOnceFileListFilterTests {
|
||||
assertEquals("baz", now.get(1).getName());
|
||||
now = filter.filterFiles(files);
|
||||
assertEquals(0, now.size());
|
||||
filter.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||
public void afterPropertiesSet() {
|
||||
if (this.messageStoreRegion != null) {
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="org/springframework/integration/gemfire/inbound/cq/common.properties"/>
|
||||
|
||||
|
||||
<context:component-scan base-package="org.springframework.integration.gemfire.store"/>
|
||||
|
||||
<int:channel id="i"/>
|
||||
@@ -33,4 +33,4 @@
|
||||
<gfe:replicated-region id="markedRegion" cache-ref="c"/>
|
||||
<gfe:replicated-region id="messageGroupRegion" cache-ref="c"/>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -2,4 +2,4 @@ host=127.0.0.1
|
||||
port=55221
|
||||
region-name=people
|
||||
region-query=select * from /people
|
||||
correlation-header=time
|
||||
correlation-header=time
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
log-level=warning
|
||||
name=Spring Integration GemFire World
|
||||
bind-address=127.0.0.1
|
||||
bind-address=127.0.0.1
|
||||
|
||||
@@ -1 +1 @@
|
||||
"groovy"
|
||||
"groovy"
|
||||
|
||||
@@ -1 +1 @@
|
||||
payload.length() > 3 ? 'longStrings' : 'shortStrings'
|
||||
payload.length() > 3 ? 'longStrings' : 'shortStrings'
|
||||
|
||||
@@ -1 +1 @@
|
||||
"groovy-$payload-" + "$foo" + " - " + bar + " - " + date
|
||||
"groovy-$payload-" + "$foo" + " - " + bar + " - " + date
|
||||
|
||||
@@ -1 +1 @@
|
||||
payload.split(',')
|
||||
payload.split(',')
|
||||
|
||||
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class ServiceActivatorParserTests {
|
||||
public void failExpressionAndScript() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext(this.getClass().getSimpleName() + "-fail-expression-and-script-context.xml",
|
||||
this.getClass());
|
||||
this.getClass()).close();
|
||||
fail("Expected exception");
|
||||
}
|
||||
catch (BeanDefinitionParsingException e) {
|
||||
|
||||
@@ -44,14 +44,14 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
|
||||
import org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -172,7 +172,8 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void failWithRestTemplateAndRestAttributes() {
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-fail-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-fail-context.xml", this.getClass())
|
||||
.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -265,7 +266,8 @@ public class HttpOutboundChannelAdapterParserTests {
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void failWithUrlAndExpression() {
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-url-fail-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("HttpOutboundChannelAdapterParserTests-url-fail-context.xml",
|
||||
this.getClass()).close();
|
||||
}
|
||||
|
||||
public static class StubErrorHandler implements ResponseErrorHandler {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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,6 +30,7 @@ import java.util.Map;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -43,14 +44,14 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
|
||||
import org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -199,7 +200,8 @@ public class HttpOutboundGatewayParserTests {
|
||||
@Test
|
||||
public void testInt2718FailForGatewayRequestChannelAttribute() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("HttpOutboundGatewayWithinChainTests-fail-context.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("HttpOutboundGatewayWithinChainTests-fail-context.xml", this.getClass())
|
||||
.close();
|
||||
fail("Expected BeanDefinitionParsingException");
|
||||
}
|
||||
catch (BeansException e) {
|
||||
@@ -217,10 +219,12 @@ public class HttpOutboundGatewayParserTests {
|
||||
|
||||
public static class StubErrorHandler implements ResponseErrorHandler {
|
||||
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class OutboundResponseTypeTests {
|
||||
@Test
|
||||
public void testMutuallyExclusivityInMethodAndMethodExpression() throws Exception {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("OutboundResponseTypeTests-context-fail.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("OutboundResponseTypeTests-context-fail.xml", this.getClass()).close();
|
||||
fail("Expected BeansException");
|
||||
}
|
||||
catch (BeansException e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2016 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.
|
||||
@@ -56,6 +56,7 @@ import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*/
|
||||
//INT-2312
|
||||
@@ -131,10 +132,10 @@ public class Int2312RequestMappingIntegrationTests extends AbstractHttpInboundTe
|
||||
|
||||
Object matrixVariables = headers.get("matrixVariables");
|
||||
assertThat(matrixVariables, Matchers.instanceOf(Map.class));
|
||||
Object value = ((Map) matrixVariables).get("value");
|
||||
Object value = ((Map<?, ?>) matrixVariables).get("value");
|
||||
assertThat(value, Matchers.instanceOf(MultiValueMap.class));
|
||||
assertEquals("1", ((MultiValueMap) value).getFirst("q1"));
|
||||
assertEquals("2", ((MultiValueMap) value).getFirst("q2"));
|
||||
assertEquals("1", ((MultiValueMap<String, ?>) value).getFirst("q1"));
|
||||
assertEquals("2", ((MultiValueMap<String, ?>) value).getFirst("q2"));
|
||||
|
||||
Object requestHeaders = headers.get("requestHeaders");
|
||||
assertNotNull(requestParams);
|
||||
|
||||
@@ -345,6 +345,7 @@ public class UdpChannelAdapterTests {
|
||||
socket.receive(packet);
|
||||
assertEquals("FOO", new String(packet.getData()));
|
||||
assertEquals(receiverServerPort, packet.getPort());
|
||||
socket.close();
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ public class UdpMulticastEndToEndTests implements Runnable {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void run() {
|
||||
@SuppressWarnings("resource")
|
||||
AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
|
||||
"testIp-in-multicast-context.xml",
|
||||
UdpMulticastEndToEndTests.class);
|
||||
@@ -196,7 +197,6 @@ public class UdpMulticastEndToEndTests implements Runnable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ctx.stop();
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@ public class DelayerHandlerRescheduleIntegrationTests {
|
||||
|
||||
//On transaction rollback the delayed Message should remain in the persistent MessageStore
|
||||
assertEquals(1, messageStore.messageGroupSize(delayerMessageGroupId));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -184,6 +185,7 @@ public class DelayerHandlerRescheduleIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
private static class ExceptionMessageHandler implements MessageHandler {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
TransactionSynchronizationManager.registerSynchronization(new RollbackTxSync());
|
||||
throw new RuntimeException("intentional");
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -335,6 +336,7 @@ public class JdbcMessageStoreTests {
|
||||
@Override
|
||||
public void execute(MessageGroupStore messageGroupStore, MessageGroup group) {
|
||||
messageGroupStore.removeMessageGroup(group.getGroupId());
|
||||
groupRemovalLatch.countDown();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -364,6 +366,7 @@ public class JdbcMessageStoreTests {
|
||||
|
||||
group = messageStore.getMessageGroup(groupId);
|
||||
assertEquals(0, group.size());
|
||||
assertTrue(groupRemovalLatch.await(10, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
@@ -36,7 +37,7 @@ public class InnerPollerParserTests {
|
||||
@Test
|
||||
public void testRefGood() {
|
||||
// Just load the context to test the parse of a 'good' inner parser
|
||||
new ClassPathXmlApplicationContext("InnerPollerParserTests-context.xml", InnerPollerParserTests.class);
|
||||
new ClassPathXmlApplicationContext("InnerPollerParserTests-context.xml", InnerPollerParserTests.class).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,7 +69,7 @@ public class InnerPollerParserTests {
|
||||
"</beans>";
|
||||
|
||||
Resource resource = new ByteArrayResource(badContext.getBytes());
|
||||
new GenericXmlApplicationContext(resource);
|
||||
new GenericXmlApplicationContext(resource).close();
|
||||
fail("Expected Failure to load ApplicationContext");
|
||||
}
|
||||
catch (BeanDefinitionParsingException bdpe) {
|
||||
@@ -105,7 +106,7 @@ public class InnerPollerParserTests {
|
||||
"</beans>";
|
||||
|
||||
Resource resource = new ByteArrayResource(badContext.getBytes());
|
||||
new GenericXmlApplicationContext(resource);
|
||||
new GenericXmlApplicationContext(resource).close();
|
||||
fail("Expected Failure to load ApplicationContext");
|
||||
}
|
||||
catch (BeanDefinitionParsingException bdpe) {
|
||||
@@ -142,7 +143,7 @@ public class InnerPollerParserTests {
|
||||
"</beans>";
|
||||
|
||||
Resource resource = new ByteArrayResource(badContext.getBytes());
|
||||
new GenericXmlApplicationContext(resource);
|
||||
new GenericXmlApplicationContext(resource).close();
|
||||
fail("Expected Failure to load ApplicationContext");
|
||||
}
|
||||
catch (BeanDefinitionParsingException bdpe) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
create table item(id int, name varchar(20), status int);
|
||||
create table item(id int, name varchar(20), status int);
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<jdbc:embedded-database type="HSQL" id="dataSource">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/config/inboundSchema.sql" />
|
||||
</jdbc:embedded-database>
|
||||
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
||||
<constructor-arg ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
<constructor-arg ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -2,4 +2,4 @@ drop table bazz;
|
||||
drop table foow;
|
||||
|
||||
create table bazz(id varchar(100),status int,name varchar(20));
|
||||
create table foow(id varchar(100),status int,name varchar(20));
|
||||
create table foow(id varchar(100),status int,name varchar(20));
|
||||
|
||||
@@ -2,4 +2,4 @@ drop table bazz;
|
||||
|
||||
create table bazz(id varchar(100),status int,name varchar(20));
|
||||
|
||||
INSERT INTO bazz (id, status, name) VALUES (100, 3, 'Cartman')
|
||||
INSERT INTO bazz (id, status, name) VALUES (100, 3, 'Cartman')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
drop table foos;
|
||||
drop table bars;
|
||||
create table foos(id varchar(100),status int,name varchar(20));
|
||||
create table bars(id int identity,status int,name varchar(20));
|
||||
create table bars(id int identity,status int,name varchar(20));
|
||||
|
||||
@@ -1 +1 @@
|
||||
create table foos(id varchar(100),status int,name varchar(20));
|
||||
create table foos(id varchar(100),status int,name varchar(20));
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
create table item(id int,status int);
|
||||
create table copy(id int,status int);
|
||||
create table copy(id int,status int);
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.integration.jms.JmsOutboundChannelAdapterTests.CFConfig;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -45,9 +44,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@DirtiesContext
|
||||
public class JmsOutboundChannelAdapterTests extends ActiveMQMultiContextTests {
|
||||
|
||||
@Autowired
|
||||
private PollableChannel out;
|
||||
|
||||
@Autowired
|
||||
private Aborter aborter;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.messaging.PollableChannel;
|
||||
*/
|
||||
public class JmsInboundChannelAdapterParserTests {
|
||||
|
||||
private long timeoutOnReceive = 3000;
|
||||
private final long timeoutOnReceive = 3000;
|
||||
|
||||
@Test
|
||||
public void adapterWithJmsTemplate() {
|
||||
@@ -103,7 +103,7 @@ public class JmsInboundChannelAdapterParserTests {
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void adapterWithDestinationOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("jmsInboundWithDestinationOnly.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("jmsInboundWithDestinationOnly.xml", this.getClass()).close();
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
Throwable rootCause = e.getRootCause();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -161,7 +161,7 @@ public class JmsOutboundChannelAdapterParserTests {
|
||||
@Test(expected = BeanDefinitionStoreException.class)
|
||||
public void adapterWithEmptyConnectionFactory() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("jmsOutboundWithEmptyConnectionFactory.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("jmsOutboundWithEmptyConnectionFactory.xml", this.getClass()).close();
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertTrue(e.getMessage().contains("connection-factory"));
|
||||
|
||||
@@ -37,8 +37,8 @@ import org.springframework.integration.MessageTimeoutException;
|
||||
import org.springframework.integration.gateway.RequestReplyExchanger;
|
||||
import org.springframework.integration.jms.ActiveMQMultiContextTests;
|
||||
import org.springframework.integration.jms.config.ActiveMqTestUtils;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.test.support.LongRunningIntegrationTest;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
@@ -162,6 +162,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests {
|
||||
for (int i = 0; i < requests; i++) {
|
||||
final int y = i;
|
||||
executor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
assertEquals(y, gateway.exchange(new GenericMessage<Integer>(y)).getPayload());
|
||||
@@ -191,7 +192,7 @@ public class PipelineJmsTests extends ActiveMQMultiContextTests {
|
||||
assertTrue(successCounter.get() > 10);
|
||||
assertEquals(0, failureCounter.get());
|
||||
assertEquals(requests, successCounter.get() + timeoutCounter.get());
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,10 +73,12 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
final Destination replyDestination = context.getBean("siInQueueOptimizedA", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -89,7 +91,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
gateway.exchange(new GenericMessage<String>("foo"));
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -109,10 +111,12 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
final Destination replyDestination = context.getBean("siInQueueNonOptimizedB", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -126,7 +130,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,10 +148,12 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
final Destination replyDestination = context.getBean("siInQueueOptimizedC", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -161,7 +167,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,10 +185,12 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
final Destination replyDestination = context.getBean("siInQueueNonOptimizedD", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -196,7 +204,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,12 +232,14 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
|
||||
dmlc.setConnectionFactory(connectionFactory);
|
||||
dmlc.setDestination(requestDestination);
|
||||
dmlc.setMessageListener(new SessionAwareMessageListener<Message>() {
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Session session) {
|
||||
String requestPayload = (String) extractPayload(message);
|
||||
try {
|
||||
@@ -259,7 +269,7 @@ public class RequestReplyScenariosWithCachedConsumersTests extends ActiveMQMulti
|
||||
assertEquals("bar", gateway.exchange(new GenericMessage<String>("bar")).getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ import org.springframework.integration.MessageTimeoutException;
|
||||
import org.springframework.integration.gateway.RequestReplyExchanger;
|
||||
import org.springframework.integration.jms.ActiveMQMultiContextTests;
|
||||
import org.springframework.integration.jms.config.ActiveMqTestUtils;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.test.support.LongRunningIntegrationTest;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.core.MessageCreator;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
@@ -60,10 +60,12 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
final Destination replyDestination = context.getBean("siInQueueC", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -77,7 +79,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +96,11 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
final Destination replyDestination = context.getBean("siInQueueD", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -110,7 +114,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +131,12 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
final Destination replyDestination = context.getBean("siInQueueA", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -144,7 +150,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,10 +167,12 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
final Destination replyDestination = context.getBean("siInQueueB", Destination.class);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Message requestMessage = jmsTemplate.receive(requestDestination);
|
||||
jmsTemplate.send(replyDestination, new MessageCreator() {
|
||||
|
||||
@Override
|
||||
public Message createMessage(Session session) throws JMSException {
|
||||
TextMessage message = session.createTextMessage();
|
||||
message.setText("bar");
|
||||
@@ -178,7 +186,7 @@ public class RequestReplyScenariosWithNonCachedConsumersTests extends ActiveMQMu
|
||||
assertEquals("bar", siReplyMessage.getPayload());
|
||||
}
|
||||
finally {
|
||||
context.destroy();
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti
|
||||
}
|
||||
}
|
||||
assertEquals(50, replyCounter + timeoutCounter);
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -264,6 +265,7 @@ public class RequestReplyScenariosWithTempReplyQueuesTests extends ActiveMQMulti
|
||||
assertEquals(0, missmatches.get());
|
||||
assertEquals(0, failures.get());
|
||||
assertEquals(0, timeouts.get());
|
||||
context.close();
|
||||
}
|
||||
|
||||
private void print(AtomicInteger failures, AtomicInteger timeouts, AtomicInteger missmatches, long echangesProcessed) {
|
||||
|
||||
@@ -165,7 +165,7 @@ public class ServiceActivatorDefaultFrameworkMethodTests {
|
||||
public void testFailOnDoubleReference() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext(this.getClass().getSimpleName() + "-fail-context.xml",
|
||||
this.getClass());
|
||||
this.getClass()).close();
|
||||
fail("Expected exception due to 2 endpoints referencing the same bean");
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration.jmx.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
@@ -28,7 +29,7 @@ public class MBeanExporterNameTests {
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void testHandlerMBeanRegistration() throws Exception {
|
||||
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
|
||||
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()).close();
|
||||
}
|
||||
|
||||
public static class Source {
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
<context:mbean-server id="mbeanServer" />
|
||||
<int-jmx:mbean-export server="mbeanServer" default-domain="test.MethodInvoker" />
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user