NC自动化测试自动登陆

/** * 登录服务器。 * * @param user 用户。 * @param psw 密码。 * @return 登录结果。 */ public boolean login(String user, String psw) { RuntimeEnv.getInstance().setProperty("CLIENT_COMMUNICATOR", "nc.bs.framework.comn.cli.JavaURLCommunicator"); RuntimeEnv.getInstance().setRunningInServer(false); String baseURL = "http://localhost:8088/";//要登录的NCHome服务器地址。 RuntimeEnv.getInstance().setProperty("SERVICEDISPATCH_URL", baseURL + "/ServiceDispatcherServlet"); RuntimeEnv.getInstance().setProperty("CLIENT_COMMUNICATOR", "nc.bs.framework.comn.cli.JavaURLCommunicator"); UserExit.getInstance().setBizCenterCode(this.bizCenterCode); UserExit.getInstance().setUserDataSource(this.dataSource); UserExit.getInstance().setGroupNumber(this.group); UserExit.getInstance().setUserCode(user); IFwLogin fwLogin = NCLocator.getInstance().lookup(IFwLogin.class); byte[] content = fwLogin.login(user, psw, null); boolean result = content != null && content.length > 0; if (result) { Proxy proxy = new Proxy(); UserVO userVO = proxy.getUser(user); InvocationInfoProxy.getInstance().setGroupId(userVO.getPk_group()); InvocationInfoProxy.getInstance().setGroupNumber(this.group); InvocationInfoProxy.getInstance().setUserId(userVO.getCuserid()); } return result; }

你可能感兴趣的:(NC6,NC57)