Author: vsiveton Date: Fri Aug 21 11:33:25 2009 New Revision: 806502 URL: http://svn.apache.org/viewvc?rev=806502&view=rev Log: o added @version and format
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java?rev=806502&r1=806501&r2=806502&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java Fri Aug 21 11:33:25 2009 @@ -28,11 +28,13 @@ * Test FoAggregateSink. * * @author ltheussl + * @version $Id$ */ public class FoAggregateSinkTest - extends TestCase + extends TestCase { private FoAggregateSink sink; + private Writer writer; /** @@ -41,10 +43,10 @@ * @throws java.lang.Exception if any. */ protected void setUp() - throws Exception + throws Exception { super.setUp(); - writer = new StringWriter(); + writer = new StringWriter(); } /** Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java?rev=806502&r1=806501&r2=806502&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java Fri Aug 21 11:33:25 2009 @@ -24,8 +24,13 @@ import junit.framework.TestCase; -/** FoConfiguration tests. */ -public class FoConfigurationTest extends TestCase +/** + * FoConfiguration tests. + * + * @version $Id$ + */ +public class FoConfigurationTest + extends TestCase { /** Tests the getAttributeString( String ) method. */ @@ -33,18 +38,13 @@ { FoConfiguration config = new FoConfiguration(); - assertEquals( - "Null attribute ID should return empty string!", - "", config.getAttributeString( null ) ); - - assertEquals( - "Non existent attribute ID should return empty string!", - "", config.getAttributeString( "a.dummy.attribute" ) ); - - assertEquals( - "Wrong attributes returned for body.pre!", - " font-family=\"monospace\" font-size=\"10pt\"", - config.getAttributeString( "body.pre" ) ); + assertEquals( "Null attribute ID should return empty string!", "", config.getAttributeString( null ) ); + + assertEquals( "Non existent attribute ID should return empty string!", "", + config.getAttributeString( "a.dummy.attribute" ) ); + + assertEquals( "Wrong attributes returned for body.pre!", " font-family=\"monospace\" font-size=\"10pt\"", + config.getAttributeString( "body.pre" ) ); } /** Tests the getAttributeSet( String ) method. */ @@ -52,28 +52,19 @@ { FoConfiguration config = new FoConfiguration(); - assertNull( - "Null attribute ID should return null AttributeSet!", - config.getAttributeSet( null ) ); - - assertNull( - "Empty attribute ID should return null AttributeSet!", - config.getAttributeSet( "" ) ); - - assertNull( - "Non existent attribute ID should return null AttributeSet!", - config.getAttributeSet( "a.dummy.attribute" ) ); + assertNull( "Null attribute ID should return null AttributeSet!", config.getAttributeSet( null ) ); + assertNull( "Empty attribute ID should return null AttributeSet!", config.getAttributeSet( "" ) ); + + assertNull( "Non existent attribute ID should return null AttributeSet!", + config.getAttributeSet( "a.dummy.attribute" ) ); MutableAttributeSet expected = new SimpleAttributeSet(); expected.addAttribute( "font-size", "10pt" ); expected.addAttribute( "font-family", "monospace" ); MutableAttributeSet actual = config.getAttributeSet( "body.pre" ); - assertTrue( - "Wrong AttributeSet returned for body.pre!", - expected.isEqual( actual ) ); + assertTrue( "Wrong AttributeSet returned for body.pre!", expected.isEqual( actual ) ); } - } Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java?rev=806502&r1=806501&r2=806502&view=diff ============================================================================== --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java (original) +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java Fri Aug 21 11:33:25 2009 @@ -35,8 +35,11 @@ /** * <code>FO Sink</code> Test case. + * + * @version $Id$ */ -public class FoSinkTest extends AbstractSinkTest +public class FoSinkTest + extends AbstractSinkTest { private FoConfiguration config; @@ -48,7 +51,8 @@ * Uses fop to generate a pdf from a test document. * @throws Exception If the conversion fails. */ - public void testConvertFO2PDF() throws Exception + public void testConvertFO2PDF() + throws Exception { String fileName = "test"; // first create fo @@ -66,7 +70,8 @@ * Uses fop to generate an aggregated pdf from two test documents. * @throws Exception If the conversion fails. */ - public void testAggregateMode() throws Exception + public void testAggregateMode() + throws Exception { FoAggregateSink fosink = new FoAggregateSink( getTestWriter( "aggregate" ) ); @@ -98,7 +103,7 @@ DocumentModel model = new DocumentModel(); model.setToc( getToc() ); model.setMeta( getMeta() ); - return model ; + return model; } private DocumentMeta getMeta() @@ -200,8 +205,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h1" ); - return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" - + attrib2 + ">1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + attrib2 + ">1 " + title + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -209,8 +214,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h2" ); - return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" - + attrib2 + ">0.1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + attrib2 + ">0.1 " + title + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -218,8 +223,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h3" ); - return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" - + attrib2 + ">0.0.1 " + title + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + attrib2 + ">0.0.1 " + title + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -227,8 +232,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h4" ); - return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" - + attrib2 + ">" + title + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + attrib2 + ">" + title + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -236,8 +241,8 @@ { String attribs = getConfig().getAttributeString( "body.text" ); String attrib2 = getConfig().getAttributeString( "body.h5" ); - return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" - + attrib2 + ">" + title + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + attribs + ">" + EOL + EOL + "<fo:block" + attrib2 + ">" + title + + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -246,9 +251,9 @@ String attribs = getConfig().getAttributeString( "list" ); String itemAttribs = getConfig().getAttributeString( "list.item" ); return EOL + EOL + "<fo:list-block" + attribs + ">" + EOL + "<fo:list-item" + itemAttribs - + "><fo:list-item-label><fo:block>•</fo:block></fo:list-item-label>" - + EOL + EOL + "<fo:list-item-body" + itemAttribs + ">" + EOL + "<fo:block>" + item - + "</fo:block>" + EOL + "</fo:list-item-body>" + EOL + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; + + "><fo:list-item-label><fo:block>•</fo:block></fo:list-item-label>" + EOL + EOL + + "<fo:list-item-body" + itemAttribs + ">" + EOL + "<fo:block>" + item + "</fo:block>" + EOL + + "</fo:list-item-body>" + EOL + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; } /** {...@inheritdoc} */ @@ -256,11 +261,10 @@ { String attribs = getConfig().getAttributeString( "list" ); String itemAttribs = getConfig().getAttributeString( "list.item" ); - return EOL + EOL + "<fo:list-block" + attribs + ">" + EOL + "<fo:list-item" + itemAttribs - + ">" + EOL + "<fo:list-item-label>" + EOL + "<fo:block>i</fo:block>" + EOL - + "</fo:list-item-label>" + EOL + EOL + "<fo:list-item-body" + itemAttribs - + ">" + EOL + "<fo:block>" + item + "</fo:block>" + EOL + "</fo:list-item-body>" + EOL - + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; + return EOL + EOL + "<fo:list-block" + attribs + ">" + EOL + "<fo:list-item" + itemAttribs + ">" + EOL + + "<fo:list-item-label>" + EOL + "<fo:block>i</fo:block>" + EOL + "</fo:list-item-label>" + EOL + EOL + + "<fo:list-item-body" + itemAttribs + ">" + EOL + "<fo:block>" + item + "</fo:block>" + EOL + + "</fo:list-item-body>" + EOL + "</fo:list-item>" + EOL + "</fo:list-block>" + EOL; } /** {...@inheritdoc} */ @@ -269,9 +273,9 @@ String dlAtts = getConfig().getAttributeString( "dl" ); String dtAtts = getConfig().getAttributeString( "dt" ); String ddAtts = getConfig().getAttributeString( "dd" ); - return EOL + EOL + "<fo:block" + dlAtts + ">" + EOL + "<fo:block" + dtAtts + ">" + definum - + "</fo:block>" + EOL + EOL + EOL + "<fo:block" + ddAtts + ">" + definition - + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + dlAtts + ">" + EOL + "<fo:block" + dtAtts + ">" + definum + "</fo:block>" + + EOL + EOL + EOL + "<fo:block" + ddAtts + ">" + definition + "</fo:block>" + EOL + "</fo:block>" + + EOL; } /** {...@inheritdoc} */ @@ -280,9 +284,8 @@ String dlAtts = getConfig().getAttributeString( "figure.display" ); String dtAtts = getConfig().getAttributeString( "figure.graphics" ); String ddAtts = getConfig().getAttributeString( "figure.caption" ); - return EOL + EOL + "<fo:block" + dlAtts + "><fo:external-graphic" - + " src=\"" + source + "\"" + dtAtts + "/>" + EOL + EOL + "<fo:block" + ddAtts - + ">" + caption + "</fo:block>" + EOL + "</fo:block>" + EOL; + return EOL + EOL + "<fo:block" + dlAtts + "><fo:external-graphic" + " src=\"" + source + "\"" + dtAtts + + "/>" + EOL + EOL + "<fo:block" + ddAtts + ">" + caption + "</fo:block>" + EOL + "</fo:block>" + EOL; } /** {...@inheritdoc} */ @@ -291,21 +294,19 @@ String dlAtts = getConfig().getAttributeString( "table.padding" ); String dtAtts = getConfig().getAttributeString( "table.layout" ); String ddAtts = getConfig().getAttributeString( "table.body.row" ); - //String deAtts = getConfig().getAttributeString( "table.body.cell" ); + // String deAtts = getConfig().getAttributeString( "table.body.cell" ); return EOL + EOL + "<fo:block" + dlAtts + ">" + EOL + "<fo:table" + dtAtts + ">" + EOL - + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" - + EOL + "<fo:table-column column-width=\"100%\"/>" - + EOL + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" - + EOL + EOL + "<fo:table-body>" + EOL + "<fo:table-row" + ddAtts + + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" + EOL + + "<fo:table-column column-width=\"100%\"/>" + EOL + + "<fo:table-column column-width=\"proportional-column-width(1)\"/>" + EOL + EOL + "<fo:table-body>" + + EOL + "<fo:table-row" + ddAtts + "><fo:table-cell column-number=\"2\" padding-after=\"1.5pt\" padding-end=\"5pt\" " + "keep-together.within-column=\"always\" padding-start=\"2.5pt\" " + "background-color=\"#eeeeee\" padding-before=\"4pt\">" + EOL + "<fo:block line-height=\"1.2em\" " + "text-align=\"center\" font-family=\"Helvetica,sans-serif\" font-size=\"9pt\">" + EOL + cell + "</fo:block>" + EOL + "</fo:table-cell>" + EOL + "</fo:table-row>" + EOL + "</fo:table-body>" + EOL - + "</fo:table>"+ EOL - + "</fo:block>"+ EOL - + EOL + + "</fo:table>" + EOL + "</fo:block>" + EOL + EOL + "<fo:block white-space-collapse=\"true\" space-after=\"6pt\" space-before=\"3pt\" " + "font-family=\"Garamond,serif\" line-height=\"12pt\" text-align=\"center\" font-size=\"11pt\">" + "Table_caption</fo:block>" + EOL; @@ -349,8 +350,8 @@ protected String getLinkBlock( String link, String text ) { String attribs = getConfig().getAttributeString( "href.internal" ); - return EOL + "<fo:basic-link internal-destination=\"" + link + "\">" + EOL + "<fo:inline" - + attribs + ">" + text + "</fo:inline></fo:basic-link>"; + return EOL + "<fo:basic-link internal-destination=\"" + link + "\">" + EOL + "<fo:inline" + attribs + ">" + + text + "</fo:inline></fo:basic-link>"; } /** {...@inheritdoc} */ @@ -402,10 +403,10 @@ // Auxiliary methods // ---------------------------------------------------------------------- - - private void fo2pdf( String baseName ) throws Exception + private void fo2pdf( String baseName ) + throws Exception { - //File outputDirectory = new File( getBasedirFile(), getOutputDir() ); + // File outputDirectory = new File( getBasedirFile(), getOutputDir() ); File outputDirectory = new File( getBasedir(), outputBaseDir() + getOutputDir() ); File resourceDirectory = new File( getBasedirFile(), "target/test-classes" ); File foFile = new File( outputDirectory, baseName + "." + outputExtension() );