Fix some broken tests
This commit is contained in:
@@ -68,7 +68,7 @@ public class ResourceSplitterIntegrationTests {
|
||||
@Test
|
||||
public void testVanillaConversion() throws Exception {
|
||||
resources.send(new GenericMessage<String>("classpath:*-context.xml"));
|
||||
Message<Resource> message = (Message<Resource>) requests.receive(100L);
|
||||
Message<Resource> message = (Message<Resource>) requests.receive(200L);
|
||||
assertNotNull(message);
|
||||
message = (Message<Resource>) requests.receive(100L);
|
||||
assertNotNull(message);
|
||||
|
||||
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -18,8 +19,9 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageHandlingException;
|
||||
import org.springframework.integration.message.MessageDeliveryException;
|
||||
import org.springframework.integration.message.MessageHeaders;
|
||||
import org.springframework.integration.message.MessageTarget;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -30,7 +32,7 @@ public class JobLaunchingMessageHandlerIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("requests")
|
||||
private PollableChannel requestChannel;
|
||||
private MessageTarget requestChannel;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("response")
|
||||
@@ -40,7 +42,6 @@ public class JobLaunchingMessageHandlerIntegrationTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
requestChannel.purge(null);
|
||||
responseChannel.purge(null);
|
||||
}
|
||||
|
||||
@@ -53,9 +54,9 @@ public class JobLaunchingMessageHandlerIntegrationTests {
|
||||
try {
|
||||
requestChannel.send(trigger);
|
||||
}
|
||||
catch (MessageHandlingException e) {
|
||||
String message = e.getMessage();
|
||||
assertTrue("Wrong message: " + message, message.contains("reply channel"));
|
||||
catch (MessageDeliveryException e) {
|
||||
String message = e.getCause().getMessage();
|
||||
assertTrue("Wrong message: " + message, message.contains("return address"));
|
||||
}
|
||||
Message<JobExecution> executionMessage = (Message<JobExecution>) responseChannel.receive(1000);
|
||||
|
||||
@@ -68,8 +69,9 @@ public class JobLaunchingMessageHandlerIntegrationTests {
|
||||
public void testReply() {
|
||||
JobParametersBuilder builder = new JobParametersBuilder();
|
||||
builder.addString("dontclash", "12");
|
||||
MessageHeaders headers = new MessageHeaders(new HashMap<String, Object>());
|
||||
headers.put(MessageHeaders.RETURN_ADDRESS, "response");
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(MessageHeaders.RETURN_ADDRESS, "response");
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
GenericMessage<JobLaunchRequest> trigger = new GenericMessage<JobLaunchRequest>(new JobLaunchRequest(job,
|
||||
builder.toJobParameters()), headers);
|
||||
requestChannel.send(trigger);
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.integration.JobSupport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
@@ -27,10 +26,6 @@ public class JobLaunchingMessageHandlerTests extends AbstractJUnit4SpringContext
|
||||
|
||||
StubJobLauncher jobLauncher;
|
||||
|
||||
// @Autowired
|
||||
// @Qualifier("jobs") TODO: Qualifier seems to be broken here why ?????
|
||||
public AbstractMessageChannel jobsChannel;
|
||||
|
||||
@Autowired
|
||||
public MessageBus messageBus;
|
||||
|
||||
@@ -38,7 +33,6 @@ public class JobLaunchingMessageHandlerTests extends AbstractJUnit4SpringContext
|
||||
public void setUp() {
|
||||
jobLauncher = new StubJobLauncher();
|
||||
messageHandler = new JobLaunchingMessageHandler(jobLauncher);
|
||||
jobsChannel = (AbstractMessageChannel) applicationContext.getBean("jobs");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<bean
|
||||
class="org.springframework.batch.integration.job.MessageOrientedStep">
|
||||
<property name="name" value="TODO: I shouldn't have to set this"/>
|
||||
<property name="requestChannel" ref="requests" />
|
||||
<property name="replyChannel" ref="replies" />
|
||||
<property name="target" ref="requests" />
|
||||
<property name="source" ref="replies" />
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
</property>
|
||||
|
||||
@@ -14,14 +14,12 @@
|
||||
|
||||
<import resource="classpath:simple-job-launcher-context.xml" />
|
||||
|
||||
<integration:message-bus auto-create-channels="true" channel-factory="channelFactory" />
|
||||
<integration:message-bus auto-create-channels="true" />
|
||||
<integration:annotation-driven />
|
||||
<integration:channel id="requests" />
|
||||
<integration:channel id="jobs" />
|
||||
<integration:direct-channel id="requests" />
|
||||
<integration:direct-channel id="jobs" />
|
||||
<integration:thread-local-channel id="response" />
|
||||
|
||||
<bean id="channelFactory" class="org.springframework.integration.dispatcher.DirectChannelFactory" />
|
||||
|
||||
<integration:service-activator input-channel="requests" ref="jobLaunchingHandler" return-address-overrides="true" />
|
||||
<integration:service-activator input-channel="none" output-channel="jobs" ref="jobRequestConverter" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user