NodeBeanLoader { public FlowTrigger toFlowTrigger(final FlowTriggerBean flowTriggerBean) { if (flowTriggerBean == null) { return null; } else { validateFlowTriggerBean(flowTriggerBean); if (flowTriggerBean.getMaxWaitMins() != null && flowTriggerBean.getMaxWaitMins() > Constants.DEFAULT_FLOW_TRIGGER_MAX_WAIT_TIME .toMinutes()) { flowTriggerBean.setMaxWaitMins(Constants.DEFAULT_FLOW_TRIGGER_MAX_WAIT_TIME.toMinutes()); } final Duration duration = flowTriggerBean.getMaxWaitMins() == null ? null : Duration .ofMinutes(flowTriggerBean.getMaxWaitMins()); return new FlowTrigger( new CronSchedule(flowTriggerBean.getSchedule().get(FlowTriggerProps.SCHEDULE_VALUE)), flowTriggerBean.getTriggerDependencies().stream() .map(d -> new FlowTriggerDependency(d.getName(), d.getType(), d.getParams())) .collect(Collectors.toList()), duration); } }  NodeBean load(final File flowFile); boolean validate(final NodeBean nodeBean); AzkabanNode toAzkabanNode(final NodeBean nodeBean); FlowTrigger toFlowTrigger(final FlowTriggerBean flowTriggerBean); String getFlowName(final File flowFile);  }
@Test public void testToFlowTrigger() throws Exception { final NodeBeanLoader loader = new NodeBeanLoader(); final NodeBean nodeBean = loader.load(ExecutionsTestUtil.getFlowFile( TRIGGER_FLOW_YML_TEST_DIR, TRIGGER_FLOW_YML_FILE)); final FlowTrigger flowTrigger = loader.toFlowTrigger(nodeBean.getTrigger()); validateFlowTrigger(flowTrigger, MAX_WAIT_MINS, CRON_EXPRESSION, 2); validateTriggerDependency(flowTrigger, TRIGGER_NAME_1, TRIGGER_TYPE, PARAMS_1); validateTriggerDependency(flowTrigger, TRIGGER_NAME_2, TRIGGER_TYPE, PARAMS_2); }