@Test public void testFailEvaluationToFalse() throws Exception { String[] directives = new String[] { "fail count > 10", }; List<Row> rows = Arrays.asList( new Row("count", 1) ); TestingRig.execute(directives, rows); }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ELContext ctx = new ELContext(context, el, row); try { ELResult result = el.execute(ctx); if (result.getBoolean()) { throw new DirectiveExecutionException( NAME, String.format("Condition '%s' evaluated to true. Terminating processing.", condition)); } } catch (ELException e) { throw new DirectiveExecutionException(NAME, e.getMessage(), e); } } return rows; }
Fail implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ELContext ctx = new ELContext(context, el, row); try { ELResult result = el.execute(ctx); if (result.getBoolean()) { throw new DirectiveExecutionException( NAME, String.format("Condition '%s' evaluated to true. Terminating processing.", condition)); } } catch (ELException e) { throw new DirectiveExecutionException(NAME, e.getMessage(), e); } } return rows; } }
Fail implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ELContext ctx = new ELContext(context, el, row); try { ELResult result = el.execute(ctx); if (result.getBoolean()) { throw new DirectiveExecutionException( NAME, String.format("Condition '%s' evaluated to true. Terminating processing.", condition)); } } catch (ELException e) { throw new DirectiveExecutionException(NAME, e.getMessage(), e); } } return rows; }  }
Fail implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ELContext ctx = new ELContext(context, el, row); try { ELResult result = el.execute(ctx); if (result.getBoolean()) { throw new DirectiveExecutionException( NAME, String.format("Condition '%s' evaluated to true. Terminating processing.", condition)); } } catch (ELException e) { throw new DirectiveExecutionException(NAME, e.getMessage(), e); } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); }
Fail implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ELContext ctx = new ELContext(context, el, row); try { ELResult result = el.execute(ctx); if (result.getBoolean()) { throw new DirectiveExecutionException( NAME, String.format("Condition '%s' evaluated to true. Terminating processing.", condition)); } } catch (ELException e) { throw new DirectiveExecutionException(NAME, e.getMessage(), e); } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); static final String NAME; }