|
|
@ -14,71 +14,71 @@ public class RemoteEnvURLTest { |
|
|
|
public void testURLParser() { |
|
|
|
public void testURLParser() { |
|
|
|
|
|
|
|
|
|
|
|
String a; |
|
|
|
String a; |
|
|
|
RemoteEnvURL b; |
|
|
|
RemoteWorkspaceURL b; |
|
|
|
|
|
|
|
|
|
|
|
// https or http begin
|
|
|
|
// https or http begin
|
|
|
|
a = "www.baidu.com:9090/web/servlet/a"; |
|
|
|
a = "www.baidu.com:9090/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
Assert.assertFalse(b.getHttps()); |
|
|
|
Assert.assertFalse(b.getHttps()); |
|
|
|
|
|
|
|
|
|
|
|
a = "http://www.baidu.com:9090/web/servlet/a"; |
|
|
|
a = "http://www.baidu.com:9090/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
Assert.assertFalse(b.getHttps()); |
|
|
|
Assert.assertFalse(b.getHttps()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
Assert.assertTrue(b.getHttps()); |
|
|
|
Assert.assertTrue(b.getHttps()); |
|
|
|
// https or http end
|
|
|
|
// https or http end
|
|
|
|
|
|
|
|
|
|
|
|
// host begin
|
|
|
|
// host begin
|
|
|
|
a = "https://www.baidu.com/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("www.baidu.com", b.getHost()); |
|
|
|
assertEquals("www.baidu.com", b.getHost()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://baidu.com/web/servlet/a"; |
|
|
|
a = "https://baidu.com/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("baidu.com", b.getHost()); |
|
|
|
assertEquals("baidu.com", b.getHost()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://192.168.1/web/servlet/a"; |
|
|
|
a = "https://192.168.1/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("192.168.1", b.getHost()); |
|
|
|
assertEquals("192.168.1", b.getHost()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; |
|
|
|
a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://a.b.c.d.e.f/web/servlet/a"; |
|
|
|
a = "https://a.b.c.d.e.f/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a.b.c.d.e.f", b.getHost()); |
|
|
|
assertEquals("a.b.c.d.e.f", b.getHost()); |
|
|
|
// host end
|
|
|
|
// host end
|
|
|
|
|
|
|
|
|
|
|
|
//port begin
|
|
|
|
//port begin
|
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("9090", b.getPort()); |
|
|
|
assertEquals("9090", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:kk/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:kk/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("kk", b.getPort()); |
|
|
|
assertEquals("kk", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; |
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; |
|
|
|
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); |
|
|
|
//port end
|
|
|
|
//port end
|
|
|
|
|
|
|
|
|
|
|
@ -86,109 +86,109 @@ public class RemoteEnvURLTest { |
|
|
|
//web begin
|
|
|
|
//web begin
|
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090///"; |
|
|
|
a = "https://www.baidu.com:9090///"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090"; |
|
|
|
a = "https://www.baidu.com:9090"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/"; |
|
|
|
a = "https://www.baidu.com:9090/"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
assertEquals("", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090///web///servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090///web///servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/web///servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090/web///servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090///web/servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090///web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
assertEquals("web", b.getWeb()); |
|
|
|
//web end
|
|
|
|
//web end
|
|
|
|
|
|
|
|
|
|
|
|
//servlet begin
|
|
|
|
//servlet begin
|
|
|
|
a = "https://www.baidu.com:9090///web////servlet/a"; |
|
|
|
a = "https://www.baidu.com:9090///web////servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("servlet", b.getServlet()); |
|
|
|
assertEquals("servlet", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090"; |
|
|
|
a = "https://www.baidu.com:9090"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090/"; |
|
|
|
a = "https://www.baidu.com:9090/"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//"; |
|
|
|
a = "https://www.baidu.com:9090//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web"; |
|
|
|
a = "https://www.baidu.com:9090//web"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web//"; |
|
|
|
a = "https://www.baidu.com:9090//web//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web/"; |
|
|
|
a = "https://www.baidu.com:9090//web/"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web//"; |
|
|
|
a = "https://www.baidu.com:9090//web//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web/a/"; |
|
|
|
a = "https://www.baidu.com:9090//web/a/"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web/a"; |
|
|
|
a = "https://www.baidu.com:9090//web/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web/a//"; |
|
|
|
a = "https://www.baidu.com:9090//web/a//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; |
|
|
|
a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); |
|
|
|
assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com//web//"; |
|
|
|
a = "https://www.baidu.com//web//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
assertEquals("", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com//web/a/"; |
|
|
|
a = "https://www.baidu.com//web/a/"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com//web/a"; |
|
|
|
a = "https://www.baidu.com//web/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a = "https://www.baidu.com//web/a//"; |
|
|
|
a = "https://www.baidu.com//web/a//"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
assertEquals("a", b.getServlet()); |
|
|
|
// servlet end
|
|
|
|
// servlet end
|
|
|
|
|
|
|
|
|
|
|
|
//others begin
|
|
|
|
//others begin
|
|
|
|
a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; |
|
|
|
a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; |
|
|
|
b = new RemoteEnvURL(a); |
|
|
|
b = new RemoteWorkspaceURL(a); |
|
|
|
Assert.assertTrue(b.getHttps()); |
|
|
|
Assert.assertTrue(b.getHttps()); |
|
|
|
assertEquals("www.baidu.com", b.getHost()); |
|
|
|
assertEquals("www.baidu.com", b.getHost()); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|
assertEquals("", b.getPort()); |
|
|
|