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 ca...@apache.org on 2007/04/21 02:04:39 UTC

svn commit: r530952 - in /logging/sandbox/log4j/expression-filter: ./ src/changes/ src/main/java/org/apache/log4j/filter/ src/site/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/log4j/ src/test/java/org/...

Author: carnold
Date: Fri Apr 20 17:04:37 2007
New Revision: 530952

URL: http://svn.apache.org/viewvc?view=rev&rev=530952
Log:
Bug 42099: Add SimpleFilterTest, rebrand as just filter

Added:
    logging/sandbox/log4j/expression-filter/build.xml
      - copied, changed from r530945, logging/sandbox/log4j/component/build.xml
    logging/sandbox/log4j/expression-filter/src/changes/
      - copied from r530937, logging/sandbox/log4j/component/src/changes/
    logging/sandbox/log4j/expression-filter/src/main/java/org/apache/log4j/filter/AndFilter.java
      - copied unchanged from r530944, logging/log4j/trunk/src/java/org/apache/log4j/filter/AndFilter.java
    logging/sandbox/log4j/expression-filter/src/main/java/org/apache/log4j/filter/DenyAllFilter.java
      - copied unchanged from r530944, logging/log4j/trunk/src/java/org/apache/log4j/filter/DenyAllFilter.java
    logging/sandbox/log4j/expression-filter/src/main/java/org/apache/log4j/filter/LevelMatchFilter.java
      - copied unchanged from r530944, logging/log4j/trunk/src/java/org/apache/log4j/filter/LevelMatchFilter.java
    logging/sandbox/log4j/expression-filter/src/main/java/org/apache/log4j/filter/LevelRangeFilter.java
      - copied unchanged from r530944, logging/log4j/trunk/src/java/org/apache/log4j/filter/LevelRangeFilter.java
    logging/sandbox/log4j/expression-filter/src/main/java/org/apache/log4j/filter/StringMatchFilter.java
      - copied unchanged from r530944, logging/log4j/trunk/src/java/org/apache/log4j/filter/StringMatchFilter.java
    logging/sandbox/log4j/expression-filter/src/site/
      - copied from r530937, logging/sandbox/log4j/component/src/site/
    logging/sandbox/log4j/expression-filter/src/test/
    logging/sandbox/log4j/expression-filter/src/test/java/
    logging/sandbox/log4j/expression-filter/src/test/java/org/
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/
      - copied from r530937, logging/log4j/trunk/tests/src/java/org/apache/log4j/filter/
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Compare.java
      - copied, changed from r530941, logging/sandbox/log4j/component/src/test/java/org/apache/log4j/util/Compare.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/ControlFilter.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/ControlFilter.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Filter.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/Filter.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/JunitTestRunnerFilter.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/LineNumberFilter.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/LineNumberFilter.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/SunReflectFilter.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/SunReflectFilter.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Transformer.java
      - copied unchanged from r530941, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/Transformer.java
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/UnexpectedFormatException.java
      - copied unchanged from r530944, logging/log4j/trunk/tests/src/java/org/apache/log4j/util/UnexpectedFormatException.java
    logging/sandbox/log4j/expression-filter/src/test/resources/
    logging/sandbox/log4j/expression-filter/src/test/resources/org/
    logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/
    logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/
    logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/
    logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter.1
      - copied unchanged from r530937, logging/log4j/trunk/tests/witness/filter/simpleFilter.1
    logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter1.xml
      - copied, changed from r530937, logging/log4j/trunk/tests/input/filter/simpleFilter1.xml
Modified:
    logging/sandbox/log4j/expression-filter/pom.xml
    logging/sandbox/log4j/expression-filter/src/changes/changes.xml
    logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/SimpleFilterTest.java

Copied: logging/sandbox/log4j/expression-filter/build.xml (from r530945, logging/sandbox/log4j/component/build.xml)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/build.xml?view=diff&rev=530952&p1=logging/sandbox/log4j/component/build.xml&r1=530945&p2=logging/sandbox/log4j/expression-filter/build.xml&r2=530952
==============================================================================
--- logging/sandbox/log4j/component/build.xml (original)
+++ logging/sandbox/log4j/expression-filter/build.xml Fri Apr 20 17:04:37 2007
@@ -27,8 +27,8 @@
     <property file="build.properties"/>
 	
 	<!--  project details  -->
