@Test
 public void testInvokeFlowFromScript() throws IOException {
   IntegrationContext ic =
       (IntegrationContext)
           builder.build(new FileInputStream("src/test/resources/messageflow1.groovy"));
   MessageFlow flow1 = ic.getMessageFlowByName("flow1");
   flow1.send("hello");
 }
  @Test
  public void testInvokeFlowFromJava()
      throws CompilationFailedException, InstantiationException, IllegalAccessException {
    builder.setAutoCreateApplicationContext(false);
    String flowScript1 =
        "messageFlow(outputChannel:'outputChannel1') {transform({it.toUpperCase()})}";

    MessageFlow flow1 =
        (MessageFlow) builder.build(new ByteArrayInputStream(flowScript1.getBytes()));

    String flowScript2 =
        ("messageFlow(inputChannel:'outputChannel1'){ filter({it.class == String})\ntransform({it.toLowerCase()})}");

    builder.build(new ByteArrayInputStream(flowScript2.getBytes()));

    Object response =
        builder.getIntegrationContext().sendAndReceive(flow1.getInputChannel(), "hello");

    assertEquals("hello", response);
  }