You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/02/19 20:46:39 UTC

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #10: [DOXIASITETOOLS-109] handle more URI formats

elharo commented on a change in pull request #10: [DOXIASITETOOLS-109] handle more URI formats
URL: https://github.com/apache/maven-doxia-sitetools/pull/10#discussion_r381530085
 
 

 ##########
 File path: doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java
 ##########
 @@ -56,4 +72,45 @@ public void testGetNormalizedPath()
         assertEquals( "file:/Documents and Settings/",
                 DefaultSiteTool.getNormalizedPath( "file://Documents and Settings/" ) );
     }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath()
+    {
+        assertEquals(
+            ".." + File.separator + "bar.html",
+            tool.getRelativePath("http://example.com/foo/bar.html", "http://example.com/foo/baz.html"));
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath_same()
+    {
+        assertTrue(
+          tool.getRelativePath( "http://example.com/foo/bar.html", "http://example.com/foo/bar.html" ).isEmpty() );
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath_differentSchemes() {
+        assertEquals(
+          "scp://example.com/foo/bar.html",
+          tool.getRelativePath( "scp://example.com/foo/bar.html", "http://example.com/foo/bar.html" ) );
+      assertEquals(
+        "file:///tmp/bloop",
+         tool.getRelativePath( "file:///tmp/bloop", "scp://localhost:/tmp/blop" ) );
 
 Review comment:
   surprisingly it is per RFC 3986. The port production is 
   
      The port subcomponent of authority is designated by an optional port
      number in decimal following the host and delimited from it by a
      single colon (":") character.
   
         port        = *DIGIT
   
   
    I copied this case from https://issues.apache.org/jira/browse/DOXIASITETOOLS-110

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services