-    <property name="project.name" value="apache-log4j-component"/>
-    <property name="project.title" value="Component"/>
+    <property name="project.name" value="apache-log4j-filter"/>
+    <property name="project.title" value="Apache Filter Companion for log4j 1.2."/>
     <property name="project.version" value="0.1-SNAPSHOT"/>
     <property name="project.jar" value="${project.name}-${project.version}.jar"/>
     
@@ -38,12 +38,15 @@
 	<!--  Versions for dependencies   -->
     <property name="log4j.version" value="1.2.14"/>
     <property name="junit.version" value="3.8.1"/>
+	<property name="oro.version" value="2.0.8"/>
 	
 	<!--  Dependency locations - assumed to be in Maven 2 repository   -->
     <property name="junit.jar" 
        location="${m2_repo}/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
     <property name="log4j.jar" 
        location="${m2_repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/>
+    <property name="oro.jar" 
+       location="${m2_repo}/oro/oro/${oro.version}/oro-${oro.version}.jar"/>
 
     <!--   Java compiler settings   -->
     <property name="javac.source" value="1.3"/>
@@ -66,7 +69,7 @@
     	   debug="${javac.debug}"
     	   target="${javac.target}"
     	   source="${javac.source}"
-    	   classpath="${log4j.jar}"/>
+    	   classpath="${log4j.jar}:${oro.jar}"/>
     	<copy todir="target/classes">
     	    <fileset dir="src/main/resources"/>
     	</copy>
@@ -97,7 +100,7 @@
     	   debug="${javac.debug}"
     	   target="${javac.target}"
     	   source="${javac.source}"
-    	   classpath="${log4j.jar}:${junit.jar}:target/classes"/>
+    	   classpath="${log4j.jar}:${junit.jar}:${oro.jar}:target/classes"/>
     	<copy todir="target/test-classes">
     		<fileset dir="src/test/resources"/>
     	</copy>
@@ -105,8 +108,8 @@
 
 
     <target name="test" depends="test-compile" description="Run unit tests">
-    	<junit printsummary="yes">
-    	    <classpath path="target/test-classes:target/classes:${log4j.jar}"/>
+    	<junit printsummary="yes" fork="yes" dir="target">
+    	    <classpath path="target/test-classes:target/classes:${log4j.jar}:${oro.jar}"/>
     		<batchtest>
     			<fileset dir="src/test/java/">
     				<include name="**/*TestCase.java"/>

Modified: logging/sandbox/log4j/expression-filter/pom.xml
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/pom.xml?view=diff&rev=530952&r1=530951&r2=530952
==============================================================================
--- logging/sandbox/log4j/expression-filter/pom.xml (original)
+++ logging/sandbox/log4j/expression-filter/pom.xml Fri Apr 20 17:04:37 2007
@@ -19,16 +19,21 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>log4j</groupId>
-  <artifactId>apache-log4j-expression-filter</artifactId>
+  <artifactId>apache-log4j-filter</artifactId>
   <packaging>jar</packaging>
   <version>0.1-SNAPSHOT</version>
-  <name>apache-log4j-expression-filter</name>
-  <description>Expression based filtering for log4j</description>
-  <url>http://logging.apache.org</url>
+  <name>Apache Filter Companion for log4j 1.2.</name>
+  <description>This companion provides a selection of filters from the Apache log4j 1.3 project 
+      for use with Apache log4j 1.2.</description>
+  <url>http://logging.apache.org/log4j/companions/filter</url>
   <issueManagement>
     <system>Bugzilla</system>
-    <url>http://issues.apache.org/bugzilla</url>
+    <url>http://issues.apache.org/bugzilla/</url>
   </issueManagement>
+  <ciManagement>
+  		<system>Gump</system>
+  		 <url>http://vmgump.apache.org/gump/public/logging-log4j-filter/logging-log4j-filter/index.html</url>
+  </ciManagement>
 <mailingLists>
 	<mailingList>
 		<name>log4j-user</name>
@@ -53,6 +58,14 @@
 		</otherArchives>
 	</mailingList>
 </mailingLists>
