package Practice_test;

import static io.restassured.http.ContentType.JSON;

import java.util.List;


import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import io.restassured.http.Headers;
import io.restassured.response.Response;

public class maxiao implements Runnable{
	public  String JSESSIONID;
	public  String StatusCode;
	public  String time;
	
	
	public maxiao(String jSESSIONID) {
		JSESSIONID = jSESSIONID;
	}

	@Override
	public void run() {
//		RestAssured ra_VerifyCode = new RestAssured();
//		ra_VerifyCode.baseURI = "http://10.10.197.245";
//		ra_VerifyCode.port = 8888;
//		ra_VerifyCode.basePath = "/puhui-lend-pre/page/lendRepay/repayList.jsp";
//		
//		Long start=System.currentTimeMillis();
//		Response re2 = ra_VerifyCode.given().given().
//					headers("Cookie", JSESSIONID,
//						"Referer","http://10.10.197.245:8888/puhui-lend-pre/main",
//						"Upgrade-Insecure-Requests","1"
//						).get();
//		Long end=System.currentTimeMillis();
//		
//		time=(end-start)+"";
//		System.out.println();
//		StatusCode=re2.getStatusCode()+"";
//		System.out.println(re2.getBody().asString());
//		System.out.print("名称:"+Thread.currentThread().getName()+"状态："+re2.getStatusCode()+"耗时:"+time+"毫秒");
		RestAssured ra_VerifyCode = new RestAssured();
		ra_VerifyCode.baseURI = "http://10.10.197.245";
		ra_VerifyCode.port = 8888;
		ra_VerifyCode.basePath = "/puhui-lend-pre/lendRepay/list ";
		
		String Parameter="{\"billDate\":\"2016-12-25\",\"page\":1,\"rows\":20}";
		System.out.println(Parameter);
		
		Long start=System.currentTimeMillis();
		Response re2 = ra_VerifyCode.given().given().contentType(JSON).
					headers("Cookie", "JSESSIONID=17E32712D50602F82C30A29E827343E6",
						"Referer"," http://10.10.197.245:8888/puhui-lend-pre/page/lendRepay/repayList.jsp",
						"Origin","http://10.10.197.245:8888"
						).body(Parameter).when().post();
		Long end=System.currentTimeMillis();
		time=(end-start)+"";
		System.out.println(re2.getBody().asString());
		System.out.print("名称:"+Thread.currentThread().getName()+"状态："+re2.getStatusCode()+"耗时:"+time+"毫秒");
	}
	public static void main(String[] args) {
		RestAssured ra_VerifyCode = new RestAssured();
		ra_VerifyCode.baseURI = "http://10.10.197.245";
		ra_VerifyCode.port = 8888;
		ra_VerifyCode.basePath = "/puhui-lend-pre/lendRepay/list";
		
		String Parameter="{\"billDate\":\"2016-12-25\",\"page\":1,\"rows\":20}";
		System.out.println(Parameter);
		
		Long start=System.currentTimeMillis();
		Response re2 = ra_VerifyCode.given().given().contentType(ContentType.URLENC).
					headers("Cookie", "JSESSIONID=17E32712D50602F82C30A29E827343E6",
						"Referer"," http://10.10.197.245:8888/puhui-lend-pre/page/lendRepay/repayList.jsp",
						"Origin","http://10.10.197.245:8888"
						).body("billDate=2016-12-25&page=1&rows=20").when().post();
		Long end=System.currentTimeMillis();
		System.out.println(re2.getBody().asString());
		System.out.print("名称:"+Thread.currentThread().getName()+"状态："+re2.getStatusCode()+"耗时:毫秒");
	}		
}
