Author: tchemit Date: 2010-11-22 16:45:39 +0100 (Mon, 22 Nov 2010) New Revision: 513 Url: http://nuiton.org/repositories/revision/jrst/513 Log: consolidate third-parties = fix tests Added: trunk/jrst/src/test/resources/log4j.properties trunk/maven-jrst-plugin/src/license/ trunk/maven-jrst-plugin/src/license/THIRD-PARTY.properties Modified: trunk/doxia-module-jrst/src/license/THIRD-PARTY.properties trunk/jrst/pom.xml trunk/jrst/src/license/THIRD-PARTY.properties trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java Modified: trunk/doxia-module-jrst/src/license/THIRD-PARTY.properties =================================================================== --- trunk/doxia-module-jrst/src/license/THIRD-PARTY.properties 2010-11-22 14:47:17 UTC (rev 512) +++ trunk/doxia-module-jrst/src/license/THIRD-PARTY.properties 2010-11-22 15:45:39 UTC (rev 513) @@ -3,22 +3,28 @@ # Already used licenses in project : # - Apache License # - Apache License 2.0 +# - BSD License # - Common Public License Version 1.0 +# - Docbook license (MIT-like) # - LGPL # - Lesser General Public License (LGPL) v 3.0 -# - MIT-like License +# - Mozilla Public License version 1.1 # - The Apache Software License, Version 2.0 +# - X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) +# - http://classworlds.codehaus.org/license.html +# - http://jaxen.codehaus.org/license.html #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Mon Jun 28 09:30:13 CEST 2010 -com.ibm.icu--icu4j--2.6.1=X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) -commons-codec--commons-codec--1.2=The Apache Software License, Version 2.0 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD -jaxen--jaxen--1.1.1=http\://jaxen.codehaus.org/license.html -jdom--jdom--1.0=The Apache Software License, Version 2.0 -org.codehaus.plexus--plexus-classworlds--1.2-alpha-9=http\://classworlds.codehaus.org/license.html -xerces--xmlParserAPIs--2.6.2=The Apache Software License, Version 2.0 -xml-apis--xml-apis--1.3.02=The Apache Software License, Version 2.0 +#Mon Nov 22 16:42:48 CET 2010 +com.ibm.icu--icu4j--2.6.1--jar=X License (http\://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.html) +commons-codec--commons-codec--1.2--jar=The Apache Software License, Version 2.0 +commons-primitives--commons-primitives--1.0--jar=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1--jar=BSD +jaxen--jaxen--1.1.1--jar=http\://jaxen.codehaus.org/license.html +jdom--jdom--1.0--jar=The Apache Software License, Version 2.0 +net.sf.docbook--docbook-xsl--1.75.2--zip--resources=Docbook license (MIT-like) +org.codehaus.plexus--plexus-classworlds--1.2-alpha-9--jar=http\://classworlds.codehaus.org/license.html +org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl--jar=Lesser General Public License (LGPL) v 3.0 +xerces--xercesImpl--2.6.2--jar=The Apache Software License, Version 2.0 Modified: trunk/jrst/pom.xml =================================================================== --- trunk/jrst/pom.xml 2010-11-22 14:47:17 UTC (rev 512) +++ trunk/jrst/pom.xml 2010-11-22 15:45:39 UTC (rev 513) @@ -132,6 +132,12 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> </dependencies> <!-- ************************************************************* --> Modified: trunk/jrst/src/license/THIRD-PARTY.properties =================================================================== --- trunk/jrst/src/license/THIRD-PARTY.properties 2010-11-22 14:47:17 UTC (rev 512) +++ trunk/jrst/src/license/THIRD-PARTY.properties 2010-11-22 15:45:39 UTC (rev 513) @@ -2,24 +2,24 @@ #------------------------------------------------------------------------------- # Already used licenses in project : # - Apache License 2.0 -# - BSD # - BSD License # - Common Public License Version 1.0 # - LGPL # - Lesser General Public License (LGPL) v 3.0 -# - MIT-like License +# - Mozilla Public License version 1.1 # - The Apache Software License, Version 2.0 +# - X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) # - http://jaxen.codehaus.org/license.html #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Mon Jun 28 09:27:16 CEST 2010 -com.ibm.icu--icu4j--2.6.1=X License (http://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.ht...) -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD -jaxen--jaxen--1.1.1=http\://jaxen.codehaus.org/license.html -jdom--jdom--1.0=The Apache Software License, Version 2.0 -org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl=Lesser General Public License (LGPL) v 3.0 -xerces--xercesImpl--2.6.2=The Apache Software License, Version 2.0 -xerces--xmlParserAPIs--2.6.2=The Apache Software License, Version 2.0 +#Mon Nov 22 15:54:39 CET 2010 +com.ibm.icu--icu4j--2.6.1--jar=X License (http\://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.html) +commons-primitives--commons-primitives--1.0--jar=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1--jar=BSD +jaxen--jaxen--1.1.1--jar=http\://jaxen.codehaus.org/license.html +jdom--jdom--1.0--jar=The Apache Software License, Version 2.0 +net.sf.docbook--docbook-xsl--1.75.2--zip--resources=Docbook license (MIT-like) +org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl--jar=Lesser General Public License (LGPL) v 3.0 +xerces--xercesImpl--2.6.2--jar=The Apache Software License, Version 2.0 Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2010-11-22 14:47:17 UTC (rev 512) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2010-11-22 15:45:39 UTC (rev 513) @@ -25,6 +25,8 @@ package org.nuiton.jrst; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.dom4j.Document; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; @@ -39,6 +41,7 @@ import junit.framework.Assert; import org.junit.Test; +import org.nuiton.util.FileUtil; /** * JRSTReaderTest. @@ -53,6 +56,9 @@ */ public class JRSTReaderTest { + /** to use log facility, just put in your code: log.info("..."); */ + protected static Log log = LogFactory.getLog(JRSTReaderTest.class); + @Test public void testRead() throws Exception { URL url = JRSTReaderTest.class @@ -62,67 +68,72 @@ JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); - { - XMLWriter out = new XMLWriter(System.out, new OutputFormat(" ", - true)); - out.write(doc); - } + log.info(url + " result : \n" + doc.asXML()); + } - // { - // StringWriter out = new StringWriter(); - // JRSTGenerator gen = new JRSTGenerator(out); - // gen.generate(doc); - // System.out.println(out.toString()); - // } - } - @Test - public void testEmptyTableContents() throws Exception{ - URL url = JRSTReaderTest.class.getResource("/testEmptyTableContents.rst"); - Reader in = new InputStreamReader(url.openStream()); - JRSTReader jrst = new JRSTReader(); - Document doc = jrst.read(in); - String XMLexpected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<document id=\"test\" name=\"test\">" + - "<title>Test</title>" + - "<topic class=\"contents\" id=\"table des matières\" name=\"table des matières\">" + - "<title>Table des matières</title>" + - "</topic>" + - "<paragraph>Texte</paragraph>" + - "</document>"; - Assert.assertEquals(XMLexpected, doc.asXML()); + public void testEmptyTableContents() throws Exception { + URL url = JRSTReaderTest.class.getResource("/testEmptyTableContents.rst"); + Reader in = new InputStreamReader(url.openStream()); + JRSTReader jrst = new JRSTReader(); + Document doc = jrst.read(in); + String xmlexpected = "<topic class=\"contents\" id=\"table des matières\" name=\"table des matières\">" + + "<title>Table des matières</title>" + + "</topic>" + + "<paragraph>Texte</paragraph>" + + "</document>"; + String actualXml = doc.asXML(); + log.info("Test file : " + url); + log.info("Result :\n" + actualXml); + log.info("Expected :\n" + xmlexpected); + + Assert.assertTrue(actualXml.contains(xmlexpected)); } - + @Test public void testExternalLink() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testExternalLink.rst"); - Reader in = new InputStreamReader(url.openStream()); - JRSTReader jrst = new JRSTReader(); - Document doc = jrst.read(in); - String XMLexpected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<document>" + - "<paragraph>External hyperlinks, like <reference name=\"Python\" refuri=\"http://www.python.org/\">Python</reference></paragraph>" + - "<target id=\"python\" name=\"python\" refuri=\"http://www.python.org/\"/>" + - "</document>"; - Assert.assertEquals(XMLexpected, doc.asXML()); + URL url = JRSTReaderTest.class.getResource("/testExternalLink.rst"); + Reader in = new InputStreamReader(url.openStream()); + JRSTReader jrst = new JRSTReader(); + Document doc = jrst.read(in); + String xmlexpected = "<paragraph>External hyperlinks, like <reference name=\"Python\" refuri=\"http://www.python.org/\">Python</reference></paragraph>" + + "<target id=\"python\" name=\"python\" refuri=\"http://www.python.org/\"/>" + + "</document>"; + + String actualXml = doc.asXML(); + log.info("Test file : " + url); + log.info("Result :\n" + actualXml); + log.info("Expected :\n" + xmlexpected); + + Assert.assertTrue(actualXml.contains(xmlexpected)); } - + @Test public void testHyperlinkTarget() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testHyperlinkTarget.rst"); - Reader in = new InputStreamReader(url.openStream()); - JRSTReader jrst = new JRSTReader(); - Document doc = jrst.read(in); - URL xmlUrl = JRSTReaderTest.class.getResource("/testHyperlinkTarget.xml"); - Reader xmlIn = new InputStreamReader(xmlUrl.openStream()); - BufferedReader reader = new BufferedReader(xmlIn); - String line = null; - StringBuilder stringBuilder = new StringBuilder(); - String ls = System.getProperty("line.separator"); - while ((line = reader.readLine()) != null) { - stringBuilder.append(line); - stringBuilder.append(ls); - } - Assert.assertEquals(stringBuilder.toString(), doc.asXML() + "\n"); + URL url = JRSTReaderTest.class.getResource("/testHyperlinkTarget.rst"); + Reader in = new InputStreamReader(url.openStream()); + JRSTReader jrst = new JRSTReader(); + Document doc = jrst.read(in); + String actualXml = doc.asXML(); + int index = actualXml.indexOf("<paragraph"); + actualXml = actualXml.substring(index).trim(); + URL xmlUrl = JRSTReaderTest.class.getResource("/testHyperlinkTarget.xml"); + Reader xmlIn = new InputStreamReader(xmlUrl.openStream()); + BufferedReader reader = new BufferedReader(xmlIn); + String line; + StringBuilder buffer = new StringBuilder(); + String ls = System.getProperty("line.separator"); + while ((line = reader.readLine()) != null) { + buffer.append(line); + buffer.append(ls); + } + String xmlexpected = buffer.toString(); + index = xmlexpected.indexOf("<paragraph"); + xmlexpected = xmlexpected.substring(index).trim(); + log.info("Test file : " + url); + log.info("Result :\n" + actualXml); + log.info("Expected :\n" + xmlexpected); + + Assert.assertEquals(xmlexpected, actualXml); } } Added: trunk/jrst/src/test/resources/log4j.properties =================================================================== --- trunk/jrst/src/test/resources/log4j.properties (rev 0) +++ trunk/jrst/src/test/resources/log4j.properties 2010-11-22 15:45:39 UTC (rev 513) @@ -0,0 +1,33 @@ +### +# #%L +# I18n :: Api +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/i18n/trunk/nuiton-i18n/src/test/resources/log4j.pr... $ +# %% +# Copyright (C) 2004 - 2010 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Lesser Public License for more details. +# +# You should have received a copy of the GNU General Lesser Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/lgpl-3.0.html>. +# #L% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n +#log4j.appender.stdout.layout.ConversionPattern=%%c=%c %%C=%C %%d=%d %%F=%F %%l=%l %%L=%L %%m=%m %%M=%M %%p=%p %%r=%r %%t=%t %%x=%x %%X=%X +# package level +log4j.logger.org.nuiton.jrst=INFO Property changes on: trunk/jrst/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/maven-jrst-plugin/src/license/THIRD-PARTY.properties =================================================================== --- trunk/maven-jrst-plugin/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/maven-jrst-plugin/src/license/THIRD-PARTY.properties 2010-11-22 15:45:39 UTC (rev 513) @@ -0,0 +1,30 @@ +# Generated by org.nuiton.license.plugin.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License 2.0 +# - BSD License +# - Common Public License Version 1.0 +# - LGPL +# - Lesser General Public License (LGPL) v 3.0 +# - Mozilla Public License version 1.1 +# - Public Domain +# - The Apache Software License, Version 2.0 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Mon Nov 22 16:43:24 CET 2010 +oro--oro--2.0.8--jar=The Apache Software License, Version 2.0 +com.ibm.icu--icu4j--2.6.1--jar=X License (http\://icu-project.org/repos/icu/icu4j/trunk/main/shared/licenses/license.html) +commons-codec--commons-codec--1.2--jar=The Apache Software License, Version 2.0 +commons-primitives--commons-primitives--1.0--jar=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1--jar=BSD +jaxen--jaxen--1.1.1--jar=http\://jaxen.codehaus.org/license.html +jdom--jdom--1.0--jar=The Apache Software License, Version 2.0 +net.sf.docbook--docbook-xsl--1.75.2--zip--resources=Docbook license (MIT-like) +org.codehaus.plexus--plexus-classworlds--1.2-alpha-9--jar=http\://classworlds.codehaus.org/license.html +org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl--jar=Lesser General Public License (LGPL) v 3.0 +xerces--xercesImpl--2.6.2--jar=The Apache Software License, Version 2.0 + +classworlds--classworlds--1.1-alpha-2--jar=http\://classworlds.codehaus.org/license.html +org.codehaus.plexus--plexus-container-default--1.0-alpha-9-stable-1--jar=The Apache Software License, Version 2.0 \ No newline at end of file Property changes on: trunk/maven-jrst-plugin/src/license/THIRD-PARTY.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native