+<developers>
+    <developer>
+    	<id>carnold</id>
+    	<name>Curt Arnold</name>
+    	<email>carnold@apache.org</email>
+    	<timezone>-6</timezone>
+    </developer>
+ </developers>
 <licenses>
 	<license>
 		<name>Apache License, Version 2.0</name>
@@ -61,9 +74,9 @@
 	</license>
 </licenses>
 <scm>
-	<connection>scm:svn:http://svn.apache.org/repos/asf/logging/sandbox/log4j/rule</connection>
-	<developerConnection>scm:svn:https://svn.apache.org/repos/asf/logging/sandbox/log4j/rule</developerConnection>
-	<url>http://svn.apache.org/viewcvs.cgi/logging/sandbox/log4j/rule</url>
+	<connection>scm:svn:http://svn.apache.org/repos/asf/logging/sandbox/log4j/expression-filter</connection>
+	<developerConnection>scm:svn:https://svn.apache.org/repos/asf/logging/sandbox/log4j/expression-filter</developerConnection>
+	<url>http://svn.apache.org/viewcvs.cgi/logging/sandbox/log4j/expression-filter</url>
 </scm>
 <organization>
     <name>Apache Software Foundation</name>
@@ -88,6 +101,19 @@
             <target>1.3</target>
         </configuration>
       </plugin>
+	<!-- clean stray cobertura.ser -->
+  <plugin> 
+   <groupId>org.codehaus.mojo</groupId> 
+   <artifactId>cobertura-maven-plugin</artifactId> 
+   <executions> 
+    <execution> 
+     <id>clean</id> 
+     <goals> 
+      <goal>clean</goal> 
+     </goals> 
+    </execution> 
+   </executions> 
+  </plugin> 
     </plugins>
 </build>
   <dependencies>
@@ -102,11 +128,11 @@
       <artifactId>log4j</artifactId>
       <version>1.2.14</version>
     </dependency>    
-    <dependency>
+	<dependency>
       <groupId>oro</groupId>
       <artifactId>oro</artifactId>
       <version>2.0.8</version>
-    </dependency>    
+    </dependency>    	
   </dependencies>
   <reporting>
     <plugins>
@@ -127,8 +153,37 @@
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>jxr-maven-plugin</artifactId>
       </plugin>
+ 	<!-- plugin> 
+    	<groupId>org.apache.maven.plugins</groupId> 
+    	<artifactId>maven-surefire-report-plugin</artifactId>    
+    </plugin --> 
+	<plugin> 
+ 		<groupId>org.codehaus.mojo</groupId> 
+ 		<artifactId>cobertura-maven-plugin</artifactId>
+		<!-- version 2.1 was flawed and reports 100% coverage  -->
+		<version>2.0</version>
+	</plugin> 
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-changes-plugin</artifactId>
+      	<reportSets>
+          <reportSet>
+            <reports>
+              <report>changes-report</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+        <configuration>
+        	<issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
+        </configuration>
+      </plugin>      
     </plugins>
   </reporting>
+ <distributionManagement>
+    <site>
+      <id>apache.website</id>
+      <url>scp://people.apache.org/home/carnold/public_html/log4j/companions/filter</url>
+    </site>
+  </distributionManagement> 
   
 </project>
-

Modified: logging/sandbox/log4j/expression-filter/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/src/changes/changes.xml?view=diff&rev=530952&r1=530937&r2=530952
==============================================================================
--- logging/sandbox/log4j/expression-filter/src/changes/changes.xml (original)
+++ logging/sandbox/log4j/expression-filter/src/changes/changes.xml Fri Apr 20 17:04:37 2007
@@ -1 +1 @@
-<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You 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.

-->
<document>
  <properties>
    <title>Component</title>
  </properties>
  <body>
    <release version="0.1" date="2099-01-01" description="First release">
      <action dev="carnold" issue="42094" type="add">
   
      Initial release of Component framework backported from log4j 1.3.
      </action>
    </release>
  </body>
</document>
\ No newline at end of file
+<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You 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.

-->
<document>
  <properties>
    <title>Component</title>
  </properties>
  <body>
    <release version="0.1" date="2099-01-01" description="First release">
      <action dev="carnold" issue="42094" type="add">
   
      Initial release of filters backported from log4j 1.3.
      </action>
    </release>
  </body>
</document>
\ No newline at end of file

