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 2009/06/08 23:39:41 UTC

svn commit: r782797 - in /maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src: main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ main/javadoc/org/apache/maven/doxia/docrenderer/itext/ test/java/org/apache/maven/doxia/docrenderer/ test/java/o...

Author: vsiveton
Date: Mon Jun  8 21:39:41 2009
New Revision: 782797

URL: http://svn.apache.org/viewvc?rev=782797&view=rev
Log:
o fixed test case

Added:
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/resources/images/doxia-logo.png
      - copied unchanged from r782668, maven/doxia/site/src/site/resources/images/doxia-logo.png
Removed:
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/itext/
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/doc-without-TOC.xml
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/org/
Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html

Modified: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java?rev=782797&r1=782796&r2=782797&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java Mon Jun  8 21:39:41 2009
@@ -599,7 +599,15 @@
         {
             try
             {
-                return new File(parentFile, logo ).toURL().toString();
+                File f = new File( parentFile, logo );
+                if ( !f.exists() )
+                {
+                    getLogger().warn( "The logo " + f.getAbsolutePath() + " doesnt exist. IGNORING" );
+                }
+                else
+                {
+                    return new File( f.getAbsolutePath() ).toURL().toString();
+                }
             }
             catch ( MalformedURLException e1 )
             {

Modified: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html?rev=782797&r1=782796&r2=782797&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/javadoc/org/apache/maven/doxia/docrenderer/itext/package.html Mon Jun  8 21:39:41 2009
@@ -21,7 +21,7 @@
 
 <body>
   <h1><b>DEPRECATED</b></h1>
-  <p>Since 1.1, the <i>org.apache.maven.doxia.docrenderer.itext</i> package is all deprecated and will be
-  removed in the future. You could use an implementation of
+  <p>Since 1.1, the <i>org.apache.maven.doxia.docrenderer.itext</i> package is all deprecated and is unmaintained.
+  It will be removed in the future. You could use an implementation of
   <a href="../DocumentRenderer.html">DocumentRenderer</a> interface.</p>
 </body>

Added: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java?rev=782797&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java Mon Jun  8 21:39:41 2009
@@ -0,0 +1,123 @@
+package org.apache.maven.doxia.docrenderer;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.doxia.docrenderer.pdf.PdfRenderer;
+import org.apache.maven.doxia.document.DocumentModel;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.1.1
+ */
+public class DocumentRendererTest
+    extends PlexusTestCase
+{
+    private PdfRenderer docRenderer;
+
+    private File siteDirectoryFile;
+
+    /** {@inheritDoc} */
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        siteDirectoryFile = getTestFile( "src/test/resources/site" );
+    }
+
+    /** {@inheritDoc} */
+    protected void tearDown()
+        throws Exception
+    {
+        release( docRenderer );
+        super.tearDown();
+    }
+
+    public void testFo()
+        throws Exception
+    {
+        renderImpl( "fo" );
+
+        // TODO
+        // renderAggregatedImpl( "fo" );
+    }
+
+    public void testIText()
+        throws Exception
+    {
+        renderImpl( "itext" );
+
+        // TODO
+        // renderAggregatedImpl( "itext" );
+    }
+
+    private void renderImpl( String implementation )
+        throws Exception
+    {
+        File outputDirectory = getTestFile( "target/output/" + implementation );
+        if ( outputDirectory.exists() )
+        {
+            FileUtils.deleteDirectory( outputDirectory );
+        }
+        outputDirectory.mkdirs();
+
+        docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
+
+        docRenderer.render( siteDirectoryFile, outputDirectory, null );
+
+        assertTrue( new File( outputDirectory, "faq.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "faq.pdf" ).length() > 0 );
+        assertTrue( new File( outputDirectory, "index.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "index.pdf" ).length() > 0 );
+        assertTrue( new File( outputDirectory, "overview.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "overview.pdf" ).length() > 0 );
+        assertTrue( new File( outputDirectory, "resources.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "resources.pdf" ).length() > 0 );
+        assertTrue( new File( outputDirectory, "references" + File.separator + "fml-format.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "references" + File.separator + "fml-format.pdf" ).length() > 0 );
+        assertTrue( new File( outputDirectory, "references" + File.separator + "xdoc-format.pdf" ).exists() );
+        assertTrue( new File( outputDirectory, "references" + File.separator + "xdoc-format.pdf" ).length() > 0 );
+    }
+
+    private void renderAggregatedImpl( String implementation )
+        throws Exception
+    {
+        File outputDirectory = getTestFile( "target/output/" + implementation + "-aggregated" );
+        if ( outputDirectory.exists() )
+        {
+            FileUtils.deleteDirectory( outputDirectory );
+        }
+        outputDirectory.mkdirs();
+
+        docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
+
+        DocumentModel descriptor = docRenderer.readDocumentModel( new File( siteDirectoryFile, "pdf.xml" ) );
+        assertNotNull( descriptor );
+        docRenderer.render( siteDirectoryFile, outputDirectory, descriptor );
+
+        assertTrue( new File( outputDirectory, descriptor.getOutputName() + ".pdf" ).exists() );
+        assertTrue( new File( outputDirectory, descriptor.getOutputName() + ".pdf" ).length() > 0 );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml?rev=782797&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml Mon Jun  8 21:39:41 2009
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * 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 xmlns="http://maven.apache.org/DOCUMENT/1.0.1"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DOCUMENT/1.0.1 file:../../../../../../doxia/doxia-core/target/generated-site/xsd/document-1.0.1.xsd"
+  outputName="doxia">
+
+  <meta>
+    <title>Apache Maven Doxia</title>
+    <author>The Apache Maven Project</author>
+    <keyWords>
+      <keyWord>Content generation framework</keyWord>
+      <keyWord>Lightweight markup language</keyWord>
+      <keyWord>APT</keyWord>
+      <keyWord>FML</keyWord>
+      <keyWord>XDOC</keyWord>
+    </keyWords>
+  </meta>
+
+  <toc name="Table of Contents">
+    <item name="What is Doxia?" ref="index.html"/>
+    <item name="Overview" ref="overview.html"/>
+    <item name="FAQ" ref="faq.html"/>
+    <item name="Resources" ref="resources.html"/>
+    <item name="FML Format" ref="references/fml-format.html"/>
+    <item name="XDoc Format" ref="references/xdoc-format.html"/>
+  </toc>
+
+  <cover>
+    <coverTitle>Apache Maven Doxia</coverTitle>
+    <coverSubTitle>v. ${doxiaVersion}</coverSubTitle>
+    <coverType>User Guide</coverType>
+    <companyName>The Apache Software Foundation</companyName>
+    <projectLogo>./images/doxia-logo.png</projectLogo>
+  </cover>
+</document>

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision