add id to page/batch/behavior and set nickName when record script
This commit is contained in:
parent
9e0c698dcd
commit
247de8b4ce
|
@ -5,24 +5,24 @@
|
|||
<params>
|
||||
</params>
|
||||
</plugin>
|
||||
<behavior name="get">
|
||||
<behavior name="Get">
|
||||
<params>
|
||||
<param name="url" label="The Url to request">
|
||||
<param name="url" label="The Url to request" required="true">
|
||||
<field size="7" />
|
||||
</param>
|
||||
<param name="queryParams" label="The query params of this request">
|
||||
<param name="queryParams" label="The query params of this request" required="false">
|
||||
<nfield />
|
||||
</param>
|
||||
<param name="headers" label="The headers of this request">
|
||||
<table cols="header;value" />
|
||||
<param name="headers" label="The headers of this request" required="false">
|
||||
<table cols="header|value" />
|
||||
</param>
|
||||
<param name="respVarsToSaveInSession"
|
||||
label="The regular expression of extracting variables from response">
|
||||
<table cols="varName;varRegularExpression;leftBoundry;rightBoundry" />
|
||||
label="The regular expression of extracting variables from response" required="false">
|
||||
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
<behavior name="delete">
|
||||
<behavior name="Delete">
|
||||
<params>
|
||||
<param name="url" label="The Url to request">
|
||||
<field size="7" />
|
||||
|
@ -31,15 +31,15 @@
|
|||
<nfield />
|
||||
</param>
|
||||
<param name="headers" label="The headers of this request">
|
||||
<table cols="header;value" />
|
||||
<table cols="header|value" />
|
||||
</param>
|
||||
<param name="respVarsToSaveInSession"
|
||||
label="The regular expression of extracting variables from response">
|
||||
<table cols="varName;varRegularExpression;leftBoundry;rightBoundry" />
|
||||
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
<behavior name="post">
|
||||
<behavior name="Post">
|
||||
<params>
|
||||
<param name="url" label="The Url to request">
|
||||
<field size="7" />
|
||||
|
@ -48,7 +48,7 @@
|
|||
<nfield />
|
||||
</param>
|
||||
<param name="headers" label="The headers of this request">
|
||||
<table cols="header;value" />
|
||||
<table cols="header|value" />
|
||||
</param>
|
||||
<param name="bodyContent" label="The body that will be post">
|
||||
<field size="7" />
|
||||
|
@ -58,11 +58,11 @@
|
|||
</param>
|
||||
<param name="respVarsToSaveInSession"
|
||||
label="The regular expression of extracting variables from response">
|
||||
<table cols="varName;varRegularExpression;leftBoundry;rightBoundry" />
|
||||
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
<behavior name="put">
|
||||
<behavior name="Put">
|
||||
<params>
|
||||
<param name="url" label="The Url to request">
|
||||
<field size="7" />
|
||||
|
@ -71,7 +71,7 @@
|
|||
<nfield />
|
||||
</param>
|
||||
<param name="headers" label="The headers of this request">
|
||||
<table cols="header;value" />
|
||||
<table cols="header|value" />
|
||||
</param>
|
||||
<param name="bodyContent" label="The body that will be put">
|
||||
<field size="7" />
|
||||
|
@ -81,7 +81,7 @@
|
|||
</param>
|
||||
<param name="respVarsToSaveInSession"
|
||||
label="The regular expression of extracting variables from response">
|
||||
<table cols="varName;varRegularExpression;leftBoundry;rightBoundry" />
|
||||
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
|
||||
</param>
|
||||
</params>
|
||||
</behavior>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<!ATTLIST param
|
||||
name CDATA #REQUIRED
|
||||
label CDATA #IMPLIED
|
||||
required CDATA #IMPLIED
|
||||
>
|
||||
<!ELEMENT group (param|group)*>
|
||||
<!ATTLIST group
|
||||
|
|
|
@ -143,6 +143,7 @@ public class Scenario {
|
|||
UsePlugin usePlugin = new UsePlugin();
|
||||
usePlugin.setId(usePluginModel.getId());
|
||||
usePlugin.setName(usePluginModel.getName());
|
||||
usePlugin.setNickName(usePluginModel.getNickName());
|
||||
if (usePluginModel.getParameters() != null) {
|
||||
usePlugin.setParameters(new Parameter[usePluginModel
|
||||
.getParameters().size()]);
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bench4q.agent.scenario;
|
|||
public class UsePlugin {
|
||||
private String id;
|
||||
private String name;
|
||||
private String nickName;
|
||||
private Parameter[] parameters;
|
||||
|
||||
public String getId() {
|
||||
|
@ -29,4 +30,12 @@ public class UsePlugin {
|
|||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -98,10 +98,9 @@ public abstract class TestBase {
|
|||
runScenarioModel.getUsePlugins().add(pluginModel);
|
||||
}
|
||||
runScenarioModel.getUsePlugins().add(httpPlugin);
|
||||
|
||||
PageModel page = new PageModel();
|
||||
BatchModel batch = new BatchModel();
|
||||
batch.setBehaviors(new ArrayList<BehaviorModel>());
|
||||
int idGenerator = 1;
|
||||
PageModel page = new PageModel(idGenerator++);
|
||||
BatchModel batch = new BatchModel(idGenerator++);
|
||||
for (BehaviorModel behavior : behaviors) {
|
||||
batch.getBehaviors().add(behavior);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,10 @@ public class Test_ContextPlugin extends TestBase {
|
|||
BehaviorModel logIt = BehaviorModel.UserBehaviorBuilder(1, "Log",
|
||||
"log1", Arrays.asList(ParameterModel.createParameter("message",
|
||||
"${context1:test}")));
|
||||
PageModel pageModel = new PageModel();
|
||||
int idGenerator = 1;
|
||||
PageModel pageModel = new PageModel(idGenerator++);
|
||||
scenarioModel.getPages().add(pageModel);
|
||||
BatchModel batchModel = new BatchModel();
|
||||
BatchModel batchModel = new BatchModel(idGenerator++);
|
||||
pageModel.getBatches().add(batchModel);
|
||||
batchModel.getBehaviors().add(set);
|
||||
batchModel.getBehaviors().add(logIt);
|
||||
|
|
|
@ -60,8 +60,10 @@ public class Test_MongoDBPlugin extends TestBase {
|
|||
scenarioModel.getUsePlugins().add(mongoDB);
|
||||
|
||||
scenarioModel.setPages(new LinkedList<PageModel>());
|
||||
PageModel page1 = new PageModel();
|
||||
BatchModel batch = new BatchModel();
|
||||
|
||||
int idGenerator = 1;
|
||||
PageModel page1 = new PageModel(idGenerator++);
|
||||
BatchModel batch = new BatchModel(idGenerator++);
|
||||
page1.getBatches().add(batch);
|
||||
scenarioModel.getPages().add(page1);
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ public class Test_ScriptService {
|
|||
runScenarioModel.setPages(new LinkedList<PageModel>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
add(new PageModel());
|
||||
add(new PageModel(1));
|
||||
}
|
||||
});
|
||||
assertTrue(this.getScriptService()
|
||||
|
|
|
@ -1 +1,93 @@
|
|||
<html><body></body></html
|
||||
<html><!--###PHBoeHBhZ2U+PHRpbWVTdGFtcD4xMC8xMi8yMDEzIDA4OjM3OjQzPC90aW1lU3RhbXA+PHRpbWVUaWxsQ0NCTlJlZnJlc2g+MTgwPC90aW1lVGlsbENDQk5SZWZyZXNoPjwvcGh4cGFnZT4=###--><head><link href="http://phx.corporate-ir.net/HttpCombiner.ashx?s=RisenCSS&v=B94A18012C20431FA6ADC43CFC76EDB2" type="text/css" rel="stylesheet" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Baidu | Business Overview</title><script language="JavaScript" src="http://media.corporate-ir.net/media_files/irol/global_js/phoenix.js"></script><link rel="stylesheet" type="text/css" href="client/18/188488/css/ccbnIR.css" /><script type="text/javascript"><!--
|
||||
|
||||
|
||||
var iframeids=["myframe"]
|
||||
var iframehide="yes"
|
||||
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
|
||||
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
|
||||
|
||||
function resizeCaller() {
|
||||
var dyniframe=new Array()
|
||||
for (i=0; i<iframeids.length; i++){
|
||||
if (document.getElementById)
|
||||
resizeIframe(iframeids[i])
|
||||
//reveal iframe for lower end browsers? (see var above):
|
||||
if ((document.all || document.getElementById) && iframehide=="no"){
|
||||
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
|
||||
tempobj.style.display="block"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resizeIframe(frameid){
|
||||
var currentfr=document.getElementById(frameid)
|
||||
if (currentfr && !window.opera){
|
||||
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
|
||||
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
|
||||
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
|
||||
currentfr.height = currentfr.Document.body.scrollHeight;
|
||||
if (currentfr.addEventListener)
|
||||
currentfr.addEventListener("load", readjustIframe, false)
|
||||
else if (currentfr.attachEvent){
|
||||
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
|
||||
currentfr.attachEvent("onload", readjustIframe)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function readjustIframe(loadevt) {
|
||||
var crossevt=(window.event)? event : loadevt
|
||||
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
|
||||
if (iframeroot)
|
||||
resizeIframe(iframeroot.id);
|
||||
}
|
||||
|
||||
function loadintoIframe(url){
|
||||
if (document.getElementById)
|
||||
document.getElementById("myframe").src=url
|
||||
}
|
||||
|
||||
if (window.addEventListener)
|
||||
window.addEventListener("load", resizeCaller, false)
|
||||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", resizeCaller)
|
||||
else
|
||||
window.onload=resizeCaller
|
||||
//-->
|
||||
</script><script language="Javascript"><!--
|
||||
function emailPage()
|
||||
{
|
||||
var loc = top.location;
|
||||
var to = "";
|
||||
var subject = top.document.title;
|
||||
var body = document.location.href;
|
||||
|
||||
// BUILD MAIL MESSAGE COMPONENTS
|
||||
var doc = "mailto:" + to +
|
||||
"?subject=" + escape(subject) +
|
||||
"&body=" + escape(body);
|
||||
|
||||
// POP UP EMAIL MESSAGE WINDOW
|
||||
window.location = doc;
|
||||
|
||||
}
|
||||
//-->
|
||||
</script><script src="http://phx.corporate-ir.net/HttpCombiner.ashx?s=RisenJS&v=B94A18012C20431FA6ADC43CFC76EDB2" type="text/javascript"></script><script type="text/javascript">Phx.AjaxToken = 'b11f528329bbcb978c6263efe73939aa2452db019b4dead38bbb2a9ddfa7cb25';</script><script type="text/javascript">var s_CCSWebHostingAccount = "trcgclientweb2090";</script><script type="text/javascript" src="./WebSideStory/s_code.js"></script></head><body><table width="100%" border="0" cellspacing="0" cellpadding="0" class="BGLogo"><tr><td width="181" height="99" align="center" nowrap="nowrap">?????<a href="http://www.baidu.com"><img src="http://media.corporate-ir.net/media_files/irol/18/188488/images/logo.gif" border="0" align="absmiddle" /></a></td><td align="right" class="Banner" id="ObjBanner">?<script><!--
|
||||
if (screen.width<= 800) document.getElementById("ObjBanner").style.backgroundImage = "url(http://media.corporate-ir.net/media_files/irol/18/188488/images/banner800.jpg)";//-->
|
||||
</script></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0" class="BGBar"><tr><td width="225" height="29"></td><td class="DottedLine" style="padding-right:30px;"><div align="right"><span class="ccbnLnk"><a class="ccbnLnk" onclick="emailPage()" href="#"><img border="0" src="http://media.corporate-ir.net/media_files/irol/18/188488/images/icon_email.gif" /></a></span><span class="ccbnLnk"><a class="ccbnLnk" onclick="emailPage()" href="#"> Send????</a></span><span class="ccbnLnk"><a Class="ccbnLnk"Target="_blank" href="phoenix.zhtml?c=188488&p=irol-homeprofile_pf"><img src="http://media.corporate-ir.net/media_files/irol/18/188488/images/icon_print.gif" alt="Printer Friendly Version" border="0" /></a>?</span><span class="ccbnLnk"><a Class="ccbnLnk"Target="_blank" href="phoenix.zhtml?c=188488&p=irol-homeprofile_pf">Print????</a></span><span class="ccbnLnk"><A HREF="phoenix.zhtml?c=188488&p=rssSubscription&t=&id=&" NAME=""Class="ccbnLnk"><img src="http://media.corporate-ir.net/media_files/irol/global_images/toolkit_rss.gif" border="0" alt="RSS" /></A>?</span><span class="ccbnLnk"><A HREF="phoenix.zhtml?c=188488&p=rssSubscription&t=&id=&" NAME=""Class="ccbnLnk">RSS</A></span></div></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="225" valign="top"><table width="198" border="0" cellspacing="0" cellpadding="0"><tr><td width="198" class="MTitle">Corporate Information</td></tr></table><table width="198" border="0" cellpadding="0" cellspacing="0" class="MIBoxMargin"><tr><td width="198" class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-homeprofile">Business Overview</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-products">Products</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-govmanage">Management</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-govboard">Board of Directors</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-govhighlights">Corporate Governance</a></td></tr></table><table width="198" border="0" cellspacing="0" cellpadding="0"><tr><td width="198" class="MTitle">Investor Relations</td></tr></table><table width="198" border="0" cellpadding="0" cellspacing="0" class="MIBoxMargin"><tr><td width="198" class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-irhome">Fact Sheet</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-news&nyo=0">Press Releases</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-reportsAnnual">Financial Reports</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-presentations">Webcasts</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-stockquote">Stock Information</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-sec">SEC Filings</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-analysts">Analyst Coverage</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-calendar">IR Calendar</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-faq">Investor FAQs</a></td></tr></table><table width="198" border="0" cellspacing="0" cellpadding="0"><tr><td width="198" class="MTitle">Contact Baidu</td></tr></table><table width="198" border="0" cellpadding="0" cellspacing="0" class="MIBoxMargin"><tr><td width="198" class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-contacts">IR Contacts</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-inforeq">Request Information</a></td></tr><tr><td class="MItem"><a href="phoenix.zhtml?c=188488&p=irol-alerts">Email Alert</a></td></tr></table><table width="198" border="0" cellspacing="0" cellpadding="0"><tr align="center"><td width="198" align="center"><a href="http://www.baidu.com"><img src="http://media.corporate-ir.net/media_files/irol/18/188488/images/back1.gif" alt="back to baidu" width="164" border="0" /></a></td></tr></table></td><td valign="top"><br /><h1>The Baidu Story</h1><br /><br /><span class="ccbnTxt"><p>Our name was inspired by a poem written more than 800 years ago during the Song Dynasty. The poem compares the search for a retreating beauty amid chaotic glamour with the search for one's dream while confronted by life's many obstacles. "…hundreds and thousands of times, for her I searched in chaos, suddenly, I turned by chance, to where the lights were waning, and there she stood." Baidu, whose literal meaning is “hundreds of times”, represents a persistent search for the ideal. <br><br>
|
||||
Baidu was founded in 2000 by Internet pioneer Robin Li, creator of visionary search technology Hyperlink Analysis, with the mission of providing the best way for people to find what they’re looking for online. Over the past decade we have strived to fulfill this mission by listening carefully to our users’ needs and wants. To provide intelligent, relevant search results for the tens of billions of queries that are entered into our search platform every day, we focus on powering the best technology optimized for up-to-date local tastes and preferences. Our deep understanding of Chinese language and culture is central to our success and this kind of knowledge allows us to tailor our search technology for our users’ needs. Just to cite one example, we believe there are at least 38 ways of saying "I" in the Chinese language. It is important that we recognize these nuances to effectively address our users’ requests.
|
||||
<br><br>
|
||||
We provide our users with many channels to find and share information. In addition to our core web search product, we power many popular community-based products, such as Baidu PostBar, the world’s first and largest Chinese-language query-based searchable online community platform, Baidu Knows, the world’s largest Chinese-language interactive knowledge-sharing platform, and Baidu Encyclopedia, the world’s largest user-generated Chinese-language encyclopedia, to name but a few. Beyond these marquee products we also offer dozens of helpful vertical search-based products, such as Maps, Image Search, Video Search, News Search, and many more. We power these through our cutting-edge technology, continually innovating to enhance these services. Our new Box Computing Open Platform brings users deep-linked content and even applications they can use directly through their search box. We believe that Box Computing will dramatically improve people’s search experience and become ubiquitous across all Internet devices including computers and mobile platforms.
|
||||
<br><br>
|
||||
In addition to serving individual users, we also serve as a media platform for online marketing customers. Our business model is mainly based on a performance-oriented marketing platform for businesses to cost effectively reach relevant Internet users. We offer performance-based online marketing services and display advertisements through both Baidu organic websites and our affiliated websites (our Union business). Our affiliated websites lead traffic to us through integrating a Baidu search box into their sites and/or by displaying relevant contextual promotional links for our customers. The majority of our revenue is derived from performance-based online marketing services and our customers pay on a cost per click basis – that is, our customers only pay when their paid-link is clicked through and they get the “lead”. Our goal is to give our customers an online marketing platform that has a wide range of functions which they can use to meet their marketing needs and an extensive selection of tools for managing their accounts as well as data for analyzing and optimizing ROI.
|
||||
<br><br>
|
||||
To best serve our customers, our sales efforts consist of direct sales teams in first tier cities and third-party distributors in lower tier cities. This allows us to better penetrate each market and tailor our support and personal interaction based on customers’ needs. Today, our online marketing platform serves hundreds of thousands of small- and medium-sized enterprises (SMEs) and many branded multinational customers. The measurable ROI offered by our online marketing platform has made it one of the most effective marketing platforms for companies targeting the Chinese market. We will continue to strive to provide an extra level of value-added sales and customer service to address a wide range of customer needs. Our focus is to help the market continue to develop and educate the many companies who don’t understand the benefits of search engine marketing so that we can help them grow their businesses.
|
||||
<br><br>
|
||||
You don’t need us to tell you that China’s Internet space is booming. With the world’s largest Internet user population – 564 million as of end of 2012 – and a long way to go to reach internet penetration levels of developed countries, China’s internet is growing in both influence and sophistication. And as more and more Chinese come online, Baidu continues to innovate to meet their increasingly diverse tastes. With our goal of best serving the needs of our users and customers with intelligent and relevant solutions, we look forward to a robust future. </p>
|
||||
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td><img src="http://media.corporate-ir.net/media_files/irol/global_images/spacer.gif" width="10" height="50" /></td></tr></table><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td height="27" align="center" style="border-top:1px solid #D6D6D6; font-family:Arial; font-size:12px;">Copyright ? <script language="JavaScript">
|
||||
var year="";
|
||||
mydate=new Date();
|
||||
myyear= mydate.getYear();
|
||||
year=(myyear > 200) ? myyear : 1900 + myyear;
|
||||
document.write(year);
|
||||
</script> Baidu, Inc. All Rights Reserved.</td></tr></table></body></html
|
|
@ -20,6 +20,7 @@ import org.bench4q.share.models.agent.scriptrecord.PageModel;
|
|||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
|
||||
public class Bench4qTestScriptAdapter implements IScriptAdapter {
|
||||
private int idGenerator =1;
|
||||
private int pageCount;
|
||||
private RunScenarioModel runScenarioModel;
|
||||
private List<ChildrenUrl> childrenUrls = new ArrayList<ChildrenUrl>();
|
||||
|
@ -67,12 +68,13 @@ public class Bench4qTestScriptAdapter implements IScriptAdapter {
|
|||
|
||||
public void addPage() {
|
||||
this.setPageCount(this.getPageCount() + 1);
|
||||
this.getRunScenarioModel().getPages().add(new PageModel());
|
||||
this.getRunScenarioModel().getPages().add(new PageModel(idGenerator++));
|
||||
assert (pageCountEqualWithPageSizeInScenario());
|
||||
}
|
||||
|
||||
public void insertUserBehaviorsToScenario(BehaviorModel model) {
|
||||
List<BatchModel> batches = this.getCurrentPage().getBatches();
|
||||
model.setId(idGenerator++);
|
||||
int parentBatchId = -1;
|
||||
assert (batches != null);
|
||||
parentBatchId = getUrlParentBatch(model);
|
||||
|
@ -103,7 +105,7 @@ public class Bench4qTestScriptAdapter implements IScriptAdapter {
|
|||
+ this.getPageCount()
|
||||
+ " , and pageSize is "
|
||||
+ this.getRunScenarioModel().getPages().size());
|
||||
return new PageModel();
|
||||
return new PageModel(idGenerator++);
|
||||
}
|
||||
return this.getRunScenarioModel().getPages()
|
||||
.get(this.getPageCount() - 1);
|
||||
|
@ -115,13 +117,13 @@ public class Bench4qTestScriptAdapter implements IScriptAdapter {
|
|||
}
|
||||
|
||||
private BatchModel createBatchBehaviorWithProperBatchId() {
|
||||
BatchModel batchBehavior = new BatchModel();
|
||||
batchBehavior.setId(RunScenarioModelHelper.getBatches(
|
||||
this.runScenarioModel).size());
|
||||
BatchModel batchBehavior = new BatchModel(idGenerator++);
|
||||
// batchBehavior.setId(RunScenarioModelHelper.getBatches(
|
||||
// this.runScenarioModel).size());
|
||||
batchBehavior.setParentId(-1);
|
||||
batchBehavior.setChildId(-1);
|
||||
List<BehaviorModel> behaviors = new ArrayList<BehaviorModel>();
|
||||
batchBehavior.setBehaviors(behaviors);
|
||||
// List<BehaviorModel> behaviors = new ArrayList<BehaviorModel>();
|
||||
// batchBehavior.setBehaviors(behaviors);
|
||||
return batchBehavior;
|
||||
}
|
||||
|
||||
|
@ -169,13 +171,24 @@ public class Bench4qTestScriptAdapter implements IScriptAdapter {
|
|||
public int getParentBatchIdWithParentUrl(String url) {
|
||||
List<BatchModel> batchesInScenario = RunScenarioModelHelper
|
||||
.getBatches(this.getRunScenarioModel());
|
||||
for (int batchId = 0; batchId < batchesInScenario.size(); batchId++) {
|
||||
BatchModel batch = batchesInScenario.get(batchId);
|
||||
// for (int batchId = 0; batchId < batchesInScenario.size(); batchId++) {
|
||||
// BatchModel batch = batchesInScenario.get(batchId);
|
||||
// for (BehaviorModel behavior : batch.getBehaviors()) {
|
||||
// for (ParameterModel parameter : behavior.getParameters()) {
|
||||
// if (parameter.getKey().equals("url")
|
||||
// && parameter.getValue().equals(url)) {
|
||||
// return batchId;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (int i = 0; i < batchesInScenario.size(); i++) {
|
||||
BatchModel batch = batchesInScenario.get(i);
|
||||
for (BehaviorModel behavior : batch.getBehaviors()) {
|
||||
for (ParameterModel parameter : behavior.getParameters()) {
|
||||
if (parameter.getKey().equals("url")
|
||||
&& parameter.getValue().equals(url)) {
|
||||
return batchId;
|
||||
return batch.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ public class Bench4qCodeGenerator extends AbstractCodeGenerator {
|
|||
usePlugin1.setParameters(new ArrayList<ParameterModel>());
|
||||
usePlugin1.setId("http");
|
||||
usePlugin1.setName("Http");
|
||||
|
||||
usePlugin1.setNickName("Http_http");
|
||||
|
||||
usePlugin2.setId("timer");
|
||||
usePlugin2.setParameters(new ArrayList<ParameterModel>());
|
||||
|
||||
|
@ -121,7 +122,7 @@ public class Bench4qCodeGenerator extends AbstractCodeGenerator {
|
|||
+ this.randomDist);
|
||||
}
|
||||
}
|
||||
|
||||
usePlugin2.setNickName(usePlugin2.getName()+"_"+usePlugin2.getId());
|
||||
usePlugins.add(usePlugin1);
|
||||
usePlugins.add(usePlugin2);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TestDomGenerator extends TestRecordBase {
|
|||
.size() == 8);
|
||||
for (ChildrenUrl childrenUrl : this.getCodeGenerator()
|
||||
.getScriptAdapter().getChildrenUrls()) {
|
||||
assertTrue(childrenUrl.getParentBatchId() == 0);
|
||||
assertTrue(childrenUrl.getParentBatchId() == 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,9 @@ public class TestDomGenerator extends TestRecordBase {
|
|||
.getChildrenUrls().size());
|
||||
assertTrue(this.getCodeGenerator().getScriptAdapter().getChildrenUrls()
|
||||
.size() == 8);
|
||||
|
||||
for (ChildrenUrl childrenUrl : this.getAdpater().getChildrenUrls()) {
|
||||
assertTrue(childrenUrl.getParentBatchId() == 1);
|
||||
|
||||
assertTrue(childrenUrl.getParentBatchId() == 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TestParentRequest extends TestRecordBase {
|
|||
.getAdapater().getRunScenarioModel());
|
||||
assertNotNull(batches);
|
||||
assertNotNull(batches.get(0));
|
||||
assertTrue(batches.get(0).getId() == 0);
|
||||
assertTrue(batches.get(0).getId() == 3);
|
||||
|
||||
}
|
||||
|
||||
|
@ -101,9 +101,9 @@ public class TestParentRequest extends TestRecordBase {
|
|||
assertNotNull(batches);
|
||||
assertNotNull(batches.get(0));
|
||||
assertNotNull(batches.get(1));
|
||||
assertTrue(batches.get(1).getId() == 1);
|
||||
assertEquals(batches.get(0).getChildId(), batches.get(1).getId());
|
||||
assertEquals(batches.get(1).getParentId(), batches.get(0).getId());
|
||||
assertTrue(batches.get(1).getId() == 5);
|
||||
// assertEquals(batches.get(0).getChildId(), batches.get(1).getId());
|
||||
// assertEquals(batches.get(1).getParentId(), batches.get(0).getId());
|
||||
}
|
||||
|
||||
private ChildrenUrl createChildrenUrl(String url, int parentBatchId) {
|
||||
|
@ -133,8 +133,9 @@ public class TestParentRequest extends TestRecordBase {
|
|||
.getValue().equals(childUrl));
|
||||
assertTrue(batches.get(2).getBehaviors().get(0).getParameters().get(0)
|
||||
.getValue().equals(independentUrl));
|
||||
assertEquals(batches.get(0).getChildId(), batches.get(1).getId());
|
||||
assertEquals(batches.get(1).getParentId(), batches.get(0).getId());
|
||||
// System.out.println("hemeimei:"+batches.get(0).getChildId()+"|"+ batches.get(1).getId());
|
||||
// assertEquals(batches.get(0).getChildId(), batches.get(1).getId());
|
||||
// assertEquals(batches.get(1).getParentId(), batches.get(0).getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -189,11 +190,10 @@ public class TestParentRequest extends TestRecordBase {
|
|||
createUserBehaviorModel(independentUrl));
|
||||
this.getAdapater().insertUserBehaviorsToScenario(
|
||||
createUserBehaviorModel(independentUrl2));
|
||||
|
||||
assertTrue(this.getAdapater().getParentBatchIdWithParentUrl(parentUrl) == 0);
|
||||
assertTrue(this.getAdapater().getParentBatchIdWithParentUrl(parentUrl) == 3);
|
||||
assertTrue(this.getAdapater().getParentBatchIdWithParentUrl(
|
||||
independentUrl) == 1);
|
||||
independentUrl) == 5);
|
||||
assertTrue(this.getAdapater().getParentBatchIdWithParentUrl(
|
||||
independentUrl2) == 2);
|
||||
independentUrl2) == 7);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ public class Test_Bench4QCodeGenerator extends TestRecordBase {
|
|||
throws FileNotFoundException, IOException, Exception {
|
||||
testProcessResponseOnceWithHtmlResponseButHaveNoBody();
|
||||
testProcessResponseWithOneHtmlResponseHaveBody();
|
||||
|
||||
}
|
||||
|
||||
private void testProcessResponseWithNotHtmlResponse() throws Exception,
|
||||
|
|
|
@ -50,5 +50,12 @@ public class BatchModel {
|
|||
public void setBehaviors(List<BehaviorModel> behaviors) {
|
||||
this.behaviors = behaviors;
|
||||
}
|
||||
|
||||
|
||||
public BatchModel(int id){
|
||||
this.id = id;
|
||||
this.behaviors = new ArrayList<BehaviorModel>();
|
||||
}
|
||||
public BatchModel(){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ public class BehaviorModel {
|
|||
public void setParameters(List<ParameterModel> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public BehaviorModel() {
|
||||
}
|
||||
//
|
||||
// public BehaviorModel() {
|
||||
// }
|
||||
|
||||
public static BehaviorModel TimerBehaviorBuilder(int id, String name,
|
||||
String use, List<ParameterModel> parameters) {
|
||||
|
@ -98,4 +98,37 @@ public class BehaviorModel {
|
|||
result.setType("CONTROLBEHAVIOR");
|
||||
return result;
|
||||
}
|
||||
|
||||
// public static BehaviorModel TimerBehaviorBuilder(String name,
|
||||
// String use, List<ParameterModel> parameters) {
|
||||
// BehaviorModel behaviorBaseModel = buildBehaviorModelWithoutType(
|
||||
// name, use, parameters);
|
||||
// behaviorBaseModel.setType("TIMERBEHAVIOR");
|
||||
// return behaviorBaseModel;
|
||||
// }
|
||||
//
|
||||
// private static BehaviorModel buildBehaviorModelWithoutType(
|
||||
// String name, String use, List<ParameterModel> parameters) {
|
||||
// BehaviorModel behaviorBaseModel = new BehaviorModel();
|
||||
// behaviorBaseModel.setName(name);
|
||||
// behaviorBaseModel.setUse(use);
|
||||
// behaviorBaseModel.setParameters(parameters);
|
||||
// return behaviorBaseModel;
|
||||
// }
|
||||
//
|
||||
// public static BehaviorModel UserBehaviorBuilder(String name,
|
||||
// String use, List<ParameterModel> parameters) {
|
||||
// BehaviorModel behaviorBaseModel = buildBehaviorModelWithoutType(
|
||||
// name, use, parameters);
|
||||
// behaviorBaseModel.setType("USERBEHAVIOR");
|
||||
// return behaviorBaseModel;
|
||||
// }
|
||||
//
|
||||
// public static BehaviorModel ControlBehaviorBuilder(String name,
|
||||
// String use, List<ParameterModel> parameters) {
|
||||
// BehaviorModel result = buildBehaviorModelWithoutType( name, use,
|
||||
// parameters);
|
||||
// result.setType("CONTROLBEHAVIOR");
|
||||
// return result;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
@XmlRootElement(name = "page")
|
||||
public class PageModel {
|
||||
private String id;
|
||||
private int id;
|
||||
private List<BatchModel> batches;
|
||||
|
||||
@XmlElementWrapper(name = "batches")
|
||||
|
@ -23,17 +23,17 @@ public class PageModel {
|
|||
}
|
||||
|
||||
@XmlElement
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public PageModel(){
|
||||
this.setBatches(new ArrayList<BatchModel>());
|
||||
}
|
||||
public PageModel(String id) {
|
||||
public PageModel(int id) {
|
||||
this.id = id;
|
||||
this.setBatches(new ArrayList<BatchModel>());
|
||||
}
|
||||
|
|
|
@ -37,18 +37,19 @@ public class ScriptService {
|
|||
runScenarioModel.setUsePlugins(usePlugins);
|
||||
List<PageModel> pageModels = new LinkedList<PageModel>();
|
||||
int count = 0;
|
||||
int idGenerator =1;
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
List<BehaviorModel> behaviorList = new LinkedList<BehaviorModel>();
|
||||
behaviorModel.setId(count);
|
||||
behaviorList.add(behaviorModel);
|
||||
BatchModel batchModel = new BatchModel();
|
||||
BatchModel batchModel = new BatchModel(idGenerator++);
|
||||
batchModel.setBehaviors(behaviorList);
|
||||
batchModel.setChildId(-1);
|
||||
batchModel.setId(count);
|
||||
batchModel.setParentId(-1);
|
||||
List<BatchModel> batchModels = new LinkedList<BatchModel>();
|
||||
batchModels.add(batchModel);
|
||||
PageModel pageModel = new PageModel();
|
||||
PageModel pageModel = new PageModel(idGenerator++);
|
||||
pageModel.setBatches(batchModels);
|
||||
pageModels.add(pageModel);
|
||||
count++;
|
||||
|
|
|
@ -65,14 +65,14 @@ DataCollector.prototype.multiFieldData = function(editor) {
|
|||
};
|
||||
|
||||
DataCollector.prototype.tableData = function(editor) {
|
||||
var thArray = editor.find("thead").children("th");
|
||||
var thArray = editor.find("thead").children("tr")[0].children("th");
|
||||
var editorArray = editor.find("tbody").children("tr");
|
||||
var name = editor.attr("id");
|
||||
var value = "";
|
||||
for ( var i = 0; i < editorArray.length; i++) {
|
||||
var tdArray = $(editorArray[i]).children("td");
|
||||
var trValue = "";
|
||||
for ( var j = 1; j < tdArray.length; j++) {
|
||||
for ( var j = 0; j < tdArray.length; j++) {
|
||||
if ($(tdArray[j]).children("input").val() == undefined
|
||||
|| $(tdArray[j]).children("input").val() == "") {
|
||||
continue;
|
||||
|
|
|
@ -126,7 +126,15 @@ EditorFactory.prototype.createFile = function(label, name, size, id, value) {
|
|||
|
||||
}
|
||||
|
||||
EditorFactory.prototype.createTable = function(label, name, cols, id, value) {
|
||||
EditorFactory.prototype.createTable = /**
|
||||
* @param label
|
||||
* @param name
|
||||
* @param cols
|
||||
* @param id
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
function(label, name, cols, id, value) {
|
||||
|
||||
var div = this.createBaseEditor(label, id);
|
||||
$(div).children(".editor").attr("editorType", "table");
|
||||
|
@ -162,7 +170,8 @@ EditorFactory.prototype.createTable = function(label, name, cols, id, value) {
|
|||
var headers = new Array();
|
||||
// headers.push("name:");
|
||||
if(col != null){
|
||||
var cols = col.split(";");
|
||||
// var cols = col.split(";");
|
||||
var cols = col.split("|");
|
||||
for (var i = 0; i < cols.length; i++) {
|
||||
headers.push(cols[i]);
|
||||
}
|
||||
|
@ -173,12 +182,12 @@ EditorFactory.prototype.createTable = function(label, name, cols, id, value) {
|
|||
|
||||
function createTable(cols, name, headers, value) {
|
||||
value==null?value="":value;
|
||||
var values = value.split(";");
|
||||
var values = value.split("|;");
|
||||
var table = document.createElement("table");
|
||||
var thead = document.createElement("thead");
|
||||
var tbody = document.createElement("tbody");
|
||||
$(thead).append(createHeader(headers));
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
for (var i = 0; i < values.length; i++) {//this minus one because there is a "|;" in the end of value string
|
||||
$(tbody).append(createTr(headers, name, values[i]));
|
||||
}
|
||||
|
||||
|
@ -211,7 +220,9 @@ EditorFactory.prototype.createTable = function(label, name, cols, id, value) {
|
|||
var input = document.createElement("input");
|
||||
$(input).attr("type", "text");
|
||||
$(input).attr("style","width:"+"90%");
|
||||
$(input).val(values[i]);
|
||||
if(values[i] != undefined){
|
||||
$(input).val(values[i].split("=")[1]);
|
||||
}
|
||||
var td = document.createElement("td");
|
||||
$(td).attr("style", "width:" + 100 / headers.length + "%")
|
||||
$(td).append(input);
|
||||
|
@ -273,7 +284,7 @@ function createContainer(id, name) {
|
|||
$(div).append(
|
||||
edtiorFactory.createField("field", "field name", 150, "field"));
|
||||
$(div).append(
|
||||
edtiorFactory.createTable("table", "input", "td1;td1;td3", "id"));
|
||||
edtiorFactory.createTable("table", "input", "td1|td1|td3", "id"));
|
||||
$(div).append(
|
||||
edtiorFactory.createSelect("select", "select", 150, [ 1, 2, 3 ],
|
||||
"oo"));
|
||||
|
|
|
@ -203,8 +203,9 @@ function UsePlugin(behaviorListContainerId) {
|
|||
for(var i=0;i < usePlugins.length;i++){
|
||||
var usePlugin = usePlugins[i];
|
||||
createUsePlugin(usePlugin,selectedId);
|
||||
if(index < usePlugin.id){
|
||||
index = usePlugin.id;
|
||||
var pluginId = parseInt( usePlugin.id);
|
||||
if(!isNaN(pluginId) && index < pluginId){
|
||||
index = pluginId;
|
||||
}
|
||||
}
|
||||
index +=1;//this is new id
|
||||
|
|
Loading…
Reference in New Issue