RuleEngine extends EventProcessor { @Override public void init() throws InitializationException { resourcePath = resolveResourcePath(); rulesURI = getRulesDirectory(); }  @Override void push(EventContext ctx); @Override void init(); @Override void start(LifeCycleEvent event); @Override void stop(); @Override String getName();  }
@Test public void testDecisionTable() throws Exception { String newResourcePath = AllTests.getAbsoluteFixturePath() .resolve("statuscache/rules/dtable/").toString(); config.setResourcePath(newResourcePath); RuleEngine rules = new RuleEngine(); rules.init(); EventGrab grab = new EventGrab(); List<EventProcessor> processors = new ArrayList<EventProcessor>(); processors.add(rules); processors.add(grab); CommandCounter commandCounter = new CommandCounter(); StatusCache cache = createCache(processors, "commandCounter", commandCounter, "count"); Switch sw = new Switch(555, "test555", "on", Switch.State.ON); cache.update(sw); Assert.assertTrue( "Expected 'triggered', got '" + commandCounter.lastValue + "'", commandCounter.lastValue.equals("triggered") ); sw = new Switch(666, "test666", "on", Switch.State.ON); cache.update(sw); Assert.assertTrue(commandCounter.lastValue.equals("started")); sw = new Switch(777, "test777", "on", Switch.State.ON); cache.update(sw); Assert.assertTrue(commandCounter.lastValue.equals("good")); }