@Test public void cleanUp_specified() throws Exception { put("testing.*=other"); Map<String, String> conf = createConf(); declare(conf, "default", FailCommandScriptHandler.class); declare(conf, "other", FailCommandScriptHandler.class); declare(conf, "specified", FailCommandScriptHandler.class); declare(conf, ExecutionScriptHandlerDispatcher.KEY_CLEANUP, "specified"); CommandScriptHandlerDispatcher dispatcher = create(conf); ExecutionContext something = context("testing", ExecutionPhase.CLEANUP); try { dispatcher.cleanUp(ExecutionMonitor.NULL, something); fail(); } catch (MessageException e) { assertThat(e.message, is("specified")); assertThat(e.context.getPhase(), is(ExecutionPhase.CLEANUP)); } }
@Override public void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { ExecutionScriptHandler<T> target; if (forceCleanUp != null) { target = delegations.get(forceCleanUp); } else { target = resolve(context, null); } assert target != null; YSLOG.info("I01003", target.getHandlerId(), context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId()); target.cleanUp(monitor, context); }
ExecutionScriptHandlerDispatcher implements ExecutionScriptHandler<T> { @Override public void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { ExecutionScriptHandler<T> target; if (forceCleanUp != null) { target = delegations.get(forceCleanUp); } else { target = resolve(context, null); } assert target != null; YSLOG.info("I01003", target.getHandlerId(), context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId()); target.cleanUp(monitor, context); } }
ExecutionScriptHandlerDispatcher implements ExecutionScriptHandler<T> { @Override public void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { ExecutionScriptHandler<T> target; if (forceCleanUp != null) { target = delegations.get(forceCleanUp); } else { target = resolve(context, null); } assert target != null; YSLOG.info("I01003", target.getHandlerId(), context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId()); target.cleanUp(monitor, context); } protected  ExecutionScriptHandlerDispatcher(Class<? extends ExecutionScriptHandler<T>> handlerKind); }
ExecutionScriptHandlerDispatcher implements ExecutionScriptHandler<T> { @Override public void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { ExecutionScriptHandler<T> target; if (forceCleanUp != null) { target = delegations.get(forceCleanUp); } else { target = resolve(context, null); } assert target != null; YSLOG.info("I01003", target.getHandlerId(), context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId()); target.cleanUp(monitor, context); } protected  ExecutionScriptHandlerDispatcher(Class<? extends ExecutionScriptHandler<T>> handlerKind); @Override void configure(ServiceProfile<?> profile); @Override String getHandlerId(); @Override String getResourceId(
            ExecutionContext context,
            ExecutionScript script); @Override Map<String, String> getProperties(
            ExecutionContext context,
            ExecutionScript script); @Override Map<String, String> getEnvironmentVariables(
            ExecutionContext context,
            ExecutionScript script); @Override void setUp(ExecutionMonitor monitor, ExecutionContext context); @Override void execute(
            ExecutionMonitor monitor,
            ExecutionContext context,
            T script); @Override void cleanUp(ExecutionMonitor monitor, ExecutionContext context); }
ExecutionScriptHandlerDispatcher implements ExecutionScriptHandler<T> { @Override public void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException { ExecutionScriptHandler<T> target; if (forceCleanUp != null) { target = delegations.get(forceCleanUp); } else { target = resolve(context, null); } assert target != null; YSLOG.info("I01003", target.getHandlerId(), context.getBatchId(), context.getFlowId(), context.getPhase(), context.getExecutionId()); target.cleanUp(monitor, context); } protected  ExecutionScriptHandlerDispatcher(Class<? extends ExecutionScriptHandler<T>> handlerKind); @Override void configure(ServiceProfile<?> profile); @Override String getHandlerId(); @Override String getResourceId(
            ExecutionContext context,
            ExecutionScript script); @Override Map<String, String> getProperties(
            ExecutionContext context,
            ExecutionScript script); @Override Map<String, String> getEnvironmentVariables(
            ExecutionContext context,
            ExecutionScript script); @Override void setUp(ExecutionMonitor monitor, ExecutionContext context); @Override void execute(
            ExecutionMonitor monitor,
            ExecutionContext context,
            T script); @Override void cleanUp(ExecutionMonitor monitor, ExecutionContext context);  }