Modified: logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/SimpleFilterTest.java
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/SimpleFilterTest.java?view=diff&rev=530952&r1=530937&r2=530952
==============================================================================
--- logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/SimpleFilterTest.java (original)
+++ logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/filter/SimpleFilterTest.java Fri Apr 20 17:04:37 2007
@@ -1,9 +1,10 @@
 package org.apache.log4j.filter;
 
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
 import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
-import org.apache.log4j.joran.JoranConfigurator;
 import org.apache.log4j.util.Compare;
 import org.apache.log4j.util.ControlFilter;
 import org.apache.log4j.util.Filter;
@@ -11,10 +12,13 @@
 import org.apache.log4j.util.LineNumberFilter;
 import org.apache.log4j.util.SunReflectFilter;
 import org.apache.log4j.util.Transformer;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.w3c.dom.Document;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
 
 
 /**
@@ -48,23 +52,32 @@
   public void tearDown() {  
     root.getLoggerRepository().resetConfiguration();
   }
-  
+
   
   public void test1() throws Exception {
-    JoranConfigurator joc = new JoranConfigurator();
-    joc.doConfigure("./input/filter/simpleFilter1.xml", LogManager.getLoggerRepository());
-    joc.dumpErrors();
+    InputStream is = getClass().getResourceAsStream("simpleFilter1.xml");
+    if (is == null) {
+        throw new FileNotFoundException(
+                "Could not find resource simpleFilter1.xml");
+    }
+    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    DocumentBuilder builder = factory.newDocumentBuilder();
+    Document doc = builder.parse(is);
+    DOMConfigurator.configure(doc.getDocumentElement());
+
     common();
     
     ControlFilter cf = new ControlFilter(new String[]{TEST1_PAT, EXCEPTION1, EXCEPTION2, EXCEPTION3});
     
 
-    Transformer.transform(TEMP, FILTERED, new Filter[] {cf, 
+    Transformer.transform(TEMP, FILTERED, new Filter[] {cf,
         new LineNumberFilter(), 
         new SunReflectFilter(), 
         new JunitTestRunnerFilter()});
 
-     assertTrue(Compare.compare(FILTERED, "witness/filter/simpleFilter.1"));
+     assertTrue(Compare.compare(SimpleFilterTest.class,
+             FILTERED,
+             "witness/filter/simpleFilter.1"));
   }
   
   void common() {

Copied: logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Compare.java (from r530941, logging/sandbox/log4j/component/src/test/java/org/apache/log4j/util/Compare.java)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Compare.java?view=diff&rev=530952&p1=logging/sandbox/log4j/component/src/test/java/org/apache/log4j/util/Compare.java&r1=530941&p2=logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Compare.java&r2=530952
==============================================================================
--- logging/sandbox/log4j/component/src/test/java/org/apache/log4j/util/Compare.java (original)
+++ logging/sandbox/log4j/expression-filter/src/test/java/org/apache/log4j/util/Compare.java Fri Apr 20 17:04:37 2007
@@ -34,7 +34,7 @@
           final String fileName) throws IOException {
       String resourceName = fileName;
       if (fileName.startsWith("witness/")) {
-          resourceName = fileName.substring(8);
+          resourceName = fileName.substring(fileName.lastIndexOf('/') + 1);
       }
       InputStream is = testClass.getResourceAsStream(resourceName);
       if (is == null) {

Copied: logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter1.xml (from r530937, logging/log4j/trunk/tests/input/filter/simpleFilter1.xml)
URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter1.xml?view=diff&rev=530952&p1=logging/log4j/trunk/tests/input/filter/simpleFilter1.xml&r1=530937&p2=logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter1.xml&r2=530952
==============================================================================
--- logging/log4j/trunk/tests/input/filter/simpleFilter1.xml (original)
+++ logging/sandbox/log4j/expression-filter/src/test/resources/org/apache/log4j/filter/simpleFilter1.xml Fri Apr 20 17:04:37 2007
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE configuration >
 
-<configuration xmlns='http://logging.apache.org/'>
+<log4j:configuration xmlns:log4j='http://logging.apache.org/'>
 
   <appender name="A1" class="org.apache.log4j.FileAppender">
   
@@ -34,4 +34,4 @@
   <root>
     <appender-ref ref="A1" />	       
   </root>
-</configuration>
+</log4j:configuration>



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