kerry 6 years ago
parent
commit
ebcdebb688
  1. 398
      designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java

398
designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java vendored

@ -1,199 +1,199 @@
//package com.fr.env; package com.fr.env;
//
//import org.junit.Assert; import org.junit.Assert;
//import org.junit.Test; import org.junit.Test;
//
//import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
//
///** /**
// * @author yaohwu * @author yaohwu
// */ */
//public class RemoteEnvURLTest { public class RemoteEnvURLTest {
//
// @Test @Test
// public void testURLParser() { public void testURLParser() {
//
// String a; String a;
// RemoteEnvURL b; RemoteEnvURL 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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(a);
// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
// //port end //port end
//
//
// //web begin //web begin
//
// a = "https://www.baidu.com:9090///"; a = "https://www.baidu.com:9090///";
// b = new RemoteEnvURL(a); b = new RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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 RemoteEnvURL(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());
// assertEquals("web", b.getWeb()); assertEquals("web", b.getWeb());
// assertEquals("servlet", b.getServlet()); assertEquals("servlet", b.getServlet());
// //others begin //others begin
// } }
//} }

Loading…
Cancel
Save