Browse Source

Merge pull request #268 in DESIGN/design from ~HZZZ/design61:release/10.0 to release/10.0

* commit '3551be07b4d3e7c1614a736d496613236534d9b0':
  .
  .
  REPORT-10066 远程设计页面,新建远程服务器默认值显示错误
research/10.0
Hzzz 7 years ago
parent
commit
640b44cf3a
  1. 47
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 30
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  3. 82
      designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java

47
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -23,7 +23,6 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@ -115,7 +114,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/** /**
* 主机位置 * 主机位置
*/ */
private RemoteEnvURL remoteEnvURL = new RemoteEnvURL(""); private RemoteWorkspaceURL remoteWorkspaceURL = new RemoteWorkspaceURL("");
/** /**
* https 配置面板 * https 配置面板
*/ */
@ -189,7 +188,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
fileChooserButton.setEnabled(isHttps); fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel(); updateHttpsConfigPanel();
remoteEnvURL.setHttps(isHttps); remoteWorkspaceURL.setHttps(isHttps);
fillRemoteEnvURLField(); fillRemoteEnvURLField();
fillIndividualField(); fillIndividualField();
} }
@ -267,9 +266,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
public void populateBean(RemoteDesignerWorkspaceInfo ob) { public void populateBean(RemoteDesignerWorkspaceInfo ob) {
WorkspaceConnection connection = ob.getConnection(); WorkspaceConnection connection = ob.getConnection();
if (connection != null) { if (connection != null) {
this.remoteEnvURL = Strings.isNullOrEmpty(connection.getUrl()) this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl())
? RemoteEnvURL.createDefaultURL() ? RemoteWorkspaceURL.createDefaultURL()
: new RemoteEnvURL(connection.getUrl()); : new RemoteWorkspaceURL(connection.getUrl());
String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY); String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY);
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY); String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY); String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);
@ -280,17 +279,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.certSecretKeyInput.setText(certSecretKey); this.certSecretKeyInput.setText(certSecretKey);
} else { } else {
this.remoteEnvURL = RemoteEnvURL.createDefaultURL(); this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY); this.usernameInput.setText(StringUtils.EMPTY);
this.passwordInput.setText(StringUtils.EMPTY); this.passwordInput.setText(StringUtils.EMPTY);
} }
fillRemoteEnvURLField(); fillRemoteEnvURLField();
fillIndividualField(); fillIndividualField();
httpsCheckbox.setSelected(this.remoteEnvURL.getHttps()); httpsCheckbox.setSelected(this.remoteWorkspaceURL.getHttps());
DesignerEnvManager.getEnvManager().setHttps(this.remoteEnvURL.getHttps()); DesignerEnvManager.getEnvManager().setHttps(this.remoteWorkspaceURL.getHttps());
fileChooserButton.setEnabled(this.remoteEnvURL.getHttps()); fileChooserButton.setEnabled(this.remoteWorkspaceURL.getHttps());
updateHttpsConfigPanel(); updateHttpsConfigPanel();
@ -299,7 +298,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
public RemoteDesignerWorkspaceInfo updateBean() { public RemoteDesignerWorkspaceInfo updateBean() {
WorkspaceConnection connection = new WorkspaceConnection( WorkspaceConnection connection = new WorkspaceConnection(
this.remoteEnvURL.getURL(), this.remoteWorkspaceURL.getURL(),
this.usernameInput.getText(), this.usernameInput.getText(),
new String(this.passwordInput.getPassword()), new String(this.passwordInput.getPassword()),
this.certPathInput.getText(), this.certPathInput.getText(),
@ -576,7 +575,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
*/ */
private void fillRemoteEnvURLField() { private void fillRemoteEnvURLField() {
remoteEnvURLInput.getDocument().removeDocumentListener(overallDocListener); remoteEnvURLInput.getDocument().removeDocumentListener(overallDocListener);
remoteEnvURLInput.setText(remoteEnvURL.getURL()); remoteEnvURLInput.setText(remoteWorkspaceURL.getURL());
remoteEnvURLInput.getDocument().addDocumentListener(overallDocListener); remoteEnvURLInput.getDocument().addDocumentListener(overallDocListener);
} }
@ -584,14 +583,14 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 自动填充子条目输入框 * 自动填充子条目输入框
*/ */
private void fillIndividualField() { private void fillIndividualField() {
if (remoteEnvURL == null) { if (remoteWorkspaceURL == null) {
return; return;
} }
disableSubDocListener(); disableSubDocListener();
hostNameInput.setText(remoteEnvURL.hasDefaultHostName() ? StringUtils.EMPTY : remoteEnvURL.getHost()); hostNameInput.setText(remoteWorkspaceURL.hasDefaultHostName() ? StringUtils.EMPTY : remoteWorkspaceURL.getHost());
portInput.setText(remoteEnvURL.getPort()); portInput.setText(remoteWorkspaceURL.getPort());
webAppNameInput.setText(remoteEnvURL.getWeb()); webAppNameInput.setText(remoteWorkspaceURL.getWeb());
servletNameInput.setText(remoteEnvURL.getServlet()); servletNameInput.setText(remoteWorkspaceURL.getServlet());
enableSubDocListener(); enableSubDocListener();
} }
@ -601,11 +600,11 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
String port = portInput.getText(); String port = portInput.getText();
String web = webAppNameInput.getText(); String web = webAppNameInput.getText();
String servlet = servletNameInput.getText(); String servlet = servletNameInput.getText();
remoteEnvURL.setHttps(isHttps); remoteWorkspaceURL.setHttps(isHttps);
remoteEnvURL.setHost(host); remoteWorkspaceURL.setHost(host);
remoteEnvURL.setPort(port); remoteWorkspaceURL.setPort(port);
remoteEnvURL.setWeb(web); remoteWorkspaceURL.setWeb(web);
remoteEnvURL.setServlet(servlet); remoteWorkspaceURL.setServlet(servlet);
} }
@ -617,10 +616,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
} }
private void actionURLInputChange() { private void actionURLInputChange() {
remoteEnvURL = new RemoteEnvURL(remoteEnvURLInput.getText()); remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField(); fillIndividualField();
httpsCheckbox.setSelected(remoteEnvURL.getHttps()); httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected(); boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps); DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps); fileChooserButton.setEnabled(isHttps);

