Authored by zhaoyue

Mod file location

... ... @@ -7,9 +7,9 @@ public interface Constants {
/**
* 服务地址
*/
//String URL_PREFIX = "http://127.0.0.1:8090";
// String URL_PREFIX = "http://127.0.0.1:8090";
String URL_PREFIX = "https://www.hanhezy.com:8090/";
// String URL_PREFIX = "http://139.129.166.85:8090";
/**
* 测试用 用户名、密码、openid、openidtype
*/
... ... @@ -20,12 +20,14 @@ public interface Constants {
/**
*
* 只有区域管理员、区域操作员才能使用接口访问。
*/
// admin account
public static final String ADMIN_ACCOUNT = "user1";
// admin password
public static final String ADMIN_PWD = "pass1";
/**
* 密钥
*/
... ... @@ -33,6 +35,8 @@ public interface Constants {
String KEY = "weixin";
// 密钥ID
String KEY_ID = "1";
/**
* 性别
*/
... ... @@ -53,7 +57,13 @@ public interface Constants {
int USER_MODPASS_LOGOUT = 1002;//修改密码成功,请重新登录
int REPORT_INVALID_ERROR = -11142;//报告在数据库中不存在/Report is not exist in the DB
int USER_NOT_FOUND = -1002;//用户不存在/User is not exist
int COMPANY_ERROR =-11170;//"用户所属公司信息有误/Company infomation error";
int COMPANY_ERROR = -11170;//"用户所属公司信息有误/Company infomation error";
/**
* Operation
*/
public static final int OP_NEWUSER_REGISTER = 0;
public static final int OP_HELTH_EXAM = 1;
public static final int OP_OLDUSER_GUIDE = 2;
public static final int OP_NEWUSER_DIAGNOSE = 3;
}
... ...
package com.xkl.internal;
import com.utils.DESTools;
import com.xkl.Constants;
import com.xkl.EncodeTools;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import com.xkl.partner.TokenTest;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
/**
* Created by zhaoyue on 2017/3/11.
*/
public class AdminOpLogTest {
private static final String URL_ADMIN_OP_LOG = Constants.URL_PREFIX + "/adminOpLog";
@Test
public void testAdminOpLog() {
String token = TokenTest.adminLoginAndGetToken(Constants.ADMIN_ACCOUNT, Constants.ADMIN_PWD);
Map<String, String> params = new HashMap<String, String>();
params.put("username", Constants.USR_ACC);
params.put("operation", Integer.toString(Constants.OP_NEWUSER_REGISTER));
params.put("t", HttpTools.getNow());
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_ADMIN_OP_LOG, "POST", params, token);
System.out.println(response);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
}
}
... ...
package com.xkl.inneruse;
package com.xkl.internal;
import com.xkl.Constants;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static com.xkl.TokenTest.loginAndGetToken;
/**
* Created by win7 on 2016/12/26.
* 报告相关
... ...
package com.xkl.inneruse.qrcode;
package com.xkl.internal.qrcode;
import com.utils.DESTools;
import com.xkl.*;
import com.xkl.partner.TokenTest;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
... ...
package com.xkl;
package com.xkl.partner;
import com.xkl.Constants;
import com.xkl.EncodeTools;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
... ...
package com.xkl;
package com.xkl.partner;
import com.xkl.Constants;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
... ... @@ -7,8 +10,6 @@ import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static com.xkl.TokenTest.loginAndGetToken;
/**
* Created by win7 on 2016/12/26.
* 报告相关
... ... @@ -26,7 +27,7 @@ public class ReportTest {
public static void init() {
// String token = OpenIdTest.bindWithOpenIdAndLoginAndGetToken(Constants.USR_OPENID, Constants.USR_OPENID_TYPE);
token = loginAndGetToken(Constants.USR_ACC, Constants.USR_PWD);
token = TokenTest.loginAndGetToken(Constants.USR_ACC, Constants.USR_PWD);
// String token =OpenIdTest.bindWithOpenIdAndLoginAndGetToken(Constants.USR_OPENID,Constants.USR_OPENID_TYPE);
}
... ...
package com.xkl;
package com.xkl.partner;
import com.xkl.Constants;
import com.xkl.EncodeTools;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
... ...
package com.xkl;
package com.xkl.partner;
import com.xkl.Constants;
import com.xkl.EncodeTools;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static com.xkl.TokenTest.loginAndGetToken;
/**
* Created by win7 on 2016/12/25.
* 用户注册、修改密码、获取个人信息
... ... @@ -79,7 +81,7 @@ public class UserInfoTest {
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
//获取token
String token = loginAndGetToken("15211112222", "pass152_new");
String token = TokenTest.loginAndGetToken("15211112222", "pass152_new");
System.out.println(token);
String response = HttpTools.requestByMapWithToken(URL_USER, "PUT", params, token);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.USER_MODPASS_LOGOUT));
... ... @@ -96,7 +98,7 @@ public class UserInfoTest {
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
//获取token
String token = loginAndGetToken(Constants.USR_ACC, Constants.USR_PWD);
String token = TokenTest.loginAndGetToken(Constants.USR_ACC, Constants.USR_PWD);
System.out.println(token);
String response = HttpTools.requestByMapWithToken(URL_USER, "GET", params, token);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
... ...
... ... @@ -74,6 +74,7 @@ public class AccountTest {
@Test
public void testLoginSuccess() {
String response = loginAndGetToken(Constants.ADMIN_ACCOUNT, Constants.ADMIN_PWD);
Assert.assertTrue(response.contains("_"));
System.out.println(response);
}
... ...