get expcode and expcnttype from recording

This commit is contained in:
hmm 2014-09-02 10:58:47 +08:00
parent 3c46fdda89
commit 723de68ba8
2 changed files with 7 additions and 5 deletions

View File

@ -293,7 +293,7 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
cont_len_str = ", " + header.contentLength; cont_len_str = ", " + header.contentLength;
doSetData(action.getMultiPartData()); doSetData(action.getMultiPartData());
} }
doCallUrl(action, method, data_str, cont_len_str); doCallUrl(action, method, data_str, cont_len_str,respCode,respContentType);
this.requestCount++; this.requestCount++;
} }
@ -406,7 +406,7 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
throws Utils.UserException; throws Utils.UserException;
public abstract void doCallUrl(Action action, String paramString2, public abstract void doCallUrl(Action action, String paramString2,
String paramString3, String paramString4) String paramString3, String paramString4, int paramInt, String paramString5)
throws Utils.UserException; throws Utils.UserException;
public abstract void doEndTransaction() throws Utils.UserException; public abstract void doEndTransaction() throws Utils.UserException;

View File

@ -157,11 +157,11 @@ public class Bench4qCodeGenerator extends AbstractCodeGenerator {
} }
public void doCallUrl(Action action, String method, String data, public void doCallUrl(Action action, String method, String data,
String contentLength) throws Utils.UserException { String contentLength, int respCode, String respContentType) throws Utils.UserException {
if (!isFirstRequest()) if (!isFirstRequest())
doInsertDelay(getTimeElapsedSinceLastestRequest()); doInsertDelay(getTimeElapsedSinceLastestRequest());
BehaviorModel userBehavior = createHttpBehavior(this.getRequestCount(), BehaviorModel userBehavior = createHttpBehavior(this.getRequestCount(),
action.getUrl(), method); action.getUrl(), method, respCode, respContentType);
insertBehavior(userBehavior); insertBehavior(userBehavior);
this.queryStringParameters = ""; this.queryStringParameters = "";
@ -169,12 +169,14 @@ public class Bench4qCodeGenerator extends AbstractCodeGenerator {
} }
public BehaviorModel createHttpBehavior(int behaviorId, String url, public BehaviorModel createHttpBehavior(int behaviorId, String url,
String method) { String method, int respCode, String respContentType) {
List<ParameterModel> params = new ArrayList<ParameterModel>(); List<ParameterModel> params = new ArrayList<ParameterModel>();
params.add(ParameterModel.createParameter("url", url)); params.add(ParameterModel.createParameter("url", url));
params.add(ParameterModel.createParameter("queryParams", params.add(ParameterModel.createParameter("queryParams",
this.queryStringParameters)); this.queryStringParameters));
params.add(ParameterModel.createParameter("headers", this.headers)); params.add(ParameterModel.createParameter("headers", this.headers));
params.add(ParameterModel.createParameter("expResCode", Integer.toString(respCode)));
params.add(ParameterModel.createParameter("expResCnttype", respContentType));
if (method.equalsIgnoreCase("post")) { if (method.equalsIgnoreCase("post")) {
if (body.length() > 0) { if (body.length() > 0) {
params.add(ParameterModel.createParameter("bodyContent", params.add(ParameterModel.createParameter("bodyContent",