Commit d50e9c24 by Li Yongyu

update

parent db0d3708
......@@ -139,7 +139,7 @@ public class ReadProperties {
Properties pps = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+qudao+"reflect.properties";
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"reflect.properties";
InputStream in = new BufferedInputStream (new FileInputStream(sourceFile));
pps.load(in);
String value = pps.getProperty(key);
......
......@@ -30,12 +30,7 @@ public class Reflect_api {
// String system = MapUtil.getValue("system", data);
// String classRoute = ReadProperties.GetPropertyByKey(system);
count++;
// if(!classRoute.equals("com.offcn.api.xyzb.liucheng")){
//// String serviceUrl = data.get("serviceUrl").toString();
//// ClassName = serviceUrl.split("/")[serviceUrl.split("/").length - 1];
// String classRoute1 = ReadProperties.GetPropertyByKey("gmysx");
// ClassName=ClassName.replaceAll(classRoute, classRoute1);
// }
}
if(count==3){
Log.logError("Reflect_api,ReflexClass Error,Classname=" + ClassName);
......@@ -65,24 +60,14 @@ public class Reflect_api {
String system = MapUtil.getValue("system", data);
String classRoute = ReadProperties.GetPropertyByKey(system);
// if ("/order/insert".equals(serviceUrl)) {
// if (serviceUrl.indexOf("/order/insert")!=-1) {
// return classRoute+CalssName + "_dd";
// }
//xuwen-添加对商户(sh)的支持
// if("zy".equals(system) || "sh".equals(system) || "dk".equals(system) ){
// String classReflectName = ReadProperties.GetPropertyByClassName(serviceUrl);
// if ( classReflectName!=null ) {
// return classRoute+ classReflectName;
// }
// }
if("xyzb".equals(system)){
if(system.contains("study")){
String classReflectName = ReadProperties.GetPropertyByClassName(serviceUrl,system);
if ( classReflectName!=null ) {
return classRoute+ classReflectName;
}
}
return classRoute+CalssName;
}
}
......@@ -55,11 +55,7 @@ public class ticket extends STUDY implements API {
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
/*phone = MapUtil.getParameter_get(parameter, "phone").trim();
if ((!phone.equals("")) && phone.equals("phone")) {
phone = "1331" + (new Random().nextInt(9000000) + 1000000);
parameter = parameter.replace("phone=phone", "phone="+ phone );
} */
data.put("parameter", parameter);
return data;
}
......@@ -80,7 +76,7 @@ public class ticket extends STUDY implements API {
MyRequest myRequest=new MyRequest();
myRequest.setParameter(parameter);
myRequest.setUrl("http://l.alitest.eoffcn.com/newapi/login.html");
myRequest.setUrl("http://l.t.eoffcn.com/newapi/login.html");
myRequest.setRequest(Request);
//myRequest.setCookies(cookies);
......
......@@ -152,7 +152,7 @@ public class moment extends STUDY implements API {
//如果自定义结果包含多个希望结果,也就是有逗号,那么就切割,包含比较。
if(data.get("custom").toString().contains(",")){
String [] strCustomStrings=data.get("custom").toString().split(",");
System.out.println(strCustomStrings.length);
//System.out.println(strCustomStrings.length);
for(int i=0;i<strCustomStrings.length;i++){
if(!json.contains(strCustomStrings[i])){
result = result && false;
......
......@@ -12,6 +12,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -43,6 +44,18 @@ public abstract class BasicsGM {
public static HashMap<String,String> DynamicParameter = new HashMap<String,String>();//动态公共参数
public static Map<String,Connection> ConnectionsMap=new HashMap<String, Connection>();
public static Map<String,Statement> StatementsMap=new HashMap<String, Statement>();
public static HashMap<Class<?>,Object> Delsql = new HashMap<Class<?>,Object>();//数据库信息源
public static Set<String> Delsqlset = new HashSet<String>();//数据库信息源
public static void setDelSystemSql(Class<?> c,Object object){
String SystemName=c.getSuperclass().getSimpleName();
int count=Delsqlset.size();
Delsqlset.add(SystemName);
if(Delsqlset.size()>count){
Delsql.put(c, object);
}
}
//
// public static boolean isProduct = false;
......@@ -177,6 +190,7 @@ public abstract class BasicsGM {
public void deleteFromDB(String tableName, String key, String value) throws Exception {
String sql = "delete from " + tableName + " where " + key + " like '" + value + "'";
Log.logInfo("sql==="+sql);
int result = stmt.executeUpdate(sql);
Log.logInfo("result==="+result);
if (result == -1) {
......
......@@ -135,7 +135,7 @@ public class STUDY extends BasicsGM{
public void cleann_moment_FromDB() {
try {
deleteFromDB("moment", "id", "565");
deleteFromDB("zxkt.moment", "id", "565");
} catch (Exception e) {
......@@ -148,6 +148,10 @@ public class STUDY extends BasicsGM{
public void cleanMysqlData() {
if (!isClearMysql) {
conn=ConnectionsMap.get("zxkt");//设置默认的连接对象
stmt=StatementsMap.get("zxkt");//设置默认的连接对象
this.cleann_moment_FromDB();
}
}
......
......@@ -7,10 +7,11 @@ public class MyRequest {
private String Request;
private String Url;
private Map<String, String> Cookies;
private Map<String,String> headers;
private Map<String, String> Headers;
private String Parameter; //json请求方式的参数
private Map<String, String> formParameter;//form_data请求方式的参数、或file请求方式的参数
private String file;
private String fileType;
public String getRequest() {
return Request;
}
......@@ -30,10 +31,10 @@ public class MyRequest {
Cookies = cookies;
}
public Map<String, String> getHeaders() {
return headers;
return Headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
Headers = headers;
}
public String getParameter() {
return Parameter;
......@@ -53,19 +54,27 @@ public class MyRequest {
public void setFile(String file) {
this.file = file;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public MyRequest(String request, String url, Map<String, String> cookies,
Map<String, String> headers, String parameter,
Map<String, String> formParameter, String file) {
Map<String, String> formParameter, String file, String fileType) {
super();
Request = request;
Url = url;
Cookies = cookies;
this.headers = headers;
Headers = headers;
Parameter = parameter;
this.formParameter = formParameter;
this.file = file;
this.fileType = fileType;
}
public MyRequest() {
}
}
......@@ -3,6 +3,10 @@ import io.restassured.response.Response;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.sf.json.JSONObject;
......@@ -23,6 +27,7 @@ import com.offcn.listener.ProcessTestng;
import com.offcn.listener.ResultTestng;
import com.offcn.process.BasicsGM;
import com.offcn.process.STUDY;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
......@@ -50,10 +55,12 @@ public class APITest_study extends BasicsGM{
Log.logInfo(data.get("TCNO").toString() + " Step " + data.get("Description").toString() + " is running......");
// API obj = new Reflect_api().Reflections(data);
Reflect_api Reflect=new Reflect_api();
c=Reflect.ReflecClass(data);
object = Reflect.ReflecObj(c);
Class<?> c=Reflect.ReflecClass(data);
Object object = Reflect.ReflecObj(c);
API obj = (API)object;
setDelSystemSql(c, object);//保存曾经操作过的系统
BasicsGM.map=new XMLread().getSystem();
......@@ -143,18 +150,19 @@ public class APITest_study extends BasicsGM{
}
}
@AfterClass
public void afterClass() {
//测试结束删除测试所用的数据
Set<Map.Entry<Class<?>,Object>> set=Delsql.entrySet();
Iterator<Entry<Class<?>,Object>> it=set.iterator();
while(it.hasNext()){
Map.Entry<Class<?>,Object> me=it.next();
Class<?> c=me.getKey();
Object object=me.getValue();
this.cleanMysqlData(c,object);
this.CloseMysql();
}
this.CloseMysql();
Log.logInfo("========测试结束========");
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<systems>
<system name="gmysx"><!-- 更美预授信 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="gmdd"><!-- 更美订单 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="rgxs"><!-- 人工信审 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://ut1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>8765</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/streaming?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="bl"><!-- 保理系统 -->
<access_token_uri>http://t.uaa.pub.puhuifinance.com:8082/uaa/oauth/token</access_token_uri>
<client_id>factoring-server</client_id>
<client_secret>factoring-server</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://10.10.121.184</RM_URI>
<RM_port>8888</RM_port>
<RM_basePath>/baoli</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/streaming?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="zy"><!-- 自营订单 -->
<!--<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>-->
<!--<client_id>bestbuy-acceptance</client_id>-->
<!--<client_secret>bestbuy-acceptance</client_secret>-->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>gengmei</client_id>
<client_secret>gengmei</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://10.10.155.181</RM_URI>
<RM_port>3000</RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="sh"><!-- 商户微信 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>gengmei</client_id>
<client_secret>gengmei</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
</systems>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment