ceki        2004/12/31 09:51:32

  Modified:    src/java/org/apache/ugli/impl JDK14LoggerFA.java
                        JDK14Logger.java SimpleLoggerFA.java
                        NOPLoggerFA.java SimpleLogger.java
               .        ugli.xml
               tests    build.xml
  Added:       tests/src/java/org/apache/ugli InvokingUGLI.java
  Log:
  - UGLI related tests.
  - Accessor modifications in ULogger implementations.
  
  Revision  Changes    Path
  1.1                  
logging-log4j/tests/src/java/org/apache/ugli/InvokingUGLI.java
  
  Index: InvokingUGLI.java
  ===================================================================
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /*
   * Created on Dec 31, 2004
   *
   * To change the template for this generated file go to
   * Window>Preferences>Java>Code Generation>Code and Comments
   */
  package org.apache.ugli;
  
  import junit.framework.TestCase;
  
  
  /**
   * Test whether invoking the UGLI API causes problems or not.
   * 
   * @author Ceki Gulcu
   *
   */
  public class InvokingUGLI extends TestCase {
    /**
     * Constructor for InvokingAPI.
     * @param arg0
     */
    public InvokingUGLI(String arg0) {
      super(arg0);
    }
  
    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
      super.setUp();
    }
  
    /*
     * @see TestCase#tearDown()
     */
    protected void tearDown() throws Exception {
      super.tearDown();
    }
    
    public void test1() {
      ULogger logger = LoggerFactory.getLogger("test1");
      logger.debug("Hello world.");
    }
    
    public void test2() {
      ULogger logger = LoggerFactory.getLogger("test2");
      logger.debug("Hello world 1.");
      logger.info("Hello world 2.");
    }
  }
  
  
  
  1.2       +19 -13    
