Return-Path: X-Original-To: apmail-incubator-jena-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-jena-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 619D2947A for ; Fri, 4 Nov 2011 12:46:17 +0000 (UTC) Received: (qmail 79508 invoked by uid 500); 4 Nov 2011 12:46:17 -0000 Delivered-To: apmail-incubator-jena-commits-archive@incubator.apache.org Received: (qmail 79484 invoked by uid 500); 4 Nov 2011 12:46:17 -0000 Mailing-List: contact jena-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jena-dev@incubator.apache.org Delivered-To: mailing list jena-commits@incubator.apache.org Received: (qmail 79477 invoked by uid 99); 4 Nov 2011 12:46:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 12:46:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 12:46:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6910E23888E4; Fri, 4 Nov 2011 12:45:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1197540 - in /incubator/jena/Jena2/jena/trunk: ./ src/main/java/jena/cmdline/ src/test/java/com/hp/hpl/jena/rdf/arp/ src/test/java/com/hp/hpl/jena/test/ src/test/resources/ Date: Fri, 04 Nov 2011 12:45:52 -0000 To: jena-commits@incubator.apache.org From: castagna@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111104124552.6910E23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: castagna Date: Fri Nov 4 12:45:51 2011 New Revision: 1197540 URL: http://svn.apache.org/viewvc?rev=1197540&view=rev Log: JENA-36 and JENA-155 This is to make sure we do not have log messages (either at WARN or ERROR level) when we run the test suite in Eclipse or via mvn test command line. There are two log4j properties file: one is used by the test suite and it's located in src/test/resources/log4j.properties. The other one is src/main/java/jena-log4j.properties and it is included in the .jar file (because we want command lines to have logging enabled). I usually have just one log4j.properties in src/test/resources and do not ship jars with log4j in it. If that is needed, a better location for jena-log4j.properties is src/main/resources. I am not going do to this now. I agree on the principle of not having spurious errors or warning when we execute the test suite (and this is the reason why I am committing this). However, I did not find this task trivial as it should have been. We could benefit from a common and shared approach towards logging, error messages, System.out|err, in the code and in the tests. It there is one, I am not aware of it and I am not able to infer it from the sources. At the moment IMHO there is a too high degree of diversity (which some could call caos). :-) I am not proposing to do anything about this now, let's focus on the release. However a discussion on what would be the right thing to do and sharing a best practice is possible. Modified: incubator/jena/Jena2/jena/trunk/.classpath incubator/jena/Jena2/jena/trunk/pom.xml incubator/jena/Jena2/jena/trunk/src/main/java/jena/cmdline/CmdLineUtils.java incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/StAX2ModelTest.java incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/test/TestPackage.java incubator/jena/Jena2/jena/trunk/src/test/resources/log4j.properties Modified: incubator/jena/Jena2/jena/trunk/.classpath URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/.classpath?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/.classpath (original) +++ incubator/jena/Jena2/jena/trunk/.classpath Fri Nov 4 12:45:51 2011 @@ -4,17 +4,12 @@ - + - - - + - Modified: incubator/jena/Jena2/jena/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/pom.xml?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/pom.xml (original) +++ incubator/jena/Jena2/jena/trunk/pom.xml Fri Nov 4 12:45:51 2011 @@ -165,25 +165,25 @@ maven-assembly-plugin - create-assembly package single - - - - assembly.xml - - - + + + + assembly.xml + + + + @@ -196,7 +196,7 @@ vocabularies - vocabularies + vocabularies false assembler.n3 @@ -218,5 +218,4 @@ - Modified: incubator/jena/Jena2/jena/trunk/src/main/java/jena/cmdline/CmdLineUtils.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/main/java/jena/cmdline/CmdLineUtils.java?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/src/main/java/jena/cmdline/CmdLineUtils.java (original) +++ incubator/jena/Jena2/jena/trunk/src/main/java/jena/cmdline/CmdLineUtils.java Fri Nov 4 12:45:51 2011 @@ -18,9 +18,14 @@ public class CmdLineUtils static public void setLog4jConfiguration() { + setLog4jConfiguration("jena-log4j.properties") ; + } + + static public void setLog4jConfiguration(String filename) + { if ( System.getProperty("log4j.configuration") == null ) { - System.setProperty("log4j.configuration", "jena-log4j.properties") ; + System.setProperty("log4j.configuration", filename) ; } } } Modified: incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java (original) +++ incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java Fri Nov 4 12:45:51 2011 @@ -153,8 +153,7 @@ public class MoreTests extends TestCase FileReader r = new FileReader( "testing/wg/rdfms-syntax-incomplete/test001.rdf"); if (r.getEncoding().startsWith("UTF")) { - System.err - .println("WARNING: Encoding mismatch tests not executed on platform with default UTF encoding."); + logger.warn("Encoding mismatch tests not executed on platform with default UTF encoding."); return; } rdr.setErrorHandler(this); Modified: incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/StAX2ModelTest.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/StAX2ModelTest.java?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/StAX2ModelTest.java (original) +++ incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/rdf/arp/StAX2ModelTest.java Fri Nov 4 12:45:51 2011 @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; +import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler; import com.hp.hpl.jena.regression.testReaderInterface; import javax.xml.stream.XMLInputFactory; @@ -1147,9 +1148,20 @@ public class StAX2ModelTest extends Test this.file = "testing/" + dir + file; } + private boolean errorHanderFlag; + @Override + public void setUp() { + errorHanderFlag = RDFDefaultErrorHandler.silent; + RDFDefaultErrorHandler.silent = true; // JENA-36 + } + + @Override + public void tearDown() { + RDFDefaultErrorHandler.silent = errorHanderFlag; + } + @Override public void runTest() throws Exception { - Model expected = ModelFactory.createDefaultModel(); Model got = ModelFactory.createDefaultModel(); Modified: incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/test/TestPackage.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/test/TestPackage.java?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/test/TestPackage.java (original) +++ incubator/jena/Jena2/jena/trunk/src/test/java/com/hp/hpl/jena/test/TestPackage.java Fri Nov 4 12:45:51 2011 @@ -22,7 +22,8 @@ import com.hp.hpl.jena.assembler.test.Te public class TestPackage extends TestCase{ static { - setLog4jConfiguration() ; + // better to have a separate log4j.properties for testing, see JENA-36 + setLog4jConfiguration("log4j.properties") ; } static public TestSuite suite() { Modified: incubator/jena/Jena2/jena/trunk/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/jena/trunk/src/test/resources/log4j.properties?rev=1197540&r1=1197539&r2=1197540&view=diff ============================================================================== --- incubator/jena/Jena2/jena/trunk/src/test/resources/log4j.properties (original) +++ incubator/jena/Jena2/jena/trunk/src/test/resources/log4j.properties Fri Nov 4 12:45:51 2011 @@ -7,6 +7,10 @@ log4j.rootLogger=INFO, stderr # Base of all Jena classes log4j.logger.com.hp.hpl.jena=INFO +log4j.logger.com.hp.hpl.jena.graph.impl.LiteralLabelImpl=ERROR +log4j.logger.com.hp.hpl.jena.rdf.arp.MoreTests=FATAL +log4j.logger.com.hp.hpl.jena.regression.testReaderInterface=FATAL +log4j.logger.com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler=FATAL # Example of switching on debug level logging for part of tree # log4j.logger.com.hp.hpl.jena.graph.test=debug