Java 类ch.qos.logback.core.joran.action.NOPAction 实例源码

项目:bartleby    文件:FruitConfigurationTest.java   
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_SRC_PREFIX + "input/joran/replay/"
          + filename);

      return fruitContext.getFruitShellList();
    } catch (Exception je) {
      StatusPrinter.print(fruitContext);
      throw je;
    }
  }
项目:bartleby    文件:JoranConfigurator.java   
@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());

  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());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringBootJoranConfigurator.java   
@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(this.initializationContext.getEnvironment()));
    rs.addRule(new ElementSelector("*/springProfile/*"), new NOPAction());
}
项目:spring-boot-concourse    文件:SpringBootJoranConfigurator.java   
@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(this.initializationContext.getEnvironment()));
    rs.addRule(new ElementSelector("*/springProfile/*"), new NOPAction());
}
项目:bartleby    文件:IfThenElseTest.java   
@Before
public void setUp() throws Exception {
  HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>();
  rulesMap.put(new ElementSelector("x"), new NOPAction());
  rulesMap.put(new ElementSelector("x/stack"), stackAction);
  rulesMap.put(new ElementSelector("x/property"), new PropertyAction());
  rulesMap.put(new ElementSelector("*/if"), new IfAction());
  rulesMap.put(new ElementSelector("*/if/then"), new ThenAction());
  rulesMap.put(new ElementSelector("*/if/then/*"), new NOPAction());
  rulesMap.put(new ElementSelector("*/if/else"), new ElseAction());
  rulesMap.put(new ElementSelector("*/if/else/*"), new NOPAction());

  tc = new TrivialConfigurator(rulesMap);
  tc.setContext(context);
}
项目:bartleby    文件:IfThenElseAndIncludeCompositionTest.java   
@Before
public void setUp() throws Exception {
  HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>();
  rulesMap.put(new ElementSelector("x"), new NOPAction());
  rulesMap.put(new ElementSelector("x/stack"), stackAction);
  rulesMap.put(new ElementSelector("*/if"), new IfAction());
  rulesMap.put(new ElementSelector("*/if/then"), new ThenAction());
  rulesMap.put(new ElementSelector("*/if/then/*"), new NOPAction());
  rulesMap.put(new ElementSelector("*/if/else"), new ElseAction());
  rulesMap.put(new ElementSelector("*/if/else/*"), new NOPAction());
  rulesMap.put(new ElementSelector("x/include"), new IncludeAction());

  tc = new TrivialConfigurator(rulesMap);
  tc.setContext(context);
}
项目:bartleby    文件:SkippingInInterpreterTest.java   
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_SRC_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);
}
项目:contestparser    文件:SpringBootJoranConfigurator.java   
@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(this.initializationContext.getEnvironment()));
    rs.addRule(new ElementSelector("*/springProfile/*"), new NOPAction());
}
项目:logback-access-spring-boot-starter    文件:LogbackAccessJoranConfigurator.java   
/** {@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());
}
项目:bartleby    文件:FruitConfigurator.java   
@Override
protected void addInstanceRules(RuleStore rs) {
  rs.addRule(new ElementSelector("fruitShell"), new NOPAction());
}
项目:bartleby    文件:JoranConfigurator.java   
@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/insertFromJNDI"),
      new InsertFromJNDIAction());
  rs.addRule(new ElementSelector("configuration/evaluator"), new EvaluatorAction());

  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());
  rs.addRule(new ElementSelector("configuration/root/appender-ref"),
      new AppenderRefAction());

  // 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());

  // add jmxConfigurator only if we have JMX available.
  // If running under JDK 1.4 (retrotranslateed logback) then we
  // might not have JMX.
  if (PlatformInfo.hasJMXObjectName()) {
    rs.addRule(new ElementSelector("configuration/jmxConfigurator"),
        new JMXConfiguratorAction());
  }
  rs.addRule(new ElementSelector("configuration/include"), new IncludeAction());

  rs.addRule(new ElementSelector("configuration/consolePlugin"),
      new ConsolePluginAction());

  rs.addRule(new ElementSelector("configuration/receiver"),
      new ReceiverAction());

}