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 lt...@apache.org on 2011/01/28 14:30:03 UTC
svn commit: r1064665 - in
/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src:
main/java/org/apache/maven/doxia/site/decoration/inheritance/
test/java/org/apache/maven/doxia/site/decoration/inheritance/ test/resources/
Author: ltheussl
Date: Fri Jan 28 13:30:03 2011
New Revision: 1064665
URL: http://svn.apache.org/viewvc?rev=1064665&view=rev
Log:
[DOXIASITETOOLS-49] paths are loosing their query parts when being relativized
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/resources/fully-populated-merged.xml
Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java?rev=1064665&r1=1064664&r2=1064665&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java Fri Jan 28 13:30:03 2011
@@ -136,7 +136,7 @@ public class URIPathDescriptor
return link;
}
- final String relativePath = PathTool.getRelativeWebPath( newBaseURI.getPath(), link.getPath() );
+ final String relativePath = PathTool.getRelativeWebPath( newBaseURI.toString(), link.toString() );
return URI.create( relativePath );
}
Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java?rev=1064665&r1=1064664&r2=1064665&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java Fri Jan 28 13:30:03 2011
@@ -92,6 +92,12 @@ public class URIPathDescriptorTest
oldPath = new URIPathDescriptor( "http://maven.apache.org", "source" );
assertEquals( expected, oldPath.resolveLink().toString() );
+
+ oldPath = new URIPathDescriptor( maven, "source/index.html" );
+ assertEquals( expected + "/index.html", oldPath.resolveLink().toString() );
+
+ oldPath = new URIPathDescriptor( maven, "source/index.html?var=foo&var2=bar" );
+ assertEquals( expected + "/index.html?var=foo&var2=bar", oldPath.resolveLink().toString() );
}
/**
@@ -107,6 +113,13 @@ public class URIPathDescriptorTest
assertEquals( "http://maven.apache.org/source", oldPath.rebaseLink( null ).toString() );
assertEquals( "http://maven.apache.org/source", oldPath.rebaseLink( "C:/Documents and Settings/" ).toString() );
+ oldPath = new URIPathDescriptor( maven, "source/index.html" );
+ assertEquals( "../source/index.html", oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() );
+
+ oldPath = new URIPathDescriptor( maven, "source/index.html?var=foo&var2=bar" );
+ assertEquals( "../source/index.html?var=foo&var2=bar",
+ oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() );
+
oldPath = new URIPathDescriptor( "scp://people.apache.org/", "source" );
assertEquals( "../source", oldPath.rebaseLink( "scp://people.apache.org/doxia" ).toString() );
@@ -136,6 +149,12 @@ public class URIPathDescriptorTest
path = new URIPathDescriptor( "http://maven.apache.org/doxia", "http://maven.apache.org/source" );
assertEquals( "../source", path.relativizeLink().toString() );
+
+ path = new URIPathDescriptor( maven, "http://maven.apache.org/index.html" );
+ assertEquals( "index.html", path.relativizeLink().toString() );
+
+ path = new URIPathDescriptor( maven, "http://maven.apache.org/index.html?var=foo&var2=bar" );
+ assertEquals( "index.html?var=foo&var2=bar", path.relativizeLink().toString() );
}
/**
Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/resources/fully-populated-merged.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/resources/fully-populated-merged.xml?rev=1064665&r1=1064664&r2=1064665&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/resources/fully-populated-merged.xml (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/resources/fully-populated-merged.xml Fri Jan 28 13:30:03 2011
@@ -38,7 +38,7 @@ under the License.
<version position="right" />
<poweredBy>
- <logo name="Maven" href="http://maven.apache.org" img="../images/maven-feather.png"/>
+ <logo name="Maven" href=".." img="../images/maven-feather.png"/>
</poweredBy>
<skin>