@Test
public void testLoadNodeBeanForEmbeddedFlow() throws Exception {

  final NodeBeanLoader loader = new NodeBeanLoader();
  final NodeBean nodeBean = loader.load(ExecutionsTestUtil.getFlowFile(
      EMBEDDED_FLOW_YML_TEST_DIR, EMBEDDED_FLOW_YML_FILE));
  validateNodeBean(nodeBean, EMBEDDED_FLOW_NAME, Constants.FLOW_NODE_TYPE, FLOW_CONFIG_KEY,
      FLOW_CONFIG_VALUE, 4, null);
  validateNodeBean(nodeBean.getNodes().get(0), SHELL_END, TYPE_NOOP, null,
      null, 0, Arrays.asList(SHELL_PWD, SHELL_ECHO, EMBEDDED_FLOW1));
  validateNodeBean(nodeBean.getNodes().get(1), SHELL_PWD, TYPE_COMMAND, TYPE_COMMAND,
      PWD_COMMAND, 0, null);
  validateNodeBean(nodeBean.getNodes().get(2), SHELL_ECHO, TYPE_COMMAND, TYPE_COMMAND,
      ECHO_COMMAND, 0, null);
  validateNodeBean(nodeBean.getNodes().get(3), EMBEDDED_FLOW1, Constants.FLOW_NODE_TYPE,
      FLOW_CONFIG_KEY, FLOW_CONFIG_VALUE, 4, null);
  // Verify nodes in embedded_flow1 are loaded correctly.
  final NodeBean embeddedNodeBean1 = nodeBean.getNodes().get(3);
  validateNodeBean(embeddedNodeBean1.getNodes().get(0), SHELL_END, TYPE_NOOP, null, null, 0,
      Arrays.asList(SHELL_ECHO, EMBEDDED_FLOW2));
  validateNodeBean(embeddedNodeBean1.getNodes().get(1), SHELL_ECHO, TYPE_COMMAND, TYPE_COMMAND,
      ECHO_COMMAND_1, 0, null);
  validateNodeBean(embeddedNodeBean1.getNodes().get(2), EMBEDDED_FLOW2, Constants.FLOW_NODE_TYPE,
      FLOW_CONFIG_KEY, FLOW_CONFIG_VALUE, 2, Arrays.asList(SHELL_BASH));
  validateNodeBean(embeddedNodeBean1.getNodes().get(3), SHELL_BASH, TYPE_COMMAND, TYPE_COMMAND,
      BASH_COMMAND, 0, null);
  // Verify nodes in embedded_flow2 are loaded correctly.
  validateNodeBean(embeddedNodeBean1.getNodes().get(2).getNodes().get(0), SHELL_END, TYPE_NOOP,
      null,
      null, 0, Arrays.asList(SHELL_PWD));
  validateNodeBean(embeddedNodeBean1.getNodes().get(2).getNodes().get(1), SHELL_PWD, TYPE_COMMAND,
      TYPE_COMMAND, PWD_COMMAND, 0, null);
}