You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2007/08/25 23:14:29 UTC
svn commit: r569735 [2/4] - in /maven/sandbox/trunk/doxia/doxia-linkcheck:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/maven/
src/main/java/org/apache/maven/doxia/ src/main/java/org/apache/mave...
Added: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml?rev=569735&view=auto
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml (added)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml Sat Aug 25 14:14:27 2007
@@ -0,0 +1,58 @@
+<?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.
+ */
+ -->
+
+<project name="Doxia :: LinkCheck">
+ <bannerLeft>
+ <name>Doxia :: LinkCheck</name>
+ <src>http://maven.apache.org/images/apache-maven-project-2.png</src>
+ <href>http://maven.apache.org/doxia/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-logo-2.gif</src>
+ </bannerRight>
+ <publishDate format="dd MMM yyyy" />
+ <skin>
+ <groupId>org.apache.maven.skins</groupId>
+ <artifactId>maven-stylus-skin</artifactId>
+ </skin>
+ <body>
+ <links>
+ <item name="Apache" href="http://www.apache.org/"/>
+ <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
+ <item name="Maven 2.x" href="http://maven.apache.org/"/>
+ <item name="Continuum" href="http://maven.apache.org/continuum"/>
+ <item name="SCM" href="http://maven.apache.org/scm"/>
+ <item name="Wagon" href="http://maven.apache.org/wagon"/>
+ <item name="JXR" href="http://maven.apache.org/jxr"/>
+ <item name="Doxia" href="http://maven.apache.org/doxia"/>
+ </links>
+
+ <menu name="Doxia :: LinkCheck">
+ <item name="Overview" href="index.html"/>
+ <item name="Usage" href="usage.html"/>
+ </menu>
+
+ ${reports}
+
+ </body>
+</project>
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/site.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml?rev=569735&view=auto
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml (added)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml Sat Aug 25 14:14:27 2007
@@ -0,0 +1,51 @@
+<?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>
+ <properties>
+ <title>Doxia LinkCheck - Index</title>
+ <author email="ltheussl@apache.org">Lukas Theussl</author>
+ </properties>
+
+ <body>
+ <section name="Doxia LinkCheck">
+
+ <p>
+ A tool to validate the links in a set of HTML documents.
+ </p>
+
+ </section>
+
+ <section name="Future Features">
+
+ <p>
+ This section holds a list of possible future features that might be nice
+ to have implemented. (In decreasing order of importance)
+ </p>
+
+ <ol>
+ <li>The ability to include exclude parts of the tree</li>
+ <li>Persists remote url checks across runs</li>
+ </ol>
+
+ </section>
+
+ </body>
+</document>
\ No newline at end of file
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/index.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml?rev=569735&view=auto
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml (added)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml Sat Aug 25 14:14:27 2007
@@ -0,0 +1,105 @@
+<?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>
+ <properties>
+ <title>Doxia FO Module - Usage</title>
+ <author email="ltheussl@apache.org">Lukas Theussl</author>
+ </properties>
+
+ <body>
+ <section name="Usage">
+
+ <p>
+ Here's an example:
+ </p>
+
+ <source>
+ LinkCheck lc = new LinkCheck();
+
+ lc.setOnline( true );
+
+ lc.setBasedir( new File( "/target/site/" ) );
+
+ lc.setOutput( new File( "/target/linkcheck/linkcheck.xml" ) );
+
+ lc.setCache( "/target/linkcheck/linkcheck.cache" );
+
+ String[] excludes = new String[]
+ {
+ "http://cvs.apache.org/viewcvs.cgi/maven-pluginszz/",
+ "http://cvs.apache.org/viewcvs.cgi/mavenzz/"
+ };
+
+ lc.setExcludes( excludes );
+
+ lc.doExecute();
+ </source>
+
+ <p>
+ This traverses all html files found under <code>target/site/</code>
+ and writes the validation result into <code>target/linkcheck/linkcheck.xml</code>.
+ </p>
+
+ <subsection name="Format of linkcheck.xml">
+
+ <p>
+ The created <code>linkcheck.xml</code> file has the following format:
+ </p>
+
+ <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8" ?>
+<linkcheck>
+ <file>
+ <name>nolink.html</name>
+ <successful>0</successful>
+ <unsuccessful>0</unsuccessful>
+ </file>
+ <file>
+ <name>testA.html</name>
+ <successful>1</successful>
+ <unsuccessful>2</unsuccessful>
+ <result>
+ <target>#bumpkin</target>
+ <status>valid</status>
+ <errorMessage></errorMessage>
+ </result>
+ <result>
+ <target>style.css</target>
+ <status>error</status>
+ <errorMessage>doesn't exist.</errorMessage>
+ </result>
+ <result>
+ <target>testnothere.html</target>
+ <status>error</status>
+ <errorMessage>doesn't exist.</errorMessage>
+ </result>
+ </file>
+</linkcheck>
+]]>
+ </source>
+
+ </subsection>
+
+ </section>
+
+ </body>
+</document>
\ No newline at end of file
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/site/xdoc/usage.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java?rev=569735&view=auto
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java (added)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java Sat Aug 25 14:14:27 2007
@@ -0,0 +1,109 @@
+package org.apache.maven.doxia.linkcheck;
+
+/* ====================================================================
+ * 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 java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Ben Walding
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class LinkCheckTest extends TestCase
+{
+ String baseDir;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ this.baseDir = System.getProperty( "basedir" ); // TODO
+ }
+
+ public void testScan() throws Exception
+ {
+ LinkCheck lc = new LinkCheck();
+
+ lc.setOnline( true ); // TODO: check if online
+
+ lc.setBasedir( new File( this.baseDir + "/src/test/resources" ) ); // TODO
+
+ lc.setOutput( new File( this.baseDir + "/target/linkcheck/linkcheck.xml" ) );
+
+ lc.setOutputEncoding( "UTF-8" );
+
+ lc.setCache( this.baseDir + "/target/linkcheck/linkcheck.cache" ); // TODO
+
+ String[] excludes = new String[]
+ {
+ "http://cvs.apache.org/viewcvs.cgi/maven-pluginszz/",
+ "http://cvs.apache.org/viewcvs.cgi/mavenzz/"
+ };
+
+ lc.setExcludes( excludes );
+
+ lc.doExecute();
+
+ Iterator iter = lc.getFiles().iterator();
+
+ Map map = new HashMap();
+
+ while ( iter.hasNext() )
+ {
+ FileToCheck ftc = (FileToCheck) iter.next();
+ map.put( ftc.getName(), ftc );
+ }
+
+ assertEquals( "files.size()", 8, lc.getFiles().size() );
+
+ check( map, "nolink.html", 0 );
+ check( map, "test-resources/nolink.html", 0 );
+ check( map, "test-resources/test1/test1.html", 2 );
+ check( map, "test-resources/test1/test2.html", 0 );
+ check( map, "test1/test1.html", 1 );
+ check( map, "testA.html", 3 );
+
+ /* test excludes */
+ String fileName = "testExcludes.html";
+ check( map, fileName, 2 );
+
+ FileToCheck ftc = (FileToCheck) map.get( fileName );
+ assertEquals( "Excluded links", 2, ftc.getSuccessful() );
+
+ // index-all.html should get parsed, but is currently having problems.
+ // There are 805 distinct links in this page
+ check( map, "index-all.html", 805 );
+
+ }
+
+ private void check( Map map, String name, int linkCount )
+ {
+ FileToCheck ftc = (FileToCheck) map.get( name );
+
+ assertNotNull( name, ftc );
+
+ assertEquals( name + ".getLinks().size()", linkCount, ftc.getResults().size() );
+ }
+
+}
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/LinkCheckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java?rev=569735&view=auto
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java (added)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java Sat Aug 25 14:14:27 2007
@@ -0,0 +1,74 @@
+package org.apache.maven.doxia.linkcheck.validation;
+
+/* ====================================================================
+ * 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 junit.framework.TestCase;
+
+/**
+ * @author <a href="bwalding@apache.org">Ben Walding</a>
+ * @author <a href="aheritier@apache.org">Arnaud Heritier</a>
+ * @version $Id$
+ */
+public class HTTPLinkValidatorTest extends TestCase
+{
+ private LinkValidator hlv;
+
+ private boolean mavenOnline = true; // TODO: check if online
+
+ public void testValidateLink() throws Exception
+ {
+ if ( this.mavenOnline )
+ {
+ /*
+ this.hlv =
+ new OnlineHTTPLinkValidator( System.getProperty( "maven.linkcheck.method" ),
+ System.getProperty( "maven.linkcheck.proxy.host" ),
+ System.getProperty( "maven.linkcheck.proxy.port" ),
+ System.getProperty( "maven.linkcheck.proxy.username" ),
+ System.getProperty( "maven.linkcheck.proxy.password" ),
+ System.getProperty( "maven.linkcheck.proxy.ntlm.host" ),
+ System.getProperty( "maven.linkcheck.proxy.ntlm.domain" ) );
+ */
+ // TODO: use proxy settings above
+
+ this.hlv = new OnlineHTTPLinkValidator();
+
+ assertEquals( LinkValidationResult.VALID, checkLink( "http://www.apache.org" ).getStatus() );
+ assertEquals( LinkValidationResult.ERROR, checkLink( "http://www.example.com>);" ).getStatus() );
+ }
+ else
+ {
+ this.hlv = new OfflineHTTPLinkValidator();
+
+ assertEquals( LinkValidationResult.WARNING, checkLink( "http://www.apache.org" ).getStatus() );
+ assertEquals( LinkValidationResult.WARNING, checkLink( "http://www.example.com>);" ).getStatus() );
+
+ }
+ }
+
+ protected LinkValidationResult checkLink( String link ) throws Exception
+ {
+
+ LinkValidationItem lvi = new LinkValidationItem( new File( "." ), link );
+ return this.hlv.validateLink( lvi );
+ }
+
+}
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-linkcheck/src/test/java/org/apache/maven/doxia/linkcheck/validation/HTTPLinkValidatorTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"