Author: vsiveton
Date: Tue Jun 9 10:48:57 2009
New Revision: 782949
URL: http://svn.apache.org/viewvc?rev=782949&view=rev
Log:
o more dynamic assert
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
Modified:
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=782949&r1=782948&r2=782949&view=diff
==============================================================================
---
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
(original)
+++
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java
Tue Jun 9 10:48:57 2009
@@ -20,11 +20,14 @@
*/
import java.io.File;
+import java.util.Iterator;
+import java.util.List;
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;
+import org.codehaus.plexus.util.StringUtils;
/**
* @author <a href="mailto:[email protected]">Vincent Siveton</a>
@@ -94,21 +97,27 @@
outputDirectory.mkdirs();
docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
+ assertNotNull( docRenderer );
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 );
+ List files =
+ FileUtils.getFileNames( new File( siteDirectoryFile, "apt" ),
"**/*.apt",
+ FileUtils.getDefaultExcludesAsString(),
false );
+ files.addAll( FileUtils.getFileNames( new File( siteDirectoryFile,
"fml" ), "**/*.fml",
+
FileUtils.getDefaultExcludesAsString(), false ) );
+ files.addAll( FileUtils.getFileNames( new File( siteDirectoryFile,
"xdoc" ), "**/*.xml",
+
FileUtils.getDefaultExcludesAsString(), false ) );
+
+ for ( Iterator it = files.iterator(); it.hasNext(); )
+ {
+ String relativeFile = it.next().toString();
+ String relativePdf = StringUtils.replace( relativeFile,
FileUtils.getExtension( relativeFile ), "pdf" );
+ File pdf = new File( outputDirectory, relativePdf );
+
+ assertTrue( pdf.exists() );
+ assertTrue( pdf.length() > 0 );
+ }
}
private void renderAggregatedImpl( String implementation )
@@ -122,12 +131,16 @@
outputDirectory.mkdirs();
docRenderer = (PdfRenderer) lookup( PdfRenderer.ROLE, implementation );
+ assertNotNull( docRenderer );
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 );
+ File pdf = new File( outputDirectory, descriptor.getOutputName() +
".pdf" );
+
+ assertTrue( pdf.exists() );
+ assertTrue( pdf.length() > 0 );
}
}
Modified:
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=782949&r1=782948&r2=782949&view=diff
==============================================================================
---
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
(original)
+++
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/test/resources/site/pdf.xml
Tue Jun 9 10:48:57 2009
@@ -23,7 +23,7 @@
<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">
+ outputName="doxia-1.1.1">
<meta>
<title>Apache Maven Doxia</title>
@@ -47,10 +47,11 @@
</toc>
<cover>
- <coverTitle>Apache Maven Doxia</coverTitle>
- <coverSubTitle>v. ${doxiaVersion}</coverSubTitle>
+ <coverTitle>Apache Maven Doxia Test</coverTitle>
+ <coverSubTitle>v. 1.1.1-SNAPSHOT</coverSubTitle>
<coverType>User Guide</coverType>
<companyName>The Apache Software Foundation</companyName>
+ <companyLogo>http://www.apache.org/images/asf_logo_wide.png</companyLogo>
<projectLogo>./images/doxia-logo.png</projectLogo>
</cover>
</document>