BeanshellActivity extends AbstractAsynchronousDependencyActivity { @Override public void configure(JsonNode json) { this.json = json; checkGranularDepths(); } BeanshellActivity(ApplicationConfiguration applicationConfiguration); @Override JsonNode getConfiguration(); @Override void configure(JsonNode json); ActivityInputPort getInputPort(String name); @Override void executeAsynch(final Map<String, T2Reference> data,
			final AsynchronousActivityCallback callback); static final String URI; }
@Test public void simpleScript() throws Exception { BeanshellActivity activity = new BeanshellActivity(null); Edits edits = new EditsImpl(); edits.getAddActivityInputPortEdit(activity, new ActivityInputPortImpl("input", 0, false, null, String.class)).doEdit(); edits.getAddActivityOutputPortEdit(activity, new ActivityOutputPortImpl("output", 0, 0)).doEdit(); configuration.put("script", "String output = input + \"_returned\";"); activity.configure(configuration); assertEquals("There should be 1 input port",1,activity.getInputPorts().size()); assertEquals("There should be 1 output port",1,activity.getOutputPorts().size()); assertEquals("The input should be called input", "input",((AbstractPort)activity.getInputPorts().toArray()[0]).getName()); assertEquals("The output should be called output", "output",((AbstractPort)activity.getOutputPorts().toArray()[0]).getName()); Map<String,Object> inputs = new HashMap<String, Object>(); inputs.put("input", "aString"); Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>(); expectedOutputs.put("output", String.class); Map<String,Object> outputs = ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs); assertTrue("there should be an output named output",outputs.containsKey("output")); assertEquals("output should have the value aString_returned","aString_returned",outputs.get("output")); }