@Inject public TriggerManager(final Props props, final TriggerLoader triggerLoader, final ExecutorManagerAdapter executorManagerAdapter) throws TriggerManagerException { requireNonNull(props); requireNonNull(executorManagerAdapter); this.triggerLoader = requireNonNull(triggerLoader); final long scannerInterval = props.getLong("trigger.scan.interval", DEFAULT_SCANNER_INTERVAL_MS); this.runnerThread = new TriggerScannerThread(scannerInterval); this.checkerTypeLoader = new CheckerTypeLoader(); this.actionTypeLoader = new ActionTypeLoader(); try { this.checkerTypeLoader.init(props); this.actionTypeLoader.init(props); } catch (final Exception e) { throw new TriggerManagerException(e); } Condition.setCheckerLoader(this.checkerTypeLoader); Trigger.setActionTypeLoader(this.actionTypeLoader); logger.info("TriggerManager loaded."); }
@Before public void setup() throws TriggerException { this.checkerLoader = new CheckerTypeLoader(); this.checkerLoader.init(new Props()); Condition.setCheckerLoader(this.checkerLoader); this.actionLoader = new ActionTypeLoader(); this.actionLoader.init(new Props()); Trigger.setActionTypeLoader(this.actionLoader); }
@Ignore @Test public void jsonConversionTest() throws Exception { final ActionTypeLoader loader = new ActionTypeLoader(); loader.init(new Props()); final ExecutionOptions options = new ExecutionOptions(); final List<Object> disabledJobs = new ArrayList<>(); options.setDisabledJobs(disabledJobs); final ExecuteFlowAction executeFlowAction = new ExecuteFlowAction("ExecuteFlowAction", 1, "testproject", "testflow", "azkaban", options, null); final Object obj = executeFlowAction.toJson(); final ExecuteFlowAction action = (ExecuteFlowAction) loader.createActionFromJson(ExecuteFlowAction.type, obj); assertTrue(executeFlowAction.getProjectId() == action.getProjectId()); assertTrue(executeFlowAction.getFlowName().equals(action.getFlowName())); assertTrue(executeFlowAction.getSubmitUser().equals(action.getSubmitUser())); }
@BeforeClass public static void prepare() throws Exception { dbOperator = azkaban.test.Utils.initTestDB(); final CheckerTypeLoader checkerTypeLoader = new CheckerTypeLoader(); final ActionTypeLoader actionTypeLoader = new ActionTypeLoader(); try { checkerTypeLoader.init(null); actionTypeLoader.init(null); } catch (final Exception e) { throw new TriggerManagerException(e); } Condition.setCheckerLoader(checkerTypeLoader); Trigger.setActionTypeLoader(actionTypeLoader); checkerTypeLoader.registerCheckerType(BasicTimeChecker.type, BasicTimeChecker.class); actionTypeLoader.registerActionType(ExecuteFlowAction.type, ExecuteFlowAction.class); }
@Inject public TriggerManager(final Props props, final TriggerLoader triggerLoader, final ExecutorManager executorManager) throws TriggerManagerException { requireNonNull(props); requireNonNull(executorManager); this.triggerLoader = requireNonNull(triggerLoader); final long scannerInterval = props.getLong("trigger.scan.interval", DEFAULT_SCANNER_INTERVAL_MS); this.runnerThread = new TriggerScannerThread(scannerInterval); this.checkerTypeLoader = new CheckerTypeLoader(); this.actionTypeLoader = new ActionTypeLoader(); try { this.checkerTypeLoader.init(props); this.actionTypeLoader.init(props); } catch (final Exception e) { throw new TriggerManagerException(e); } Condition.setCheckerLoader(this.checkerTypeLoader); Trigger.setActionTypeLoader(this.actionTypeLoader); logger.info("TriggerManager loaded."); }
public TriggerManager(Props props, TriggerLoader triggerLoader, ExecutorManager executorManager) throws TriggerManagerException { this.triggerLoader = triggerLoader; long scannerInterval = props.getLong("trigger.scan.interval", DEFAULT_SCANNER_INTERVAL_MS); runnerThread = new TriggerScannerThread(scannerInterval); checkerTypeLoader = new CheckerTypeLoader(); actionTypeLoader = new ActionTypeLoader(); try { checkerTypeLoader.init(props); actionTypeLoader.init(props); } catch (Exception e) { throw new TriggerManagerException(e); } Condition.setCheckerLoader(checkerTypeLoader); Trigger.setActionTypeLoader(actionTypeLoader); executorManager.addListener(listener); logger.info("TriggerManager loaded."); }