add httpcapture
This commit is contained in:
parent
3afd6c63d4
commit
0de37bdd11
|
@ -350,13 +350,14 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
|
|||
.removeFirst());
|
||||
}
|
||||
|
||||
Matcher m = this.insertMarkerRE
|
||||
.matcher(getScriptAdapter().getText());
|
||||
Matcher m = this.insertMarkerRE.matcher(this
|
||||
.getScriptAdapter().getText());
|
||||
if (!(m.find()))
|
||||
throw new Utils.UserException(
|
||||
"You have altered your script and it no longer includes the lines that you were told not to alter.");
|
||||
System.out.println(sb.toString());
|
||||
getScriptAdapter().insert(sb.toString(), m.start(0));
|
||||
this.getScriptAdapter().insert(sb.toString(),
|
||||
m.start(0));
|
||||
}
|
||||
} catch (Utils.UserException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -1,298 +1,390 @@
|
|||
package org.bench4q.master.entity.httpcapture.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.master.communication.agent.ParameterModel;
|
||||
import org.bench4q.master.communication.agent.UsePluginModel;
|
||||
import org.bench4q.master.entity.httpcapture.Config;
|
||||
import org.bench4q.master.entity.httpcapture.HeaderValue;
|
||||
import org.bench4q.master.entity.httpcapture.IScriptAdapter;
|
||||
import org.bench4q.master.entity.httpcapture.Param;
|
||||
import org.bench4q.master.entity.httpcapture.Utils;
|
||||
|
||||
public class IsacCodeGenerator extends AbstractCodeGenerator{
|
||||
public class IsacCodeGenerator extends AbstractCodeGenerator {
|
||||
static final String TIMER_PROP = "generator.isac.timer";
|
||||
static final String NULL_TIMER = "null";
|
||||
static final String CONSTANT_TIMER = "ConstantTimer";
|
||||
static final String RANDOM_TIMER = "Random";
|
||||
static final String DEFAULT_TIMER = "ConstantTimer";
|
||||
static final String RANDOM_TIMER_DIST_PROP = "generator.isac.timer.random.dist";
|
||||
static final String RANDOM_TIMER_DIST_UNIFORM = "uniform";
|
||||
static final String RANDOM_TIMER_DIST_GAUSSIAN = "gaussian";
|
||||
static final String RANDOM_TIMER_DIST_POISSON = "poisson";
|
||||
static final String RANDOM_TIMER_DIST_NEGEXPO = "negexpo";
|
||||
static final String RANDOM_TIMER_DIST_DEFAULT = "uniform";
|
||||
static final String RANDOM_TIMER_MIN_PROP = "generator.isac.timer.random.min";
|
||||
static final String RANDOM_TIMER_DELTA_PROP = "generator.isac.timer.random.delta";
|
||||
static final String RANDOM_TIMER_UNIT_PROP = "generator.isac.timer.random.unit";
|
||||
static final String RANDOM_TIMER_DEVIATION_PROP = "generator.isac.timer.random.deviation";
|
||||
static final String[][] escapes = {
|
||||
{ "\\", "\\\\" },
|
||||
{ ";", "\\;" },
|
||||
{ "&", "&" },
|
||||
{ "\"", """ },
|
||||
{ "<", "<" },
|
||||
{ ">", ">" } };
|
||||
private String queryStringParameters = "";
|
||||
private String bodyParameters = "";
|
||||
private String timer;
|
||||
private String randomDist;
|
||||
private int delta = 0;
|
||||
private int deviation = 0;
|
||||
private int unit = 1;
|
||||
static final String NULL_TIMER = "null";
|
||||
static final String CONSTANT_TIMER = "ConstantTimer";
|
||||
static final String RANDOM_TIMER = "Random";
|
||||
static final String DEFAULT_TIMER = "ConstantTimer";
|
||||
static final String RANDOM_TIMER_DIST_PROP = "generator.isac.timer.random.dist";
|
||||
static final String RANDOM_TIMER_DIST_UNIFORM = "uniform";
|
||||
static final String RANDOM_TIMER_DIST_GAUSSIAN = "gaussian";
|
||||
static final String RANDOM_TIMER_DIST_POISSON = "poisson";
|
||||
static final String RANDOM_TIMER_DIST_NEGEXPO = "negexpo";
|
||||
static final String RANDOM_TIMER_DIST_DEFAULT = "uniform";
|
||||
static final String RANDOM_TIMER_MIN_PROP = "generator.isac.timer.random.min";
|
||||
static final String RANDOM_TIMER_DELTA_PROP = "generator.isac.timer.random.delta";
|
||||
static final String RANDOM_TIMER_UNIT_PROP = "generator.isac.timer.random.unit";
|
||||
static final String RANDOM_TIMER_DEVIATION_PROP = "generator.isac.timer.random.deviation";
|
||||
static final String[][] escapes = { { "\\", "\\\\" }, { ";", "\\;" },
|
||||
{ "&", "&" }, { "\"", """ }, { "<", "<" },
|
||||
{ ">", ">" } };
|
||||
private String queryStringParameters = "";
|
||||
private String bodyParameters = "";
|
||||
private String timer;
|
||||
private String randomDist;
|
||||
private int delta = 0;
|
||||
private int deviation = 0;
|
||||
private int unit = 1;
|
||||
|
||||
private static String escapeXmlString(String str)
|
||||
{
|
||||
for (int i = 0; i < escapes.length; ++i)
|
||||
str = str.replace(escapes[i][0], escapes[i][1]);
|
||||
private static String escapeXmlString(String str) {
|
||||
for (int i = 0; i < escapes.length; ++i)
|
||||
str = str.replace(escapes[i][0], escapes[i][1]);
|
||||
|
||||
return str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private static String encodedParameterList(Param[] params)
|
||||
{
|
||||
String result = "";
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
if (i > 0)
|
||||
result = result + ";";
|
||||
private static String encodedParameterList(Param[] params) {
|
||||
String result = "";
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
if (i > 0)
|
||||
result = result + ";";
|
||||
|
||||
result = result + escapeXmlString(params[i].name) + "=" + escapeXmlString(params[i].value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
result = result + escapeXmlString(params[i].name) + "="
|
||||
+ escapeXmlString(params[i].value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IsacCodeGenerator(IScriptAdapter adapter) {
|
||||
super(adapter, new String[0]);
|
||||
}
|
||||
public IsacCodeGenerator(IScriptAdapter adapter) {
|
||||
super(adapter, new String[0]);
|
||||
}
|
||||
|
||||
public static String getGeneratorDescription()
|
||||
{
|
||||
return "ISAC scenario for CLIF.ow2.org";
|
||||
}
|
||||
public static String getGeneratorDescription() {
|
||||
return "ISAC scenario for CLIF.ow2.org";
|
||||
}
|
||||
|
||||
public void doNew()
|
||||
{
|
||||
wl("<?xml version=\"1.0\"?>");
|
||||
public void doNew() {
|
||||
wl("<?xml version=\"1.0\"?>");
|
||||
|
||||
wl("<scenario>");
|
||||
wl("\t<behaviors>");
|
||||
wl("\t\t<plugins>");
|
||||
wl("\t\t\t<use id=\"replayHttp\" name=\"HttpInjector\">");
|
||||
wl("\t\t\t\t<params>");
|
||||
wl("\t\t\t\t\t<param name=\"indepthload\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyuserpass\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"useragent\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyport\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyhost\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyusername\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"preemptiveauthentication\" value=\"\"></param>");
|
||||
wl("\t\t\t\t</params>");
|
||||
wl("\t\t\t</use>");
|
||||
wl("<scenario>");
|
||||
wl("\t<behaviors>");
|
||||
wl("\t\t<plugins>");
|
||||
wl("\t\t\t<use id=\"replayHttp\" name=\"HttpInjector\">");
|
||||
wl("\t\t\t\t<params>");
|
||||
wl("\t\t\t\t\t<param name=\"indepthload\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyuserpass\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"useragent\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyport\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyhost\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"proxyusername\" value=\"\"></param>");
|
||||
wl("\t\t\t\t\t<param name=\"preemptiveauthentication\" value=\"\"></param>");
|
||||
wl("\t\t\t\t</params>");
|
||||
wl("\t\t\t</use>");
|
||||
|
||||
Config conf = Config.getConfig();
|
||||
this.timer = conf.getProperty("generator.isac.timer", "ConstantTimer");
|
||||
Config conf = Config.getConfig();
|
||||
this.timer = conf.getProperty("generator.isac.timer", "ConstantTimer");
|
||||
|
||||
if (this.timer.equals("ConstantTimer"))
|
||||
{
|
||||
wl("\t\t\t<use id=\"replayTimer\" name=\"ConstantTimer\"></use>");
|
||||
}
|
||||
else if (this.timer.equals("Random"))
|
||||
{
|
||||
wl(" <use id=\"replayTimer\" name=\"Random\"></use>");
|
||||
this.randomDist = Config.getConfig().getProperty("generator.isac.timer.random.dist", "uniform");
|
||||
try
|
||||
{
|
||||
if (this.randomDist.equals("uniform"))
|
||||
{
|
||||
this.delta = conf.getPropertyInt("generator.isac.timer.random.delta").intValue();
|
||||
}
|
||||
else if (this.randomDist.equals("gaussian"))
|
||||
{
|
||||
this.delta = conf.getPropertyInt("generator.isac.timer.random.delta").intValue();
|
||||
this.deviation = conf.getPropertyInt("generator.isac.timer.random.deviation").intValue();
|
||||
}
|
||||
else if (this.randomDist.equals("poisson"))
|
||||
{
|
||||
this.unit = conf.getPropertyInt("generator.isac.timer.random.unit").intValue();
|
||||
}
|
||||
else if (!(this.randomDist.equals("negexpo")))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.delta = conf.getPropertyInt("generator.isac.timer.random.delta").intValue();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Utils.UserException ex)
|
||||
{
|
||||
ex.printStackTrace(System.err);
|
||||
System.err.println("Warning: incorrect property settings for Isac random timer distribution " + this.randomDist);
|
||||
}
|
||||
}
|
||||
if (this.timer.equals("ConstantTimer")) {
|
||||
wl("\t\t\t<use id=\"replayTimer\" name=\"ConstantTimer\"></use>");
|
||||
} else if (this.timer.equals("Random")) {
|
||||
wl(" <use id=\"replayTimer\" name=\"Random\"></use>");
|
||||
this.randomDist = Config.getConfig().getProperty(
|
||||
"generator.isac.timer.random.dist", "uniform");
|
||||
try {
|
||||
if (this.randomDist.equals("uniform")) {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
} else if (this.randomDist.equals("gaussian")) {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
this.deviation = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.deviation").intValue();
|
||||
} else if (this.randomDist.equals("poisson")) {
|
||||
this.unit = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.unit").intValue();
|
||||
} else if (!(this.randomDist.equals("negexpo"))) {
|
||||
|
||||
wl("\t\t</plugins>");
|
||||
wl("\t\t<behavior id=\"session\">");
|
||||
wl("");
|
||||
wl("\t\t<!-- ^^^ Insert new recordings here. (Do not remove this line.) -->");
|
||||
wl("");
|
||||
wl("\t\t</behavior>");
|
||||
wl("\t</behaviors>");
|
||||
wl("\t<loadprofile></loadprofile>");
|
||||
wl("</scenario>");
|
||||
}
|
||||
} else {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
}
|
||||
|
||||
public String[] getValidFileExtensions() {
|
||||
return new String[] { ".xis" };
|
||||
}
|
||||
} catch (Utils.UserException ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
System.err
|
||||
.println("Warning: incorrect property settings for Isac random timer distribution "
|
||||
+ this.randomDist);
|
||||
}
|
||||
}
|
||||
|
||||
public void doParameterList(Param[] params) throws Utils.UserException {
|
||||
}
|
||||
wl("\t\t</plugins>");
|
||||
wl("\t\t<behavior id=\"session\">");
|
||||
wl("");
|
||||
wl("\t\t<!-- ^^^ Insert new recordings here. (Do not remove this line.) -->");
|
||||
wl("");
|
||||
wl("\t\t</behavior>");
|
||||
wl("\t</behaviors>");
|
||||
wl("\t<loadprofile></loadprofile>");
|
||||
wl("</scenario>");
|
||||
}
|
||||
|
||||
public void doQueryStringParameterList(Param[] params) throws Utils.UserException {
|
||||
this.queryStringParameters = encodedParameterList(params);
|
||||
}
|
||||
public void doNewForNewScenarioModel() {
|
||||
|
||||
public void doBodyParameterList(Param[] params) throws Utils.UserException {
|
||||
this.bodyParameters = encodedParameterList(params);
|
||||
}
|
||||
UsePluginModel usePlugin1 = new UsePluginModel();
|
||||
UsePluginModel usePlugin2 = new UsePluginModel();
|
||||
List<UsePluginModel> usePlugins = new ArrayList<UsePluginModel>();
|
||||
ParameterModel param1 = new ParameterModel();
|
||||
ParameterModel param2 = new ParameterModel();
|
||||
ParameterModel param3 = new ParameterModel();
|
||||
ParameterModel param4 = new ParameterModel();
|
||||
ParameterModel param5 = new ParameterModel();
|
||||
ParameterModel param6 = new ParameterModel();
|
||||
ParameterModel param7 = new ParameterModel();
|
||||
|
||||
public void doTestUrlMessage(String url)
|
||||
{
|
||||
}
|
||||
param1.setKey("indepthload");
|
||||
param1.setValue("");
|
||||
param2.setKey("proxyuserpass");
|
||||
param2.setValue("");
|
||||
param3.setKey("useragent");
|
||||
param3.setValue("");
|
||||
param4.setKey("proxyport");
|
||||
param4.setValue("");
|
||||
param5.setKey("proxyhost");
|
||||
param5.setValue("");
|
||||
param6.setKey("proxyusername");
|
||||
param6.setValue("");
|
||||
param7.setKey("preemptiveauthentication");
|
||||
param7.setValue("");
|
||||
|
||||
public void doSetData(String data)
|
||||
{
|
||||
}
|
||||
List<ParameterModel> params = new ArrayList<ParameterModel>();
|
||||
params.add(param1);
|
||||
params.add(param2);
|
||||
params.add(param3);
|
||||
params.add(param4);
|
||||
params.add(param5);
|
||||
params.add(param6);
|
||||
params.add(param7);
|
||||
|
||||
public void doCallUrl(String url, String method, String data, String contentLength) throws Utils.UserException {
|
||||
if (!(isFirstRequest()))
|
||||
doInsertDelay(getTimeElapsedSinceLastestRequest());
|
||||
StringBuilder sample = new StringBuilder();
|
||||
usePlugin1.setParameters(params);
|
||||
usePlugin1.setId("replayHttp");
|
||||
usePlugin1.setName("HttpInjector");
|
||||
usePlugin2.setId("replayTimer");
|
||||
|
||||
sample.append("\t\t\t<sample use=\"replayHttp\" name=\"" + method + "\">" + EOL);
|
||||
sample.append("\t\t\t\t<params>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"password\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"parameters\" value=\"" + this.queryStringParameters + "\"></param>" + EOL);
|
||||
if (method.equalsIgnoreCase("post"))
|
||||
{
|
||||
sample.append("\t\t\t\t\t<param name=\"bodyparameters\" value=\"" + this.bodyParameters + "\"></param>" + EOL);
|
||||
}
|
||||
sample.append("\t\t\t\t\t<param name=\"realm\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxyport\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxyhost\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"cookies\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxypassword\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"hostauth\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"cookiepolicy\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"uri\" value=\"" + url + "\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"username\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"redirect\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"localaddress\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxylogin\" value=\"\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t</params>" + EOL);
|
||||
sample.append("\t\t\t</sample>" + EOL);
|
||||
insertStmt(sample.toString());
|
||||
this.queryStringParameters = "";
|
||||
this.bodyParameters = "";
|
||||
}
|
||||
Config conf = Config.getConfig();
|
||||
this.timer = conf.getProperty("generator.isac.timer", "ConstantTimer");
|
||||
|
||||
public void doAssertResponse(String respCode)
|
||||
{
|
||||
}
|
||||
if (this.timer.equals("ConstantTimer")) {
|
||||
usePlugin2.setName("ConstantTimer");
|
||||
} else if (this.timer.equals("Random")) {
|
||||
usePlugin2.setName("Random");
|
||||
this.randomDist = Config.getConfig().getProperty(
|
||||
"generator.isac.timer.random.dist", "uniform");
|
||||
try {
|
||||
if (this.randomDist.equals("uniform")) {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
} else if (this.randomDist.equals("gaussian")) {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
this.deviation = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.deviation").intValue();
|
||||
} else if (this.randomDist.equals("poisson")) {
|
||||
this.unit = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.unit").intValue();
|
||||
} else if (!(this.randomDist.equals("negexpo"))) {
|
||||
|
||||
public void doTidyCode(String url) {
|
||||
}
|
||||
} else {
|
||||
this.delta = conf.getPropertyInt(
|
||||
"generator.isac.timer.random.delta").intValue();
|
||||
}
|
||||
|
||||
public void doResponseForStdOut(String url) {
|
||||
}
|
||||
} catch (Utils.UserException ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
System.err
|
||||
.println("Warning: incorrect property settings for Isac random timer distribution "
|
||||
+ this.randomDist);
|
||||
}
|
||||
}
|
||||
usePlugins.add(usePlugin1);
|
||||
usePlugins.add(usePlugin2);
|
||||
}
|
||||
|
||||
public void doResponseForFile() {
|
||||
}
|
||||
public String[] getValidFileExtensions() {
|
||||
return new String[] { ".xis" };
|
||||
}
|
||||
|
||||
public void doEndTransaction() throws Utils.UserException {
|
||||
}
|
||||
public void doParameterList(Param[] params) throws Utils.UserException {
|
||||
}
|
||||
|
||||
public void doStartRecording() {
|
||||
}
|
||||
public void doQueryStringParameterList(Param[] params)
|
||||
throws Utils.UserException {
|
||||
this.queryStringParameters = encodedParameterList(params);
|
||||
}
|
||||
|
||||
public void doStopRecording() {
|
||||
}
|
||||
public void doBodyParameterList(Param[] params) throws Utils.UserException {
|
||||
this.bodyParameters = encodedParameterList(params);
|
||||
}
|
||||
|
||||
public void doClose() {
|
||||
}
|
||||
public void doTestUrlMessage(String url) {
|
||||
}
|
||||
|
||||
public void setStruts(boolean struts) {
|
||||
}
|
||||
public void doSetData(String data) {
|
||||
}
|
||||
|
||||
public void doHeaders(HeaderValue[] headers) {
|
||||
}
|
||||
public void doCallUrl(String url, String method, String data,
|
||||
String contentLength) throws Utils.UserException {
|
||||
if (!(isFirstRequest()))
|
||||
doInsertDelay(getTimeElapsedSinceLastestRequest());
|
||||
StringBuilder sample = new StringBuilder();
|
||||
|
||||
private void wl(String s) {
|
||||
getScriptAdapter().append(s + EOL);
|
||||
}
|
||||
sample.append("\t\t\t<sample use=\"replayHttp\" name=\"" + method
|
||||
+ "\">" + EOL);
|
||||
sample.append("\t\t\t\t<params>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"password\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"parameters\" value=\""
|
||||
+ this.queryStringParameters + "\"></param>" + EOL);
|
||||
if (method.equalsIgnoreCase("post")) {
|
||||
sample.append("\t\t\t\t\t<param name=\"bodyparameters\" value=\""
|
||||
+ this.bodyParameters + "\"></param>" + EOL);
|
||||
}
|
||||
sample.append("\t\t\t\t\t<param name=\"realm\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxyport\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxyhost\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"cookies\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxypassword\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"hostauth\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"cookiepolicy\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"uri\" value=\"" + url
|
||||
+ "\"></param>" + EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"username\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"redirect\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"localaddress\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t\t<param name=\"proxylogin\" value=\"\"></param>"
|
||||
+ EOL);
|
||||
sample.append("\t\t\t\t</params>" + EOL);
|
||||
sample.append("\t\t\t</sample>" + EOL);
|
||||
insertStmt(sample.toString());
|
||||
this.queryStringParameters = "";
|
||||
this.bodyParameters = "";
|
||||
}
|
||||
|
||||
private void insertStmt(String s)
|
||||
throws Utils.UserException
|
||||
{
|
||||
insert(s + EOL);
|
||||
}
|
||||
public void doAssertResponse(String respCode) {
|
||||
}
|
||||
|
||||
private void doInsertDelay(long delay)
|
||||
throws Utils.UserException
|
||||
{
|
||||
StringBuilder timerStr = new StringBuilder();
|
||||
if (this.timer.equals("Random"))
|
||||
{
|
||||
int min = (int)(delay - this.delta);
|
||||
if (min < 0)
|
||||
min = 0;
|
||||
public void doTidyCode(String url) {
|
||||
}
|
||||
|
||||
if (this.randomDist.equals("uniform")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setUniform\">" + EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"max\" value=\"" + (delay + this.delta) + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
}
|
||||
else if (this.randomDist.equals("gaussian")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setGaussian\">" + EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"max\" value=\"" + (delay + this.delta) + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"mean\" value=\"" + delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"deviation\" value=\"" + this.deviation + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
}
|
||||
else if (this.randomDist.equals("poisson")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setPoisson\">" + EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"unit\" value=\"" + this.unit + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"parameter\" value=\"" + delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
}
|
||||
else if (this.randomDist.equals("negexpo")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setNegativeExpo\">" + EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"mean\" value=\"" + delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
}
|
||||
timerStr.append("\t\t\t<timer use=\"replayTimer\" name=\"sleep\"/>" + EOL);
|
||||
}
|
||||
else if (this.timer.equals("ConstantTimer")) {
|
||||
timerStr.append("\t\t\t<timer use=\"replayTimer\" name=\"sleep\">" + EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"duration_arg\" value=\"" + delay + "\"></param>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</timer>" + EOL);
|
||||
}
|
||||
insertStmt(timerStr.toString());
|
||||
}
|
||||
public void doResponseForStdOut(String url) {
|
||||
}
|
||||
|
||||
public void doSetCharset(String cs)
|
||||
throws Utils.UserException
|
||||
{
|
||||
}
|
||||
public void doResponseForFile() {
|
||||
}
|
||||
|
||||
public void doEndTransaction() throws Utils.UserException {
|
||||
}
|
||||
|
||||
public void doStartRecording() {
|
||||
}
|
||||
|
||||
public void doStopRecording() {
|
||||
}
|
||||
|
||||
public void doClose() {
|
||||
}
|
||||
|
||||
public void setStruts(boolean struts) {
|
||||
}
|
||||
|
||||
public void doHeaders(HeaderValue[] headers) {
|
||||
}
|
||||
|
||||
private void wl(String s) {
|
||||
getScriptAdapter().append(s + EOL);
|
||||
}
|
||||
|
||||
private void insertStmt(String s) throws Utils.UserException {
|
||||
insert(s + EOL);
|
||||
}
|
||||
|
||||
private void doInsertDelay(long delay) throws Utils.UserException {
|
||||
StringBuilder timerStr = new StringBuilder();
|
||||
if (this.timer.equals("Random")) {
|
||||
int min = (int) (delay - this.delta);
|
||||
if (min < 0)
|
||||
min = 0;
|
||||
|
||||
if (this.randomDist.equals("uniform")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setUniform\">"
|
||||
+ EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min
|
||||
+ "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"max\" value=\""
|
||||
+ (delay + this.delta) + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
} else if (this.randomDist.equals("gaussian")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setGaussian\">"
|
||||
+ EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min
|
||||
+ "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"max\" value=\""
|
||||
+ (delay + this.delta) + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"mean\" value=\""
|
||||
+ delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"deviation\" value=\""
|
||||
+ this.deviation + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
} else if (this.randomDist.equals("poisson")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setPoisson\">"
|
||||
+ EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"unit\" value=\""
|
||||
+ this.unit + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"parameter\" value=\""
|
||||
+ delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
} else if (this.randomDist.equals("negexpo")) {
|
||||
timerStr.append("\t\t\t<control use=\"replayTimer\" name=\"setNegativeExpo\">"
|
||||
+ EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"min\" value=\"" + min
|
||||
+ "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"mean\" value=\""
|
||||
+ delay + "\"/>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</control>" + EOL);
|
||||
}
|
||||
timerStr.append("\t\t\t<timer use=\"replayTimer\" name=\"sleep\"/>"
|
||||
+ EOL);
|
||||
} else if (this.timer.equals("ConstantTimer")) {
|
||||
timerStr.append("\t\t\t<timer use=\"replayTimer\" name=\"sleep\">"
|
||||
+ EOL);
|
||||
timerStr.append("\t\t\t\t<params>" + EOL);
|
||||
timerStr.append("\t\t\t\t\t<param name=\"duration_arg\" value=\""
|
||||
+ delay + "\"></param>" + EOL);
|
||||
timerStr.append("\t\t\t\t</params>" + EOL);
|
||||
timerStr.append("\t\t\t</timer>" + EOL);
|
||||
}
|
||||
insertStmt(timerStr.toString());
|
||||
}
|
||||
|
||||
public void doSetCharset(String cs) throws Utils.UserException {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue