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 mw...@apache.org on 2003/03/26 07:27:03 UTC

cvs commit: jakarta-log4j/tests/src/java/org/apache/log4j PatternLayoutTestCase.java

mwomack     2003/03/25 22:27:03

  Modified:    tests/src/java/org/apache/log4j PatternLayoutTestCase.java
  Log:
  Test cases for testing output of MDC data, bug #18246, changes submitted by Paul Smith.
  
  Revision  Changes    Path
  1.6       +18 -0     jakarta-log4j/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java
  
  Index: PatternLayoutTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PatternLayoutTestCase.java	13 Nov 2002 16:44:54 -0000	1.5
  +++ PatternLayoutTestCase.java	26 Mar 2003 06:27:03 -0000	1.6
  @@ -61,6 +61,8 @@
   
     static String PAT14 = "^(DEBUG| INFO| WARN|ERROR|FATAL)\\ \\d{1,2}\\ *- Message \\d{1,2}";
   
  +  static String PAT_MDC_1 = "";
  +
     public PatternLayoutTestCase(String name) {
       super(name);
     }
  @@ -235,6 +237,20 @@
       assertTrue(Compare.compare(FILTERED, "witness/patternLayout.14"));
     }
   
  +  public void testMDCAllowAllKeys() throws Exception {
  +    PropertyConfigurator.configure("input/patternLayout.mdc.1.properties");
  +    MDC.put("key1", "va11");
  +    MDC.put("key2", "va12");
  +    logger.debug("Hello World");
  +    MDC.clear();
  +
  +    Transformer.transform(TEMP, FILTERED, new Filter[] {
  +                                                      new LineNumberFilter(),
  +                                                      new SunReflectFilter()});
  +    assertTrue(Compare.compare(FILTERED, "witness/patternLayout.mdc.1"));
  +
  +  }
  +
     void common() {
       int i = -1;
   
  @@ -278,6 +294,8 @@
       suite.addTest(new PatternLayoutTestCase("test12"));
       suite.addTest(new PatternLayoutTestCase("test13"));
       suite.addTest(new PatternLayoutTestCase("test14"));
  +    suite.addTest(new PatternLayoutTestCase("testMDCAllowAllKeys"));
  +
       return suite;
     }
   
  
  
  

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