You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2007/08/22 05:52:02 UTC
svn commit: r568401 - in /maven/doxia/doxia/trunk:
doxia-core/src/test/java/org/apache/maven/doxia/
doxia-core/src/test/java/org/apache/maven/doxia/sink/
doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/
Author: vsiveton
Date: Tue Aug 21 20:52:01 2007
New Revision: 568401
URL: http://svn.apache.org/viewvc?rev=568401&view=rev
Log:
o fixed encoding and revert r567233
o used WriterFactory.newPlatformWriter(...) and WriterFactory.newXmlWriter(...) instead of FileWriter(...)
o fixed javadoc
o Thanks to Hervé BOUTEMY's inputs
Modified:
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java?rev=568401&r1=568400&r2=568401&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java Tue Aug 21 20:52:01 2007
@@ -20,9 +20,9 @@
*/
import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.WriterFactory;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -69,7 +69,31 @@
outputDirectory.mkdirs();
}
- return new FileWriter(
+ return WriterFactory.newPlatformWriter(
+ new File( outputDirectory, baseName + "." + extension ) );
+ }
+
+ /**
+ * Returns an XML FileWriter to write to a file with the given name
+ * in the test target output directory.
+ *
+ * @param baseName The name of the target file.
+ * @param extension The file extension of the file to write.
+ * @return An XML FileWriter.
+ * @throws IOException If the FileWriter could not be generated.
+ */
+ protected Writer getXmlTestWriter( String baseName, String extension )
+ throws IOException
+ {
+ File outputDirectory =
+ new File( getBasedirFile(), outputBaseDir() + getOutputDir() );
+
+ if ( !outputDirectory.exists() )
+ {
+ outputDirectory.mkdirs();
+ }
+
+ return WriterFactory.newXmlWriter(
new File( outputDirectory, baseName + "." + extension ) );
}
Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java?rev=568401&r1=568400&r2=568401&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/SinkTestDocument.java Tue Aug 21 20:52:01 2007
@@ -595,15 +595,7 @@
sink.paragraph_();
sink.paragraph();
- String copyright;
- try
- {
- copyright = new String( String.valueOf( '\u00a9' ).getBytes( "UTF-8" ) );
- }
- catch ( UnsupportedEncodingException e )
- {
- throw new IllegalArgumentException( e.getMessage() );
- }
+ String copyright = String.valueOf( '\u00a9' );
sink.text( "Copyright symbol: " + copyright + ", "
+ copyright + ", " + copyright + "." );
sink.paragraph_();
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java?rev=568401&r1=568400&r2=568401&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java Tue Aug 21 20:52:01 2007
@@ -22,10 +22,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.io.Writer;
import java.net.URL;
@@ -44,17 +40,13 @@
public class ITextSinkTestCase
extends AbstractModuleTest
{
-
/** {@inheritDoc} */
protected String outputExtension()
{
return "xml";
}
- /**
- * Returns the directory where all sink test output will go.
- * @return The test output directory.
- */
+ /** {@inheritDoc} */
protected String getOutputDir()
{
return "sink/";
@@ -89,7 +81,11 @@
return sink;
}
-
+ /**
+ * Test PDF generation
+ *
+ * @throws Exception
+ */
public void testGeneratingPDFFromITextXml()
throws Exception
{
@@ -107,7 +103,7 @@
public void testModel()
throws Exception
{
- Sink sink = createSink( getTestWriter( "test_model", "xml" ) );
+ Sink sink = createSink( getXmlTestWriter( "test_model", "xml" ) );
SinkTestDocument.generate( sink );
@@ -117,7 +113,5 @@
new FileOutputStream( getGeneratedFile( "test_model", "pdf" ) ) );
ITextUtil.writeRtf( new FileInputStream( getGeneratedFile( "test_model", "xml" ) ),
new FileOutputStream( getGeneratedFile( "test_model", "rtf" ) ) );
-
}
-
}