Exemplo n.º 1
0
 @Test
 public void good() throws JoranException {
   simpleConfigurator.doConfigure(DEFINE_INPUT_DIR + GOOD_XML);
   InterpretationContext ic = simpleConfigurator.getInterpreter().getInterpretationContext();
   String inContextFoo = ic.getProperty("foo");
   assertEquals("monster", inContextFoo);
 }
Exemplo n.º 2
0
 @Test
 public void noClass() throws JoranException {
   simpleConfigurator.doConfigure(DEFINE_INPUT_DIR + NOCLASS_XML);
   String inContextFoo = context.getProperty("foo");
   assertNull(inContextFoo);
   checker.assertContainsMatch(
       Status.ERROR, "Missing class name for property definer. Near \\[define\\] line 1");
 }
Exemplo n.º 3
0
  @Before
  public void setUp() throws Exception {

    HashMap<Pattern, Action> rulesMap = new HashMap<Pattern, Action>();
    rulesMap.put(new Pattern("define"), new DefinePropertyAction());
    simpleConfigurator = new SimpleConfigurator(rulesMap);
    simpleConfigurator.setContext(context);
  }
Exemplo n.º 4
0
 @Test
 public void testBadClass() throws JoranException {
   simpleConfigurator.doConfigure(DEFINE_INPUT_DIR + BADCLASS_XML);
   // get from context
   String inContextFoo = context.getProperty("foo");
   assertNull(inContextFoo);
   // check context errors
   checker.assertContainsMatch(Status.ERROR, "Could not create an PropertyDefiner of type");
 }
Exemplo n.º 5
0
 @Test
 public void noName() throws JoranException {
   simpleConfigurator.doConfigure(DEFINE_INPUT_DIR + NONAME_XML);
   // get from context
   String inContextFoo = context.getProperty("foo");
   assertNull(inContextFoo);
   // check context errors
   checker.assertContainsMatch(
       Status.ERROR, "Missing property name for property definer. Near \\[define\\] line 1");
 }