Endpoints now recognize an EndpointVisitor in the message payload. The EndpointPoller is now an implementation of EndpointVisitor (removed PollCommand).

This commit is contained in:
Mark Fisher
2008-07-06 03:09:56 +00:00
parent 06f4e1d011
commit 1b90086e4e
12 changed files with 49 additions and 91 deletions

View File

@@ -25,10 +25,10 @@ import org.junit.Test;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.endpoint.EndpointPoller;
import org.springframework.integration.endpoint.SourceEndpoint;
import org.springframework.integration.message.CommandMessage;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.PollCommand;
import org.springframework.integration.scheduling.PollingSchedule;
/**
@@ -45,7 +45,7 @@ public class ByteStreamSourceTests {
SourceEndpoint endpoint = new SourceEndpoint(source);
endpoint.setOutputChannel(channel);
endpoint.afterPropertiesSet();
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message1 = channel.receive(500);
byte[] payload = (byte[]) message1.getPayload();
assertEquals(3, payload.length);
@@ -54,7 +54,7 @@ public class ByteStreamSourceTests {
assertEquals(3, payload[2]);
Message<?> message2 = channel.receive(0);
assertNull(message2);
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message3 = channel.receive(0);
assertNull(message3);
}
@@ -71,12 +71,12 @@ public class ByteStreamSourceTests {
SourceEndpoint endpoint = new SourceEndpoint(source);
endpoint.setOutputChannel(channel);
endpoint.afterPropertiesSet();
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message1 = channel.receive(0);
assertEquals(4, ((byte[]) message1.getPayload()).length);
Message<?> message2 = channel.receive(0);
assertNull(message2);
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message3 = channel.receive(0);
assertEquals(2, ((byte[]) message3.getPayload()).length);
}
@@ -94,12 +94,12 @@ public class ByteStreamSourceTests {
SourceEndpoint endpoint = new SourceEndpoint(source);
endpoint.setOutputChannel(channel);
endpoint.afterPropertiesSet();
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message1 = channel.receive(0);
assertEquals(4, ((byte[]) message1.getPayload()).length);
Message<?> message2 = channel.receive(0);
assertNull(message2);
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message3 = channel.receive(0);
assertEquals(4, ((byte[]) message3.getPayload()).length);
assertEquals(0, ((byte[]) message3.getPayload())[3]);

View File

@@ -25,10 +25,10 @@ import org.junit.Test;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.endpoint.EndpointPoller;
import org.springframework.integration.endpoint.SourceEndpoint;
import org.springframework.integration.message.CommandMessage;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.PollCommand;
import org.springframework.integration.scheduling.PollingSchedule;
/**
@@ -46,12 +46,12 @@ public class CharacterStreamSourceTests {
SourceEndpoint endpoint = new SourceEndpoint(source);
endpoint.setOutputChannel(channel);
endpoint.afterPropertiesSet();
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message1 = channel.receive(0);
assertEquals("test", message1.getPayload());
Message<?> message2 = channel.receive(0);
assertNull(message2);
endpoint.send(new CommandMessage(new PollCommand()));
endpoint.send(new GenericMessage<EndpointPoller>(new EndpointPoller()));
Message<?> message3 = channel.receive(0);
assertNull(message3);
}