Browse Source

REPORT-55795 【10.0.19】报错规范——设计器远程设计连接部分 fix 单元测试

feature/10.0
hades 3 years ago
parent
commit
1ad6e86411
  1. 21
      designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java

21
designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java vendored

@ -4,7 +4,10 @@ import com.fr.invoke.Reflect;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReaderHelper; import com.fr.stable.xml.XMLReaderHelper;
import com.fr.stable.xml.XMLableReader; 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.WorkspaceConnectionInfo;
import com.fr.workspace.connect.WorkspaceConnector;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.junit.Assert; import org.junit.Assert;
@ -18,15 +21,31 @@ import java.io.ByteArrayOutputStream;
*/ */
public class RemoteDesignerWorkspaceInfoTest extends TestCase { 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 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 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 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)); 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(workspaceInfo0.checkValid());
Assert.assertFalse(workspaceInfo1.checkValid()); Assert.assertFalse(workspaceInfo1.checkValid());
Assert.assertFalse(workspaceInfo2.checkValid()); Assert.assertFalse(workspaceInfo2.checkValid());
Assert.assertFalse(workspaceInfo3.checkValid()); Assert.assertFalse(workspaceInfo3.checkValid());
WorkContext.setConnector(connector);
} }
public void testReadXml() { public void testReadXml() {

Loading…
Cancel
Save