From 0fe776d60736cb57723571497c65cc18412a7a77 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 16 Jun 2010 19:37:32 +0000 Subject: [PATCH] INT-681, INT-710, INT-1181 added more tests --- .../ServiceActivatorParserTests-context.xml | 4 ++ .../xml/ServiceActivatorParserTests.java | 44 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests-context.xml index 99b38387b9..3e9fe45bb5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests-context.xml @@ -15,6 +15,10 @@ + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests.java index c450a23681..1067a8ae3a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ServiceActivatorParserTests.java @@ -47,6 +47,12 @@ public class ServiceActivatorParserTests { @Autowired private MessageChannel beanInvocationResultInput; + @Autowired + private MessageChannel multipleLiteralArgsInput; + + @Autowired + private MessageChannel multipleArgsFromPayloadInput; + @Test public void literalExpression() { @@ -72,6 +78,18 @@ public class ServiceActivatorParserTests { assertEquals("helloFOO", result); } + @Test + public void multipleLiteralArgs() { + Object result = this.sendAndReceive(multipleLiteralArgsInput, "hello"); + assertEquals("foobar", result); + } + + @Test + public void multipleArgsFromPayload() { + Object result = this.sendAndReceive(multipleArgsFromPayloadInput, new TestPerson("John", "Doe")); + assertEquals("JohnDoe", result); + } + private Object sendAndReceive(MessageChannel channel, Object payload) { SimpleMessagingGateway gateway = new SimpleMessagingGateway(); @@ -86,6 +104,10 @@ public class ServiceActivatorParserTests { public String caps(String s) { return s.toUpperCase(); } + + public String concat(String s1, String s2) { + return s1 + s2; + } } @@ -97,4 +119,26 @@ public class ServiceActivatorParserTests { } } + + @SuppressWarnings("unused") + private static class TestPerson { + + private String firstName; + + private String lastName; + + public TestPerson(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + } + }