INT-1727 renamed ScriptedVariableSource to ScriptVariableGenerator

This commit is contained in:
Oleg Zhurakousky
2011-01-31 13:43:25 -05:00
parent c3b99e4bcf
commit da227f07a9
9 changed files with 23 additions and 25 deletions

View File

@@ -72,8 +72,8 @@ public class GroovyScriptExecutingMessageProcessorTests {
TestResource resource = new TestResource(script, "simpleTest");
ScriptSource scriptSource = new ResourceScriptSource(resource);
Object result = null;
class CustomScriptVariableSource implements ScriptVariableSource {
public Map<String, Object> resolveScriptVariables(Message<?> message) {
class CustomScriptVariableSource implements ScriptVariablesGenerator {
public Map<String, Object> generateScriptVariables(Message<?> message) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("date", System.nanoTime());
variables.put("payload", message.getPayload());
@@ -82,7 +82,7 @@ public class GroovyScriptExecutingMessageProcessorTests {
}
}
for (int i = 0; i < 5; i++) {
ScriptVariableSource scriptVariableSource = new CustomScriptVariableSource();
ScriptVariablesGenerator scriptVariableSource = new CustomScriptVariableSource();
MessageProcessor<Object> processor = new GroovyScriptExecutingMessageProcessor(scriptSource, scriptVariableSource);
Object newResult = processor.processMessage(message);
assertFalse(newResult.equals(result)); // make sure that we get different nanotime verifying that resolveScriptVariables() is invoked

View File

@@ -64,7 +64,7 @@ public class GroovyScriptPayloadMessageProcessorTests {
public void testSimpleExecutionWithContext() throws Exception {
Message<?> message = MessageBuilder.withPayload("\"spam is $spam foo is $headers.foo\"")
.setHeader("foo", "bar").build();
ScriptVariableSource scriptVariableSource =
ScriptVariablesGenerator scriptVariableSource =
new DefaultScriptVariableSource(Collections.singletonMap("spam",(Object)"bucket"));
MessageProcessor<Object> processor = new GroovyCommandMessageProcessor(scriptVariableSource);
Object result = processor.processMessage(message);

View File

@@ -34,8 +34,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.groovy.DefaultScriptVariableSource;
import org.springframework.integration.groovy.ScriptVariableSource;
import org.springframework.integration.groovy.ScriptVariablesGenerator;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -129,8 +128,8 @@ public class GroovyServiceActivatorTests {
new ClassPathXmlApplicationContext("GroovyServiceActivatorTests-fail-withsource-context.xml", this.getClass());
}
public static class SampleScriptVariSource implements ScriptVariableSource{
public Map<String, Object> resolveScriptVariables(Message<?> message) {
public static class SampleScriptVariSource implements ScriptVariablesGenerator{
public Map<String, Object> generateScriptVariables(Message<?> message) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("foo", "foo");
variables.put("bar", "bar");