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:
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user