@Test(expectedExceptions = ClassCastException.class) public void testScriptExecutionWithNonBooleanReturnNoBinding() throws ConditionParsingException { String script = "\"a\".concat(\"b\")"; ConditionScript parsedScript = this.shell.parse(script); Assert.assertEquals(parsedScript.execute(new HashMap<String, Object>()), false); }
@Override public boolean execute(final Map<String, Object> boundVariables) { if (LOGGER.isDebugEnabled()) { StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append("The script is bound to the following variables:\n"); for (Entry<String, Object> entry : boundVariables.entrySet()) { msgBuilder.append("* ").append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } LOGGER.debug(msgBuilder.toString()); } Binding binding = new Binding(boundVariables); this.script.setBinding(binding); return (boolean) this.script.run(); }
GroovyConditionScript implements ConditionScript { @Override public boolean execute(final Map<String, Object> boundVariables) { if (LOGGER.isDebugEnabled()) { StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append("The script is bound to the following variables:\n"); for (Entry<String, Object> entry : boundVariables.entrySet()) { msgBuilder.append("* ").append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } LOGGER.debug(msgBuilder.toString()); } Binding binding = new Binding(boundVariables); this.script.setBinding(binding); return (boolean) this.script.run(); } }
GroovyConditionScript implements ConditionScript { @Override public boolean execute(final Map<String, Object> boundVariables) { if (LOGGER.isDebugEnabled()) { StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append("The script is bound to the following variables:\n"); for (Entry<String, Object> entry : boundVariables.entrySet()) { msgBuilder.append("* ").append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } LOGGER.debug(msgBuilder.toString()); } Binding binding = new Binding(boundVariables); this.script.setBinding(binding); return (boolean) this.script.run(); } GroovyConditionScript(final Script script); }
GroovyConditionScript implements ConditionScript { @Override public boolean execute(final Map<String, Object> boundVariables) { if (LOGGER.isDebugEnabled()) { StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append("The script is bound to the following variables:\n"); for (Entry<String, Object> entry : boundVariables.entrySet()) { msgBuilder.append("* ").append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } LOGGER.debug(msgBuilder.toString()); } Binding binding = new Binding(boundVariables); this.script.setBinding(binding); return (boolean) this.script.run(); } GroovyConditionScript(final Script script); @Override boolean execute(final Map<String, Object> boundVariables); }
GroovyConditionScript implements ConditionScript { @Override public boolean execute(final Map<String, Object> boundVariables) { if (LOGGER.isDebugEnabled()) { StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append("The script is bound to the following variables:\n"); for (Entry<String, Object> entry : boundVariables.entrySet()) { msgBuilder.append("* ").append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); } LOGGER.debug(msgBuilder.toString()); } Binding binding = new Binding(boundVariables); this.script.setBinding(binding); return (boolean) this.script.run(); } GroovyConditionScript(final Script script); @Override boolean execute(final Map<String, Object> boundVariables);  }