logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject cvs commit: logging-log4j/tests/src/java/org/apache/log4j/net SocketServerTestCase.java
Date Fri, 26 Aug 2005 03:11:34 GMT
carnold     2005/08/25 20:11:34

  Modified:    tests    Tag: v1_2-branch build.properties.sample build.xml
               tests/src/java/org/apache/log4j Tag: v1_2-branch
                        FileAppenderTest.java LevelTest.java
               tests/src/java/org/apache/log4j/helpers Tag: v1_2-branch
                        PatternParserTestCase.java
               tests/src/java/org/apache/log4j/net Tag: v1_2-branch
                        SocketServerTestCase.java
  Log:
  Mod tests for JDK 1.1, arbibrary log4j, second try
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.4   +4 -2      logging-log4j/tests/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.properties.sample,v
  retrieving revision 1.3.2.3
  retrieving revision 1.3.2.4
  diff -u -r1.3.2.3 -r1.3.2.4
  --- build.properties.sample	19 Aug 2005 07:10:22 -0000	1.3.2.3
  +++ build.properties.sample	26 Aug 2005 03:11:33 -0000	1.3.2.4
  @@ -14,8 +14,10 @@
   jaxp.parser.jar=${jaxp.home}/crimson.jar
   
   jakarta.oro.jar=${lib.home.dir}/jakarta-oro-2.0.8/jakarta-oro-2.0.8.jar
  -clover.jar="${lib.home.dir}/clover-1.3.8/lib/clover.jar
  +clover.jar=${lib.home.dir}/clover-1.3.8/lib/clover.jar
   deprecation=on
   
  -# junit must be on the classpath! It can't be handled as a property.
  +# junit must be on the classpath or specified with -lib
  +# only needs to be set here for JDK 1.1.
  +junit.jar=${lib.home.dir}/junit3.8.1/junit.jar
   
  
  
  
  1.16.2.14 +9 -3      logging-log4j/tests/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.xml,v
  retrieving revision 1.16.2.13
  retrieving revision 1.16.2.14
  diff -u -r1.16.2.13 -r1.16.2.14
  --- build.xml	19 Aug 2005 07:10:22 -0000	1.16.2.13
  +++ build.xml	26 Aug 2005 03:11:33 -0000	1.16.2.14
  @@ -1,6 +1,6 @@
   
   <!-- This file is an ANT build script. ANT is a Java based build tool. -->
  -<!-- It is availale from http://jakarta.apache.org/ant/                -->
  +<!-- It is availale from http://ant.apache.org/                -->
   
   
   <!-- ================================================================= -->
  @@ -28,6 +28,7 @@
     <property name="javac.target" value="1.1"/>
   
     <path id="tests.classpath">
  +    <pathelement location="${log4j.jar}"/>
       <pathelement location="${project.source.home}"/>
       <pathelement location="${project.classes.home}"/>
       <pathelement location="${tests.source.home}"/>
  @@ -37,6 +38,8 @@
       <pathelement location="${jaxp.jaxp.jar}"/>
       <pathelement location="${jaxp.parser.jar}"/>
       <pathelement location="${clover.jar}"/>
  +    <pathelement location="${junit.jar}"/>
  +    <pathelement path="${java.class.path}"/>
     </path>
   
     <!-- ================================================================= -->
  @@ -60,6 +63,9 @@
       regression - Run regression tests which check large parts of log4j.
   
       runAll     - run all available tests
  +
  +    Specify the log4j.jar property to test an arbitrary jar,
  +        otherwise the parent log4j will be built and tested.
       </echo>
     </target>
   
  @@ -70,7 +76,7 @@
   
     <!-- Clean the parent project                                          -->
     <!-- ================================================================= -->
  -  <target name="parentClean">
  +  <target name="parentClean" unless="log4j.jar">
       <ant dir=".." target="clean" inheritRefs="true"/>
     </target>
     
  @@ -79,7 +85,7 @@
     <!-- ================================================================= -->
     <!-- Build the parent project                                          -->
     <!-- ================================================================= -->  
  -  <target name="parentBuild">    
  +  <target name="parentBuild" unless="log4j.jar">    
       <ant dir=".." target="build.core" inheritRefs="true"/>
       <ant dir=".." target="build.xml" inheritRefs="true"/>
     </target>
  
  
  
  No                   revision
  No                   revision
  1.6.2.2   +13 -9     logging-log4j/tests/src/java/org/apache/log4j/FileAppenderTest.java
  
  Index: FileAppenderTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/FileAppenderTest.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- FileAppenderTest.java	22 Jul 2005 18:58:44 -0000	1.6.2.1
  +++ FileAppenderTest.java	26 Aug 2005 03:11:33 -0000	1.6.2.2
  @@ -32,16 +32,20 @@
      *
      */
     public void testDirectoryCreation() {
  -      File newFile = new File("output/newdir/temp.log");
  -      newFile.delete();
  -      File newDir = new File("output/newdir");
  -      newDir.delete();
  +      //
  +      //   known to fail on JDK 1.1
  +      if (!System.getProperty("java.version").startsWith("1.1.")) {
  +          File newFile = new File("output/newdir/temp.log");
  +          newFile.delete();
  +          File newDir = new File("output/newdir");
  +          newDir.delete();
   
  -      org.apache.log4j.FileAppender wa = new org.apache.log4j.FileAppender();
  -      wa.setFile("output/newdir/temp.log");
  -      wa.setLayout(new PatternLayout("%m%n"));
  -      wa.activateOptions();
  +          org.apache.log4j.FileAppender wa = new org.apache.log4j.FileAppender();
  +          wa.setFile("output/newdir/temp.log");
  +          wa.setLayout(new PatternLayout("%m%n"));
  +          wa.activateOptions();
   
  -      assertTrue(new File("output/newdir/temp.log").exists());
  +          assertTrue(new File("output/newdir/temp.log").exists());
  +      }
     }
   }
  
  
  
  1.1.2.3   +7 -1      logging-log4j/tests/src/java/org/apache/log4j/LevelTest.java
  
  Index: LevelTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/LevelTest.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- LevelTest.java	22 Jul 2005 19:00:46 -0000	1.1.2.2
  +++ LevelTest.java	26 Aug 2005 03:11:33 -0000	1.1.2.3
  @@ -56,7 +56,13 @@
         SerializationTestHelper.deserializeStream(
           "witness/serialization/info.bin");
       assertTrue(obj instanceof Level);
  -    assertTrue(obj == Level.INFO);
  +    Level info = (Level) obj;
  +    assertEquals("INFO", info.toString());
  +    //
  +    //  JDK 1.1 doesn't support readResolve necessary for the assertion
  +    if (!System.getProperty("java.version").startsWith("1.1.")) {
  +       assertTrue(obj == Level.INFO);
  +    }
     }
   
     /**
  
  
  
  No                   revision
  No                   revision
  1.1.2.3   +6 -1      logging-log4j/tests/src/java/org/apache/log4j/helpers/Attic/PatternParserTestCase.java
  
  Index: PatternParserTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/helpers/Attic/PatternParserTestCase.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- PatternParserTestCase.java	24 May 2005 05:06:24 -0000	1.1.2.2
  +++ PatternParserTestCase.java	26 Aug 2005 03:11:33 -0000	1.1.2.3
  @@ -123,7 +123,12 @@
   
     public static Test suite() {
       TestSuite suite = new TestSuite();
  -    suite.addTest(new PatternParserTestCase("mdcPattern"));
  +    //
  +    //   MDC requires JDK 1.2+
  +    //
  +    if (!System.getProperty("java.version").startsWith("1.1.")) {
  +       suite.addTest(new PatternParserTestCase("mdcPattern"));
  +    }
       return suite;
     }
   
  
  
  
  No                   revision
  No                   revision
  1.2.2.7   +70 -45    logging-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java
  
  Index: SocketServerTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java,v
  retrieving revision 1.2.2.6
  retrieving revision 1.2.2.7
  diff -u -r1.2.2.6 -r1.2.2.7
  --- SocketServerTestCase.java	19 Aug 2005 19:35:09 -0000	1.2.2.6
  +++ SocketServerTestCase.java	26 Aug 2005 03:11:33 -0000	1.2.2.7
  @@ -187,16 +187,21 @@
       common("T4", "key4", "MDC-TEST4");
       NDC.pop();
       delay(1);
  -    ControlFilter cf = new ControlFilter(new String[]{PAT4, EXCEPTION1, 
  -						       EXCEPTION2, EXCEPTION3, EXCEPTION4});
  -    
  -    Transformer.transform(
  -      TEMP, FILTERED,
  -      new Filter[] { cf, new LineNumberFilter(), 
  -          new JunitTestRunnerFilter(),
  -          new SunReflectFilter() });
  +    //
  +    //  These tests check MDC operation which
  +    //    requires JDK 1.2 or later
  +    if(!System.getProperty("java.version").startsWith("1.1.")) {
  +    
  +        ControlFilter cf = new ControlFilter(new String[]{PAT4, EXCEPTION1, 
  +						           EXCEPTION2, EXCEPTION3, EXCEPTION4});
  +        Transformer.transform(
  +          TEMP, FILTERED,
  +          new Filter[] { cf, new LineNumberFilter(), 
  +              new JunitTestRunnerFilter(),
  +              new SunReflectFilter() });
   
  -    assertTrue(Compare.compare(FILTERED, "witness/socketServer.4"));
  +        assertTrue(Compare.compare(FILTERED, "witness/socketServer.4"));
  +    }
     }
   
     /**
  @@ -225,16 +230,21 @@
       common("T5", "key5", "MDC-TEST5");
       NDC.pop();
       delay(2);
  -    ControlFilter cf = new ControlFilter(new String[]{PAT5, EXCEPTION1, 
  -						       EXCEPTION2, EXCEPTION3, EXCEPTION4});
  -    
  -    Transformer.transform(
  -      TEMP, FILTERED,
  -      new Filter[] { cf, new LineNumberFilter(), 
  -          new JunitTestRunnerFilter(),
  -          new SunReflectFilter() });
  +    //
  +    //  These tests check MDC operation which
  +    //    requires JDK 1.2 or later
  +    if(!System.getProperty("java.version").startsWith("1.1.")) {
  +        ControlFilter cf = new ControlFilter(new String[]{PAT5, EXCEPTION1, 
  +						           EXCEPTION2, EXCEPTION3, EXCEPTION4});
  +    
  +        Transformer.transform(
  +          TEMP, FILTERED,
  +          new Filter[] { cf, new LineNumberFilter(), 
  +              new JunitTestRunnerFilter(),
  +              new SunReflectFilter() });
   
  -    assertTrue(Compare.compare(FILTERED, "witness/socketServer.5"));
  +        assertTrue(Compare.compare(FILTERED, "witness/socketServer.5"));
  +    }
     }
   
     /**
  @@ -257,16 +267,21 @@
       NDC.pop();
       MDC.remove("hostID");
       delay(2);
  -    ControlFilter cf = new ControlFilter(new String[]{PAT6, EXCEPTION1, 
  -						       EXCEPTION2, EXCEPTION3, EXCEPTION4});
  -    
  -    Transformer.transform(
  -      TEMP, FILTERED,
  -      new Filter[] { cf, new LineNumberFilter(), 
  -          new JunitTestRunnerFilter(),
  -          new SunReflectFilter() });
  +    //
  +    //  These tests check MDC operation which
  +    //    requires JDK 1.2 or later
  +    if(!System.getProperty("java.version").startsWith("1.1.")) {
  +        ControlFilter cf = new ControlFilter(new String[]{PAT6, EXCEPTION1, 
  +						           EXCEPTION2, EXCEPTION3, EXCEPTION4});
  +    
  +        Transformer.transform(
  +          TEMP, FILTERED,
  +          new Filter[] { cf, new LineNumberFilter(), 
  +              new JunitTestRunnerFilter(),
  +              new SunReflectFilter() });
   
  -    assertTrue(Compare.compare(FILTERED, "witness/socketServer.6"));
  +        assertTrue(Compare.compare(FILTERED, "witness/socketServer.6"));
  +    }
     }
   
     /**
  @@ -285,15 +300,20 @@
       NDC.pop();
       MDC.remove("hostID"); 
       delay(2);
  -    ControlFilter cf = new ControlFilter(new String[]{PAT7, EXCEPTION1, 
  -						       EXCEPTION2, EXCEPTION3, EXCEPTION4});
  -    
  -    Transformer.transform(
  -      TEMP, FILTERED,
  -      new Filter[] { cf, new LineNumberFilter(), 
  -          new JunitTestRunnerFilter(),
  -          new SunReflectFilter() });
  -    assertTrue(Compare.compare(FILTERED, "witness/socketServer.7"));
  +    //
  +    //  These tests check MDC operation which
  +    //    requires JDK 1.2 or later
  +    if(!System.getProperty("java.version").startsWith("1.1.")) {
  +        ControlFilter cf = new ControlFilter(new String[]{PAT7, EXCEPTION1, 
  +						           EXCEPTION2, EXCEPTION3, EXCEPTION4});
  +    
  +        Transformer.transform(
  +          TEMP, FILTERED,
  +          new Filter[] { cf, new LineNumberFilter(), 
  +              new JunitTestRunnerFilter(),
  +              new SunReflectFilter() });
  +        assertTrue(Compare.compare(FILTERED, "witness/socketServer.7"));
  +    }
     }
   
     /**
  @@ -310,15 +330,20 @@
       common("T8", "key8", "MDC-TEST8");
       NDC.pop();
       delay(2);
  -    ControlFilter cf = new ControlFilter(new String[]{PAT8, EXCEPTION1, 
  -						       EXCEPTION2, EXCEPTION3, EXCEPTION4});
  -    
  -    Transformer.transform(
  -      TEMP, FILTERED,
  -      new Filter[] { cf, new LineNumberFilter(), 
  -          new JunitTestRunnerFilter(),
  -          new SunReflectFilter() });
  -    assertTrue(Compare.compare(FILTERED, "witness/socketServer.8"));
  +    //
  +    //  These tests check MDC operation which
  +    //    requires JDK 1.2 or later
  +    if(!System.getProperty("java.version").startsWith("1.1.")) {
  +        ControlFilter cf = new ControlFilter(new String[]{PAT8, EXCEPTION1, 
  +						           EXCEPTION2, EXCEPTION3, EXCEPTION4});
  +    
  +        Transformer.transform(
  +          TEMP, FILTERED,
  +          new Filter[] { cf, new LineNumberFilter(), 
  +              new JunitTestRunnerFilter(),
  +              new SunReflectFilter() });
  +        assertTrue(Compare.compare(FILTERED, "witness/socketServer.8"));
  +    }
     }
   
     static 
  
  
  

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


Mime
View raw message