logging-log4j/src/java/org/apache/ugli/impl/JDK14LoggerFA.java
  
  Index: JDK14LoggerFA.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/JDK14LoggerFA.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JDK14LoggerFA.java        30 Dec 2004 20:44:50 -0000      1.1
  +++ JDK14LoggerFA.java        31 Dec 2004 17:51:32 -0000      1.2
  @@ -1,19 +1,28 @@
   /*
  - * Created on Dec 30, 2004
  + * Copyright 1999,2004 The Apache Software Foundation.
    *
  - * To change the template for this generated file go to
  - * Window>Preferences>Java>Code Generation>Code and Comments
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  +
   package org.apache.ugli.impl;
   
  +import org.apache.ugli.LoggerFactoryAdapter;
  +import org.apache.ugli.ULogger;
  +
   import java.util.HashMap;
   import java.util.Map;
  -import java.util.WeakHashMap;
   import java.util.logging.Logger;
   
  -import org.apache.ugli.LoggerFactoryAdapter;
  -import org.apache.ugli.ULogger;
  -
   
   /**
    * @author ceki
  @@ -22,10 +31,9 @@
    * Window>Preferences>Java>Code Generation>Code and Comments
    */
   public class JDK14LoggerFA implements LoggerFactoryAdapter {
  -
     Map map;
  -  
  -  JDK14LoggerFA() {
  +
  +  public JDK14LoggerFA() {
       map = new HashMap();
     }
   
  @@ -34,7 +42,7 @@
      */
     public ULogger getLogger(String name) {
       ULogger ulogger = (ULogger) map.get(name);
  -    if(ulogger == null) {
  +    if (ulogger == null) {
         Logger logger = Logger.getLogger(name);
         ulogger = new JDK14Logger(logger);
         map.put(name, ulogger);
  @@ -48,6 +56,4 @@
     public ULogger getLogger(String domainName, String subDomainName) {
       return getLogger(domainName);
     }
  -  
  -  
   }
  
  
  
  1.3       +2 -0      
logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java
  
  Index: JDK14Logger.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDK14Logger.java  31 Dec 2004 15:18:58 -0000      1.2
  +++ JDK14Logger.java  31 Dec 2004 17:51:32 -0000      1.3
  @@ -38,6 +38,8 @@
   public class JDK14Logger implements ULogger {
     final Logger logger;
   
  +  // WARN: JDK14Logger constructor should have only package access so that
  +  // only JDK14LoggerFA be able to create one.
     JDK14Logger(Logger logger) {
       this.logger = logger;
     }
  
  
  
  1.2       +1 -1      
logging-log4j/src/java/org/apache/ugli/impl/SimpleLoggerFA.java
  
  Index: SimpleLoggerFA.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/SimpleLoggerFA.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleLoggerFA.java       31 Dec 2004 15:18:58 -0000      1.1
  +++ SimpleLoggerFA.java       31 Dec 2004 17:51:32 -0000      1.2
  @@ -23,7 +23,7 @@
   
     Map map;
     
  -  SimpleLoggerFA() {
  +  public SimpleLoggerFA() {
       map = new HashMap();
     }
   
  
  
  
  1.2       +4 -0      
logging-log4j/src/java/org/apache/ugli/impl/NOPLoggerFA.java
  
  Index: NOPLoggerFA.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/NOPLoggerFA.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NOPLoggerFA.java  30 Dec 2004 20:44:50 -0000      1.1
  +++ NOPLoggerFA.java  31 Dec 2004 17:51:32 -0000      1.2
  @@ -18,6 +18,10 @@
    */
   public class NOPLoggerFA implements LoggerFactoryAdapter {
     
  +  public NOPLoggerFA() {
  +    // nothing to do
  +  }
  +  
     public ULogger getLogger(String name) {
       return NOPLogger.NOP_LOGGER;
     }
  
  
  
  1.2       +4 -5      
logging-log4j/src/java/org/apache/ugli/impl/SimpleLogger.java
  
  Index: SimpleLogger.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/SimpleLogger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleLogger.java 31 Dec 2004 15:18:58 -0000      1.1
  +++ SimpleLogger.java 31 Dec 2004 17:51:32 -0000      1.2
  @@ -49,16 +49,15 @@
      */
     static private long startTime = System.currentTimeMillis();
     
  -  static private String LINE_SEPARATOR;
  +  public static final String LINE_SEPARATOR = 
System.getProperty("line.separator");
     
     static private String INFO_STR = "INFO";
     static private String WARN_STR = "WARN";
     static private String ERROR_STR = "ERROR";
     
     /**
  -   * Package access allows [EMAIL PROTECTED] SimpleLoggerFA} to instantiate 
SimpleLogger
  -   * instances.
  -   * 
  +   * Package access allows only [EMAIL PROTECTED] SimpleLoggerFA} to 
instantiate 
  +   * SimpleLogger instances.
      */
     SimpleLogger(String name) {
       this.loggerName = name;
  @@ -128,10 +127,10 @@
       buf.append(LINE_SEPARATOR);
       
       System.out.print(buf.toString());
  -    
       if(t != null) {
         t.printStackTrace(System.out);
       }
  +    System.out.flush();
     }
     /**
      * For parameterized messages, first substitute parameters and then log.
  
  
  
  1.2       +18 -1     logging-log4j/ugli.xml
  
  Index: ugli.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/ugli.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ugli.xml  31 Dec 2004 15:18:57 -0000      1.1
  +++ ugli.xml  31 Dec 2004 17:51:32 -0000      1.2
  @@ -1,4 +1,4 @@
  -<project name="ugli" default="build.core" basedir="." >
  +<project name="ugli" default="ussage" basedir="." >
   
     <!-- The directory where source files are stored. -->
     <property name="java.source.dir" value="./src/java/"/>
  @@ -16,6 +16,23 @@
     <property name="UGLI_STEM" value="org/apache/ugli"/>
     
     <property name="ugli.properties" value="dist/classes/ugli.properties"/>
  +
  +    <!-- ================================================================= 
-->
  +  <!-- Default target                                                    -->
  +  <!-- ================================================================= -->
  +  <target name="usage">
  +    <echo>      
  +      These are some of the targets supported by this ANT build scpript:
  +      
  +      build.core - compile core UGLI files.
  +
  +      ugli-nop.jar - build the jar file of the same name.
  +      ugli-simple.jar - build the jar file of the same name.
  +      ugli-jdk14.jar - build the jar file of the same name.
  +      
  +    </echo>
  +  </target>
  +
   
     <!-- ================================================================= -->
     <!-- Remove all generated (compiled) class files.                      -->
  
  
  
  1.84      +15 -27    logging-log4j/tests/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.xml,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- build.xml 31 Dec 2004 16:19:55 -0000      1.83
  +++ build.xml 31 Dec 2004 17:51:32 -0000      1.84
  @@ -110,18 +110,11 @@
     <!-- ================================================================= -->
     <!-- Build the parent project                                          -->
     <!-- ================================================================= --> 
 
  -  <target name="parentBuild">
  -       <!-- everything in the "build" target except examples
  -              which define classes in namespaces not
  -              supported by the ASF licensed clover  -->
  -       <ant dir=".." target="build.core" inheritRefs="true"/>
  -       <ant dir=".." target="build.xml" inheritRefs="true"/>
  -       <ant dir=".." target="build.javamail" inheritRefs="true"/>
  -       <ant dir=".." target="build.jms" inheritRefs="true"/>
  -       <ant dir=".." target="build.jmx" inheritRefs="true"/>
  -       <ant dir=".." target="build.servletAPI" inheritRefs="true"/>
  -       <ant dir=".." target="build.db" inheritRefs="true"/>
  -       <ant dir=".." target="build.chainsaw" inheritRefs="true"/>
  +  <target name="parentBuild">    
  +    <ant dir=".." target="build.core" inheritRefs="true"/>
  +    <ant dir=".." target="build.xml" inheritRefs="true"/>
  +    <ant dir=".." target="build.javamail" inheritRefs="true"/>
  +    <ant dir=".." target="build.servletAPI" inheritRefs="true"/>
     </target>
   
     <!-- ================================================================= -->
  @@ -132,13 +125,15 @@
       <property name="haltonfailure" value="yes"/>
       <javac srcdir="${tests.source.home}"
           destdir="./classes" 
  -            excludes="${stem}/chainsaw/receivers/*.java,
  -                      ${stem}/selector/PassByJNDI.java"
  +           excludes="${stem}/chainsaw/receivers/*.java,
  +                     ${stem}/selector/PassByJNDI.java,
  +                     ${stem}/ugli/**.java,
  +                     ${stem}/db/**.java"
           deprecation="${deprecation}"
           debug="on">
         <classpath refid="tests.classpath"/>
       </javac>
  -  </target>
  +  </target> 
     
     <!-- ================================================================= -->
     <!-- Remove all generated files such as compiled class files and test  -->
  @@ -183,16 +178,17 @@
                                     Scheduler, 
                                        ThrowableInformation,
                                        LocationInfo,
  -                                     CyclicBuffer, OR, 
  +                                     CyclicBuffer, 
  +                                     OR, 
                                     VariaLevelMatchFilter, 
                                        VariaLevelRangeFilter, PatternParser,
                                        LevelMatchFilter, DRFA, 
                                        Rolling, 
  -                                     ReaderWriterLock,
                                        NDC,
                                        Plugins,
  -                                     MessageFormatter,
  -                                     CachedDateFormat"/>
  +                                     CachedDateFormat,
  +                                     ReaderWriterLock
  +                                     "/>
   
   
   
  @@ -614,14 +610,6 @@
       </junit>
     </target>
     
  -  <target name="MessageFormatter" depends="check, build, cleanOutputDir">
  -     <junit printsummary="yes" fork="yes" haltonfailure="yes">
  -       <classpath refid="tests.classpath"/>
  -       <formatter type="plain" usefile="false"/>
  -       <test name="org.apache.ugli.impl.MessageFormatterTest" />
  -    </junit>
  -  </target>
  -
     <target name="CachedDateFormat" depends="check, build, cleanOutputDir">
        <junit printsummary="yes" fork="yes" haltonfailure="yes">
          <classpath refid="tests.classpath"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to