diff --git a/designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java b/designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java index d6e89cd93f..e5fa7e3095 100644 --- a/designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java +++ b/designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java @@ -4,7 +4,10 @@ import com.fr.invoke.Reflect; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReaderHelper; import com.fr.stable.xml.XMLableReader; +import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.connect.WorkspaceConnector; import junit.framework.TestCase; import org.junit.Assert; @@ -18,15 +21,31 @@ import java.io.ByteArrayOutputStream; */ public class RemoteDesignerWorkspaceInfoTest extends TestCase { - public void testCheckValid() { + public void testCheckValid() throws Exception { RemoteDesignerWorkspaceInfo workspaceInfo0 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://localhost:8075/webroot/decision", "admin", "123", "", "", true)); RemoteDesignerWorkspaceInfo workspaceInfo1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true)); RemoteDesignerWorkspaceInfo workspaceInfo2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true)); RemoteDesignerWorkspaceInfo workspaceInfo3 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://localhost:8075/webroot/decision", "admin", "123", "", "", true)); + WorkspaceConnector connector = WorkContext.getConnector(); + + WorkspaceConnector workspaceConnector = new WorkspaceConnector() { + @Override + public boolean testConnection(WorkspaceConnectionInfo connection) throws Exception { + return false; + } + + @Override + public WorkspaceClient connect(WorkspaceConnectionInfo connection) throws Exception { + return null; + } + }; + WorkContext.setConnector(workspaceConnector); + Assert.assertFalse(workspaceInfo0.checkValid()); Assert.assertFalse(workspaceInfo1.checkValid()); Assert.assertFalse(workspaceInfo2.checkValid()); Assert.assertFalse(workspaceInfo3.checkValid()); + WorkContext.setConnector(connector); } public void testReadXml() {