summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
diff options
context:
space:
mode:
authorMarc Strapetz <marc.strapetz@syntevo.com>2017-12-09 13:23:28 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2017-12-23 21:18:12 +0100
commit8cc783ca7d3180ec8b548dd67743f5fc1e9a6a15 (patch)
treef1ce399b7fe3cdc4a3839dc5626f0188eea0b590 /org.eclipse.jgit.test/tst/org/eclipse
parenta107bb18a4460a30675f13c23f9d0f5728ecf0e4 (diff)
downloadjgit-8cc783ca7d3180ec8b548dd67743f5fc1e9a6a15.tar.gz
jgit-8cc783ca7d3180ec8b548dd67743f5fc1e9a6a15.zip
URIish: support for empty ports
Properly parse URLs like "ssh://host:/path" Bug: 519187 Change-Id: I0054868e30509e4ba919444be16c2a20f741545a Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java
index 9bd30b8837..1eb218c865 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java
@@ -503,6 +503,22 @@ public class URIishTest {
}
@Test
+ public void testSshProtoHostWithEmptyPortAndPath() throws Exception {
+ final String str = "ssh://example.com:/path";
+ URIish u = new URIish(str);
+ assertEquals("ssh", u.getScheme());
+ assertTrue(u.isRemote());
+ assertEquals("/path", u.getRawPath());
+ assertEquals("/path", u.getPath());
+ assertEquals("example.com", u.getHost());
+ assertEquals(-1, u.getPort());
+ assertEquals("ssh://example.com/path", u.toString());
+ assertEquals("ssh://example.com/path", u.toASCIIString());
+ assertEquals(u, new URIish(str));
+ assertEquals(u, new URIish("ssh://example.com/path"));
+ }
+
+ @Test
public void testSshProtoWithUserAndPort() throws Exception {
final String str = "ssh://user@example.com:33/some/p ath";
URIish u = new URIish(str);
@@ -973,13 +989,6 @@ public class URIishTest {
}
@Test
- public void testMissingPort() throws URISyntaxException {
- final String incorrectSshUrl = "ssh://some-host:/path/to/repository.git";
- URIish u = new URIish(incorrectSshUrl);
- assertFalse(TransportGitSsh.PROTO_SSH.canHandle(u));
- }
-
- @Test
public void testALot() throws URISyntaxException {
// user pass host port path
// 1 2 3 4 5