use of com.adaptris.core.services.EmbeddedScriptingService in project interlok by adaptris.
the class PollingTriggerTest method testTrigger_TemplateFails.
@Test
public void testTrigger_TemplateFails() throws Exception {
// setContent must have a encoding...
String script = "message.setContent('" + PAYLOAD + "')";
Trigger trigger = new Trigger();
MockMessageProducer mockProducer = new MockMessageProducer();
Channel c = createChannel(new PollingTrigger(trigger, new DynamicPollingTemplate(new EmbeddedScriptingService().withScript("nashorn", script))), mockProducer);
try {
BaseCase.start(c);
trigger.fire();
assertEquals(0, mockProducer.getMessages().size());
} finally {
BaseCase.stop(c);
}
}
use of com.adaptris.core.services.EmbeddedScriptingService in project interlok by adaptris.
the class PollingTriggerTest method testTriggerWithDynamicTemplate.
@Test
public void testTriggerWithDynamicTemplate() throws Exception {
Trigger trigger = new Trigger();
String script = "message.setContent('" + PAYLOAD + "', 'UTF-8')";
MockMessageProducer mockProducer = new MockMessageProducer();
Channel c = createChannel(new PollingTrigger(trigger, new DynamicPollingTemplate(new EmbeddedScriptingService().withScript("nashorn", script))), mockProducer);
try {
BaseCase.start(c);
trigger.fire();
AdaptrisMessage msg = mockProducer.getMessages().get(0);
assertEquals(PAYLOAD, msg.getContent());
} finally {
BaseCase.stop(c);
}
}
use of com.adaptris.core.services.EmbeddedScriptingService in project interlok by adaptris.
the class NashornCheckerTest method createAdapterConfig.
private Adapter createAdapterConfig(boolean hasNashorn) {
Adapter result = new Adapter();
result.setUniqueId(GUID.safeUUID());
result.getSharedComponents().addService(new EmbeddedScriptingService(GUID.safeUUID()).withScript("jruby", ""));
result.getSharedComponents().addService(new EmbeddedScriptingService(GUID.safeUUID()).withScript("jruby", ""));
result.getSharedComponents().addService(new EmbeddedScriptingService(GUID.safeUUID()).withScript("jruby", ""));
if (hasNashorn) {
result.getSharedComponents().addService(new EmbeddedScriptingService("explicit_nashorn").withScript("nashorn", ""));
}
return result;
}
Aggregations