MVELEventProcessor extends EventProcessor { public java.io.Serializable process(String source, java.io.Serializable event, int retriesLeft) throws Exception { java.io.Serializable ret=null; if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Process event '"+event+" from source '"+source +"' on MVEL Event Processor '"+getScript() +"'"); } if (_scriptExpression != null) { java.util.Map<String,Object> vars= new java.util.HashMap<String, Object>(); vars.put("source", source); vars.put("event", event); vars.put("retriesLeft", retriesLeft); vars.put("epc", _context); synchronized (this) { _context.handle(null); MVEL.executeExpression(_scriptExpression, vars); ret = (java.io.Serializable)_context.getResult(); } if (ret instanceof Exception) { throw (Exception)ret; } } return (ret); }  void init(); String getScript(); void setScript(String script); java.io.Serializable process(String source,
                java.io.Serializable event, int retriesLeft);  }
@Test public void testProcess() { MVELEventProcessor ep=new MVELEventProcessor(); ep.setScript("script/Process.mvel"); try { ep.init(); } catch (Exception e) { fail("Failed to initialize: "+e); } ActivityUnit au=new ActivityUnit(); RequestReceived rr=new RequestReceived(); au.getActivityTypes().add(rr); java.util.Properties props=null; try { props = (java.util.Properties)ep.process(SOURCE_VALUE, au, 1); } catch (Exception e) { fail("Failed to process: "+e); } if (props == null) { fail("Properties not returned"); } if (!props.get("source").equals(SOURCE_VALUE)) { fail("Source value incorrect"); } if (props.get("event") != au) { fail("Event incorrect"); } if (((Integer)props.get("retriesLeft")) != 1) { fail("Retries Left incorrect"); } }