30
designer-base/src/main/java/com/fr/env/RemoteEnvURL.java → designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -8,7 +8,7 @@ import java.util.Objects;
/** /**
* @author yaohwu * @author yaohwu
*/ */
public class RemoteEnvURL implements FCloneable { public class RemoteWorkspaceURL implements FCloneable {
/** /**
* 默认 hostname * 默认 hostname
@ -17,20 +17,20 @@ public class RemoteEnvURL implements FCloneable {
/** /**
* 默认 web app name * 默认 web app name
*/ */
private static final String DEFAULT_WEB_APP_NAME = "WebReport"; private static final String DEFAULT_WEB_APP_NAME = "webroot";
/** /**
* 默认 servlet name * 默认 servlet name
*/ */
private static final String DEFAULT_SERVLET_NAME = "ReportServer"; private static final String DEFAULT_SERVLET_NAME = "decision";
/** /**
* 默认端口 * 默认端口
*/ */
private static final String DEFAULT_PORT = "8080"; private static final String DEFAULT_PORT = "8075";
private static final String HTTPS = "https://"; private static final String HTTPS = "https://";
private static final String HTTP = "http://"; private static final String HTTP = "http://";
public static final RemoteEnvURL DEFAULT_URL = public static final RemoteWorkspaceURL DEFAULT_URL =
new RemoteEnvURL( new RemoteWorkspaceURL(
false, false,
DEFAULT_HOST_NAME, DEFAULT_HOST_NAME,
DEFAULT_PORT, DEFAULT_PORT,
@ -45,12 +45,12 @@ public class RemoteEnvURL implements FCloneable {
/** /**
* 解析 url 字符串 生成 RemoteEnvURL 对象 * 解析 url 字符串 生成 RemoteWorkspaceURL 对象
* url 字符串格式 (http(s)://)host(:port)/+web/+servlet/+(others) * url 字符串格式 (http(s)://)host(:port)/+web/+servlet/+(others)
* *
* @param url x:x/x/x/x * @param url x:x/x/x/x
*/ */
public RemoteEnvURL(String url) { public RemoteWorkspaceURL(String url) {
// 没有写协议名称 默认 使用 http 协议 // 没有写协议名称 默认 使用 http 协议
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) { if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) {
@ -102,12 +102,12 @@ public class RemoteEnvURL implements FCloneable {
return DEFAULT_HOST_NAME.equals(host); return DEFAULT_HOST_NAME.equals(host);
} }
public static RemoteEnvURL createDefaultURL() { public static RemoteWorkspaceURL createDefaultURL() {
return DEFAULT_URL.clone(); return DEFAULT_URL.clone();
} }
public RemoteEnvURL(boolean isHttps, String host, String port, String web, String servlet) { public RemoteWorkspaceURL(boolean isHttps, String host, String port, String web, String servlet) {
this.isHttps = isHttps; this.isHttps = isHttps;
this.host = host != null ? host.trim() : StringUtils.EMPTY; this.host = host != null ? host.trim() : StringUtils.EMPTY;
this.port = port != null ? port.trim() : StringUtils.EMPTY; this.port = port != null ? port.trim() : StringUtils.EMPTY;
@ -172,7 +172,7 @@ public class RemoteEnvURL implements FCloneable {
if (o == null || getClass() != o.getClass()) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
RemoteEnvURL that = (RemoteEnvURL) o; RemoteWorkspaceURL that = (RemoteWorkspaceURL) o;
return isHttps == that.isHttps && return isHttps == that.isHttps &&
Objects.equals(host, that.host) && Objects.equals(host, that.host) &&
Objects.equals(port, that.port) && Objects.equals(port, that.port) &&
@ -188,7 +188,7 @@ public class RemoteEnvURL implements FCloneable {
@Override @Override
public String toString() { public String toString() {
return "RemoteEnvURL{" + return "RemoteWorkspaceURL{" +
"isHttps=" + isHttps + "isHttps=" + isHttps +
", host='" + host + '\'' + ", host='" + host + '\'' +
", port='" + port + '\'' + ", port='" + port + '\'' +
@ -198,10 +198,10 @@ public class RemoteEnvURL implements FCloneable {
} }
@Override @Override
public RemoteEnvURL clone() { public RemoteWorkspaceURL clone() {
RemoteEnvURL cloned; RemoteWorkspaceURL cloned;
try { try {
cloned = (RemoteEnvURL) super.clone(); cloned = (RemoteWorkspaceURL) super.clone();
return cloned; return cloned;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable // this shouldn't happen, since we are Cloneable

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

@ -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());

Loading…
Cancel
Save