You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ho...@apache.org on 2004/12/05 22:43:03 UTC

cvs commit: logging-log4j/tests/src/java/org/apache/joran InterpreterTest.java

hoju        2004/12/05 13:43:03

  Modified:    examples/src/joran/implicit PrintMe.java
               src/java/org/apache/joran/action Action.java
               tests/src/java/org/apache/joran InterpreterTest.java
  Removed:     examples/src/joran/implicit NOPAction.java
  Log:
  Get rid of compile-time dependencies between test sources and example sources.  Niether should depend on the other, only on the main sources.
  
  Revision  Changes    Path
  1.4       +2 -1      logging-log4j/examples/src/joran/implicit/PrintMe.java
  
  Index: PrintMe.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/examples/src/joran/implicit/PrintMe.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PrintMe.java	1 Dec 2004 09:41:00 -0000	1.3
  +++ PrintMe.java	5 Dec 2004 21:43:03 -0000	1.4
  @@ -19,6 +19,7 @@
   import org.apache.joran.Interpreter;
   import org.apache.joran.Pattern;
   import org.apache.joran.RuleStore;
  +import org.apache.joran.action.Action;
   import org.apache.joran.helper.SimpleRuleStore;
   
   import java.util.List;
  @@ -48,7 +49,7 @@
       RuleStore ruleStore = new SimpleRuleStore();
   
       // we start with the rule for the top-most (root) element
  -    ruleStore.addRule(new Pattern("*/foo"), new NOPAction());
  +    ruleStore.addRule(new Pattern("*/foo"), Action.NOP_ACTION);
   
   
       // Create a new Joran Interpreter and hand it our simple rule store.
  
  
  
  1.18      +6 -0      logging-log4j/src/java/org/apache/joran/action/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/Action.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Action.java	22 Nov 2004 17:05:13 -0000	1.17
  +++ Action.java	5 Dec 2004 21:43:03 -0000	1.18
  @@ -47,6 +47,12 @@
     public static final String PATTERN_ATTRIBUTE = "pattern";
     public static final String ACTION_CLASS_ATTRIBUTE = "actionClass";
   
  +  public static final Action NOP_ACTION = 
  +    new Action() {
  +      public void begin(ExecutionContext ec, String name, Attributes attributes) {}
  +      public void end(ExecutionContext ec, String name) {}
  +    };
  +
     /*
      * An inststance specific logger. 
      */
  
  
  
  1.10      +4 -4      logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java
  
  Index: InterpreterTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- InterpreterTest.java	1 Dec 2004 09:41:00 -0000	1.9
  +++ InterpreterTest.java	5 Dec 2004 21:43:03 -0000	1.10
  @@ -22,11 +22,11 @@
    */
   package org.apache.joran;
   
  -import joran.implicit.NOPAction;
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  +import org.apache.joran.action.Action;
   import org.apache.joran.action.NestComponentIA;
   import org.apache.joran.action.NewRuleAction;
   import org.apache.joran.action.ParamAction;
  @@ -163,9 +163,9 @@
   
       RuleStore rs = new SimpleRuleStore();
       
  -    rs.addRule(new Pattern("log4j:configuration"), new NOPAction());
  +    rs.addRule(new Pattern("log4j:configuration"), Action.NOP_ACTION);
       rs.addRule(new Pattern("log4j:configuration/logger"), new LoggerAction());
  -    rs.addRule(new Pattern("*/appender-ref"), new NOPAction());
  +    rs.addRule(new Pattern("*/appender-ref"), Action.NOP_ACTION);
       rs.addRule(
         new Pattern("log4j:configuration/logger/level"), new LevelAction());
       rs.addRule(
  @@ -209,7 +209,7 @@
     public void testParsing2() throws Exception {
       logger.debug("Starting testLoop2");
       RuleStore rs = new SimpleRuleStore();
  -    rs.addRule(new Pattern("log4j:configuration"), new NOPAction());
  +    rs.addRule(new Pattern("log4j:configuration"), Action.NOP_ACTION);
       rs.addRule(new Pattern("log4j:configuration/logger"), new LoggerAction());
       rs.addRule(
         new Pattern("log4j:configuration/logger/level"), new LevelAction());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org