@Override public void addInstanceRules(RuleStore rs) { super.addInstanceRules(rs); Environment environment = this.initializationContext.getEnvironment(); rs.addRule(new ElementSelector("configuration/springProperty"), new SpringPropertyAction(environment)); rs.addRule(new ElementSelector("*/springProfile"), new SpringProfileAction(environment)); rs.addRule(new ElementSelector("*/springProfile/*"), new NOPAction()); }
rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
@Override protected void addInstanceRules(RuleStore rs) { rs.addRule(new ElementSelector("fruitShell"), new NOPAction()); }
@Before public void setUp() throws Exception { FileTestUtil.makeTestOutputDir(); HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>(); rulesMap.put(new ElementSelector("x"), new NOPAction()); rulesMap.put(new ElementSelector("x/include"), new IncludeAction()); rulesMap.put(new ElementSelector("x/stack"), stackAction); tc = new TrivialConfigurator(rulesMap); tc.setContext(context); }
@Before public void setUp() throws Exception { FileTestUtil.makeTestOutputDir(); HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>(); rulesMap.put(new ElementSelector("x"), new NOPAction()); rulesMap.put(new ElementSelector("x/include"), new IncludeAction()); rulesMap.put(new ElementSelector("x/findInclude"), new FindIncludeAction()); rulesMap.put(new ElementSelector("x/findInclude/include"), new ConditionalIncludeAction()); stackAction = new StackAction(); rulesMap.put(new ElementSelector("x/stack"), stackAction); tc = new TrivialConfigurator(rulesMap); tc.setContext(context); }
/** {@inheritDoc} */ @Override public void addInstanceRules(RuleStore ruleStore) { super.addInstanceRules(ruleStore); ruleStore.addRule(new ElementSelector("*/springProfile"), new SpringProfileAction()); ruleStore.addRule(new ElementSelector("*/springProfile/*"), new NOPAction()); ruleStore.addRule(new ElementSelector("configuration/springProperty"), new SpringPropertyAction()); }
void doTest(String filename, Integer expectedInt, Class<?> exceptionClass) throws Exception { rulesMap.put(new ElementSelector("test"), new NOPAction()); rulesMap.put(new ElementSelector("test/badBegin"), new BadBeginAction()); rulesMap.put(new ElementSelector("test/badBegin/touch"), new TouchAction()); rulesMap.put(new ElementSelector("test/badEnd"), new BadEndAction()); rulesMap.put(new ElementSelector("test/badEnd/touch"), new TouchAction()); rulesMap.put(new ElementSelector("test/hello"), new HelloAction()); rulesMap.put(new ElementSelector("test/isolate"), new NOPAction()); rulesMap.put(new ElementSelector("test/isolate/badEnd"), new BadEndAction()); rulesMap.put(new ElementSelector("test/isolate/badEnd/touch"), new TouchAction()); rulesMap.put(new ElementSelector("test/isolate/touch"), new TouchAction()); rulesMap.put(new ElementSelector("test/hello"), new HelloAction()); TrivialConfigurator tc = new TrivialConfigurator(rulesMap); tc.setContext(context); tc.doConfigure(CoreTestConstants.TEST_DIR_PREFIX + "input/joran/skip/" + filename); String str = context.getProperty(HelloAction.PROPERTY_KEY); assertEquals("Hello John Doe.", str); Integer i = (Integer) context.getObject(TouchAction.KEY); if (expectedInt == null) { assertNull(i); } else { assertEquals(expectedInt, i); } // check the existence of an ERROR status List<Status> statusList = sm.getCopyOfStatusList(); Status s0 = statusList.get(0); assertEquals(Status.ERROR, s0.getLevel()); assertTrue(s0.getThrowable().getClass() == exceptionClass); }
public List<FruitShell> doFirstPart(String filename) throws Exception { try { HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>(); rulesMap.put(new ElementSelector("group/fruitShell"), new FruitShellAction()); rulesMap.put(new ElementSelector("group/fruitShell/fruit"), new FruitFactoryAction()); rulesMap.put(new ElementSelector("group/fruitShell/fruit/*"), new NOPAction()); SimpleConfigurator simpleConfigurator = new SimpleConfigurator(rulesMap); simpleConfigurator.setContext(fruitContext); simpleConfigurator.doConfigure(CoreTestConstants.TEST_DIR_PREFIX + "input/joran/replay/" + filename); return fruitContext.getFruitShellList(); } catch (Exception je) { StatusPrinter.print(fruitContext); throw je; } }
@Override public void addInstanceRules(RuleStore rs) { super.addInstanceRules(rs); rs.addRule(new ElementSelector("configuration"), new ConfigurationAction()); rs.addRule(new ElementSelector("configuration/appender-ref"), new AppenderRefAction<IAccessEvent>()); rs.addRule(new ElementSelector("configuration/appender/sift"), new SiftAction()); rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("configuration/evaluator"), new EvaluatorAction()); // add if-then-else support rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction()); rs.addRule(new ElementSelector("configuration/include"), new IncludeAction()); }
rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if"), new IfAction()); rs.addRule(new ElementSelector("*/if/then"), new ThenAction()); rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction()); rs.addRule(new ElementSelector("*/if/else"), new ElseAction()); rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new Pattern("*/if"), new IfAction()); rs.addRule(new Pattern("*/if/then"), new ThenAction()); rs.addRule(new Pattern("*/if/then/*"), new NOPAction()); rs.addRule(new Pattern("*/if/else"), new ElseAction()); rs.addRule(new Pattern("*/if/else/*"), new NOPAction());
@SuppressWarnings("deprecation") @Override public void addInstanceRules(RuleStore rs) { // parent rules already added super.addInstanceRules(rs); rs.addRule(new ElementSelector("configuration"), new ConfigurationAction()); rs.addRule(new ElementSelector("configuration/contextName"), new ContextNameAction()); rs.addRule(new ElementSelector("configuration/contextListener"), new LoggerContextListenerAction()); rs.addRule(new ElementSelector("configuration/appender/sift"), new SiftAction()); rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("configuration/logger"), new LoggerAction()); rs.addRule(new ElementSelector("configuration/logger/level"), new LevelAction()); rs.addRule(new ElementSelector("configuration/root"), new RootLoggerAction()); rs.addRule(new ElementSelector("configuration/root/level"), new LevelAction()); rs.addRule(new ElementSelector("configuration/logger/appender-ref"), new AppenderRefAction<ILoggingEvent>()); rs.addRule(new ElementSelector("configuration/root/appender-ref"), new AppenderRefAction<ILoggingEvent>()); rs.addRule(new ElementSelector("configuration/include"), new IncludeAction()); rs.addRule(new ElementSelector("configuration/includes"), new FindIncludeAction()); rs.addRule(new ElementSelector("configuration/includes/include"), new ConditionalIncludeAction()); rs.addRule(new ElementSelector("configuration/receiver"), new ReceiverAction()); }
rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction());