Refactored SimpleMessagingGateway to include a base AbstractMessagingGateway with abstract methods for mapping messages to and from Objects. SimpleMessagingGateway delegates to a MessageMapper instance or uses DefaultMessageMapper.

This commit is contained in:
Mark Fisher
2008-09-25 21:18:01 +00:00
parent 6b659523b9
commit b0a00c7c0d
6 changed files with 212 additions and 166 deletions

View File

@@ -59,7 +59,8 @@ public class SimpleMessagingGatewayTests {
@Before
public void initializeSample() {
this.simpleMessagingGateway = new SimpleMessagingGateway(requestChannel);
this.simpleMessagingGateway = new SimpleMessagingGateway();
this.simpleMessagingGateway.setRequestChannel(requestChannel);
this.simpleMessagingGateway.setReplyChannel(replyChannel);
this.simpleMessagingGateway.setMessageBus(messageBusMock);
reset(allmocks);

View File

@@ -23,13 +23,13 @@ import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
*/
public class TestMessageMapper implements MessageMapper<String> {
public class TestMessageMapper implements MessageMapper {
public Message<?> toMessage(String object) {
public Message<?> toMessage(Object object) {
return new StringMessage("pre." + object);
}
public String fromMessage(Message<?> message) {
public Object fromMessage(Message<?> message) {
return message.getPayload().toString() + ".post";
}