Author: jvanzyl Date: Sat Mar 17 22:08:28 2007 New Revision: 519553 URL: http://svn.apache.org/viewvc?view=rev&rev=519553 Log: decoupling module
Added: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml (with props) maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml (with props) maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml (with props) maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml (with props) Modified: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/pom.xml maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java Modified: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/pom.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/pom.xml?view=diff&rev=519553&r1=519552&r2=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/pom.xml (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/pom.xml Sat Mar 17 22:08:28 2007 @@ -5,17 +5,5 @@ <version>1.0-alpha-9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-module-xdoc</artifactId> - <name>doxia-module-xdoc</name> - <version>1.0-SNAPSHOT</version> - <url>http://maven.apache.org</url> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file +</project> Modified: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?view=diff&rev=519553&r1=519552&r2=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java Sat Mar 17 22:08:28 2007 @@ -21,10 +21,10 @@ import java.io.Writer; -import org.apache.maven.doxia.module.HtmlTools; -import org.apache.maven.doxia.module.apt.AptParser; +import org.apache.maven.doxia.util.HtmlTools; import org.apache.maven.doxia.sink.SinkAdapter; import org.apache.maven.doxia.util.LineBreaker; +import org.apache.maven.doxia.parser.Parser; /** * A doxia Sink which produces an xdoc model. @@ -496,13 +496,13 @@ { switch ( cellJustif[cellCount] ) { - case AptParser.JUSTIFY_LEFT: + case Parser.JUSTIFY_LEFT: justif = "left"; break; - case AptParser.JUSTIFY_RIGHT: + case Parser.JUSTIFY_RIGHT: justif = "right"; break; - case AptParser.JUSTIFY_CENTER: + case Parser.JUSTIFY_CENTER: default: justif = "center"; break; Added: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml?view=auto&rev=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml Sat Mar 17 22:08:28 2007 @@ -0,0 +1,23 @@ +<component-set> + <components> + <component> + <role>org.apache.maven.doxia.parser.Parser</role> + <role-hint>xdoc</role-hint> + <implementation>org.apache.maven.doxia.module.xdoc.XdocParser</implementation> + <requirements> + <requirement> + <role>org.apache.maven.doxia.macro.manager.MacroManager</role> + <field-name>macroManager</field-name> + </requirement> + </requirements> +<description>Parse an xdoc model and emit events into the specified doxia +Sink.</description> + </component> + <component> + <role>org.apache.maven.doxia.site.module.SiteModule</role> + <role-hint>xdoc</role-hint> + <implementation>org.apache.maven.doxia.module.xdoc.XdocSiteModule</implementation> + <description></description> + </component> + </components> +</component-set> Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java?view=diff&rev=519553&r1=519552&r2=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java Sat Mar 17 22:08:28 2007 @@ -37,9 +37,7 @@ { private XdocParser parser; - /** - * @see junit.framework.TestCase#setUp() - */ + /** @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { @@ -48,25 +46,19 @@ parser = (XdocParser) lookup( Parser.ROLE, "xdoc" ); } - /** - * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getParser() - */ + /** @see org.apache.maven.doxia.parser.AbstractParserTestCase#getParser() */ protected Parser getParser() { return parser; } - /** - * @see org.apache.maven.doxia.parser.AbstractParserTestCase#getDocument() - */ + /** @see org.apache.maven.doxia.parser.AbstractParserTestCase#getDocument() */ protected String getDocument() { - return "src/test/site/xdoc/report.xml"; + return "src/test/resources/report.xml"; } - /** - * @throws Exception - */ + /** @throws Exception */ public void testSnippetMacro() throws Exception { @@ -76,7 +68,7 @@ try { output = new StringWriter(); - reader = new FileReader( getTestFile( getBasedir(), "src/test/site/xdoc/macro.xml" ) ); + reader = new FileReader( getTestFile( getBasedir(), "src/test/resources/macro.xml" ) ); Sink sink = new XdocSink( output ); getParser().parse( reader, sink ); @@ -85,14 +77,19 @@ } finally { - output.close(); - reader.close(); + if ( output != null ) + { + output.close(); + } + + if ( reader != null ) + { + reader.close(); + } } } - /** - * @throws Exception - */ + /** @throws Exception */ public void testTocMacro() throws Exception { @@ -102,7 +99,7 @@ try { output = new StringWriter(); - reader = new FileReader( getTestFile( getBasedir(), "src/test/site/xdoc/toc.xml" ) ); + reader = new FileReader( getTestFile( getBasedir(), "src/test/resources/toc.xml" ) ); Sink sink = new XdocSink( output ); getParser().parse( reader, sink ); @@ -113,8 +110,15 @@ } finally { - output.close(); - reader.close(); + if ( output != null ) + { + output.close(); + } + + if ( reader != null ) + { + reader.close(); + } } } } Modified: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java?view=diff&rev=519553&r1=519552&r2=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java (original) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java Sat Mar 17 22:08:28 2007 @@ -22,6 +22,11 @@ import org.apache.maven.doxia.module.xdoc.XdocSink; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.AbstractSinkTestCase; +import org.apache.maven.doxia.parser.Parser; + +import java.io.Reader; +import java.io.InputStream; +import java.io.InputStreamReader; /** * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> @@ -35,9 +40,24 @@ return "xml"; } + protected Parser createParser() + { + return new XdocParser(); + } + protected Sink createSink() throws Exception { return new XdocSink( getTestWriter() ); + } + + protected Reader getTestReader() + throws Exception + { + InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( "report.xml" ); + + InputStreamReader reader = new InputStreamReader( is ); + + return reader; } } Added: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml?view=auto&rev=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml Sat Mar 17 22:08:28 2007 @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +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> + <properties> + <title>Test DOXIA-77</title> + <author email="[EMAIL PROTECTED]">Vincent Siveton</author> + </properties> + <body> + <p> + Test DOXIA-77 + </p> + <macro name="snippet" id="superpom" url="http://svn.apache.org/repos/asf/maven/components/trunk/maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml"/> + </body> +</document> Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/macro.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml?view=auto&rev=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml Sat Mar 17 22:08:28 2007 @@ -0,0 +1,36 @@ +<!-- +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> +<properties> +<author>meeper</author> +<title>Synchronization report for Codehaus</title> +</properties> +<body> +<section name="Synchronization report for Codehaus"> +<table> +<tr> +<th>Artifact</th> +<th>Size (in bytes)</th> +<th>Date</th> +</tr> +</table> +<p><a href="codehaus-2004-08-29.txt">Raw report</a></p></section> +</body> +</document> Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/report.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml?view=auto&rev=519553 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml Sat Mar 17 22:08:28 2007 @@ -0,0 +1,64 @@ +<?xml version="1.0"?> +<!-- +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> + <properties> + <title>Test DOXIA-40</title> + <author email="[EMAIL PROTECTED]">Vincent Siveton</author> + </properties> + <body> + <p> + Test DOXIA-40 + </p> + <section name="Section 1"> + <p> + Section 1 + </p> + <p> + <macro name="toc" section="1" fromDepth="1" toDepth="2"/> + </p> + <subsection name="Section 11"> + <p> + Section 11 + </p> + </subsection> + <subsection name="Section 12"> + <p> + Section 12 + </p> + <subsection name="Section 121"> + <p> + Section 121 + </p> + <subsection name="Section 1211"> + <p> + Section 1211 + </p> + </subsection> + </subsection> + </subsection> + <subsection name="Section 13"> + <p> + Section 13 + </p> + </subsection> + </section> + </body> +</document> Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/resources/toc.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"