@Test public void executeAsynch() throws Exception { activity.configure(configBean); Map<String, Object> inputs = new HashMap<String, Object>(); inputs.put("firstInput", "hello"); Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>(); expectedOutputTypes.put("simpleOutput", String.class); expectedOutputTypes.put("moreOutputs", String.class); Map<String, Object> outputs = ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputTypes); assertEquals("Unexpected outputs", 2, outputs.size()); assertEquals("simple", outputs.get("simpleOutput")); assertEquals(Arrays.asList("Value 1", "Value 2"), outputs.get("moreOutputs")); }
@SuppressWarnings("unchecked") @Override public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) { callback.requestRun(new Runnable() { public void run() { InvocationContext context = callback.getContext(); ReferenceService referenceService = context.getReferenceService(); String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT), String.class, context); boolean optionalPorts = configBean.getExampleString().equals("specialCase"); List<byte[]> special = null; if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) { special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class, context); } Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); String simpleValue = "simple"; T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context); outputs.put(OUT_SIMPLE_OUTPUT, simpleRef); List<String> moreValues = new ArrayList<String>(); moreValues.add("Value 1"); moreValues.add("Value 2"); T2Reference moreRef = referenceService.register(moreValues, 1, true, context); outputs.put(OUT_MORE_OUTPUTS, moreRef); if (optionalPorts) { String report = "Everything OK"; outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context)); } callback.receiveResult(outputs, new int[0]); } }); }
RAWvernaActivity extends AbstractAsynchronousActivity<RAWvernaActivityConfigurationBean> implements
    AsynchronousActivity<RAWvernaActivityConfigurationBean> { @SuppressWarnings("unchecked") @Override public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) { callback.requestRun(new Runnable() { public void run() { InvocationContext context = callback.getContext(); ReferenceService referenceService = context.getReferenceService(); String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT), String.class, context); boolean optionalPorts = configBean.getExampleString().equals("specialCase"); List<byte[]> special = null; if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) { special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class, context); } Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); String simpleValue = "simple"; T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context); outputs.put(OUT_SIMPLE_OUTPUT, simpleRef); List<String> moreValues = new ArrayList<String>(); moreValues.add("Value 1"); moreValues.add("Value 2"); T2Reference moreRef = referenceService.register(moreValues, 1, true, context); outputs.put(OUT_MORE_OUTPUTS, moreRef); if (optionalPorts) { String report = "Everything OK"; outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context)); } callback.receiveResult(outputs, new int[0]); } }); } }
RAWvernaActivity extends AbstractAsynchronousActivity<RAWvernaActivityConfigurationBean> implements
    AsynchronousActivity<RAWvernaActivityConfigurationBean> { @SuppressWarnings("unchecked") @Override public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) { callback.requestRun(new Runnable() { public void run() { InvocationContext context = callback.getContext(); ReferenceService referenceService = context.getReferenceService(); String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT), String.class, context); boolean optionalPorts = configBean.getExampleString().equals("specialCase"); List<byte[]> special = null; if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) { special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class, context); } Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); String simpleValue = "simple"; T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context); outputs.put(OUT_SIMPLE_OUTPUT, simpleRef); List<String> moreValues = new ArrayList<String>(); moreValues.add("Value 1"); moreValues.add("Value 2"); T2Reference moreRef = referenceService.register(moreValues, 1, true, context); outputs.put(OUT_MORE_OUTPUTS, moreRef); if (optionalPorts) { String report = "Everything OK"; outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context)); } callback.receiveResult(outputs, new int[0]); } }); }  }
RAWvernaActivity extends AbstractAsynchronousActivity<RAWvernaActivityConfigurationBean> implements
    AsynchronousActivity<RAWvernaActivityConfigurationBean> { @SuppressWarnings("unchecked") @Override public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) { callback.requestRun(new Runnable() { public void run() { InvocationContext context = callback.getContext(); ReferenceService referenceService = context.getReferenceService(); String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT), String.class, context); boolean optionalPorts = configBean.getExampleString().equals("specialCase"); List<byte[]> special = null; if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) { special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class, context); } Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); String simpleValue = "simple"; T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context); outputs.put(OUT_SIMPLE_OUTPUT, simpleRef); List<String> moreValues = new ArrayList<String>(); moreValues.add("Value 1"); moreValues.add("Value 2"); T2Reference moreRef = referenceService.register(moreValues, 1, true, context); outputs.put(OUT_MORE_OUTPUTS, moreRef); if (optionalPorts) { String report = "Everything OK"; outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context)); } callback.receiveResult(outputs, new int[0]); } }); }  @Override void configure(RAWvernaActivityConfigurationBean configBean); @SuppressWarnings("unchecked") @Override void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback); @Override RAWvernaActivityConfigurationBean getConfiguration(); }
RAWvernaActivity extends AbstractAsynchronousActivity<RAWvernaActivityConfigurationBean> implements
    AsynchronousActivity<RAWvernaActivityConfigurationBean> { @SuppressWarnings("unchecked") @Override public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) { callback.requestRun(new Runnable() { public void run() { InvocationContext context = callback.getContext(); ReferenceService referenceService = context.getReferenceService(); String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT), String.class, context); boolean optionalPorts = configBean.getExampleString().equals("specialCase"); List<byte[]> special = null; if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) { special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class, context); } Map<String, T2Reference> outputs = new HashMap<String, T2Reference>(); String simpleValue = "simple"; T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context); outputs.put(OUT_SIMPLE_OUTPUT, simpleRef); List<String> moreValues = new ArrayList<String>(); moreValues.add("Value 1"); moreValues.add("Value 2"); T2Reference moreRef = referenceService.register(moreValues, 1, true, context); outputs.put(OUT_MORE_OUTPUTS, moreRef); if (optionalPorts) { String report = "Everything OK"; outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context)); } callback.receiveResult(outputs, new int[0]); } }); }  @Override void configure(RAWvernaActivityConfigurationBean configBean); @SuppressWarnings("unchecked") @Override void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback); @Override RAWvernaActivityConfigurationBean getConfiguration();  }