INTSAMPLES-102 - Fix intermittently failing tests
Reference: https://jira.springsource.org/browse/INTSAMPLES-102
This commit is contained in:
@@ -38,11 +38,14 @@ import org.springframework.integration.core.SubscribableChannel;
|
||||
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
public class JmsMockTests {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(JmsMockTests.class);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.File;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
@@ -38,7 +38,7 @@ public class FtpOutboundChannelAdapterSample {
|
||||
|
||||
@Test
|
||||
public void runDemo() throws Exception{
|
||||
ApplicationContext ctx =
|
||||
ConfigurableApplicationContext ctx =
|
||||
new ClassPathXmlApplicationContext("META-INF/spring/integration/DynamicFtpOutboundChannelAdapterSample-context.xml");
|
||||
MessageChannel channel = ctx.getBean("toDynRouter", MessageChannel.class);
|
||||
File file = File.createTempFile("temp", "txt");
|
||||
@@ -89,5 +89,7 @@ public class FtpOutboundChannelAdapterSample {
|
||||
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
|
||||
assertEquals("host.for.cust1", e.getCause().getCause().getMessage());
|
||||
}
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class FtpInboundChannelAdapterSample {
|
||||
assertNotNull(message2);
|
||||
assertNull("Was NOT expecting a third message.", message3);
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class FtpOutboundGatewaySample {
|
||||
|
||||
assertTrue("Expected FTP remote directory to be empty", new File(TestSuite.FTP_ROOT_DIR).delete());
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user