.gitignore not work well
This commit is contained in:
parent
ec42ccc4a5
commit
ae3800160b
|
@ -1,36 +1,38 @@
|
|||
/*/.project
|
||||
/*/.classpath
|
||||
/*/.settings
|
||||
/*/target
|
||||
/*/logs
|
||||
/*/bin
|
||||
|
||||
/Bench4Q-Master/.project
|
||||
/Bench4Q-Master/.classpath
|
||||
/Bench4Q-Master/.settings
|
||||
/Bench4Q-Master/target
|
||||
/Bench4Q-Master/logs
|
||||
|
||||
/Bench4Q-Agent/.project
|
||||
/Bench4Q-Agent/.classpath
|
||||
/Bench4Q-Agent/.settings
|
||||
/Bench4Q-Agent/target
|
||||
/Bench4Q-Agent/logs
|
||||
|
||||
/Bench4Q-Web/.project
|
||||
/Bench4Q-Web/.classpath
|
||||
/Bench4Q-Web/.settings
|
||||
/Bench4Q-Web/target
|
||||
/Bench4Q-Web/logs
|
||||
|
||||
/Bench4Q-Monitor/.project
|
||||
/Bench4Q-Monitor/.classpath
|
||||
/Bench4Q-Monitor/.settings
|
||||
/Bench4Q-Monitor/target
|
||||
/Bench4Q-Monitor/logs
|
||||
|
||||
/Bench4Q-Share/.project
|
||||
/Bench4Q-Share/.classpath
|
||||
/Bench4Q-Share/.settings
|
||||
/Bench4Q-Share/target
|
||||
/*/.project/
|
||||
/*/.classpath/
|
||||
/*/.settings/
|
||||
/*/target/
|
||||
/*/logs/
|
||||
/*/bin/
|
||||
/*/ScenarioParameters/
|
||||
/*/Scripts/
|
||||
|
||||
/Bench4Q-Master/.project
|
||||
/Bench4Q-Master/.classpath
|
||||
/Bench4Q-Master/.settings
|
||||
/Bench4Q-Master/target
|
||||
/Bench4Q-Master/logs
|
||||
|
||||
/Bench4Q-Agent/.project
|
||||
/Bench4Q-Agent/.classpath
|
||||
/Bench4Q-Agent/.settings
|
||||
/Bench4Q-Agent/target
|
||||
/Bench4Q-Agent/logs
|
||||
|
||||
/Bench4Q-Web/.project
|
||||
/Bench4Q-Web/.classpath
|
||||
/Bench4Q-Web/.settings
|
||||
/Bench4Q-Web/target
|
||||
/Bench4Q-Web/logs
|
||||
|
||||
/Bench4Q-Monitor/.project
|
||||
/Bench4Q-Monitor/.classpath
|
||||
/Bench4Q-Monitor/.settings
|
||||
/Bench4Q-Monitor/target
|
||||
/Bench4Q-Monitor/logs
|
||||
|
||||
/Bench4Q-Share/.project
|
||||
/Bench4Q-Share/.classpath
|
||||
/Bench4Q-Share/.settings
|
||||
/Bench4Q-Share/target
|
||||
/Bench4Q-Share/logs
|
|
@ -1 +0,0 @@
|
|||
12;13;14;15
|
|
@ -1 +0,0 @@
|
|||
12;13;14;15
|
|
@ -1 +0,0 @@
|
|||
row1;10;11~row2;20;21~row3,30,31~
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<batches>
|
||||
<batches>
|
||||
<behaviors>
|
||||
<behaviors>
|
||||
<id>1</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://www.baidu.com
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</behaviors>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batches>
|
||||
</batches>
|
||||
<poolSize>0</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>http</id>
|
||||
<name>Http</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
|
@ -1,397 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<definedParams>
|
||||
<definedParam>
|
||||
<name>param_HBase</name>
|
||||
<pickOrder>sequencial</pickOrder>
|
||||
<type>Ppara_Table</type>
|
||||
<updateStrategy>Once</updateStrategy>
|
||||
</definedParam>
|
||||
</definedParams>
|
||||
<pages>
|
||||
<page>
|
||||
<batches>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>1</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>2</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>2001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>2100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>3</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>4</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>4001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>4100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>5</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>6</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>6001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>6100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>7</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>8</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>8001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>8100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>9</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>10</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>10001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>10100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>11</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>12</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>12001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>12100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>13</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>14</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>14001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>14100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>15</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>16</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>16001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>16100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>17</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>18</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>18001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>18100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>19</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
</batches>
|
||||
</page>
|
||||
</pages>
|
||||
<poolSize>1</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>hBase</id>
|
||||
<name>Hbase</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
|
@ -1,17 +0,0 @@
|
|||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/testcase.html
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,146 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<batches>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<userBehavior>
|
||||
<id>1</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/testcase.html
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
</behaviors>
|
||||
<childId>2</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<timerBehavior>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>2500</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>timer</use>
|
||||
</timerBehavior>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>1</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<userBehavior>
|
||||
<id>3</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/3.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
<userBehavior>
|
||||
<id>4</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/script/agentTable.js
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
<userBehavior>
|
||||
<id>5</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/script/base.js
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
<userBehavior>
|
||||
<id>6</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/1.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
<userBehavior>
|
||||
<id>7</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/2.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<use>http</use>
|
||||
</userBehavior>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>2</id>
|
||||
<parentId>0</parentId>
|
||||
</batch>
|
||||
</batches>
|
||||
<poolSize>0</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>http</id>
|
||||
<name>Http</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
|
@ -1,234 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<pages>
|
||||
<page>
|
||||
<batches>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>
|
||||
http://133.133.12.3:8080/Bench4QTestCase/testcase.html
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>2</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>230</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>1</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>1</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/script/agentTable.js
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>2</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/3.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>3</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/script/base.js
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>4</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/1.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>5</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>http://133.133.12.3:8080/Bench4QTestCase/images/2.jpg
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>2</id>
|
||||
<parentId>0</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>96</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>3</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>3</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>4</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>10</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>5</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>6</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>6</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
</batches>
|
||||
</page>
|
||||
</pages>
|
||||
<poolSize>0</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>http</id>
|
||||
<name>Http</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<pages>
|
||||
<page>
|
||||
<batches>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Get</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>url</key>
|
||||
<value>
|
||||
http://www.baidu.com
|
||||
</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>parameters</key>
|
||||
<value></value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>http</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>2</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>230</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>1</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
</batches>
|
||||
</page>
|
||||
</pages>
|
||||
<poolSize>0</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>http</id>
|
||||
<name>Http</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
|
@ -1,9 +1,9 @@
|
|||
package org.bench4q.agent.plugin.basic.hbase;
|
||||
|
||||
import org.bench4q.agent.plugin.basic.PluginReturn;
|
||||
|
||||
public class ElectReturn extends PluginReturn {
|
||||
public ElectReturn(int succ, int fail) {
|
||||
super(succ, fail);
|
||||
}
|
||||
}
|
||||
package org.bench4q.agent.plugin.basic.hbase;
|
||||
|
||||
import org.bench4q.agent.plugin.basic.PluginReturn;
|
||||
|
||||
public class ElectReturn extends PluginReturn {
|
||||
public ElectReturn(int succ, int fail) {
|
||||
super(succ, fail);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Bench4Q Test Case</title>
|
||||
<link href="style/bootstrap-cerulean.css" />
|
||||
<link href="style/bootstrap-classic.css" />
|
||||
<link href="style/bootstrap-cerulean.css" />
|
||||
</head>
|
||||
<body>
|
||||
<img src="images/1.jpg" alt="No this one" />
|
||||
<img src="images/2.jpg" alt="No this one" />
|
||||
<img src="images/3.jpg" alt="No this one" />
|
||||
|
||||
<script src="script/agentTable.js" type="text/javascript"></script>
|
||||
<script src="script/base.js" type="text/javascript"></script>
|
||||
</body>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bench4Q Test Case</title>
|
||||
<link href="style/bootstrap-cerulean.css" />
|
||||
<link href="style/bootstrap-classic.css" />
|
||||
<link href="style/bootstrap-cerulean.css" />
|
||||
</head>
|
||||
<body>
|
||||
<img src="images/1.jpg" alt="No this one" />
|
||||
<img src="images/2.jpg" alt="No this one" />
|
||||
<img src="images/3.jpg" alt="No this one" />
|
||||
|
||||
<script src="script/agentTable.js" type="text/javascript"></script>
|
||||
<script src="script/base.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,390 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<runScenario>
|
||||
<definedParams />
|
||||
<pages>
|
||||
<page>
|
||||
<batches>
|
||||
<batch>
|
||||
<behaviors>
|
||||
<behaviorModel>
|
||||
<id>0</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>1</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>1</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>2</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>2001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>2100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>3</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>4</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>4001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>4100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>5</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>6</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>6001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>6100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>7</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>8</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>8001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>8100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>9</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>10</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>10001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>10100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>11</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>12</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>12001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>12100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>13</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>14</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>14001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>14100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>15</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>16</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>16001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>16100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>17</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>18</id>
|
||||
<name>Send</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>beginTime</key>
|
||||
<value>201309111715001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endTime</key>
|
||||
<value>201309112215001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>beginUser</key>
|
||||
<value>18001</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<key>endUser</key>
|
||||
<value>18100</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>USERBEHAVIOR</type>
|
||||
<use>hBase</use>
|
||||
</behaviorModel>
|
||||
<behaviorModel>
|
||||
<id>19</id>
|
||||
<name>Sleep</name>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<key>time</key>
|
||||
<value>5000</value>
|
||||
</parameter>
|
||||
</parameters>
|
||||
<type>TIMERBEHAVIOR</type>
|
||||
<use>timer</use>
|
||||
</behaviorModel>
|
||||
</behaviors>
|
||||
<childId>-1</childId>
|
||||
<id>0</id>
|
||||
<parentId>-1</parentId>
|
||||
</batch>
|
||||
</batches>
|
||||
</page>
|
||||
</pages>
|
||||
<poolSize>1</poolSize>
|
||||
<usePlugins>
|
||||
<usePlugin>
|
||||
<id>hBase</id>
|
||||
<name>Hbase</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
<usePlugin>
|
||||
<id>timer</id>
|
||||
<name>ConstantTimer</name>
|
||||
<parameters />
|
||||
</usePlugin>
|
||||
</usePlugins>
|
||||
</runScenario>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>publish</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<files>
|
||||
<file>
|
||||
<source>target/bench4q-master.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>publish</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<files>
|
||||
<file>
|
||||
<source>target/bench4q-master.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
|
@ -1,180 +1,180 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-master</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0 Beta</version>
|
||||
<name>Bench4Q Master</name>
|
||||
<description>Bench4Q Master</description>
|
||||
<organization>
|
||||
<name>TCSE, ISCAS</name>
|
||||
</organization>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.3.0.Beta3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.1-api</artifactId>
|
||||
<version>1.0.0.Draft-16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.python</groupId>
|
||||
<artifactId>jython</artifactId>
|
||||
<version>2.7-b1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>1.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.5</version>
|
||||
</dependency>
|
||||
<!-- this is used to create chart for report -->
|
||||
<dependency>
|
||||
<groupId>jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.0.13</version>
|
||||
</dependency>
|
||||
<!-- this is used to create a pdf report -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
|
||||
<artifactId>com.lowagie.text</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- for file utils -->
|
||||
<dependency>
|
||||
<groupId>org.apache.portals.jetspeed-2</groupId>
|
||||
<artifactId>jetspeed-fileutils-maven-plugin</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<type>maven-plugin</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-share</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>9.1.0.RC2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>9.1.0.RC2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- this is used to parse html dom tree -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
<!-- this is used to parse http request and response -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore-nio</artifactId>
|
||||
<version>4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-recorder</artifactId>
|
||||
<version>1.0-Beta</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.bench4q.master.Main</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-zip</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>bench4q-master</finalName>
|
||||
</build>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-master</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0 Beta</version>
|
||||
<name>Bench4Q Master</name>
|
||||
<description>Bench4Q Master</description>
|
||||
<organization>
|
||||
<name>TCSE, ISCAS</name>
|
||||
</organization>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.3.0.Beta3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.1-api</artifactId>
|
||||
<version>1.0.0.Draft-16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.python</groupId>
|
||||
<artifactId>jython</artifactId>
|
||||
<version>2.7-b1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>1.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.5</version>
|
||||
</dependency>
|
||||
<!-- this is used to create chart for report -->
|
||||
<dependency>
|
||||
<groupId>jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.0.13</version>
|
||||
</dependency>
|
||||
<!-- this is used to create a pdf report -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
|
||||
<artifactId>com.lowagie.text</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- for file utils -->
|
||||
<dependency>
|
||||
<groupId>org.apache.portals.jetspeed-2</groupId>
|
||||
<artifactId>jetspeed-fileutils-maven-plugin</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<type>maven-plugin</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-share</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>9.1.0.RC2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>9.1.0.RC2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- this is used to parse html dom tree -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
<!-- this is used to parse http request and response -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore-nio</artifactId>
|
||||
<version>4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bench4q</groupId>
|
||||
<artifactId>bench4q-recorder</artifactId>
|
||||
<version>1.0-Beta</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.bench4q.master.Main</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-zip</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>bench4q-master</finalName>
|
||||
</build>
|
||||
</project>
|
|
@ -1,165 +1,165 @@
|
|||
package org.bench4q.master.api;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.service.PluginService;
|
||||
import org.bench4q.master.domain.service.UserService;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/plugin")
|
||||
public class PluginController extends BaseController {
|
||||
private Logger logger = Logger.getLogger(PluginController.class);
|
||||
private PluginService pluginService;
|
||||
|
||||
public PluginService getPluginService() {
|
||||
return pluginService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginService(PluginService pluginService) {
|
||||
this.pluginService = pluginService;
|
||||
}
|
||||
|
||||
@RequestMapping("/loadPluginList")
|
||||
@ResponseBody
|
||||
public PluginResponseModel loadPluginList() throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadPluginList");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setPluginList(this.getPluginService()
|
||||
.getPluginNameList());
|
||||
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethods/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethods(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadMethods/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodModels(this.getPluginService()
|
||||
.getMethodsInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
pluginResponseModel.setSuccess(false);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodList/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodList(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadMethodList/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodList(this.getPluginService()
|
||||
.getMethodNameInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
pluginResponseModel.setSuccess(false);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodParams/{pluginName}/{methodName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodParams(
|
||||
@PathVariable("pluginName") String pluginName,
|
||||
@PathVariable("methodName") String methodName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setMethosMethodParamModels(this.getPluginService()
|
||||
.getMethodParamModelsInPlugin(pluginName, methodName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addPlugin", method = { RequestMethod.PUT })
|
||||
@ResponseBody
|
||||
public PluginResponseModel addPlugin(@RequestBody PluginGUI pluginGUI)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"addPlugin/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = validatePlugin(pluginGUI);
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||
pluginGUI.getPlugin()));
|
||||
}
|
||||
|
||||
return pluginResponseModel;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deletePlugin/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel deletePlugin(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(this.getPluginService().deletePlugin(
|
||||
pluginName));
|
||||
return pluginResponseModel;
|
||||
|
||||
}
|
||||
|
||||
private PluginResponseModel validatePlugin(PluginGUI pluginGUI) {
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(true);
|
||||
if (pluginGUI.getPlugin() == null) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("plugin is null");
|
||||
}
|
||||
if (pluginGUI.getPlugin().getMethods() == null
|
||||
|| pluginGUI.getPlugin().getMethods().size() == 0) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("method is empty");
|
||||
}
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.api;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.service.PluginService;
|
||||
import org.bench4q.master.domain.service.UserService;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/plugin")
|
||||
public class PluginController extends BaseController {
|
||||
private Logger logger = Logger.getLogger(PluginController.class);
|
||||
private PluginService pluginService;
|
||||
|
||||
public PluginService getPluginService() {
|
||||
return pluginService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginService(PluginService pluginService) {
|
||||
this.pluginService = pluginService;
|
||||
}
|
||||
|
||||
@RequestMapping("/loadPluginList")
|
||||
@ResponseBody
|
||||
public PluginResponseModel loadPluginList() throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadPluginList");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setPluginList(this.getPluginService()
|
||||
.getPluginNameList());
|
||||
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethods/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethods(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadMethods/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodModels(this.getPluginService()
|
||||
.getMethodsInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
pluginResponseModel.setSuccess(false);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodList/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodList(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"/loadMethodList/{pluginName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
try {
|
||||
|
||||
pluginResponseModel.setMethodList(this.getPluginService()
|
||||
.getMethodNameInPlugin(pluginName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionLog.getStackTrace(e));
|
||||
pluginResponseModel.setSuccess(false);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "loadMethodParams/{pluginName}/{methodName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel getMethodParams(
|
||||
@PathVariable("pluginName") String pluginName,
|
||||
@PathVariable("methodName") String methodName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setMethosMethodParamModels(this.getPluginService()
|
||||
.getMethodParamModelsInPlugin(pluginName, methodName));
|
||||
pluginResponseModel.setSuccess(true);
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/addPlugin", method = { RequestMethod.PUT })
|
||||
@ResponseBody
|
||||
public PluginResponseModel addPlugin(@RequestBody PluginGUI pluginGUI)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"addPlugin/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = validatePlugin(pluginGUI);
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||
pluginGUI.getPlugin()));
|
||||
}
|
||||
|
||||
return pluginResponseModel;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deletePlugin/{pluginName}", method = {
|
||||
RequestMethod.GET, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public PluginResponseModel deletePlugin(
|
||||
@PathVariable("pluginName") String pluginName)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||
throw new Bench4QException(400 + "", "not permitted",
|
||||
"loadMethodParams/{pluginName}/{methodName}");
|
||||
}
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(this.getPluginService().deletePlugin(
|
||||
pluginName));
|
||||
return pluginResponseModel;
|
||||
|
||||
}
|
||||
|
||||
private PluginResponseModel validatePlugin(PluginGUI pluginGUI) {
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(true);
|
||||
if (pluginGUI.getPlugin() == null) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("plugin is null");
|
||||
}
|
||||
if (pluginGUI.getPlugin().getMethods() == null
|
||||
|| pluginGUI.getPlugin().getMethods().size() == 0) {
|
||||
pluginResponseModel.setSuccess(false);
|
||||
pluginResponseModel.setFailMessage("method is empty");
|
||||
}
|
||||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "methodParamProperty")
|
||||
public class MethodParamProperty {
|
||||
|
||||
private int id;
|
||||
private String propertyKey;
|
||||
private String propertyValue;
|
||||
private MethodParam methodParam;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "propertyKey", nullable = false)
|
||||
public String getPropertyKey() {
|
||||
return propertyKey;
|
||||
}
|
||||
|
||||
public void setPropertyKey(String propertyKey) {
|
||||
this.propertyKey = propertyKey;
|
||||
}
|
||||
|
||||
@Column(name = "propertyValue", nullable = false)
|
||||
public String getPropertyValue() {
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
public void setPropertyValue(String propertyValue) {
|
||||
this.propertyValue = propertyValue;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "methodParamId")
|
||||
public MethodParam getMethodParam() {
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
public void setMethodParam(MethodParam methodParam) {
|
||||
this.methodParam = methodParam;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "methodParamProperty")
|
||||
public class MethodParamProperty {
|
||||
|
||||
private int id;
|
||||
private String propertyKey;
|
||||
private String propertyValue;
|
||||
private MethodParam methodParam;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "propertyKey", nullable = false)
|
||||
public String getPropertyKey() {
|
||||
return propertyKey;
|
||||
}
|
||||
|
||||
public void setPropertyKey(String propertyKey) {
|
||||
this.propertyKey = propertyKey;
|
||||
}
|
||||
|
||||
@Column(name = "propertyValue", nullable = false)
|
||||
public String getPropertyValue() {
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
public void setPropertyValue(String propertyValue) {
|
||||
this.propertyValue = propertyValue;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "methodParamId")
|
||||
public MethodParam getMethodParam() {
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
public void setMethodParam(MethodParam methodParam) {
|
||||
this.methodParam = methodParam;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
|
||||
@Entity
|
||||
@Table(name = "paramType")
|
||||
public class ParamType {
|
||||
private int id;
|
||||
private ParamTypeEnum type;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name="type",columnDefinition = "ENUM('Field', 'MultiField', 'Table','CheckBox')")
|
||||
public ParamTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ParamTypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
|
||||
@Entity
|
||||
@Table(name = "paramType")
|
||||
public class ParamType {
|
||||
private int id;
|
||||
private ParamTypeEnum type;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name="type",columnDefinition = "ENUM('Field', 'MultiField', 'Table','CheckBox')")
|
||||
public ParamTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ParamTypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,148 +1,148 @@
|
|||
package org.bench4q.master.domain.factory;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParamProperty;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginFactory {
|
||||
|
||||
private PluginRepository pluginRepository;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public Plugin createPluginEntity(PluginModel pluginModel)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setPluginMethods(new HashSet<Method>());
|
||||
if (pluginModel.getMethods() != null) {
|
||||
for (MethodModel methodModel : pluginModel.getMethods()) {
|
||||
plugin.getPluginMethods().add(
|
||||
createMethodEntity(methodModel, plugin));
|
||||
}
|
||||
plugin.setName(pluginModel.getName());
|
||||
return plugin;
|
||||
} else
|
||||
throw new Bench4QException("", "no method in plugin", "");
|
||||
|
||||
}
|
||||
|
||||
private Method createMethodEntity(MethodModel methodModel, Plugin plugin)
|
||||
throws Bench4QException {
|
||||
Method method = new Method();
|
||||
method.setMethodParams(new HashSet<MethodParam>());
|
||||
method.setName(methodModel.getName());
|
||||
if (methodModel.getMethodParams() != null) {
|
||||
for (MethodParamModel methodParamModel : methodModel
|
||||
.getMethodParams()) {
|
||||
Logger.getLogger(PluginFactory.class).info(
|
||||
"method model:" + methodModel.getName());
|
||||
method.getMethodParams().add(
|
||||
createMethodParamEntity(methodParamModel, method));
|
||||
}
|
||||
}
|
||||
method.setPlugin(plugin);
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
private MethodParam createMethodParamEntity(
|
||||
MethodParamModel methodParamModel, Method method)
|
||||
throws Bench4QException {
|
||||
MethodParam methodParam = new MethodParam();
|
||||
methodParam.setLable(methodParamModel.getLable());
|
||||
methodParam.setName(methodParamModel.getName());
|
||||
methodParam.setMethod(method);
|
||||
methodParam.setParamType(createPraParamTypeWithOutId(methodParamModel
|
||||
.getParamType()));
|
||||
if (methodParamModel.getMethodParamProperties() != null) {
|
||||
methodParam
|
||||
.setMethodParamProperties(new HashSet<MethodParamProperty>());
|
||||
for (MethodParamPropertyModel methodParamPropertyModel : methodParamModel
|
||||
.getMethodParamProperties()) {
|
||||
methodParam.getMethodParamProperties().add(
|
||||
createMethodParamPropertyWithOutId(
|
||||
methodParamPropertyModel, methodParam));
|
||||
}
|
||||
}
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
private ParamType createPraParamTypeWithOutId(ParamTypeEnum paramTypeEnum)
|
||||
throws Bench4QException {
|
||||
return this.getPluginRepository().getParamTypeByType(paramTypeEnum);
|
||||
}
|
||||
|
||||
private MethodParamProperty createMethodParamPropertyWithOutId(
|
||||
MethodParamPropertyModel methodParamPropertyModel,
|
||||
MethodParam methodParam) {
|
||||
MethodParamProperty methodParamProperty = new MethodParamProperty();
|
||||
methodParamProperty.setPropertyKey(methodParamPropertyModel.getKey());
|
||||
methodParamProperty.setPropertyValue(methodParamPropertyModel
|
||||
.getValue());
|
||||
methodParamProperty.setMethodParam(methodParam);
|
||||
return methodParamProperty;
|
||||
}
|
||||
|
||||
public static MethodModel extractMethodModel(Method method) {
|
||||
MethodModel methodModel = new MethodModel();
|
||||
methodModel.setName(method.getName());
|
||||
if (method.getMethodParams() != null) {
|
||||
methodModel.setMethodParams(new HashSet<MethodParamModel>());
|
||||
for (MethodParam methodParam : method.getMethodParams()) {
|
||||
methodModel.getMethodParams().add(
|
||||
extractMethodParamModel(methodParam));
|
||||
}
|
||||
}
|
||||
return methodModel;
|
||||
}
|
||||
|
||||
private static MethodParamModel extractMethodParamModel(
|
||||
MethodParam methodParam) {
|
||||
MethodParamModel methodParamModel = new MethodParamModel();
|
||||
methodParamModel.setLable(methodParam.getLable());
|
||||
methodParamModel.setName(methodParam.getName());
|
||||
methodParamModel.setParamType(methodParam.getParamType().getType());
|
||||
if (methodParam.getMethodParamProperties() != null) {
|
||||
methodParamModel
|
||||
.setMethodParamProperties(new HashSet<MethodParamPropertyModel>());
|
||||
for (MethodParamProperty methodParamProperty : methodParam
|
||||
.getMethodParamProperties()) {
|
||||
methodParamModel.getMethodParamProperties().add(
|
||||
extractMethodParamPropertyModel(methodParamProperty));
|
||||
}
|
||||
}
|
||||
return methodParamModel;
|
||||
}
|
||||
|
||||
private static MethodParamPropertyModel extractMethodParamPropertyModel(
|
||||
MethodParamProperty methodParamProperty) {
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey(methodParamProperty.getPropertyKey());
|
||||
methodParamPropertyModel.setValue(methodParamProperty
|
||||
.getPropertyValue());
|
||||
return methodParamPropertyModel;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.factory;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParamProperty;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginFactory {
|
||||
|
||||
private PluginRepository pluginRepository;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public Plugin createPluginEntity(PluginModel pluginModel)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setPluginMethods(new HashSet<Method>());
|
||||
if (pluginModel.getMethods() != null) {
|
||||
for (MethodModel methodModel : pluginModel.getMethods()) {
|
||||
plugin.getPluginMethods().add(
|
||||
createMethodEntity(methodModel, plugin));
|
||||
}
|
||||
plugin.setName(pluginModel.getName());
|
||||
return plugin;
|
||||
} else
|
||||
throw new Bench4QException("", "no method in plugin", "");
|
||||
|
||||
}
|
||||
|
||||
private Method createMethodEntity(MethodModel methodModel, Plugin plugin)
|
||||
throws Bench4QException {
|
||||
Method method = new Method();
|
||||
method.setMethodParams(new HashSet<MethodParam>());
|
||||
method.setName(methodModel.getName());
|
||||
if (methodModel.getMethodParams() != null) {
|
||||
for (MethodParamModel methodParamModel : methodModel
|
||||
.getMethodParams()) {
|
||||
Logger.getLogger(PluginFactory.class).info(
|
||||
"method model:" + methodModel.getName());
|
||||
method.getMethodParams().add(
|
||||
createMethodParamEntity(methodParamModel, method));
|
||||
}
|
||||
}
|
||||
method.setPlugin(plugin);
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
private MethodParam createMethodParamEntity(
|
||||
MethodParamModel methodParamModel, Method method)
|
||||
throws Bench4QException {
|
||||
MethodParam methodParam = new MethodParam();
|
||||
methodParam.setLable(methodParamModel.getLable());
|
||||
methodParam.setName(methodParamModel.getName());
|
||||
methodParam.setMethod(method);
|
||||
methodParam.setParamType(createPraParamTypeWithOutId(methodParamModel
|
||||
.getParamType()));
|
||||
if (methodParamModel.getMethodParamProperties() != null) {
|
||||
methodParam
|
||||
.setMethodParamProperties(new HashSet<MethodParamProperty>());
|
||||
for (MethodParamPropertyModel methodParamPropertyModel : methodParamModel
|
||||
.getMethodParamProperties()) {
|
||||
methodParam.getMethodParamProperties().add(
|
||||
createMethodParamPropertyWithOutId(
|
||||
methodParamPropertyModel, methodParam));
|
||||
}
|
||||
}
|
||||
return methodParam;
|
||||
}
|
||||
|
||||
private ParamType createPraParamTypeWithOutId(ParamTypeEnum paramTypeEnum)
|
||||
throws Bench4QException {
|
||||
return this.getPluginRepository().getParamTypeByType(paramTypeEnum);
|
||||
}
|
||||
|
||||
private MethodParamProperty createMethodParamPropertyWithOutId(
|
||||
MethodParamPropertyModel methodParamPropertyModel,
|
||||
MethodParam methodParam) {
|
||||
MethodParamProperty methodParamProperty = new MethodParamProperty();
|
||||
methodParamProperty.setPropertyKey(methodParamPropertyModel.getKey());
|
||||
methodParamProperty.setPropertyValue(methodParamPropertyModel
|
||||
.getValue());
|
||||
methodParamProperty.setMethodParam(methodParam);
|
||||
return methodParamProperty;
|
||||
}
|
||||
|
||||
public static MethodModel extractMethodModel(Method method) {
|
||||
MethodModel methodModel = new MethodModel();
|
||||
methodModel.setName(method.getName());
|
||||
if (method.getMethodParams() != null) {
|
||||
methodModel.setMethodParams(new HashSet<MethodParamModel>());
|
||||
for (MethodParam methodParam : method.getMethodParams()) {
|
||||
methodModel.getMethodParams().add(
|
||||
extractMethodParamModel(methodParam));
|
||||
}
|
||||
}
|
||||
return methodModel;
|
||||
}
|
||||
|
||||
private static MethodParamModel extractMethodParamModel(
|
||||
MethodParam methodParam) {
|
||||
MethodParamModel methodParamModel = new MethodParamModel();
|
||||
methodParamModel.setLable(methodParam.getLable());
|
||||
methodParamModel.setName(methodParam.getName());
|
||||
methodParamModel.setParamType(methodParam.getParamType().getType());
|
||||
if (methodParam.getMethodParamProperties() != null) {
|
||||
methodParamModel
|
||||
.setMethodParamProperties(new HashSet<MethodParamPropertyModel>());
|
||||
for (MethodParamProperty methodParamProperty : methodParam
|
||||
.getMethodParamProperties()) {
|
||||
methodParamModel.getMethodParamProperties().add(
|
||||
extractMethodParamPropertyModel(methodParamProperty));
|
||||
}
|
||||
}
|
||||
return methodParamModel;
|
||||
}
|
||||
|
||||
private static MethodParamPropertyModel extractMethodParamPropertyModel(
|
||||
MethodParamProperty methodParamProperty) {
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey(methodParamProperty.getPropertyKey());
|
||||
methodParamPropertyModel.setValue(methodParamProperty
|
||||
.getPropertyValue());
|
||||
return methodParamPropertyModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,127 +1,127 @@
|
|||
package org.bench4q.master.domain.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginService {
|
||||
private PluginRepository pluginRepository;
|
||||
private PluginFactory pluginFactory;
|
||||
private Logger logger = Logger.getLogger(PluginService.class);
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
}
|
||||
|
||||
public boolean addPlugin(PluginModel pluginModel) throws Bench4QException {
|
||||
return this.getPluginRepository().attatch(
|
||||
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
}
|
||||
|
||||
public boolean deletePlugin(String pluginName) throws Bench4QException {
|
||||
return this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
public List<String> getPluginNameList() throws Bench4QException {
|
||||
List<String> pluginNameList = new ArrayList<String>();
|
||||
Set<Plugin> plugins = getPlugins();
|
||||
if (plugins != null) {
|
||||
for (Plugin plugin : plugins) {
|
||||
pluginNameList.add(plugin.getName());
|
||||
}
|
||||
}
|
||||
return pluginNameList;
|
||||
}
|
||||
|
||||
private Set<Plugin> getPlugins() throws Bench4QException {
|
||||
List<Plugin> loadPluginList = this.getPluginRepository().loadPlugins();
|
||||
Set<Plugin> plugins = new HashSet<Plugin>();
|
||||
if (loadPluginList != null) {
|
||||
|
||||
for (Plugin plugin : loadPluginList) {
|
||||
plugins.add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public List<String> getMethodNameInPlugin(String pluginName) {
|
||||
List<String> methodNameList = new ArrayList<String>();
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
methodNameList.add(method.getName());
|
||||
}
|
||||
}
|
||||
return methodNameList;
|
||||
}
|
||||
|
||||
private Method getMethodInPlugin(String pluginName, String methodName)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(methodName))
|
||||
return method;
|
||||
}
|
||||
}
|
||||
logger.info("method is empty");
|
||||
|
||||
throw new Bench4QException("", "no such method:" + methodName
|
||||
+ "in plugin:" + pluginName, "");
|
||||
|
||||
}
|
||||
|
||||
public Set<MethodParamModel> getMethodParamModelsInPlugin(
|
||||
String pluginName, String methodName) throws Bench4QException {
|
||||
return PluginFactory.extractMethodModel(
|
||||
this.getMethodInPlugin(pluginName, methodName))
|
||||
.getMethodParams();
|
||||
}
|
||||
|
||||
public Set<MethodModel> getMethodsInPlugin(String pluginName) {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
Set<MethodModel> methodModels = new HashSet<MethodModel>();
|
||||
for (Method method : this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin)) {
|
||||
methodModels.add(PluginFactory.extractMethodModel(method));
|
||||
}
|
||||
return methodModels;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class PluginService {
|
||||
private PluginRepository pluginRepository;
|
||||
private PluginFactory pluginFactory;
|
||||
private Logger logger = Logger.getLogger(PluginService.class);
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
}
|
||||
|
||||
public boolean addPlugin(PluginModel pluginModel) throws Bench4QException {
|
||||
return this.getPluginRepository().attatch(
|
||||
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
}
|
||||
|
||||
public boolean deletePlugin(String pluginName) throws Bench4QException {
|
||||
return this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
public List<String> getPluginNameList() throws Bench4QException {
|
||||
List<String> pluginNameList = new ArrayList<String>();
|
||||
Set<Plugin> plugins = getPlugins();
|
||||
if (plugins != null) {
|
||||
for (Plugin plugin : plugins) {
|
||||
pluginNameList.add(plugin.getName());
|
||||
}
|
||||
}
|
||||
return pluginNameList;
|
||||
}
|
||||
|
||||
private Set<Plugin> getPlugins() throws Bench4QException {
|
||||
List<Plugin> loadPluginList = this.getPluginRepository().loadPlugins();
|
||||
Set<Plugin> plugins = new HashSet<Plugin>();
|
||||
if (loadPluginList != null) {
|
||||
|
||||
for (Plugin plugin : loadPluginList) {
|
||||
plugins.add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public List<String> getMethodNameInPlugin(String pluginName) {
|
||||
List<String> methodNameList = new ArrayList<String>();
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
methodNameList.add(method.getName());
|
||||
}
|
||||
}
|
||||
return methodNameList;
|
||||
}
|
||||
|
||||
private Method getMethodInPlugin(String pluginName, String methodName)
|
||||
throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
List<Method> methods = this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin);
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(methodName))
|
||||
return method;
|
||||
}
|
||||
}
|
||||
logger.info("method is empty");
|
||||
|
||||
throw new Bench4QException("", "no such method:" + methodName
|
||||
+ "in plugin:" + pluginName, "");
|
||||
|
||||
}
|
||||
|
||||
public Set<MethodParamModel> getMethodParamModelsInPlugin(
|
||||
String pluginName, String methodName) throws Bench4QException {
|
||||
return PluginFactory.extractMethodModel(
|
||||
this.getMethodInPlugin(pluginName, methodName))
|
||||
.getMethodParams();
|
||||
}
|
||||
|
||||
public Set<MethodModel> getMethodsInPlugin(String pluginName) {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
Set<MethodModel> methodModels = new HashSet<MethodModel>();
|
||||
for (Method method : this.getPluginRepository().loadMethodsInPlugin(
|
||||
plugin)) {
|
||||
methodModels.add(PluginFactory.extractMethodModel(method));
|
||||
}
|
||||
return methodModels;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,178 +1,178 @@
|
|||
package org.bench4q.master.domain.testplan;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.Monitor;
|
||||
import org.bench4q.master.domain.entity.MonitorResult;
|
||||
import org.bench4q.master.domain.entity.TestPlan;
|
||||
import org.bench4q.master.domain.entity.TestPlanScript;
|
||||
import org.bench4q.master.domain.entity.TestPlanScriptResult;
|
||||
import org.bench4q.master.domain.factory.TestPlanFactory;
|
||||
import org.bench4q.master.domain.repository.TestPlanRepository;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.helper.SessionHelper;
|
||||
import org.bench4q.share.models.master.statistics.ScriptResultModel;
|
||||
import org.bench4q.share.models.monitor.MonitorMain;
|
||||
import org.hibernate.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class TestResultSave {
|
||||
private TestPlanFactory testPlanFactory;
|
||||
private SessionHelper sessionHelper;
|
||||
private TestPlanRepository testPlanRepository;
|
||||
private Logger logger = Logger.getLogger(TestScriptResultSave.class);
|
||||
private ConcurrentHashMap<String, TestPlan> runningTestPlans;
|
||||
|
||||
private final int SAVEINTERVAL = 5;
|
||||
|
||||
public TestResultSave() {
|
||||
this.setRunningTestPlans(new ConcurrentHashMap<String, TestPlan>());
|
||||
}
|
||||
|
||||
private TestPlanRepository getTestPlanRepository() {
|
||||
return testPlanRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanRepository(TestPlanRepository testPlanRepository) {
|
||||
this.testPlanRepository = testPlanRepository;
|
||||
}
|
||||
|
||||
private SessionHelper getSessionHelper() {
|
||||
return sessionHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setSessionHelper(SessionHelper sessionHelper) {
|
||||
this.sessionHelper = sessionHelper;
|
||||
}
|
||||
|
||||
private TestPlanFactory getTestPlanFactory() {
|
||||
return testPlanFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanFactory(TestPlanFactory testPlanFactory) {
|
||||
this.testPlanFactory = testPlanFactory;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, TestPlan> getRunningTestPlans() {
|
||||
return runningTestPlans;
|
||||
}
|
||||
|
||||
public void setRunningTestPlans(
|
||||
ConcurrentHashMap<String, TestPlan> runningTestPlans) {
|
||||
this.runningTestPlans = runningTestPlans;
|
||||
}
|
||||
|
||||
public void doSaveTestPlanResult() {
|
||||
try {
|
||||
ScheduledExecutorService sheScheduledExecutorService = Executors
|
||||
.newScheduledThreadPool(10);
|
||||
sheScheduledExecutorService.scheduleAtFixedRate(new Runnable() {
|
||||
public void run() {
|
||||
Session session = getSessionHelper().openSession();
|
||||
Set<String> testPlanRunIdSet = getRunningTestPlans()
|
||||
.keySet();
|
||||
for (String testPlanRunId : testPlanRunIdSet) {
|
||||
getTestPlanRepository().doUpdateEntity(session,
|
||||
getRunningTestPlans().get(testPlanRunId));
|
||||
}
|
||||
runningTestPlans.clear();
|
||||
session.close();
|
||||
}
|
||||
}, 0, SAVEINTERVAL, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(TestPlan.class).info(e, e.fillInStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
private TestPlan getTestPlan(String testPlanRunId) {
|
||||
if (this.getRunningTestPlans().get(testPlanRunId) != null)
|
||||
return this.getRunningTestPlans().get(testPlanRunId);
|
||||
else {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
TestPlan testPlan = this.getTestPlanRepository().doGetTestPlanBy(
|
||||
session, UUID.fromString(testPlanRunId));
|
||||
session.close();
|
||||
if (testPlan == null) {
|
||||
logger.error("get testPlan:" + testPlanRunId
|
||||
+ " from dataBase failed");
|
||||
return null;
|
||||
}
|
||||
|
||||
this.getRunningTestPlans().put(testPlanRunId, testPlan);
|
||||
return testPlan;
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Observable messageSender, Object arg) {
|
||||
if (messageSender instanceof Monitor) {
|
||||
Monitor monitor = (Monitor) messageSender;
|
||||
this.updateTestplanMonitorResult(monitor.getTestPlan()
|
||||
.getTestPlanRunId(), monitor.getHostName(),
|
||||
(MonitorMain) arg);
|
||||
} else if (messageSender instanceof TestPlanScript) {
|
||||
TestPlanScript testPlanScript = (TestPlanScript) messageSender;
|
||||
this.updateTestPlanScriptResult(testPlanScript.getTestPlan()
|
||||
.getTestPlanRunId(), testPlanScript.getScriptId(),
|
||||
(ScriptResultModel) arg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTestPlanScriptResult(String testPlanRunId, int scriptId,
|
||||
ScriptResultModel scriptResultModel) {
|
||||
try {
|
||||
TestPlan testPlan = this.getTestPlan(testPlanRunId);
|
||||
if (testPlan == null)
|
||||
return;
|
||||
TestPlanScript testPlanScript = testPlan
|
||||
.extracSpecifiedScript(scriptId);
|
||||
List<TestPlanScriptResult> testPlanScriptResults = this
|
||||
.getTestPlanFactory().createScriptResultsWithoutId(
|
||||
scriptResultModel, testPlan, testPlanScript,
|
||||
scriptResultModel.getSamplingTime());
|
||||
if (testPlanScript.getTestPlanScriptResults() == null)
|
||||
testPlanScript
|
||||
.setTestPlanScriptResults(new HashSet<TestPlanScriptResult>());
|
||||
testPlanScript.getTestPlanScriptResults().addAll(
|
||||
testPlanScriptResults);
|
||||
} catch (Exception e) {
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTestplanMonitorResult(String testPlanRunId,
|
||||
String hostName, MonitorMain monitorMain) {
|
||||
System.out.println(testPlanRunId);
|
||||
TestPlan testPlan = this.getTestPlan(testPlanRunId);
|
||||
if (testPlan == null)
|
||||
return;
|
||||
Monitor monitor = testPlan.extractSpecifiedMonitor(hostName);
|
||||
List<MonitorResult> monitorResults = this.getTestPlanFactory()
|
||||
.createMonitorResultListWithOutId(monitorMain, testPlan,
|
||||
monitor, monitorMain.getSamplingTime());
|
||||
if (monitorResults == null || monitorResults.size() == 0)
|
||||
return;
|
||||
try {
|
||||
monitor.getResults().addAll(monitorResults);
|
||||
} catch (Exception e) {
|
||||
monitor.setResults(new HashSet<MonitorResult>());
|
||||
monitor.getResults().addAll(monitorResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.bench4q.master.domain.testplan;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.Monitor;
|
||||
import org.bench4q.master.domain.entity.MonitorResult;
|
||||
import org.bench4q.master.domain.entity.TestPlan;
|
||||
import org.bench4q.master.domain.entity.TestPlanScript;
|
||||
import org.bench4q.master.domain.entity.TestPlanScriptResult;
|
||||
import org.bench4q.master.domain.factory.TestPlanFactory;
|
||||
import org.bench4q.master.domain.repository.TestPlanRepository;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.master.helper.SessionHelper;
|
||||
import org.bench4q.share.models.master.statistics.ScriptResultModel;
|
||||
import org.bench4q.share.models.monitor.MonitorMain;
|
||||
import org.hibernate.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class TestResultSave {
|
||||
private TestPlanFactory testPlanFactory;
|
||||
private SessionHelper sessionHelper;
|
||||
private TestPlanRepository testPlanRepository;
|
||||
private Logger logger = Logger.getLogger(TestScriptResultSave.class);
|
||||
private ConcurrentHashMap<String, TestPlan> runningTestPlans;
|
||||
|
||||
private final int SAVEINTERVAL = 5;
|
||||
|
||||
public TestResultSave() {
|
||||
this.setRunningTestPlans(new ConcurrentHashMap<String, TestPlan>());
|
||||
}
|
||||
|
||||
private TestPlanRepository getTestPlanRepository() {
|
||||
return testPlanRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanRepository(TestPlanRepository testPlanRepository) {
|
||||
this.testPlanRepository = testPlanRepository;
|
||||
}
|
||||
|
||||
private SessionHelper getSessionHelper() {
|
||||
return sessionHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setSessionHelper(SessionHelper sessionHelper) {
|
||||
this.sessionHelper = sessionHelper;
|
||||
}
|
||||
|
||||
private TestPlanFactory getTestPlanFactory() {
|
||||
return testPlanFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setTestPlanFactory(TestPlanFactory testPlanFactory) {
|
||||
this.testPlanFactory = testPlanFactory;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, TestPlan> getRunningTestPlans() {
|
||||
return runningTestPlans;
|
||||
}
|
||||
|
||||
public void setRunningTestPlans(
|
||||
ConcurrentHashMap<String, TestPlan> runningTestPlans) {
|
||||
this.runningTestPlans = runningTestPlans;
|
||||
}
|
||||
|
||||
public void doSaveTestPlanResult() {
|
||||
try {
|
||||
ScheduledExecutorService sheScheduledExecutorService = Executors
|
||||
.newScheduledThreadPool(10);
|
||||
sheScheduledExecutorService.scheduleAtFixedRate(new Runnable() {
|
||||
public void run() {
|
||||
Session session = getSessionHelper().openSession();
|
||||
Set<String> testPlanRunIdSet = getRunningTestPlans()
|
||||
.keySet();
|
||||
for (String testPlanRunId : testPlanRunIdSet) {
|
||||
getTestPlanRepository().doUpdateEntity(session,
|
||||
getRunningTestPlans().get(testPlanRunId));
|
||||
}
|
||||
runningTestPlans.clear();
|
||||
session.close();
|
||||
}
|
||||
}, 0, SAVEINTERVAL, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(TestPlan.class).info(e, e.fillInStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
private TestPlan getTestPlan(String testPlanRunId) {
|
||||
if (this.getRunningTestPlans().get(testPlanRunId) != null)
|
||||
return this.getRunningTestPlans().get(testPlanRunId);
|
||||
else {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
TestPlan testPlan = this.getTestPlanRepository().doGetTestPlanBy(
|
||||
session, UUID.fromString(testPlanRunId));
|
||||
session.close();
|
||||
if (testPlan == null) {
|
||||
logger.error("get testPlan:" + testPlanRunId
|
||||
+ " from dataBase failed");
|
||||
return null;
|
||||
}
|
||||
|
||||
this.getRunningTestPlans().put(testPlanRunId, testPlan);
|
||||
return testPlan;
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Observable messageSender, Object arg) {
|
||||
if (messageSender instanceof Monitor) {
|
||||
Monitor monitor = (Monitor) messageSender;
|
||||
this.updateTestplanMonitorResult(monitor.getTestPlan()
|
||||
.getTestPlanRunId(), monitor.getHostName(),
|
||||
(MonitorMain) arg);
|
||||
} else if (messageSender instanceof TestPlanScript) {
|
||||
TestPlanScript testPlanScript = (TestPlanScript) messageSender;
|
||||
this.updateTestPlanScriptResult(testPlanScript.getTestPlan()
|
||||
.getTestPlanRunId(), testPlanScript.getScriptId(),
|
||||
(ScriptResultModel) arg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTestPlanScriptResult(String testPlanRunId, int scriptId,
|
||||
ScriptResultModel scriptResultModel) {
|
||||
try {
|
||||
TestPlan testPlan = this.getTestPlan(testPlanRunId);
|
||||
if (testPlan == null)
|
||||
return;
|
||||
TestPlanScript testPlanScript = testPlan
|
||||
.extracSpecifiedScript(scriptId);
|
||||
List<TestPlanScriptResult> testPlanScriptResults = this
|
||||
.getTestPlanFactory().createScriptResultsWithoutId(
|
||||
scriptResultModel, testPlan, testPlanScript,
|
||||
scriptResultModel.getSamplingTime());
|
||||
if (testPlanScript.getTestPlanScriptResults() == null)
|
||||
testPlanScript
|
||||
.setTestPlanScriptResults(new HashSet<TestPlanScriptResult>());
|
||||
testPlanScript.getTestPlanScriptResults().addAll(
|
||||
testPlanScriptResults);
|
||||
} catch (Exception e) {
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTestplanMonitorResult(String testPlanRunId,
|
||||
String hostName, MonitorMain monitorMain) {
|
||||
System.out.println(testPlanRunId);
|
||||
TestPlan testPlan = this.getTestPlan(testPlanRunId);
|
||||
if (testPlan == null)
|
||||
return;
|
||||
Monitor monitor = testPlan.extractSpecifiedMonitor(hostName);
|
||||
List<MonitorResult> monitorResults = this.getTestPlanFactory()
|
||||
.createMonitorResultListWithOutId(monitorMain, testPlan,
|
||||
monitor, monitorMain.getSamplingTime());
|
||||
if (monitorResults == null || monitorResults.size() == 0)
|
||||
return;
|
||||
try {
|
||||
monitor.getResults().addAll(monitorResults);
|
||||
} catch (Exception e) {
|
||||
monitor.setResults(new HashSet<MonitorResult>());
|
||||
monitor.getResults().addAll(monitorResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
package TestHelper;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
|
||||
public class Test_PlunginHelper {
|
||||
|
||||
public static PluginModel createOnePlugin() {
|
||||
PluginModel plugin = new PluginModel();
|
||||
MethodModel method = new MethodModel();
|
||||
MethodParamModel methodParamModelUrl = new MethodParamModel();
|
||||
methodParamModelUrl.setLable("input url");
|
||||
methodParamModelUrl.setName("url");
|
||||
methodParamModelUrl.setMethodParamProperties(generatePropertyForField());
|
||||
methodParamModelUrl.setParamType(ParamTypeEnum.Field);
|
||||
|
||||
MethodParamModel methodParamsParamModel = new MethodParamModel();
|
||||
methodParamsParamModel.setName("queryparams");
|
||||
methodParamsParamModel.setLable("key=value");
|
||||
methodParamsParamModel.setMethodParamProperties(generatePropertyForMulti());
|
||||
methodParamsParamModel.setParamType(ParamTypeEnum.MultiField);
|
||||
Set<MethodParamModel> methodParams = new HashSet<MethodParamModel>();
|
||||
methodParams.add(methodParamModelUrl);
|
||||
methodParams.add(methodParamsParamModel);
|
||||
method.setName("get");
|
||||
method.setMethodParams(methodParams);
|
||||
|
||||
Set<MethodModel> methods = new HashSet<MethodModel>();
|
||||
methods.add(method);
|
||||
plugin.setMethods(methods);
|
||||
plugin.setName("http" + UUID.randomUUID());
|
||||
return plugin;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForField() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForMulti() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
}
|
||||
package TestHelper;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.share.models.master.plugin.MethodModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamPropertyModel;
|
||||
|
||||
public class Test_PlunginHelper {
|
||||
|
||||
public static PluginModel createOnePlugin() {
|
||||
PluginModel plugin = new PluginModel();
|
||||
MethodModel method = new MethodModel();
|
||||
MethodParamModel methodParamModelUrl = new MethodParamModel();
|
||||
methodParamModelUrl.setLable("input url");
|
||||
methodParamModelUrl.setName("url");
|
||||
methodParamModelUrl.setMethodParamProperties(generatePropertyForField());
|
||||
methodParamModelUrl.setParamType(ParamTypeEnum.Field);
|
||||
|
||||
MethodParamModel methodParamsParamModel = new MethodParamModel();
|
||||
methodParamsParamModel.setName("queryparams");
|
||||
methodParamsParamModel.setLable("key=value");
|
||||
methodParamsParamModel.setMethodParamProperties(generatePropertyForMulti());
|
||||
methodParamsParamModel.setParamType(ParamTypeEnum.MultiField);
|
||||
Set<MethodParamModel> methodParams = new HashSet<MethodParamModel>();
|
||||
methodParams.add(methodParamModelUrl);
|
||||
methodParams.add(methodParamsParamModel);
|
||||
method.setName("get");
|
||||
method.setMethodParams(methodParams);
|
||||
|
||||
Set<MethodModel> methods = new HashSet<MethodModel>();
|
||||
methods.add(method);
|
||||
plugin.setMethods(methods);
|
||||
plugin.setName("http" + UUID.randomUUID());
|
||||
return plugin;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForField() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
private static Set<MethodParamPropertyModel> generatePropertyForMulti() {
|
||||
Set<MethodParamPropertyModel> metList = new HashSet<MethodParamPropertyModel>();
|
||||
MethodParamPropertyModel methodParamPropertyModel = new MethodParamPropertyModel();
|
||||
methodParamPropertyModel.setKey("size");
|
||||
methodParamPropertyModel.setValue("20");
|
||||
metList.add(methodParamPropertyModel);
|
||||
return metList;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,150 +1,150 @@
|
|||
package org.bench4q.master.test.controller;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
|
||||
public class PluginControllerTest extends TestBase {
|
||||
private final String URLSTRING = BASE_URL + "/plugin";
|
||||
|
||||
private String pluginName;
|
||||
|
||||
public String getURLSTRING() {
|
||||
return URLSTRING;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException, JAXBException {
|
||||
testAddPlugin();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddPlugin() throws JAXBException, IOException {
|
||||
this.setAccessTocken(this.login());
|
||||
String url = URLSTRING + "/addPlugin";
|
||||
PluginGUI pluginGUI = new PluginGUI();
|
||||
pluginGUI.setPlugin(Test_PlunginHelper.createOnePlugin());
|
||||
pluginName = pluginGUI.getPlugin().getName();
|
||||
String pluginContentString = MarshalHelper.marshal(PluginGUI.class,
|
||||
pluginGUI);
|
||||
HttpResponse httpResponse = this.httpRequester.sendPutXml(url,
|
||||
pluginContentString,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
Assert.assertNotNull(pluginResponseModel);
|
||||
Logger.getLogger(PluginControllerTest.class).info(
|
||||
"add:"
|
||||
+ MarshalHelper.marshal(PluginResponseModel.class,
|
||||
pluginResponseModel));
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodParamModel() throws IOException, JAXBException {
|
||||
String url = URLSTRING + "/loadMethodParams";
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponseMethod = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModelMethod = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class,
|
||||
httpResponseMethod.getContent());
|
||||
assertTrue(pluginResponseModelMethod.isSuccess());
|
||||
String methodName = pluginResponseModelMethod.getMethodList().get(0);
|
||||
url += "/" + pluginName + "/" + methodName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethosMethodParamModels().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPluginList() throws JAXBException, IOException {
|
||||
String url = URLSTRING + "/loadPluginList";
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
assertNotNull(pluginResponseModel);
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
Assert.assertTrue(pluginResponseModel.getPluginList().size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodNameList() throws IOException, JAXBException {
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
System.out.println(httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class, httpResponse.getContent());
|
||||
assertNotNull(pluginResponseModel);
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethodList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePlugin() throws IOException, JAXBException {
|
||||
setUp();
|
||||
String url = URLSTRING + "/loadPluginList";
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
assertTrue(pluginResponseModel.getPluginList().size() > 0);
|
||||
String pluginName = pluginResponseModel.getPluginList().get(0);
|
||||
url = URLSTRING + "/deletePlugin" + "/" + pluginName;
|
||||
httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
pluginResponseModel = (PluginResponseModel) MarshalHelper.tryUnmarshal(
|
||||
PluginResponseModel.class, httpResponse.getContent());
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodInPlugin() throws IOException {
|
||||
String url = URLSTRING + "/loadMethods/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
Logger.getLogger(PluginControllerTest.class).info(
|
||||
httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
|
||||
assertNotNull(pluginResponseModel);
|
||||
assertTrue(pluginResponseModel.isSuccess());
|
||||
assertTrue(pluginResponseModel.getMethodModels().size() == 2);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void clear() throws IOException {
|
||||
String url = URLSTRING + "/deletePlugin" + "/" + pluginName;
|
||||
this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.test.controller;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.PluginGUI;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
|
||||
public class PluginControllerTest extends TestBase {
|
||||
private final String URLSTRING = BASE_URL + "/plugin";
|
||||
|
||||
private String pluginName;
|
||||
|
||||
public String getURLSTRING() {
|
||||
return URLSTRING;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException, JAXBException {
|
||||
testAddPlugin();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddPlugin() throws JAXBException, IOException {
|
||||
this.setAccessTocken(this.login());
|
||||
String url = URLSTRING + "/addPlugin";
|
||||
PluginGUI pluginGUI = new PluginGUI();
|
||||
pluginGUI.setPlugin(Test_PlunginHelper.createOnePlugin());
|
||||
pluginName = pluginGUI.getPlugin().getName();
|
||||
String pluginContentString = MarshalHelper.marshal(PluginGUI.class,
|
||||
pluginGUI);
|
||||
HttpResponse httpResponse = this.httpRequester.sendPutXml(url,
|
||||
pluginContentString,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
Assert.assertNotNull(pluginResponseModel);
|
||||
Logger.getLogger(PluginControllerTest.class).info(
|
||||
"add:"
|
||||
+ MarshalHelper.marshal(PluginResponseModel.class,
|
||||
pluginResponseModel));
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodParamModel() throws IOException, JAXBException {
|
||||
String url = URLSTRING + "/loadMethodParams";
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponseMethod = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModelMethod = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class,
|
||||
httpResponseMethod.getContent());
|
||||
assertTrue(pluginResponseModelMethod.isSuccess());
|
||||
String methodName = pluginResponseModelMethod.getMethodList().get(0);
|
||||
url += "/" + pluginName + "/" + methodName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethosMethodParamModels().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPluginList() throws JAXBException, IOException {
|
||||
String url = URLSTRING + "/loadPluginList";
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
assertNotNull(pluginResponseModel);
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
Assert.assertTrue(pluginResponseModel.getPluginList().size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodNameList() throws IOException, JAXBException {
|
||||
String urlForLoadMethod = URLSTRING + "/loadMethodList/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(
|
||||
urlForLoadMethod, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
System.out.println(httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.unmarshal(PluginResponseModel.class, httpResponse.getContent());
|
||||
assertNotNull(pluginResponseModel);
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
assertEquals(2, pluginResponseModel.getMethodList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePlugin() throws IOException, JAXBException {
|
||||
setUp();
|
||||
String url = URLSTRING + "/loadPluginList";
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
assertTrue(pluginResponseModel.getPluginList().size() > 0);
|
||||
String pluginName = pluginResponseModel.getPluginList().get(0);
|
||||
url = URLSTRING + "/deletePlugin" + "/" + pluginName;
|
||||
httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
pluginResponseModel = (PluginResponseModel) MarshalHelper.tryUnmarshal(
|
||||
PluginResponseModel.class, httpResponse.getContent());
|
||||
Assert.assertTrue(pluginResponseModel.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodInPlugin() throws IOException {
|
||||
String url = URLSTRING + "/loadMethods/" + pluginName;
|
||||
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
Logger.getLogger(PluginControllerTest.class).info(
|
||||
httpResponse.getContent());
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) MarshalHelper
|
||||
.tryUnmarshal(PluginResponseModel.class,
|
||||
httpResponse.getContent());
|
||||
|
||||
assertNotNull(pluginResponseModel);
|
||||
assertTrue(pluginResponseModel.isSuccess());
|
||||
assertTrue(pluginResponseModel.getMethodModels().size() == 2);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void clear() throws IOException {
|
||||
String url = URLSTRING + "/deletePlugin" + "/" + pluginName;
|
||||
this.httpRequester.sendPost(url, null,
|
||||
makeAccessTockenMap(this.getAccessTocken()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,117 +1,117 @@
|
|||
package org.bench4q.master.test.repository;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||
public class Test_PluginRepository {
|
||||
private PluginRepository pluginRepository;
|
||||
private String pluginName;
|
||||
private PluginFactory pluginFactory;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Bench4QException {
|
||||
pluginName = addPlugin();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPlugin() {
|
||||
assertNotNull(this.getPluginRepository().getPlugin(pluginName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestLoadMethodParam() {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
MethodParam methodParam = plugin.getPluginMethods().iterator().next()
|
||||
.getMethodParams().iterator().next();
|
||||
|
||||
System.out.println(methodParam.getParamType().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodList() throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
assertNotNull(plugin);
|
||||
assertEquals(1, plugin.getPluginMethods().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPlugin() throws Bench4QException {
|
||||
|
||||
int countBeforeInsert = this.getPluginRepository().loadPlugins().size();
|
||||
String insertPlugin = addPlugin();
|
||||
assertEquals(countBeforeInsert + 1, this.getPluginRepository()
|
||||
.loadPlugins().size());
|
||||
this.getPluginRepository().detach(insertPlugin);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetParamTypeByType() throws Bench4QException {
|
||||
ParamType paramType = this.getPluginRepository().getParamTypeByType(
|
||||
ParamTypeEnum.Field);
|
||||
assertNotNull(paramType);
|
||||
assertEquals(paramType.getType(), ParamTypeEnum.Field);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodInPlugin(){
|
||||
Plugin plugin=this.getPluginRepository().getPlugin(this.pluginName);
|
||||
List<Method> methods=this.getPluginRepository().loadMethodsInPlugin(plugin);
|
||||
assertNotNull(methods);
|
||||
assertTrue(methods.size()>0);
|
||||
|
||||
}
|
||||
@After
|
||||
public void clear() throws Bench4QException {
|
||||
this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
private String addPlugin() throws Bench4QException {
|
||||
PluginModel pluginModel = Test_PlunginHelper.createOnePlugin();
|
||||
this.getPluginRepository().attatch(
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
return pluginModel.getName();
|
||||
|
||||
}
|
||||
}
|
||||
package org.bench4q.master.test.repository;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.master.domain.entity.plugin.Method;
|
||||
import org.bench4q.master.domain.entity.plugin.MethodParam;
|
||||
import org.bench4q.master.domain.entity.plugin.ParamType;
|
||||
import org.bench4q.master.domain.entity.plugin.Plugin;
|
||||
import org.bench4q.master.domain.factory.PluginFactory;
|
||||
import org.bench4q.master.domain.repository.PluginRepository;
|
||||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.share.models.master.plugin.ParamTypeEnum;
|
||||
import org.bench4q.share.models.master.plugin.PluginModel;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import TestHelper.Test_PlunginHelper;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||
public class Test_PluginRepository {
|
||||
private PluginRepository pluginRepository;
|
||||
private String pluginName;
|
||||
private PluginFactory pluginFactory;
|
||||
|
||||
public PluginRepository getPluginRepository() {
|
||||
return pluginRepository;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginRepository(PluginRepository pluginRepository) {
|
||||
this.pluginRepository = pluginRepository;
|
||||
}
|
||||
|
||||
public PluginFactory getPluginFactory() {
|
||||
return pluginFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setPluginFactory(PluginFactory pluginFactory) {
|
||||
this.pluginFactory = pluginFactory;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Bench4QException {
|
||||
pluginName = addPlugin();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPlugin() {
|
||||
assertNotNull(this.getPluginRepository().getPlugin(pluginName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestLoadMethodParam() {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
MethodParam methodParam = plugin.getPluginMethods().iterator().next()
|
||||
.getMethodParams().iterator().next();
|
||||
|
||||
System.out.println(methodParam.getParamType().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodList() throws Bench4QException {
|
||||
Plugin plugin = this.getPluginRepository().getPlugin(pluginName);
|
||||
assertNotNull(plugin);
|
||||
assertEquals(1, plugin.getPluginMethods().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadPlugin() throws Bench4QException {
|
||||
|
||||
int countBeforeInsert = this.getPluginRepository().loadPlugins().size();
|
||||
String insertPlugin = addPlugin();
|
||||
assertEquals(countBeforeInsert + 1, this.getPluginRepository()
|
||||
.loadPlugins().size());
|
||||
this.getPluginRepository().detach(insertPlugin);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetParamTypeByType() throws Bench4QException {
|
||||
ParamType paramType = this.getPluginRepository().getParamTypeByType(
|
||||
ParamTypeEnum.Field);
|
||||
assertNotNull(paramType);
|
||||
assertEquals(paramType.getType(), ParamTypeEnum.Field);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadMethodInPlugin(){
|
||||
Plugin plugin=this.getPluginRepository().getPlugin(this.pluginName);
|
||||
List<Method> methods=this.getPluginRepository().loadMethodsInPlugin(plugin);
|
||||
assertNotNull(methods);
|
||||
assertTrue(methods.size()>0);
|
||||
|
||||
}
|
||||
@After
|
||||
public void clear() throws Bench4QException {
|
||||
this.getPluginRepository().detach(pluginName);
|
||||
}
|
||||
|
||||
private String addPlugin() throws Bench4QException {
|
||||
PluginModel pluginModel = Test_PlunginHelper.createOnePlugin();
|
||||
this.getPluginRepository().attatch(
|
||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||
return pluginModel.getName();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src/main/resource"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>bench4q-recorder</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,93 +1,93 @@
|
|||
<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);
|
||||
<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
|
|
@ -1,38 +1,38 @@
|
|||
package org.bench4q.share.models.master;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
|
||||
public class PluginEditScriptRequestModel {
|
||||
|
||||
List<BehaviorModel> behaviorModels;
|
||||
List<UsePluginModel> usePluginModels;
|
||||
String scriptName;
|
||||
|
||||
public List<BehaviorModel> getBehaviorModels() {
|
||||
return behaviorModels;
|
||||
}
|
||||
|
||||
public void setBehaviorModels(List<BehaviorModel> behaviorModels) {
|
||||
this.behaviorModels = behaviorModels;
|
||||
}
|
||||
|
||||
public List<UsePluginModel> getUsePluginModels() {
|
||||
return usePluginModels;
|
||||
}
|
||||
|
||||
public void setUsePluginModels(List<UsePluginModel> usePluginModels) {
|
||||
this.usePluginModels = usePluginModels;
|
||||
}
|
||||
|
||||
public String getScriptName() {
|
||||
return scriptName;
|
||||
}
|
||||
|
||||
public void setScriptName(String scriptName) {
|
||||
this.scriptName = scriptName;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
|
||||
public class PluginEditScriptRequestModel {
|
||||
|
||||
List<BehaviorModel> behaviorModels;
|
||||
List<UsePluginModel> usePluginModels;
|
||||
String scriptName;
|
||||
|
||||
public List<BehaviorModel> getBehaviorModels() {
|
||||
return behaviorModels;
|
||||
}
|
||||
|
||||
public void setBehaviorModels(List<BehaviorModel> behaviorModels) {
|
||||
this.behaviorModels = behaviorModels;
|
||||
}
|
||||
|
||||
public List<UsePluginModel> getUsePluginModels() {
|
||||
return usePluginModels;
|
||||
}
|
||||
|
||||
public void setUsePluginModels(List<UsePluginModel> usePluginModels) {
|
||||
this.usePluginModels = usePluginModels;
|
||||
}
|
||||
|
||||
public String getScriptName() {
|
||||
return scriptName;
|
||||
}
|
||||
|
||||
public void setScriptName(String scriptName) {
|
||||
this.scriptName = scriptName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodModel {
|
||||
private Set<MethodParamModel> methodParams;
|
||||
|
||||
private String name;
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@XmlElementWrapper(name = "params")
|
||||
@XmlElement(name = "param", type = MethodParamModel.class)
|
||||
public Set<MethodParamModel> getMethodParams() {
|
||||
return methodParams;
|
||||
}
|
||||
|
||||
public void setMethodParams(Set<MethodParamModel> methodParams) {
|
||||
this.methodParams = methodParams;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodModel {
|
||||
private Set<MethodParamModel> methodParams;
|
||||
|
||||
private String name;
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@XmlElementWrapper(name = "params")
|
||||
@XmlElement(name = "param", type = MethodParamModel.class)
|
||||
public Set<MethodParamModel> getMethodParams() {
|
||||
return methodParams;
|
||||
}
|
||||
|
||||
public void setMethodParams(Set<MethodParamModel> methodParams) {
|
||||
this.methodParams = methodParams;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,69 +1,69 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodParamModel {
|
||||
private String name;
|
||||
private String lable;
|
||||
private ParamTypeEnum paramType;
|
||||
private String valueSeperator = ";";
|
||||
private String fieldSeperator = ",";
|
||||
private Set<MethodParamPropertyModel> methodParamProperties;
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
@XmlElement
|
||||
public ParamTypeEnum getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(ParamTypeEnum paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
@XmlElement
|
||||
public String getValueSeperator() {
|
||||
return valueSeperator;
|
||||
}
|
||||
|
||||
public void setValueSeperator(String valueSeperator) {
|
||||
this.valueSeperator = valueSeperator;
|
||||
}
|
||||
@XmlElement
|
||||
public String getFieldSeperator() {
|
||||
return fieldSeperator;
|
||||
}
|
||||
|
||||
public void setFieldSeperator(String fieldSeperator) {
|
||||
this.fieldSeperator = fieldSeperator;
|
||||
}
|
||||
@XmlElement
|
||||
public Set<MethodParamPropertyModel> getMethodParamProperties() {
|
||||
return methodParamProperties;
|
||||
}
|
||||
|
||||
public void setMethodParamProperties(
|
||||
Set<MethodParamPropertyModel> methodParamProperties) {
|
||||
this.methodParamProperties = methodParamProperties;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodParamModel {
|
||||
private String name;
|
||||
private String lable;
|
||||
private ParamTypeEnum paramType;
|
||||
private String valueSeperator = ";";
|
||||
private String fieldSeperator = ",";
|
||||
private Set<MethodParamPropertyModel> methodParamProperties;
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
@XmlElement
|
||||
public ParamTypeEnum getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(ParamTypeEnum paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
@XmlElement
|
||||
public String getValueSeperator() {
|
||||
return valueSeperator;
|
||||
}
|
||||
|
||||
public void setValueSeperator(String valueSeperator) {
|
||||
this.valueSeperator = valueSeperator;
|
||||
}
|
||||
@XmlElement
|
||||
public String getFieldSeperator() {
|
||||
return fieldSeperator;
|
||||
}
|
||||
|
||||
public void setFieldSeperator(String fieldSeperator) {
|
||||
this.fieldSeperator = fieldSeperator;
|
||||
}
|
||||
@XmlElement
|
||||
public Set<MethodParamPropertyModel> getMethodParamProperties() {
|
||||
return methodParamProperties;
|
||||
}
|
||||
|
||||
public void setMethodParamProperties(
|
||||
Set<MethodParamPropertyModel> methodParamProperties) {
|
||||
this.methodParamProperties = methodParamProperties;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodParamPropertyModel {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
@XmlElement
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class MethodParamPropertyModel {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
@XmlElement
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
public enum ParamTypeEnum {
|
||||
Field, MultiField, CheckBox, Table
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
public enum ParamTypeEnum {
|
||||
Field, MultiField, CheckBox, Table
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginGUI {
|
||||
|
||||
private PluginModel plugin;
|
||||
@XmlElement
|
||||
public PluginModel getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
public void setPlugin(PluginModel plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginGUI {
|
||||
|
||||
private PluginModel plugin;
|
||||
@XmlElement
|
||||
public PluginModel getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
public void setPlugin(PluginModel plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginModel {
|
||||
private Set<MethodModel> methods;
|
||||
private String name;
|
||||
|
||||
@XmlElementWrapper(name = "methods")
|
||||
@XmlElement(name = "method", type = MethodModel.class)
|
||||
public Set<MethodModel> getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
public void setMethods(Set<MethodModel> methods) {
|
||||
this.methods = methods;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginModel {
|
||||
private Set<MethodModel> methods;
|
||||
private String name;
|
||||
|
||||
@XmlElementWrapper(name = "methods")
|
||||
@XmlElement(name = "method", type = MethodModel.class)
|
||||
public Set<MethodModel> getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
public void setMethods(Set<MethodModel> methods) {
|
||||
this.methods = methods;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginResponseModel {
|
||||
|
||||
private boolean success;
|
||||
private List<String> pluginList;
|
||||
private List<String> methodList;
|
||||
private Set<MethodParamModel> methosMethodParamModels;
|
||||
private String failMessage;
|
||||
private Set<MethodModel> methodModels;
|
||||
|
||||
@XmlElement
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public List<String> getPluginList() {
|
||||
return pluginList;
|
||||
}
|
||||
|
||||
public void setPluginList(List<String> pluginList) {
|
||||
this.pluginList = pluginList;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public List<String> getMethodList() {
|
||||
return methodList;
|
||||
}
|
||||
|
||||
public void setMethodList(List<String> methodList) {
|
||||
this.methodList = methodList;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "methodParamList")
|
||||
@XmlElement(name = "methodParam", type = MethodParamModel.class)
|
||||
public Set<MethodParamModel> getMethosMethodParamModels() {
|
||||
return methosMethodParamModels;
|
||||
}
|
||||
|
||||
public void setMethosMethodParamModels(
|
||||
Set<MethodParamModel> methosMethodParamModels) {
|
||||
this.methosMethodParamModels = methosMethodParamModels;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getFailMessage() {
|
||||
return failMessage;
|
||||
}
|
||||
|
||||
public void setFailMessage(String failMessage) {
|
||||
this.failMessage = failMessage;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "methods")
|
||||
@XmlElement
|
||||
public Set<MethodModel> getMethodModels() {
|
||||
return methodModels;
|
||||
}
|
||||
|
||||
public void setMethodModels(Set<MethodModel> methodModels) {
|
||||
this.methodModels = methodModels;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.share.models.master.plugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class PluginResponseModel {
|
||||
|
||||
private boolean success;
|
||||
private List<String> pluginList;
|
||||
private List<String> methodList;
|
||||
private Set<MethodParamModel> methosMethodParamModels;
|
||||
private String failMessage;
|
||||
private Set<MethodModel> methodModels;
|
||||
|
||||
@XmlElement
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public List<String> getPluginList() {
|
||||
return pluginList;
|
||||
}
|
||||
|
||||
public void setPluginList(List<String> pluginList) {
|
||||
this.pluginList = pluginList;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public List<String> getMethodList() {
|
||||
return methodList;
|
||||
}
|
||||
|
||||
public void setMethodList(List<String> methodList) {
|
||||
this.methodList = methodList;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "methodParamList")
|
||||
@XmlElement(name = "methodParam", type = MethodParamModel.class)
|
||||
public Set<MethodParamModel> getMethosMethodParamModels() {
|
||||
return methosMethodParamModels;
|
||||
}
|
||||
|
||||
public void setMethosMethodParamModels(
|
||||
Set<MethodParamModel> methosMethodParamModels) {
|
||||
this.methosMethodParamModels = methosMethodParamModels;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getFailMessage() {
|
||||
return failMessage;
|
||||
}
|
||||
|
||||
public void setFailMessage(String failMessage) {
|
||||
this.failMessage = failMessage;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "methods")
|
||||
@XmlElement
|
||||
public Set<MethodModel> getMethodModels() {
|
||||
return methodModels;
|
||||
}
|
||||
|
||||
public void setMethodModels(Set<MethodModel> methodModels) {
|
||||
this.methodModels = methodModels;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
package org.bench4q.share.models.master.statistics;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class ScriptResultModel extends SampleModel {
|
||||
|
||||
private ScriptBriefResultModel scriptBriefResultModel;
|
||||
private ScriptBehaviorsBriefModel scriptBehaviorsBriefModel;
|
||||
private ScriptPagesBriefModel scriptPagesBriefModel;
|
||||
|
||||
@XmlElement
|
||||
public ScriptBriefResultModel getScriptBriefResultModel() {
|
||||
return scriptBriefResultModel;
|
||||
}
|
||||
|
||||
public void setScriptBriefResultModel(
|
||||
ScriptBriefResultModel scriptBriefResultModel) {
|
||||
this.scriptBriefResultModel = scriptBriefResultModel;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public ScriptBehaviorsBriefModel getScriptBehaviorsBriefModel() {
|
||||
return scriptBehaviorsBriefModel;
|
||||
}
|
||||
|
||||
public void setScriptBehaviorsBriefModel(
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
|
||||
this.scriptBehaviorsBriefModel = scriptBehaviorsBriefModel;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public ScriptPagesBriefModel getScriptPagesBriefModel() {
|
||||
return scriptPagesBriefModel;
|
||||
}
|
||||
|
||||
public void setScriptPagesBriefModel(
|
||||
ScriptPagesBriefModel scriptPagesBriefModel) {
|
||||
this.scriptPagesBriefModel = scriptPagesBriefModel;
|
||||
}
|
||||
|
||||
public static ScriptResultModel buildFinishedResult() {
|
||||
ScriptResultModel result = new ScriptResultModel();
|
||||
result.setScriptBehaviorsBriefModel(buildFinishedBehaviors());
|
||||
result.setScriptBriefResultModel(buildFinishedScenario());
|
||||
result.setScriptPagesBriefModel(buildFinishedPages());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptPagesBriefModel buildFinishedPages() {
|
||||
ScriptPagesBriefModel result = new ScriptPagesBriefModel();
|
||||
result.setFinished(true);
|
||||
result.setSamplingTime(new Date());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptBriefResultModel buildFinishedScenario() {
|
||||
ScriptBriefResultModel result = new ScriptBriefResultModel();
|
||||
result.setSamplingTime(new Date());
|
||||
result.setFinished(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptBehaviorsBriefModel buildFinishedBehaviors() {
|
||||
ScriptBehaviorsBriefModel result = new ScriptBehaviorsBriefModel();
|
||||
result.setSamplingTime(new Date());
|
||||
result.setFinished(true);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package org.bench4q.share.models.master.statistics;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class ScriptResultModel extends SampleModel {
|
||||
|
||||
private ScriptBriefResultModel scriptBriefResultModel;
|
||||
private ScriptBehaviorsBriefModel scriptBehaviorsBriefModel;
|
||||
private ScriptPagesBriefModel scriptPagesBriefModel;
|
||||
|
||||
@XmlElement
|
||||
public ScriptBriefResultModel getScriptBriefResultModel() {
|
||||
return scriptBriefResultModel;
|
||||
}
|
||||
|
||||
public void setScriptBriefResultModel(
|
||||
ScriptBriefResultModel scriptBriefResultModel) {
|
||||
this.scriptBriefResultModel = scriptBriefResultModel;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public ScriptBehaviorsBriefModel getScriptBehaviorsBriefModel() {
|
||||
return scriptBehaviorsBriefModel;
|
||||
}
|
||||
|
||||
public void setScriptBehaviorsBriefModel(
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
|
||||
this.scriptBehaviorsBriefModel = scriptBehaviorsBriefModel;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public ScriptPagesBriefModel getScriptPagesBriefModel() {
|
||||
return scriptPagesBriefModel;
|
||||
}
|
||||
|
||||
public void setScriptPagesBriefModel(
|
||||
ScriptPagesBriefModel scriptPagesBriefModel) {
|
||||
this.scriptPagesBriefModel = scriptPagesBriefModel;
|
||||
}
|
||||
|
||||
public static ScriptResultModel buildFinishedResult() {
|
||||
ScriptResultModel result = new ScriptResultModel();
|
||||
result.setScriptBehaviorsBriefModel(buildFinishedBehaviors());
|
||||
result.setScriptBriefResultModel(buildFinishedScenario());
|
||||
result.setScriptPagesBriefModel(buildFinishedPages());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptPagesBriefModel buildFinishedPages() {
|
||||
ScriptPagesBriefModel result = new ScriptPagesBriefModel();
|
||||
result.setFinished(true);
|
||||
result.setSamplingTime(new Date());
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptBriefResultModel buildFinishedScenario() {
|
||||
ScriptBriefResultModel result = new ScriptBriefResultModel();
|
||||
result.setSamplingTime(new Date());
|
||||
result.setFinished(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ScriptBehaviorsBriefModel buildFinishedBehaviors() {
|
||||
ScriptBehaviorsBriefModel result = new ScriptBehaviorsBriefModel();
|
||||
result.setSamplingTime(new Date());
|
||||
result.setFinished(true);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,432 +1,432 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.PluginEditScriptRequestModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class ScriptActionController {
|
||||
|
||||
private final String baseUrl = "RecordScript";
|
||||
private ScriptService scriptService;
|
||||
private final String BASECALLER = "ScriptActionController:";
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
@RequestMapping("loadScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadScript(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "ScriptActionController:loadScripts";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/loadScriptList",
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null)
|
||||
scripts = new ArrayList<ScriptModel>();
|
||||
return new BaseResponseModel(true, scripts);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("deleteScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel deletescript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = new String("ScriptActionComntroller:deleteScript");
|
||||
String url = this.getBaseUrl() + "/deleteScript";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId",
|
||||
scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("editScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel editScript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "editScript";
|
||||
String url = this.getBaseUrl() + "/queryScriptById";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId",
|
||||
scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
|
||||
/*
|
||||
* Logger.getLogger(ScriptActionController.class).info(
|
||||
* MarshalHelper.marshal(OperateScriptServerResponseModel.class,
|
||||
* operateScriptServerResponseModel));
|
||||
*/
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null || scripts.isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
Iterator<ScriptModel> it = scripts.iterator();
|
||||
ScriptModel script = it.next();
|
||||
if (script.getScriptContent() == null
|
||||
|| script.getScriptContent().isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
try {
|
||||
RunScenarioModel result = (RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
script.getScriptContent());
|
||||
Gson gson = new Gson();
|
||||
String scriptContent = null;
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"edit script Before toJson :"
|
||||
+ script.getScriptContent());
|
||||
scriptContent = gson.toJson(result);
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"edit script after toJson :" + scriptContent);
|
||||
return new BaseResponseModel(true,
|
||||
(Object) scriptContent);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("1",
|
||||
"script content is invalidate", caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("saveEditScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveEditScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId, @RequestParam String script)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/updateScript"+"/"+scriptId;
|
||||
String caller = this.BASECALLER + "saveScript";
|
||||
Gson gson = new Gson();
|
||||
RunScenarioModel scriptModel = gson.fromJson(script,
|
||||
RunScenarioModel.class);
|
||||
try {
|
||||
String scriptContent = ObjectXmlExchange.toXml(
|
||||
RunScenarioModel.class, scriptModel);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModelByPut(accessToken, url,scriptContent,
|
||||
OperateScriptServerResponseModel.class,
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("startRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel startRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws JAXBException, CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/startScriptRecordServer";
|
||||
String caller = BASECALLER + "startRecordServer";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, operateScriptServerResponseModel);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("stopRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel stopRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String fileNameUUID)
|
||||
throws CustomGenericException {
|
||||
String caller = BASECALLER + "stopeRecordServer";
|
||||
String url = this.getBaseUrl() + "/stopScriptRecordServer";
|
||||
Map<String, String> params = BaseService.makeParamsMap("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("saveRecordScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScriptToDB(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String scriptName,
|
||||
@RequestParam String fileNameUUID) throws CustomGenericException {
|
||||
String caller = BASECALLER + "saveRecordScript";
|
||||
String url = this.getBaseUrl() + "/saveScriptToDB";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptName",
|
||||
scriptName);
|
||||
params.put("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadScript", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("script") CommonsMultipartFile script,
|
||||
@RequestParam String scriptName) throws CustomGenericException {
|
||||
if (script.isEmpty()) {
|
||||
return new BaseResponseModel(false, "empty file");
|
||||
}
|
||||
if (scriptName == null || scriptName.equals(""))
|
||||
return new BaseResponseModel(false, "empty file name");
|
||||
try {
|
||||
String scenarioModel = new String(script.getBytes());
|
||||
MarshalHelper.unmarshal(RunScenarioModel.class, scenarioModel);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = this
|
||||
.getScriptService().uploadScript(accessToken,
|
||||
scenarioModel, scriptName);
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"script:" + scenarioModel);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, (Object) new String(
|
||||
"upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
return new BaseResponseModel(false,
|
||||
"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("validateScript")
|
||||
public @ResponseBody
|
||||
String validateScript(@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String content) {
|
||||
String result;
|
||||
String message = "";
|
||||
String schemaFileName = "src/main/webapp/WEB-INF/validateScript.xsd";
|
||||
content = content.replace("runScenario", "runscenario")
|
||||
.replace("poolSize", "poolsize")
|
||||
.replace("usePlugin", "useplugin")
|
||||
.replace("userBehavior", "userbehavior")
|
||||
.replace("timerBehavior", "timerbehavior")
|
||||
.replace("userbehaviors", "behaviors");
|
||||
try {
|
||||
result = validateXmlWithSchema(schemaFileName, content);
|
||||
if (result == "true") {
|
||||
message = "Success";
|
||||
} else {
|
||||
message = URLEncoder.encode(result, "UTF-8").replace("+", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("analysis of failure:" + e.toString());
|
||||
message = "failed to read schema file";
|
||||
}
|
||||
// System.out.println(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
private String validateXmlWithSchema(String schemaFileName, String xmlScript)
|
||||
throws SAXException, IOException {
|
||||
String validationResult = "";
|
||||
SchemaFactory schemaFactory = SchemaFactory
|
||||
.newInstance("http://www.w3.org/2001/XMLSchema");
|
||||
File schemaFile = new File(schemaFileName);
|
||||
Schema schema = schemaFactory.newSchema(schemaFile);
|
||||
Validator validator = schema.newValidator();
|
||||
InputStream script = new ByteArrayInputStream(xmlScript.getBytes());
|
||||
Source source = new StreamSource(script);
|
||||
try {
|
||||
// System.out.println("enter validateXmlWithSchema");
|
||||
validator.validate(source);
|
||||
validationResult = "true";
|
||||
} catch (Exception ex) {
|
||||
validationResult = ex.toString();
|
||||
}
|
||||
return validationResult;
|
||||
}
|
||||
|
||||
@RequestMapping("readSchemaContent")
|
||||
public @ResponseBody
|
||||
String readSchemaContent() throws Exception {
|
||||
String schema = "";
|
||||
FileReader fr = new FileReader("src/main/webapp/WEB-INF/schema.json");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((schema = br.readLine()) != null) {
|
||||
sb.append(schema);
|
||||
}
|
||||
br.close();
|
||||
String str = sb.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadPluginEditedScript", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadPluginEditedScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestBody String content) throws CustomGenericException {
|
||||
Gson gson = new Gson();
|
||||
Logger.getLogger(ScriptActionController.class).info(content);
|
||||
PluginEditScriptRequestModel pluginEditScriptRequestModel = null;
|
||||
try {
|
||||
pluginEditScriptRequestModel = gson.fromJson(content,
|
||||
PluginEditScriptRequestModel.class);
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
List<BehaviorModel> behaviorModelsList = pluginEditScriptRequestModel
|
||||
.getBehaviorModels();
|
||||
List<UsePluginModel> usePluginModelsList = pluginEditScriptRequestModel
|
||||
.getUsePluginModels();
|
||||
String scriptName = pluginEditScriptRequestModel.getScriptName();
|
||||
if (!validateScript(behaviorModelsList, usePluginModelsList))
|
||||
return new BaseResponseModel(false, "invalidate script");
|
||||
RunScenarioModel runScenarioModel = this
|
||||
.getScriptService()
|
||||
.createRunScenarioModel(behaviorModelsList, usePluginModelsList);
|
||||
try {
|
||||
String script = ObjectXmlExchange.toXml(RunScenarioModel.class,
|
||||
runScenarioModel);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = this
|
||||
.getScriptService().uploadScript(accessToken, script,
|
||||
scriptName);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, (Object) new String(
|
||||
"upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false,
|
||||
"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean validateScript(List<BehaviorModel> behaviorModels,
|
||||
List<UsePluginModel> usePluginModels) {
|
||||
|
||||
if (behaviorModels == null || behaviorModels.size() == 0)
|
||||
return false;
|
||||
if (usePluginModels == null || usePluginModels.size() == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.api;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.PluginEditScriptRequestModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
import org.bench4q.web.service.ScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("accessToken")
|
||||
public class ScriptActionController {
|
||||
|
||||
private final String baseUrl = "RecordScript";
|
||||
private ScriptService scriptService;
|
||||
private final String BASECALLER = "ScriptActionController:";
|
||||
|
||||
private String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
private ScriptService getScriptService() {
|
||||
return scriptService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private void setScriptService(ScriptService scriptService) {
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
@RequestMapping("loadScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadScript(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = "ScriptActionController:loadScripts";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/loadScriptList",
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null)
|
||||
scripts = new ArrayList<ScriptModel>();
|
||||
return new BaseResponseModel(true, scripts);
|
||||
} else {
|
||||
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("deleteScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel deletescript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException {
|
||||
String caller = new String("ScriptActionComntroller:deleteScript");
|
||||
String url = this.getBaseUrl() + "/deleteScript";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId",
|
||||
scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("editScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel editScript(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId) throws CustomGenericException,
|
||||
JAXBException {
|
||||
String caller = this.BASECALLER + "editScript";
|
||||
String url = this.getBaseUrl() + "/queryScriptById";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptId",
|
||||
scriptId);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
|
||||
/*
|
||||
* Logger.getLogger(ScriptActionController.class).info(
|
||||
* MarshalHelper.marshal(OperateScriptServerResponseModel.class,
|
||||
* operateScriptServerResponseModel));
|
||||
*/
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
List<ScriptModel> scripts = operateScriptServerResponseModel
|
||||
.getScriptModels();
|
||||
if (scripts == null || scripts.isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
Iterator<ScriptModel> it = scripts.iterator();
|
||||
ScriptModel script = it.next();
|
||||
if (script.getScriptContent() == null
|
||||
|| script.getScriptContent().isEmpty())
|
||||
return new BaseResponseModel(false, "data empty");
|
||||
else {
|
||||
try {
|
||||
RunScenarioModel result = (RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
script.getScriptContent());
|
||||
Gson gson = new Gson();
|
||||
String scriptContent = null;
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"edit script Before toJson :"
|
||||
+ script.getScriptContent());
|
||||
scriptContent = gson.toJson(result);
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"edit script after toJson :" + scriptContent);
|
||||
return new BaseResponseModel(true,
|
||||
(Object) scriptContent);
|
||||
} catch (JAXBException e) {
|
||||
throw new CustomGenericException("1",
|
||||
"script content is invalidate", caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("saveEditScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveEditScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String scriptId, @RequestParam String script)
|
||||
throws CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/updateScript"+"/"+scriptId;
|
||||
String caller = this.BASECALLER + "saveScript";
|
||||
Gson gson = new Gson();
|
||||
RunScenarioModel scriptModel = gson.fromJson(script,
|
||||
RunScenarioModel.class);
|
||||
try {
|
||||
String scriptContent = ObjectXmlExchange.toXml(
|
||||
RunScenarioModel.class, scriptModel);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModelByPut(accessToken, url,scriptContent,
|
||||
OperateScriptServerResponseModel.class,
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true);
|
||||
} else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("startRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel startRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws JAXBException, CustomGenericException {
|
||||
String url = this.getBaseUrl() + "/startScriptRecordServer";
|
||||
String caller = BASECALLER + "startRecordServer";
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, null, caller);
|
||||
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, operateScriptServerResponseModel);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("stopRecordServer")
|
||||
public @ResponseBody
|
||||
BaseResponseModel stopRecordServer(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String fileNameUUID)
|
||||
throws CustomGenericException {
|
||||
String caller = BASECALLER + "stopeRecordServer";
|
||||
String url = this.getBaseUrl() + "/stopScriptRecordServer";
|
||||
Map<String, String> params = BaseService.makeParamsMap("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
|
||||
@RequestMapping("saveRecordScript")
|
||||
public @ResponseBody
|
||||
BaseResponseModel saveScriptToDB(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String port, @RequestParam String scriptName,
|
||||
@RequestParam String fileNameUUID) throws CustomGenericException {
|
||||
String caller = BASECALLER + "saveRecordScript";
|
||||
String url = this.getBaseUrl() + "/saveScriptToDB";
|
||||
Map<String, String> params = BaseService.makeParamsMap("scriptName",
|
||||
scriptName);
|
||||
params.put("port", port);
|
||||
params.put("fileNameUUID", fileNameUUID);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getScriptService()
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(accessToken, url,
|
||||
OperateScriptServerResponseModel.class, params, caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true);
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadScript", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam("script") CommonsMultipartFile script,
|
||||
@RequestParam String scriptName) throws CustomGenericException {
|
||||
if (script.isEmpty()) {
|
||||
return new BaseResponseModel(false, "empty file");
|
||||
}
|
||||
if (scriptName == null || scriptName.equals(""))
|
||||
return new BaseResponseModel(false, "empty file name");
|
||||
try {
|
||||
String scenarioModel = new String(script.getBytes());
|
||||
MarshalHelper.unmarshal(RunScenarioModel.class, scenarioModel);
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = this
|
||||
.getScriptService().uploadScript(accessToken,
|
||||
scenarioModel, scriptName);
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
"script:" + scenarioModel);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, (Object) new String(
|
||||
"upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
return new BaseResponseModel(false,
|
||||
"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("validateScript")
|
||||
public @ResponseBody
|
||||
String validateScript(@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String content) {
|
||||
String result;
|
||||
String message = "";
|
||||
String schemaFileName = "src/main/webapp/WEB-INF/validateScript.xsd";
|
||||
content = content.replace("runScenario", "runscenario")
|
||||
.replace("poolSize", "poolsize")
|
||||
.replace("usePlugin", "useplugin")
|
||||
.replace("userBehavior", "userbehavior")
|
||||
.replace("timerBehavior", "timerbehavior")
|
||||
.replace("userbehaviors", "behaviors");
|
||||
try {
|
||||
result = validateXmlWithSchema(schemaFileName, content);
|
||||
if (result == "true") {
|
||||
message = "Success";
|
||||
} else {
|
||||
message = URLEncoder.encode(result, "UTF-8").replace("+", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("analysis of failure:" + e.toString());
|
||||
message = "failed to read schema file";
|
||||
}
|
||||
// System.out.println(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
private String validateXmlWithSchema(String schemaFileName, String xmlScript)
|
||||
throws SAXException, IOException {
|
||||
String validationResult = "";
|
||||
SchemaFactory schemaFactory = SchemaFactory
|
||||
.newInstance("http://www.w3.org/2001/XMLSchema");
|
||||
File schemaFile = new File(schemaFileName);
|
||||
Schema schema = schemaFactory.newSchema(schemaFile);
|
||||
Validator validator = schema.newValidator();
|
||||
InputStream script = new ByteArrayInputStream(xmlScript.getBytes());
|
||||
Source source = new StreamSource(script);
|
||||
try {
|
||||
// System.out.println("enter validateXmlWithSchema");
|
||||
validator.validate(source);
|
||||
validationResult = "true";
|
||||
} catch (Exception ex) {
|
||||
validationResult = ex.toString();
|
||||
}
|
||||
return validationResult;
|
||||
}
|
||||
|
||||
@RequestMapping("readSchemaContent")
|
||||
public @ResponseBody
|
||||
String readSchemaContent() throws Exception {
|
||||
String schema = "";
|
||||
FileReader fr = new FileReader("src/main/webapp/WEB-INF/schema.json");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((schema = br.readLine()) != null) {
|
||||
sb.append(schema);
|
||||
}
|
||||
br.close();
|
||||
String str = sb.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadPluginEditedScript", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadPluginEditedScript(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestBody String content) throws CustomGenericException {
|
||||
Gson gson = new Gson();
|
||||
Logger.getLogger(ScriptActionController.class).info(content);
|
||||
PluginEditScriptRequestModel pluginEditScriptRequestModel = null;
|
||||
try {
|
||||
pluginEditScriptRequestModel = gson.fromJson(content,
|
||||
PluginEditScriptRequestModel.class);
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(ScriptActionController.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
List<BehaviorModel> behaviorModelsList = pluginEditScriptRequestModel
|
||||
.getBehaviorModels();
|
||||
List<UsePluginModel> usePluginModelsList = pluginEditScriptRequestModel
|
||||
.getUsePluginModels();
|
||||
String scriptName = pluginEditScriptRequestModel.getScriptName();
|
||||
if (!validateScript(behaviorModelsList, usePluginModelsList))
|
||||
return new BaseResponseModel(false, "invalidate script");
|
||||
RunScenarioModel runScenarioModel = this
|
||||
.getScriptService()
|
||||
.createRunScenarioModel(behaviorModelsList, usePluginModelsList);
|
||||
try {
|
||||
String script = ObjectXmlExchange.toXml(RunScenarioModel.class,
|
||||
runScenarioModel);
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = this
|
||||
.getScriptService().uploadScript(accessToken, script,
|
||||
scriptName);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return new BaseResponseModel(true, (Object) new String(
|
||||
"upload script:" + scriptName + " success!"));
|
||||
|
||||
else
|
||||
return new BaseResponseModel(false,
|
||||
operateScriptServerResponseModel.getFailCauseString());
|
||||
} catch (JAXBException e) {
|
||||
return new BaseResponseModel(false,
|
||||
"Failed:invalidated script file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean validateScript(List<BehaviorModel> behaviorModels,
|
||||
List<UsePluginModel> usePluginModels) {
|
||||
|
||||
if (behaviorModels == null || behaviorModels.size() == 0)
|
||||
return false;
|
||||
if (usePluginModels == null || usePluginModels.size() == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
package org.bench4q.web.model;
|
||||
|
||||
public class NameAndIdMap {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
public NameAndIdMap(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.web.model;
|
||||
|
||||
public class NameAndIdMap {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
public NameAndIdMap(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,311 +1,311 @@
|
|||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.ParameterModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.PageModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.NameAndIdMap;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ScriptService extends BaseService {
|
||||
private String baseUrl = "RecordScript";
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public ScriptModel queryScriptById(int id, String accessToken)
|
||||
throws CustomGenericException {
|
||||
// check script id and return throw exception
|
||||
String caller = "ScriptService:queryScript";
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(id)), caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", caller
|
||||
+ ":" + id);
|
||||
}
|
||||
|
||||
public ScriptModel queryScriptByName(String scriptName, String accessToken)
|
||||
throws CustomGenericException {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptByName",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("name", scriptName), "");
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", ""
|
||||
+ ":" + scriptName);
|
||||
}
|
||||
|
||||
public List<ScriptModel> queryScripts(List<Integer> scriptIds,
|
||||
String accessToken) throws CustomGenericException {
|
||||
String caller = "ScriptService:queryScript";
|
||||
List<ScriptModel> scriptModels = new ArrayList<ScriptModel>();
|
||||
for (Integer scriptId : scriptIds) {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(
|
||||
accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(scriptId)),
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
scriptModels.add(operateScriptServerResponseModel
|
||||
.getScriptModels().get(0));
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed",
|
||||
caller + ":" + scriptId);
|
||||
}
|
||||
return scriptModels;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getScriptNameIdMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getName(), scriptModel.getId());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<NameAndIdMap> getScriptIdNameMap(List<ScriptModel> scriptModels)
|
||||
throws CustomGenericException {
|
||||
List<NameAndIdMap> nameAndIdMaps = new ArrayList<NameAndIdMap>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
NameAndIdMap nameAndIdMap = new NameAndIdMap(scriptModel.getId(),
|
||||
scriptModel.getName());
|
||||
nameAndIdMaps.add(nameAndIdMap);
|
||||
}
|
||||
return nameAndIdMaps;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getPageNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> pageMap = getPageNameAndIdMap((RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (pageMap != null)
|
||||
map.putAll(pageMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Integer> getPageNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<PageModel> pageModels = runScenarioModel.getPages();
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (int i = 0; i < pageModels.size(); i++) {
|
||||
map.put("page_" + i, i);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> behaviorMap = getBehaviorNameAndIdMap((RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (behaviorMap != null)
|
||||
map.putAll(behaviorMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptPages(RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<String> scriptPages = new ArrayList<String>();
|
||||
for (int i = 1; i < scriptPages.size(); i++) {
|
||||
scriptPages.add("page_" + i);
|
||||
}
|
||||
return scriptPages;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptBehaviorUrl(RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<BehaviorModel> behaviorModelsWithUrl = getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModelsWithUrl == null)
|
||||
return null;
|
||||
List<String> urList = new ArrayList<String>();
|
||||
for (BehaviorModel behaviorModelWithUrl : behaviorModelsWithUrl) {
|
||||
String url = generateUrl(behaviorModelWithUrl.getParameters());
|
||||
urList.add(url);
|
||||
}
|
||||
return urList;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
List<BehaviorModel> behaviorModels = this
|
||||
.getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
String url = this.generateUrl(behaviorModel.getParameters());
|
||||
if (url != null)
|
||||
map.put(url, behaviorModel.getId());
|
||||
}
|
||||
return map;
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateUrl(List<ParameterModel> parameterModels) {
|
||||
String url = new String("");
|
||||
int i = 0;
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (i == 1 && parameterModel.getValue() != null)
|
||||
url += "?" + parameterModel.getValue();
|
||||
if (i > 1 && parameterModel.getValue() != null)
|
||||
url += "&" + parameterModel.getValue();
|
||||
i++;
|
||||
}
|
||||
if (url.length() <= 0)
|
||||
return null;
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModelsHasUrl(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
|
||||
List<BehaviorModel> behaviorModels = getBehaviorModels(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
List<BehaviorModel> behaviorModelsWithUrl = new ArrayList<BehaviorModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
List<ParameterModel> parameterModels = new ArrayList<ParameterModel>();
|
||||
parameterModels.addAll(behaviorModel.getParameters());
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (parameterModel.getKey().equals("url"))
|
||||
behaviorModelsWithUrl.add(behaviorModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return behaviorModelsWithUrl;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModels(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<BatchModel> batchModels = new ArrayList<BatchModel>();
|
||||
for (PageModel pageModel : runScenarioModel.getPages())
|
||||
batchModels.addAll(pageModel.getBatches());
|
||||
List<BehaviorModel> behaviorModels = new ArrayList<BehaviorModel>();
|
||||
for (BatchModel batchModel : batchModels)
|
||||
behaviorModels.addAll(batchModel.getBehaviors());
|
||||
return behaviorModels;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public RunScenarioModel createRunScenarioModel(
|
||||
List<BehaviorModel> behaviorModels,
|
||||
List<UsePluginModel> usedPluginModels) {
|
||||
RunScenarioModel runScenarioModel = new RunScenarioModel();
|
||||
runScenarioModel
|
||||
.setPages(createPageModelsWithBehaviorList(behaviorModels));
|
||||
runScenarioModel.setUsePlugins(usedPluginModels);
|
||||
return runScenarioModel;
|
||||
}
|
||||
|
||||
private List<PageModel> createPageModelsWithBehaviorList(
|
||||
List<BehaviorModel> behaviorModels) {
|
||||
List<PageModel> pageModels = new ArrayList<PageModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
pageModels.add(createPageModelWithOneBehaviorModel(behaviorModel));
|
||||
}
|
||||
return pageModels;
|
||||
|
||||
}
|
||||
|
||||
private PageModel createPageModelWithOneBehaviorModel(
|
||||
BehaviorModel behaviorModel) {
|
||||
PageModel pageModel = new PageModel();
|
||||
pageModel.setBatches(new ArrayList<BatchModel>());
|
||||
pageModel.getBatches().add(
|
||||
createBatchModelWithOneBehavior(behaviorModel));
|
||||
return pageModel;
|
||||
}
|
||||
|
||||
private BatchModel createBatchModelWithOneBehavior(
|
||||
BehaviorModel behaviorModel) {
|
||||
BatchModel batchModel = new BatchModel();
|
||||
batchModel.setBehaviors(new ArrayList<BehaviorModel>());
|
||||
batchModel.getBehaviors().add(behaviorModel);
|
||||
batchModel.setChildId(-1);
|
||||
batchModel.setParentId(-1);
|
||||
batchModel.setId(behaviorModel.getId());
|
||||
return batchModel;
|
||||
}
|
||||
|
||||
public OperateScriptServerResponseModel uploadScript(String accessToken,
|
||||
String scenarioModel, String scriptName)
|
||||
throws CustomGenericException {
|
||||
String url = "RecordScript" + "/uploadScript" + "/" + scriptName;
|
||||
return (OperateScriptServerResponseModel) getCommunicateWithMaster()
|
||||
.getResponseModelByPut(accessToken, url, scenarioModel,
|
||||
OperateScriptServerResponseModel.class, "upload script");
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.bench4q.share.models.agent.ParameterModel;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BatchModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.PageModel;
|
||||
import org.bench4q.share.models.agent.scriptrecord.UsePluginModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.extractObjectFromXml.ObjectXmlExchange;
|
||||
import org.bench4q.web.model.NameAndIdMap;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ScriptService extends BaseService {
|
||||
private String baseUrl = "RecordScript";
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public ScriptModel queryScriptById(int id, String accessToken)
|
||||
throws CustomGenericException {
|
||||
// check script id and return throw exception
|
||||
String caller = "ScriptService:queryScript";
|
||||
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(id)), caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", caller
|
||||
+ ":" + id);
|
||||
}
|
||||
|
||||
public ScriptModel queryScriptByName(String scriptName, String accessToken)
|
||||
throws CustomGenericException {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken,
|
||||
this.getBaseUrl() + "/queryScriptByName",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("name", scriptName), "");
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
return operateScriptServerResponseModel.getScriptModels().get(0);
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed", ""
|
||||
+ ":" + scriptName);
|
||||
}
|
||||
|
||||
public List<ScriptModel> queryScripts(List<Integer> scriptIds,
|
||||
String accessToken) throws CustomGenericException {
|
||||
String caller = "ScriptService:queryScript";
|
||||
List<ScriptModel> scriptModels = new ArrayList<ScriptModel>();
|
||||
for (Integer scriptId : scriptIds) {
|
||||
OperateScriptServerResponseModel operateScriptServerResponseModel = (OperateScriptServerResponseModel) this
|
||||
.getCommunicateWithMaster()
|
||||
.getResponseModel(
|
||||
accessToken,
|
||||
this.getBaseUrl() + "/queryScriptById",
|
||||
OperateScriptServerResponseModel.class,
|
||||
makeParamsMap("scriptId", String.valueOf(scriptId)),
|
||||
caller);
|
||||
if (operateScriptServerResponseModel.isSuccess())
|
||||
scriptModels.add(operateScriptServerResponseModel
|
||||
.getScriptModels().get(0));
|
||||
else
|
||||
throw new CustomGenericException("5", "query script failed",
|
||||
caller + ":" + scriptId);
|
||||
}
|
||||
return scriptModels;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getScriptNameIdMap(
|
||||
List<ScriptModel> scriptModels) throws CustomGenericException {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
map.put(scriptModel.getName(), scriptModel.getId());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<NameAndIdMap> getScriptIdNameMap(List<ScriptModel> scriptModels)
|
||||
throws CustomGenericException {
|
||||
List<NameAndIdMap> nameAndIdMaps = new ArrayList<NameAndIdMap>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
NameAndIdMap nameAndIdMap = new NameAndIdMap(scriptModel.getId(),
|
||||
scriptModel.getName());
|
||||
nameAndIdMaps.add(nameAndIdMap);
|
||||
}
|
||||
return nameAndIdMaps;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getPageNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> pageMap = getPageNameAndIdMap((RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (pageMap != null)
|
||||
map.putAll(pageMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Integer> getPageNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<PageModel> pageModels = runScenarioModel.getPages();
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (int i = 0; i < pageModels.size(); i++) {
|
||||
map.put("page_" + i, i);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
List<ScriptModel> scriptModels) throws JAXBException {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for (ScriptModel scriptModel : scriptModels) {
|
||||
Map<String, Integer> behaviorMap = getBehaviorNameAndIdMap((RunScenarioModel) ObjectXmlExchange
|
||||
.fromXml(RunScenarioModel.class,
|
||||
scriptModel.getScriptContent()));
|
||||
if (behaviorMap != null)
|
||||
map.putAll(behaviorMap);
|
||||
}
|
||||
return map;
|
||||
} catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptPages(RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<String> scriptPages = new ArrayList<String>();
|
||||
for (int i = 1; i < scriptPages.size(); i++) {
|
||||
scriptPages.add("page_" + i);
|
||||
}
|
||||
return scriptPages;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getScriptBehaviorUrl(RunScenarioModel runScenarioModel) {
|
||||
|
||||
List<BehaviorModel> behaviorModelsWithUrl = getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModelsWithUrl == null)
|
||||
return null;
|
||||
List<String> urList = new ArrayList<String>();
|
||||
for (BehaviorModel behaviorModelWithUrl : behaviorModelsWithUrl) {
|
||||
String url = generateUrl(behaviorModelWithUrl.getParameters());
|
||||
urList.add(url);
|
||||
}
|
||||
return urList;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getBehaviorNameAndIdMap(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
List<BehaviorModel> behaviorModels = this
|
||||
.getBehaviorModelsHasUrl(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
String url = this.generateUrl(behaviorModel.getParameters());
|
||||
if (url != null)
|
||||
map.put(url, behaviorModel.getId());
|
||||
}
|
||||
return map;
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateUrl(List<ParameterModel> parameterModels) {
|
||||
String url = new String("");
|
||||
int i = 0;
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (i == 1 && parameterModel.getValue() != null)
|
||||
url += "?" + parameterModel.getValue();
|
||||
if (i > 1 && parameterModel.getValue() != null)
|
||||
url += "&" + parameterModel.getValue();
|
||||
i++;
|
||||
}
|
||||
if (url.length() <= 0)
|
||||
return null;
|
||||
return url;
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModelsHasUrl(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
|
||||
List<BehaviorModel> behaviorModels = getBehaviorModels(runScenarioModel);
|
||||
if (behaviorModels == null)
|
||||
return null;
|
||||
List<BehaviorModel> behaviorModelsWithUrl = new ArrayList<BehaviorModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
List<ParameterModel> parameterModels = new ArrayList<ParameterModel>();
|
||||
parameterModels.addAll(behaviorModel.getParameters());
|
||||
for (ParameterModel parameterModel : parameterModels) {
|
||||
if (parameterModel.getKey().equals("url"))
|
||||
behaviorModelsWithUrl.add(behaviorModel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return behaviorModelsWithUrl;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private List<BehaviorModel> getBehaviorModels(
|
||||
RunScenarioModel runScenarioModel) {
|
||||
try {
|
||||
List<BatchModel> batchModels = new ArrayList<BatchModel>();
|
||||
for (PageModel pageModel : runScenarioModel.getPages())
|
||||
batchModels.addAll(pageModel.getBatches());
|
||||
List<BehaviorModel> behaviorModels = new ArrayList<BehaviorModel>();
|
||||
for (BatchModel batchModel : batchModels)
|
||||
behaviorModels.addAll(batchModel.getBehaviors());
|
||||
return behaviorModels;
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public RunScenarioModel createRunScenarioModel(
|
||||
List<BehaviorModel> behaviorModels,
|
||||
List<UsePluginModel> usedPluginModels) {
|
||||
RunScenarioModel runScenarioModel = new RunScenarioModel();
|
||||
runScenarioModel
|
||||
.setPages(createPageModelsWithBehaviorList(behaviorModels));
|
||||
runScenarioModel.setUsePlugins(usedPluginModels);
|
||||
return runScenarioModel;
|
||||
}
|
||||
|
||||
private List<PageModel> createPageModelsWithBehaviorList(
|
||||
List<BehaviorModel> behaviorModels) {
|
||||
List<PageModel> pageModels = new ArrayList<PageModel>();
|
||||
for (BehaviorModel behaviorModel : behaviorModels) {
|
||||
pageModels.add(createPageModelWithOneBehaviorModel(behaviorModel));
|
||||
}
|
||||
return pageModels;
|
||||
|
||||
}
|
||||
|
||||
private PageModel createPageModelWithOneBehaviorModel(
|
||||
BehaviorModel behaviorModel) {
|
||||
PageModel pageModel = new PageModel();
|
||||
pageModel.setBatches(new ArrayList<BatchModel>());
|
||||
pageModel.getBatches().add(
|
||||
createBatchModelWithOneBehavior(behaviorModel));
|
||||
return pageModel;
|
||||
}
|
||||
|
||||
private BatchModel createBatchModelWithOneBehavior(
|
||||
BehaviorModel behaviorModel) {
|
||||
BatchModel batchModel = new BatchModel();
|
||||
batchModel.setBehaviors(new ArrayList<BehaviorModel>());
|
||||
batchModel.getBehaviors().add(behaviorModel);
|
||||
batchModel.setChildId(-1);
|
||||
batchModel.setParentId(-1);
|
||||
batchModel.setId(behaviorModel.getId());
|
||||
return batchModel;
|
||||
}
|
||||
|
||||
public OperateScriptServerResponseModel uploadScript(String accessToken,
|
||||
String scenarioModel, String scriptName)
|
||||
throws CustomGenericException {
|
||||
String url = "RecordScript" + "/uploadScript" + "/" + scriptName;
|
||||
return (OperateScriptServerResponseModel) getCommunicateWithMaster()
|
||||
.getResponseModelByPut(accessToken, url, scenarioModel,
|
||||
OperateScriptServerResponseModel.class, "upload script");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.loginDiv {
|
||||
margin: 20px auto;
|
||||
width: 958px;
|
||||
height: 600px;
|
||||
background-color: #efefef;
|
||||
.loginDiv {
|
||||
margin: 20px auto;
|
||||
width: 958px;
|
||||
height: 600px;
|
||||
background-color: #efefef;
|
||||
}
|
|
@ -1,42 +1,42 @@
|
|||
.registerContainer {
|
||||
background-color: #efefef;
|
||||
padding-top: 80px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 50px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.bench4qLog {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.tipContainer {
|
||||
height: 50px;
|
||||
width: 50%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.registerInput {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.userInput {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
input {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.submitDiv {
|
||||
float: left;
|
||||
margin-right: 50px;
|
||||
.registerContainer {
|
||||
background-color: #efefef;
|
||||
padding-top: 80px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 50px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.bench4qLog {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.tipContainer {
|
||||
height: 50px;
|
||||
width: 50%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.registerInput {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.userInput {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
input {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.submitDiv {
|
||||
float: left;
|
||||
margin-right: 50px;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
addField=Add Field
|
||||
removeField=Remove Field
|
||||
addCol=addCol
|
||||
removeCol=removeCol
|
||||
save=Save
|
||||
addField=Add Field
|
||||
removeField=Remove Field
|
||||
addCol=addCol
|
||||
removeCol=removeCol
|
||||
save=Save
|
||||
cancel=Cancel
|
|
@ -1,6 +1,6 @@
|
|||
addField=\u6DFB\u52A0\u57DF
|
||||
removeField=\u79FB\u9664\u57DF
|
||||
addCol=\u6DFB\u52A0\u884C
|
||||
removeCol=\u79FB\u9664\u884C
|
||||
cancel=\u53D6\u6D88
|
||||
addField=\u6DFB\u52A0\u57DF
|
||||
removeField=\u79FB\u9664\u57DF
|
||||
addCol=\u6DFB\u52A0\u884C
|
||||
removeCol=\u79FB\u9664\u884C
|
||||
cancel=\u53D6\u6D88
|
||||
save=\u4FDD\u5B58
|
File diff suppressed because it is too large
Load Diff
|
@ -1,144 +1,144 @@
|
|||
<%@page language="java" contentType="text/html; charset=GBK"
|
||||
pageEncoding="GBK"%>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Bench4Q</title>
|
||||
<link rel="search" type="application/opensearchdescription+xml"
|
||||
href="https://github.com/opensearch.xml" title="GitHub">
|
||||
<link rel="fluid-icon" href="https://github.com/fluidicon.png"
|
||||
title="GitHub">
|
||||
<link rel="shortcut icon" href="favicon.ico" type="images/x-icon">
|
||||
|
||||
|
||||
<meta content="authenticity_token" name="csrf-param">
|
||||
<meta content="wedm5SiF4gf6cxpqmjS1xTCRp86Sc8PAssZUiID8N0M="
|
||||
name="csrf-token">
|
||||
|
||||
<link href="lib/github/css/github-6053501db2b69fd2b04652c6349117be14468ce4.css"
|
||||
media="screen" rel="stylesheet" type="text/css">
|
||||
<link href="lib/github/css/github2-277183b6724249eea8a7d10300542831eac78d3f.css"
|
||||
media="screen" rel="stylesheet" type="text/css">
|
||||
<link href="css/login.css" rel="stylesheet">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<script src="lib/other/frameworks-a450c7f907bdc1ee6b362ab1ecca811c761fd259.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><link rel="stylesheet" type="text/css" href="flip_ie.css"/><![endif]-->
|
||||
<!-- <script src="http://www.google.com/jsapi"></script> -->
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
||||
</head>
|
||||
|
||||
<body class="logged_out wider windows env-production ">
|
||||
<div id="wrapper">
|
||||
|
||||
<div id="header" class="true clearfix">
|
||||
<div class="container clearfix">
|
||||
<a class="site-logo" href="index.jsp"> <img alt="GitHub"
|
||||
class="github-logo-4x" src="images/headerLogo.png" height="30"> <img
|
||||
alt="GitHub" class="github-logo-4x-hover" src="images/bench4q-2.png"
|
||||
height="30">
|
||||
</a>
|
||||
|
||||
|
||||
<ul class="top-nav logged_out">
|
||||
<li class="login"><a href="login.jsp"><fmt:message key="login_jsp_home" /></a></li>
|
||||
<li class="login"><a href="register.jsp"><fmt:message key="login_jsp_register" /></a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="site home">
|
||||
<div class="container">
|
||||
<div class="pagehead homehead">
|
||||
<div class="hero">
|
||||
<h1><fmt:message key="login_jsp_Title" /></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="loginDiv">
|
||||
<div style="height: 20px"></div>
|
||||
<div style="font-size: 18px; margin-left: 280px">
|
||||
<h1><fmt:message key="login_jsp_welcome" /></h1>
|
||||
</div>
|
||||
|
||||
<div style="height: 60px;"></div>
|
||||
<div id="div1" style="float: left; width: 270px; height: 300px;"></div>
|
||||
<div id="div2"
|
||||
style="width: 400px; height: 300px; float: left; background-color: #e9f1f4; border: efefff 1px solid;">
|
||||
|
||||
<div style="width: 100%; height: 100%">
|
||||
<div style="width: 100%; height: 40px; background-color: #607989">
|
||||
<div style="width: 10%; height: 40px; float: left"></div>
|
||||
<div
|
||||
style="font-size: 20px; color: #ffffff; padding-top: 5px; font-weight: 900">
|
||||
<fmt:message key="login_jsp_signIn" /> <a
|
||||
style="font-size: 15px; color: #ffffff; font-weight: normal"
|
||||
href="register.jsp">(<fmt:message key="login_jsp_register" />)</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%; height: 260px;">
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div style="height: 40px; width: 100% border:black 1px solid;">
|
||||
<div
|
||||
style="height: 40px; width: 30px; padding-left: 40px; float: left">
|
||||
<img src="images/username.jpg" />
|
||||
</div>
|
||||
<div style="height: 40px; padding-top: 9px;">
|
||||
<fmt:message key="login_jsp_username" /> </div>
|
||||
</div>
|
||||
<div style="height: 2px; width: 100%"></div>
|
||||
<div>
|
||||
<input autofocus type="text" id="username" name="username"
|
||||
style="font-size: 18px; margin-left: 40px; height: 30px; width: 300px;"
|
||||
onblur="checkName(this.value)" />
|
||||
<div id='alertUserName'
|
||||
style='display: none; color: red; margin-left: 40px'><fmt:message key="login_jsp_usernameWarnning" /> </div>
|
||||
</div>
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div style="height: 40px; width: 100%">
|
||||
<div
|
||||
style="height: 40px; width: 30; padding-left: 40px; float: left">
|
||||
<img src="images/password.jpg" />
|
||||
</div>
|
||||
<div style="height: 40px; padding-top: 9px;">
|
||||
<fmt:message key="login_jsp_password" /> </div>
|
||||
</div>
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div>
|
||||
<input type="password" id="password" name="password"
|
||||
style="font-size: 18px; margin-left: 40px; height: 30px; width: 300px;"
|
||||
onblur="checkPass(this.value)" />
|
||||
<div id='alertPassWord'
|
||||
style='display: none; color: red; margin-left: 40px'><fmt:message key="login_jsp_passwordWarnning" /> </div>
|
||||
</div>
|
||||
<div style="height: 20px; width: 100%"></div>
|
||||
<div style="height: 40px; padding-left: 40px;">
|
||||
<button type="submit" class="btn btn-large btn-primary"
|
||||
onClick="login()"><fmt:message key="login_jsp_signIn" /> </button>
|
||||
<button type="submit" class="btn btn-large btn-primary"
|
||||
onClick="adminLogin()"><fmt:message key="login_jsp_admin" /> </button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
|
||||
<script src="script/login.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<%@page language="java" contentType="text/html; charset=GBK"
|
||||
pageEncoding="GBK"%>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Bench4Q</title>
|
||||
<link rel="search" type="application/opensearchdescription+xml"
|
||||
href="https://github.com/opensearch.xml" title="GitHub">
|
||||
<link rel="fluid-icon" href="https://github.com/fluidicon.png"
|
||||
title="GitHub">
|
||||
<link rel="shortcut icon" href="favicon.ico" type="images/x-icon">
|
||||
|
||||
|
||||
<meta content="authenticity_token" name="csrf-param">
|
||||
<meta content="wedm5SiF4gf6cxpqmjS1xTCRp86Sc8PAssZUiID8N0M="
|
||||
name="csrf-token">
|
||||
|
||||
<link href="lib/github/css/github-6053501db2b69fd2b04652c6349117be14468ce4.css"
|
||||
media="screen" rel="stylesheet" type="text/css">
|
||||
<link href="lib/github/css/github2-277183b6724249eea8a7d10300542831eac78d3f.css"
|
||||
media="screen" rel="stylesheet" type="text/css">
|
||||
<link href="css/login.css" rel="stylesheet">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<script src="lib/other/frameworks-a450c7f907bdc1ee6b362ab1ecca811c761fd259.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><link rel="stylesheet" type="text/css" href="flip_ie.css"/><![endif]-->
|
||||
<!-- <script src="http://www.google.com/jsapi"></script> -->
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
||||
</head>
|
||||
|
||||
<body class="logged_out wider windows env-production ">
|
||||
<div id="wrapper">
|
||||
|
||||
<div id="header" class="true clearfix">
|
||||
<div class="container clearfix">
|
||||
<a class="site-logo" href="index.jsp"> <img alt="GitHub"
|
||||
class="github-logo-4x" src="images/headerLogo.png" height="30"> <img
|
||||
alt="GitHub" class="github-logo-4x-hover" src="images/bench4q-2.png"
|
||||
height="30">
|
||||
</a>
|
||||
|
||||
|
||||
<ul class="top-nav logged_out">
|
||||
<li class="login"><a href="login.jsp"><fmt:message key="login_jsp_home" /></a></li>
|
||||
<li class="login"><a href="register.jsp"><fmt:message key="login_jsp_register" /></a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="site home">
|
||||
<div class="container">
|
||||
<div class="pagehead homehead">
|
||||
<div class="hero">
|
||||
<h1><fmt:message key="login_jsp_Title" /></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="loginDiv">
|
||||
<div style="height: 20px"></div>
|
||||
<div style="font-size: 18px; margin-left: 280px">
|
||||
<h1><fmt:message key="login_jsp_welcome" /></h1>
|
||||
</div>
|
||||
|
||||
<div style="height: 60px;"></div>
|
||||
<div id="div1" style="float: left; width: 270px; height: 300px;"></div>
|
||||
<div id="div2"
|
||||
style="width: 400px; height: 300px; float: left; background-color: #e9f1f4; border: efefff 1px solid;">
|
||||
|
||||
<div style="width: 100%; height: 100%">
|
||||
<div style="width: 100%; height: 40px; background-color: #607989">
|
||||
<div style="width: 10%; height: 40px; float: left"></div>
|
||||
<div
|
||||
style="font-size: 20px; color: #ffffff; padding-top: 5px; font-weight: 900">
|
||||
<fmt:message key="login_jsp_signIn" /> <a
|
||||
style="font-size: 15px; color: #ffffff; font-weight: normal"
|
||||
href="register.jsp">(<fmt:message key="login_jsp_register" />)</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%; height: 260px;">
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div style="height: 40px; width: 100% border:black 1px solid;">
|
||||
<div
|
||||
style="height: 40px; width: 30px; padding-left: 40px; float: left">
|
||||
<img src="images/username.jpg" />
|
||||
</div>
|
||||
<div style="height: 40px; padding-top: 9px;">
|
||||
<fmt:message key="login_jsp_username" /> </div>
|
||||
</div>
|
||||
<div style="height: 2px; width: 100%"></div>
|
||||
<div>
|
||||
<input autofocus type="text" id="username" name="username"
|
||||
style="font-size: 18px; margin-left: 40px; height: 30px; width: 300px;"
|
||||
onblur="checkName(this.value)" />
|
||||
<div id='alertUserName'
|
||||
style='display: none; color: red; margin-left: 40px'><fmt:message key="login_jsp_usernameWarnning" /> </div>
|
||||
</div>
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div style="height: 40px; width: 100%">
|
||||
<div
|
||||
style="height: 40px; width: 30; padding-left: 40px; float: left">
|
||||
<img src="images/password.jpg" />
|
||||
</div>
|
||||
<div style="height: 40px; padding-top: 9px;">
|
||||
<fmt:message key="login_jsp_password" /> </div>
|
||||
</div>
|
||||
<div style="height: 10px; width: 100%"></div>
|
||||
<div>
|
||||
<input type="password" id="password" name="password"
|
||||
style="font-size: 18px; margin-left: 40px; height: 30px; width: 300px;"
|
||||
onblur="checkPass(this.value)" />
|
||||
<div id='alertPassWord'
|
||||
style='display: none; color: red; margin-left: 40px'><fmt:message key="login_jsp_passwordWarnning" /> </div>
|
||||
</div>
|
||||
<div style="height: 20px; width: 100%"></div>
|
||||
<div style="height: 40px; padding-left: 40px;">
|
||||
<button type="submit" class="btn btn-large btn-primary"
|
||||
onClick="login()"><fmt:message key="login_jsp_signIn" /> </button>
|
||||
<button type="submit" class="btn btn-large btn-primary"
|
||||
onClick="adminLogin()"><fmt:message key="login_jsp_admin" /> </button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
|
||||
<script src="script/login.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,269 +1,269 @@
|
|||
<!DOCTYPE html>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<meta charset="utf-8">
|
||||
<title>Bench4Q</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description"
|
||||
content="Bench4Q, a new method for QOS benchmarking.">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
|
||||
<link
|
||||
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
|
||||
rel="stylesheet">
|
||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
padding: 9px 0;
|
||||
}
|
||||
</style>
|
||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||
<link href="css/bench4q.css" rel="stylesheet">
|
||||
<link href='css/plugin.css' rel='stylesheet'>
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- The fav icon -->
|
||||
<link rel="shortcut icon" href="img/favicon.ico">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<fmt:bundle basename="i18n">
|
||||
<!-- topbar starts -->
|
||||
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
|
||||
<!-- topbar ends -->
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include>
|
||||
<noscript>
|
||||
<div class="alert alert-block span10">
|
||||
<h4 class="alert-heading">
|
||||
<fmt:message key="warning" />
|
||||
!
|
||||
</h4>
|
||||
<p>
|
||||
<fmt:message key="warningcontent1" />
|
||||
<a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
|
||||
<fmt:message key="warningcontent2" />
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="content" class="span10">
|
||||
<!-- content starts -->
|
||||
<div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
|
||||
class="divider">/</span></li>
|
||||
<li><a href="script.jsp"><fmt:message
|
||||
key="scriptmanagement" /></a><span class="divider">/</span></li>
|
||||
<li><a href="plugin.jsp"><fmt:message
|
||||
key="script_jsp_makeScript" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid sortable">
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
<h2>
|
||||
<span><fmt:message key="plugin_jsp_plugins" />(usePlugins)</span>
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a> <a href="#" class="btn btn-round"><i
|
||||
class="icon-list"></i></a> <a href="#"
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content row-fluid">
|
||||
|
||||
<div id="pluginArea" class="listArea span9"></div>
|
||||
<div class=" span3 button-div">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="addPlugin" onClick="addPlugin();">
|
||||
<fmt:message key="plugin_jsp_add" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removePlugin" onClick="removePluginByClicked();">
|
||||
<fmt:message key="plugin_jsp_remove" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removeAllPlugin" onClick="clearPluginChoosedList();">
|
||||
<fmt:message key="plugin_jsp_clear" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/span-->
|
||||
<!-- Behavior start -->
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
<h2>
|
||||
<i></i>
|
||||
<fmt:message key="plugin_jsp_behavior" />
|
||||
(behaviors)
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a> <a href="#" class="btn btn-round"><i
|
||||
class="icon-list"></i></a> <a href="#"
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content row-fluid">
|
||||
<div id="behaviorArea" class="listArea span9"></div>
|
||||
<div class="span3 button-div">
|
||||
<div class="hide" id="insertBefore">
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="insert();">
|
||||
<fmt:message key="plugin_jsp_insertBefore" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="insertAfter();">
|
||||
<fmt:message key="plugin_jsp_insertAfter" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removeBehavior_Plugin"
|
||||
onClick="removeInsertPluginByClicked();">
|
||||
<fmt:message key="plugin_jsp_remove" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="clearPluginMethodList();">
|
||||
<fmt:message key="plugin_jsp_clear" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="showPluginMethod" class="showPluginMethod"></div>
|
||||
</div>
|
||||
<!--/row-->
|
||||
<!-- content ends -->
|
||||
<div class="hide" id="submitBehaviors">
|
||||
<p>
|
||||
<fmt:message key="plugin_jsp_scriptName"></fmt:message>
|
||||
<input id="writeAScriptName" type="text" name="scriptName"
|
||||
size=20></input>
|
||||
</p>
|
||||
<p>
|
||||
<button class='btn-large' onClick="submitBehaviors(this);">
|
||||
<fmt:message key="plugin_jsp_submit" />
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--/#content.span10-->
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
<div class="modal hide fade " id="myModal_Plugin">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="plugin_jsp_addNewPlugin" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 260px;">
|
||||
<div class="inset scroll" id="choosePlugin"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="pluginFinish();" id="pluginFinish">
|
||||
<fmt:message key="plugin_jsp_finish" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="pluginCancel();" id="pluginCancel">
|
||||
<fmt:message key="plugin_jsp_cancel" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal hide fade " id="myModal_Behavior">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="plugin_jsp_chooseBehaviors" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row-fluid">
|
||||
<div class="span6 behavior-box scroll">
|
||||
<div id="insertPluginAreaPlugins"></div>
|
||||
</div>
|
||||
<div class="span6 behavior-box scroll">
|
||||
<div id="pluginMethod"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="behaviorFinish();" id="behaviorFinish">
|
||||
<fmt:message key="plugin_jsp_finish" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-width" onClick=""
|
||||
id="behaviorCancel">
|
||||
<fmt:message key="plugin_jsp_cancel" />
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
|
||||
</div>
|
||||
|
||||
<!--/.fluid-container-->
|
||||
|
||||
<!-- external javascript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
|
||||
<script
|
||||
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
|
||||
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
|
||||
<script
|
||||
src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js'></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/pluginModel.js"></script>
|
||||
<script src="script/plugin-new.js"></script>
|
||||
<script src="script/behaviorsForm.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<meta charset="utf-8">
|
||||
<title>Bench4Q</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description"
|
||||
content="Bench4Q, a new method for QOS benchmarking.">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
|
||||
<link
|
||||
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
|
||||
rel="stylesheet">
|
||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
padding: 9px 0;
|
||||
}
|
||||
</style>
|
||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||
<link href="css/bench4q.css" rel="stylesheet">
|
||||
<link href='css/plugin.css' rel='stylesheet'>
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- The fav icon -->
|
||||
<link rel="shortcut icon" href="img/favicon.ico">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<fmt:bundle basename="i18n">
|
||||
<!-- topbar starts -->
|
||||
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
|
||||
<!-- topbar ends -->
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<jsp:include page="publiccontrol/leftmenubar.jsp"></jsp:include>
|
||||
<noscript>
|
||||
<div class="alert alert-block span10">
|
||||
<h4 class="alert-heading">
|
||||
<fmt:message key="warning" />
|
||||
!
|
||||
</h4>
|
||||
<p>
|
||||
<fmt:message key="warningcontent1" />
|
||||
<a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
|
||||
<fmt:message key="warningcontent2" />
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="content" class="span10">
|
||||
<!-- content starts -->
|
||||
<div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
|
||||
class="divider">/</span></li>
|
||||
<li><a href="script.jsp"><fmt:message
|
||||
key="scriptmanagement" /></a><span class="divider">/</span></li>
|
||||
<li><a href="plugin.jsp"><fmt:message
|
||||
key="script_jsp_makeScript" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid sortable">
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
<h2>
|
||||
<span><fmt:message key="plugin_jsp_plugins" />(usePlugins)</span>
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a> <a href="#" class="btn btn-round"><i
|
||||
class="icon-list"></i></a> <a href="#"
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content row-fluid">
|
||||
|
||||
<div id="pluginArea" class="listArea span9"></div>
|
||||
<div class=" span3 button-div">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="addPlugin" onClick="addPlugin();">
|
||||
<fmt:message key="plugin_jsp_add" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removePlugin" onClick="removePluginByClicked();">
|
||||
<fmt:message key="plugin_jsp_remove" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removeAllPlugin" onClick="clearPluginChoosedList();">
|
||||
<fmt:message key="plugin_jsp_clear" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/span-->
|
||||
<!-- Behavior start -->
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
<h2>
|
||||
<i></i>
|
||||
<fmt:message key="plugin_jsp_behavior" />
|
||||
(behaviors)
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a> <a href="#" class="btn btn-round"><i
|
||||
class="icon-list"></i></a> <a href="#"
|
||||
class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content row-fluid">
|
||||
<div id="behaviorArea" class="listArea span9"></div>
|
||||
<div class="span3 button-div">
|
||||
<div class="hide" id="insertBefore">
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="insert();">
|
||||
<fmt:message key="plugin_jsp_insertBefore" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="insertAfter();">
|
||||
<fmt:message key="plugin_jsp_insertAfter" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
id="removeBehavior_Plugin"
|
||||
onClick="removeInsertPluginByClicked();">
|
||||
<fmt:message key="plugin_jsp_remove" />
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
onClick="clearPluginMethodList();">
|
||||
<fmt:message key="plugin_jsp_clear" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="showPluginMethod" class="showPluginMethod"></div>
|
||||
</div>
|
||||
<!--/row-->
|
||||
<!-- content ends -->
|
||||
<div class="hide" id="submitBehaviors">
|
||||
<p>
|
||||
<fmt:message key="plugin_jsp_scriptName"></fmt:message>
|
||||
<input id="writeAScriptName" type="text" name="scriptName"
|
||||
size=20></input>
|
||||
</p>
|
||||
<p>
|
||||
<button class='btn-large' onClick="submitBehaviors(this);">
|
||||
<fmt:message key="plugin_jsp_submit" />
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--/#content.span10-->
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
<div class="modal hide fade " id="myModal_Plugin">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="plugin_jsp_addNewPlugin" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body" style="height: 260px;">
|
||||
<div class="inset scroll" id="choosePlugin"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="pluginFinish();" id="pluginFinish">
|
||||
<fmt:message key="plugin_jsp_finish" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="pluginCancel();" id="pluginCancel">
|
||||
<fmt:message key="plugin_jsp_cancel" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal hide fade " id="myModal_Behavior">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="plugin_jsp_chooseBehaviors" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row-fluid">
|
||||
<div class="span6 behavior-box scroll">
|
||||
<div id="insertPluginAreaPlugins"></div>
|
||||
</div>
|
||||
<div class="span6 behavior-box scroll">
|
||||
<div id="pluginMethod"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary btn-width"
|
||||
onClick="behaviorFinish();" id="behaviorFinish">
|
||||
<fmt:message key="plugin_jsp_finish" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-width" onClick=""
|
||||
id="behaviorCancel">
|
||||
<fmt:message key="plugin_jsp_cancel" />
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
|
||||
</div>
|
||||
|
||||
<!--/.fluid-container-->
|
||||
|
||||
<!-- external javascript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
|
||||
<script
|
||||
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
|
||||
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
|
||||
<script
|
||||
src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js'></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/pluginModel.js"></script>
|
||||
<script src="script/plugin-new.js"></script>
|
||||
<script src="script/behaviorsForm.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
|
@ -1,104 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="lib/github/css/github-6053501db2b69fd2b04652c6349117be14468ce4.css"
|
||||
media="screen" rel="stylesheet">
|
||||
<link href="css/index.css" media="screen" rel="stylesheet">
|
||||
<link href="css/register.css" media="screen" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<style type="text/css">
|
||||
/* body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.sidebar-nav {
|
||||
padding: 9px 0;
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="true clearfix" style="height: 50px">
|
||||
<div class="container clearfix">
|
||||
<a class="site-logo" href="index.jsp"><img id="bench4q"
|
||||
src="images/headerLogo.png" height="30" /></a>
|
||||
<ul class="top-nav logged_out">
|
||||
<li class="login"><a href="login.jsp"><fmt:message
|
||||
key="index_jsp_login" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>
|
||||
<fmt:message key="index_jsp_Title" />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="registerContainer">
|
||||
<div class="left ">
|
||||
<div class="tipContainer">
|
||||
<img src="images/tips.jpg" />
|
||||
</div>
|
||||
<div class="userInput">
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-username" src="images/username.jpg"><span> UserName: </span>
|
||||
<input id="username" name="username" tabindex="1" type="text"
|
||||
onchange="form_validation('username')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the username must
|
||||
be 5-20 letters or numbers</span>
|
||||
</div>
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-password" src="images/password.jpg"><span> Password: </span>
|
||||
<input id="password" name="password" tabindex="1" type="text"
|
||||
onchange="form_validation('password')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the password must
|
||||
be 6-20 letters or numbers </span>
|
||||
</div>
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-retype-password" src="images/retype.jpg"><span> Re-Password:
|
||||
</span> <input id="retype_pwd" name="retype_pwd" tabindex="1" type="text"
|
||||
onchange="form_validation('retype_pwd')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the
|
||||
retype-password is wrong</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="submitDiv">
|
||||
<input type="image" name="Submit" value="Register"
|
||||
src="images/submit.jpg"
|
||||
onMouseOver="this.src='images/submiton.jpg'"
|
||||
onMouseOut="this.src='images/submit.jpg'"
|
||||
onClick="javascript:password_validation();return false" />
|
||||
</div>
|
||||
<div class="submitDiv">
|
||||
<img name="Clear" src="images/clear.jpg"
|
||||
onMouseOver="this.src='images/clearon.jpg'"
|
||||
onMouseOut="this.src='images/clear.jpg'"
|
||||
onClick="javascript:clean();return false" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="bench4qLog">
|
||||
<img src="images/bench4qblog.jpg" />
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- for scripts -->
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
|
||||
<script src="script/register.js"></script>
|
||||
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="lib/github/css/github-6053501db2b69fd2b04652c6349117be14468ce4.css"
|
||||
media="screen" rel="stylesheet">
|
||||
<link href="css/index.css" media="screen" rel="stylesheet">
|
||||
<link href="css/register.css" media="screen" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<style type="text/css">
|
||||
/* body {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.sidebar-nav {
|
||||
padding: 9px 0;
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="true clearfix" style="height: 50px">
|
||||
<div class="container clearfix">
|
||||
<a class="site-logo" href="index.jsp"><img id="bench4q"
|
||||
src="images/headerLogo.png" height="30" /></a>
|
||||
<ul class="top-nav logged_out">
|
||||
<li class="login"><a href="login.jsp"><fmt:message
|
||||
key="index_jsp_login" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>
|
||||
<fmt:message key="index_jsp_Title" />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="registerContainer">
|
||||
<div class="left ">
|
||||
<div class="tipContainer">
|
||||
<img src="images/tips.jpg" />
|
||||
</div>
|
||||
<div class="userInput">
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-username" src="images/username.jpg"><span> UserName: </span>
|
||||
<input id="username" name="username" tabindex="1" type="text"
|
||||
onchange="form_validation('username')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the username must
|
||||
be 5-20 letters or numbers</span>
|
||||
</div>
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-password" src="images/password.jpg"><span> Password: </span>
|
||||
<input id="password" name="password" tabindex="1" type="text"
|
||||
onchange="form_validation('password')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the password must
|
||||
be 6-20 letters or numbers </span>
|
||||
</div>
|
||||
<div class="registerInput row-fluid">
|
||||
<img alt="bench4q-retype-password" src="images/retype.jpg"><span> Re-Password:
|
||||
</span> <input id="retype_pwd" name="retype_pwd" tabindex="1" type="text"
|
||||
onchange="form_validation('retype_pwd')">
|
||||
</div>
|
||||
<div class="hide">
|
||||
<img src="images/error.jpg"> <span>the
|
||||
retype-password is wrong</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="submitDiv">
|
||||
<input type="image" name="Submit" value="Register"
|
||||
src="images/submit.jpg"
|
||||
onMouseOver="this.src='images/submiton.jpg'"
|
||||
onMouseOut="this.src='images/submit.jpg'"
|
||||
onClick="javascript:password_validation();return false" />
|
||||
</div>
|
||||
<div class="submitDiv">
|
||||
<img name="Clear" src="images/clear.jpg"
|
||||
onMouseOver="this.src='images/clearon.jpg'"
|
||||
onMouseOut="this.src='images/clear.jpg'"
|
||||
onClick="javascript:clean();return false" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="bench4qLog">
|
||||
<img src="images/bench4qblog.jpg" />
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- for scripts -->
|
||||
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
|
||||
<script src="script/register.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,276 +1,276 @@
|
|||
function loadProperties() {
|
||||
jQuery.i18n.properties({// 加载资浏览器语言对应的资源文件
|
||||
name : 'i18n', // 资源文件名称
|
||||
path : 'i18n/', // 资源文件路径
|
||||
mode : 'map', // 用 Map 的方式使用资源文件中的值
|
||||
});
|
||||
}
|
||||
|
||||
function createBehaviorsForm(data, behaviorData, behaviorIndex) {
|
||||
var methodParams = new Array();
|
||||
var fieldHTML = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
methodParams.push(data[i]);
|
||||
}
|
||||
for (var j = 0; j < methodParams.length; j++) {
|
||||
var methodParamModel = new MethodParamModel(methodParams[j].name,
|
||||
methodParams[j].lable, methodParams[j].valueSeperator,
|
||||
methodParams[j].fieldSeperator, methodParams[j].paramType,
|
||||
methodParams[j].methodParamProperties);
|
||||
var methodParamProperties = new Array();
|
||||
for (var q = 0; q < methodParamModel.methodParamProperties.length; q++) {
|
||||
var methodParamPropertyModel = new MethodParamPropertyModel(
|
||||
methodParamModel.methodParamProperties[q].key,
|
||||
methodParamModel.methodParamProperties[q].value);
|
||||
methodParamProperties.push(methodParamPropertyModel);
|
||||
}
|
||||
var type = methodParamModel.paramType;
|
||||
var size = 0, cols = "", rows = "";
|
||||
for (var p = 0; p < methodParamProperties.length; p++) {
|
||||
var methodParamProertyModel = methodParamProperties[p];
|
||||
if (methodParamProertyModel.key == "size") {
|
||||
size = methodParamProertyModel.value;
|
||||
} else if (methodParamProertyModel.key == "cols") {
|
||||
cols = methodParamProertyModel.value;
|
||||
} else if (methodParamProertyModel.key == "rows") {
|
||||
rows = methodParamProertyModel.value;
|
||||
}
|
||||
}
|
||||
if (type == "Field") {
|
||||
fieldHTML += createField(methodParamModel.lable,
|
||||
methodParamModel.name, size, behaviorIndex);
|
||||
} else if (type == "MultiField") {
|
||||
fieldHTML += createMultiField(methodParamModel.lable,
|
||||
methodParamModel.name, size, behaviorIndex);
|
||||
} else if (type == "Table") {
|
||||
fieldHTML += createTable(methodParamModel, cols, behaviorIndex);
|
||||
} else if (type == "CheckBox") {
|
||||
fieldHTML += createCheckBox(methodParamModel, rows, behaviorIndex);
|
||||
}
|
||||
}
|
||||
return fieldHTML;
|
||||
}
|
||||
|
||||
|
||||
function createField(label, name, size, behaviorIndex) {
|
||||
if (size == 0) {
|
||||
size = 20;
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var div = document.createElement("div");
|
||||
var nameNode = document.createTextNode(name);
|
||||
var input = document.createElement("input");
|
||||
|
||||
$(divNode).attr("class", "Field sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(input).attr("type", "text");
|
||||
$(input).attr("size", size);
|
||||
$(input).attr("id", name + "_input");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(input);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
}
|
||||
|
||||
function createMultiField(label, name, size, behaviorIndex) {
|
||||
if (size == 0) {
|
||||
size = 20;
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(name + ":" + label);
|
||||
var div = document.createElement("div");
|
||||
var addFieldButton = document.createElement("button");
|
||||
var addFieldNode = document.createTextNode($.i18n
|
||||
.prop("addField"));
|
||||
var removeFieldButton = document.createElement("button");
|
||||
var removeFieldNode = document.createTextNode($.i18n
|
||||
.prop("removeField"));
|
||||
var br = document.createElement("br");
|
||||
var table = document.createElement("table");
|
||||
|
||||
$(divNode).attr("class", "MultiField sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(addFieldButton).attr("type", "submit");
|
||||
$(addFieldButton).attr("class", "btn-large");
|
||||
$(addFieldButton).attr("onClick",
|
||||
"addField(" + size + "," + behaviorIndex + ");");
|
||||
$(removeFieldButton).attr("type", "submit");
|
||||
$(removeFieldButton).attr("class", "btn-large");
|
||||
$(removeFieldButton).attr("onClick", "removeField(this)");
|
||||
$(table).attr("id", "addFieldTable_" + behaviorIndex);
|
||||
$(table).attr("class", "table-margin");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
addFieldButton.appendChild(addFieldNode);
|
||||
removeFieldButton.appendChild(removeFieldNode);
|
||||
div.appendChild(addFieldButton);
|
||||
div.appendChild(removeFieldButton);
|
||||
div.appendChild(br);
|
||||
div.appendChild(table);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
}
|
||||
|
||||
var field;
|
||||
function addField(size, addId) {
|
||||
field = $("#addFieldTable_" + addId).children().length;
|
||||
var data = "field_" + field + ":";
|
||||
field = field + 1;
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
newTdNode1.setAttribute("class", data);
|
||||
var textNode = document.createTextNode(data);
|
||||
var inputNode = document.createElement("input");
|
||||
inputNode.setAttribute("type", "text");
|
||||
inputNode.setAttribute("size", size);
|
||||
|
||||
newTdNode1.appendChild(textNode);
|
||||
newTdNode2.appendChild(inputNode);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
document.getElementById("addFieldTable_" + addId).appendChild(newTrNode);
|
||||
}
|
||||
|
||||
function removeField(selectedNode) {
|
||||
var table = selectedNode.nextSibling.nextSibling;
|
||||
var deletedNode = table.lastChild;
|
||||
table.removeChild(deletedNode);
|
||||
}
|
||||
|
||||
function createTable(methodParamModel, cols, behaviorIndex) {
|
||||
var name = methodParamModel.name;
|
||||
var label = methodParamModel.lable;
|
||||
var valueSeperator = methodParamModel.valueSeperator;
|
||||
var table_content = cols.split(valueSeperator);
|
||||
var tr = document.createElement("tr");
|
||||
for (var i = 0; i < table_content.length; i++) {
|
||||
var th = document.createElement("th");
|
||||
var text = document.createTextNode(table_content[i]);
|
||||
th.appendChild(text);
|
||||
tr.appendChild(th);
|
||||
}
|
||||
var tr_content = document.createElement("tr");
|
||||
for (var j = 0; j < table_content.length; j++) {
|
||||
var td_content = document.createElement("td");
|
||||
var text_content = document.createElement("input");
|
||||
text_content.setAttribute("type", "text");
|
||||
td_content.appendChild(text_content);
|
||||
tr_content.appendChild(td_content);
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var div = document.createElement("div");
|
||||
var nameNode = document.createTextNode(name);
|
||||
var br1 = document.createElement("br");
|
||||
var br2 = document.createElement("br");
|
||||
var addColButton = document.createElement("button");
|
||||
var addColNode = document.createTextNode($.i18n.prop("addCol"));
|
||||
var removeColButton = document.createElement("button");
|
||||
var removeColNode = document.createTextNode($.i18n
|
||||
.prop("removeCol"));
|
||||
var table = document.createElement("table");
|
||||
var thead = document.createElement("thead");
|
||||
var tbody = document.createElement("tbody");
|
||||
|
||||
$(divNode).attr("class", "Table sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(addColButton).attr("type", "submit");
|
||||
$(addColButton).attr("class", "btn-large");
|
||||
$(addColButton).attr("onClick", "addCol(this)");
|
||||
$(removeColButton).attr("type", "submit");
|
||||
$(removeColButton).attr("class", "btn-large");
|
||||
$(removeColButton).attr("onClick", "removeCol(this)");
|
||||
$(table).attr("class", behaviorIndex + "_operateTableCols");
|
||||
$(table).attr("class", "table-margin");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
addColButton.appendChild(addColNode);
|
||||
removeColButton.appendChild(removeColNode);
|
||||
thead.appendChild(tr);
|
||||
tbody.appendChild(tr_content);
|
||||
table.appendChild(thead);
|
||||
table.appendChild(tbody);
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(br1);
|
||||
div.appendChild(addColButton);
|
||||
div.appendChild(removeColButton);
|
||||
div.appendChild(br2);
|
||||
div.appendChild(table);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
|
||||
}
|
||||
|
||||
function addCol(selectedNode) {
|
||||
var tbody = selectedNode.nextSibling.nextSibling.nextSibling.lastChild;
|
||||
var length = tbody.previousSibling.firstChild.childNodes.length;
|
||||
var tr = document.createElement("tr");
|
||||
for (var i = 0; i < length; i++) {
|
||||
var td = document.createElement("td");
|
||||
var input = document.createElement("input");
|
||||
input.setAttribute("type", "text");
|
||||
td.appendChild(input);
|
||||
tr.appendChild(td);
|
||||
}
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
function removeCol(selectedNode) {
|
||||
var tbody = selectedNode.nextSibling.nextSibling.lastChild;
|
||||
var removeNode = tbody.lastChild;
|
||||
tbody.removeChild(removeNode);
|
||||
}
|
||||
|
||||
function createCheckBox(methodParamModel, rows, behaviorIndex) {
|
||||
var name = methodParamModel.name;
|
||||
var label = methodParamModel.lable;
|
||||
var valueSeperator = methodParamModel.valueSeperator;
|
||||
var cb_content = rows.split(valueSeperator);
|
||||
|
||||
var result = document.createElement("div");
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var div = document.createElement("div");
|
||||
var br = document.createElement("br");
|
||||
var divInput = document.createElement("div");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var nameNode = document.createTextNode(name);
|
||||
$(divNode).attr("class", "CheckBox sample_frame");
|
||||
$(divNode).attr("id", "checkbox_" + name + "_" + behaviorIndex);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(divInput).attr("class", "sample_sub_frame");
|
||||
p.appendChild(labelNode);
|
||||
for (var i = 0; i < cb_content.length; i++) {
|
||||
var checkBoxNode = document.createElement("input");
|
||||
var brInput = document.createElement("br");
|
||||
checkBoxNode.setAttribute("type", "checkbox");
|
||||
checkBoxNode.setAttribute("name", "checkbox_" + name + "_"
|
||||
+ behaviorIndex);
|
||||
checkBoxNode.setAttribute("value", cb_content[i]);
|
||||
var checkBoxValue = document.createTextNode(cb_content[i]);
|
||||
divInput.appendChild(checkBoxNode);
|
||||
divInput.appendChild(checkBoxValue);
|
||||
divInput.appendChild(brInput);
|
||||
}
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(br);
|
||||
div.appendChild(divInput);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
result.appendChild(divNode);
|
||||
return $(result).html();
|
||||
|
||||
function loadProperties() {
|
||||
jQuery.i18n.properties({// 加载资浏览器语言对应的资源文件
|
||||
name : 'i18n', // 资源文件名称
|
||||
path : 'i18n/', // 资源文件路径
|
||||
mode : 'map', // 用 Map 的方式使用资源文件中的值
|
||||
});
|
||||
}
|
||||
|
||||
function createBehaviorsForm(data, behaviorData, behaviorIndex) {
|
||||
var methodParams = new Array();
|
||||
var fieldHTML = "";
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
methodParams.push(data[i]);
|
||||
}
|
||||
for (var j = 0; j < methodParams.length; j++) {
|
||||
var methodParamModel = new MethodParamModel(methodParams[j].name,
|
||||
methodParams[j].lable, methodParams[j].valueSeperator,
|
||||
methodParams[j].fieldSeperator, methodParams[j].paramType,
|
||||
methodParams[j].methodParamProperties);
|
||||
var methodParamProperties = new Array();
|
||||
for (var q = 0; q < methodParamModel.methodParamProperties.length; q++) {
|
||||
var methodParamPropertyModel = new MethodParamPropertyModel(
|
||||
methodParamModel.methodParamProperties[q].key,
|
||||
methodParamModel.methodParamProperties[q].value);
|
||||
methodParamProperties.push(methodParamPropertyModel);
|
||||
}
|
||||
var type = methodParamModel.paramType;
|
||||
var size = 0, cols = "", rows = "";
|
||||
for (var p = 0; p < methodParamProperties.length; p++) {
|
||||
var methodParamProertyModel = methodParamProperties[p];
|
||||
if (methodParamProertyModel.key == "size") {
|
||||
size = methodParamProertyModel.value;
|
||||
} else if (methodParamProertyModel.key == "cols") {
|
||||
cols = methodParamProertyModel.value;
|
||||
} else if (methodParamProertyModel.key == "rows") {
|
||||
rows = methodParamProertyModel.value;
|
||||
}
|
||||
}
|
||||
if (type == "Field") {
|
||||
fieldHTML += createField(methodParamModel.lable,
|
||||
methodParamModel.name, size, behaviorIndex);
|
||||
} else if (type == "MultiField") {
|
||||
fieldHTML += createMultiField(methodParamModel.lable,
|
||||
methodParamModel.name, size, behaviorIndex);
|
||||
} else if (type == "Table") {
|
||||
fieldHTML += createTable(methodParamModel, cols, behaviorIndex);
|
||||
} else if (type == "CheckBox") {
|
||||
fieldHTML += createCheckBox(methodParamModel, rows, behaviorIndex);
|
||||
}
|
||||
}
|
||||
return fieldHTML;
|
||||
}
|
||||
|
||||
|
||||
function createField(label, name, size, behaviorIndex) {
|
||||
if (size == 0) {
|
||||
size = 20;
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var div = document.createElement("div");
|
||||
var nameNode = document.createTextNode(name);
|
||||
var input = document.createElement("input");
|
||||
|
||||
$(divNode).attr("class", "Field sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(input).attr("type", "text");
|
||||
$(input).attr("size", size);
|
||||
$(input).attr("id", name + "_input");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(input);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
}
|
||||
|
||||
function createMultiField(label, name, size, behaviorIndex) {
|
||||
if (size == 0) {
|
||||
size = 20;
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(name + ":" + label);
|
||||
var div = document.createElement("div");
|
||||
var addFieldButton = document.createElement("button");
|
||||
var addFieldNode = document.createTextNode($.i18n
|
||||
.prop("addField"));
|
||||
var removeFieldButton = document.createElement("button");
|
||||
var removeFieldNode = document.createTextNode($.i18n
|
||||
.prop("removeField"));
|
||||
var br = document.createElement("br");
|
||||
var table = document.createElement("table");
|
||||
|
||||
$(divNode).attr("class", "MultiField sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(addFieldButton).attr("type", "submit");
|
||||
$(addFieldButton).attr("class", "btn-large");
|
||||
$(addFieldButton).attr("onClick",
|
||||
"addField(" + size + "," + behaviorIndex + ");");
|
||||
$(removeFieldButton).attr("type", "submit");
|
||||
$(removeFieldButton).attr("class", "btn-large");
|
||||
$(removeFieldButton).attr("onClick", "removeField(this)");
|
||||
$(table).attr("id", "addFieldTable_" + behaviorIndex);
|
||||
$(table).attr("class", "table-margin");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
addFieldButton.appendChild(addFieldNode);
|
||||
removeFieldButton.appendChild(removeFieldNode);
|
||||
div.appendChild(addFieldButton);
|
||||
div.appendChild(removeFieldButton);
|
||||
div.appendChild(br);
|
||||
div.appendChild(table);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
}
|
||||
|
||||
var field;
|
||||
function addField(size, addId) {
|
||||
field = $("#addFieldTable_" + addId).children().length;
|
||||
var data = "field_" + field + ":";
|
||||
field = field + 1;
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
newTdNode1.setAttribute("class", data);
|
||||
var textNode = document.createTextNode(data);
|
||||
var inputNode = document.createElement("input");
|
||||
inputNode.setAttribute("type", "text");
|
||||
inputNode.setAttribute("size", size);
|
||||
|
||||
newTdNode1.appendChild(textNode);
|
||||
newTdNode2.appendChild(inputNode);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
document.getElementById("addFieldTable_" + addId).appendChild(newTrNode);
|
||||
}
|
||||
|
||||
function removeField(selectedNode) {
|
||||
var table = selectedNode.nextSibling.nextSibling;
|
||||
var deletedNode = table.lastChild;
|
||||
table.removeChild(deletedNode);
|
||||
}
|
||||
|
||||
function createTable(methodParamModel, cols, behaviorIndex) {
|
||||
var name = methodParamModel.name;
|
||||
var label = methodParamModel.lable;
|
||||
var valueSeperator = methodParamModel.valueSeperator;
|
||||
var table_content = cols.split(valueSeperator);
|
||||
var tr = document.createElement("tr");
|
||||
for (var i = 0; i < table_content.length; i++) {
|
||||
var th = document.createElement("th");
|
||||
var text = document.createTextNode(table_content[i]);
|
||||
th.appendChild(text);
|
||||
tr.appendChild(th);
|
||||
}
|
||||
var tr_content = document.createElement("tr");
|
||||
for (var j = 0; j < table_content.length; j++) {
|
||||
var td_content = document.createElement("td");
|
||||
var text_content = document.createElement("input");
|
||||
text_content.setAttribute("type", "text");
|
||||
td_content.appendChild(text_content);
|
||||
tr_content.appendChild(td_content);
|
||||
}
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var div = document.createElement("div");
|
||||
var nameNode = document.createTextNode(name);
|
||||
var br1 = document.createElement("br");
|
||||
var br2 = document.createElement("br");
|
||||
var addColButton = document.createElement("button");
|
||||
var addColNode = document.createTextNode($.i18n.prop("addCol"));
|
||||
var removeColButton = document.createElement("button");
|
||||
var removeColNode = document.createTextNode($.i18n
|
||||
.prop("removeCol"));
|
||||
var table = document.createElement("table");
|
||||
var thead = document.createElement("thead");
|
||||
var tbody = document.createElement("tbody");
|
||||
|
||||
$(divNode).attr("class", "Table sample_frame");
|
||||
$(divNode).attr("id", behaviorIndex + "_" + name);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(addColButton).attr("type", "submit");
|
||||
$(addColButton).attr("class", "btn-large");
|
||||
$(addColButton).attr("onClick", "addCol(this)");
|
||||
$(removeColButton).attr("type", "submit");
|
||||
$(removeColButton).attr("class", "btn-large");
|
||||
$(removeColButton).attr("onClick", "removeCol(this)");
|
||||
$(table).attr("class", behaviorIndex + "_operateTableCols");
|
||||
$(table).attr("class", "table-margin");
|
||||
|
||||
p.appendChild(labelNode);
|
||||
addColButton.appendChild(addColNode);
|
||||
removeColButton.appendChild(removeColNode);
|
||||
thead.appendChild(tr);
|
||||
tbody.appendChild(tr_content);
|
||||
table.appendChild(thead);
|
||||
table.appendChild(tbody);
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(br1);
|
||||
div.appendChild(addColButton);
|
||||
div.appendChild(removeColButton);
|
||||
div.appendChild(br2);
|
||||
div.appendChild(table);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
return divNode.outerHTML;
|
||||
|
||||
}
|
||||
|
||||
function addCol(selectedNode) {
|
||||
var tbody = selectedNode.nextSibling.nextSibling.nextSibling.lastChild;
|
||||
var length = tbody.previousSibling.firstChild.childNodes.length;
|
||||
var tr = document.createElement("tr");
|
||||
for (var i = 0; i < length; i++) {
|
||||
var td = document.createElement("td");
|
||||
var input = document.createElement("input");
|
||||
input.setAttribute("type", "text");
|
||||
td.appendChild(input);
|
||||
tr.appendChild(td);
|
||||
}
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
function removeCol(selectedNode) {
|
||||
var tbody = selectedNode.nextSibling.nextSibling.lastChild;
|
||||
var removeNode = tbody.lastChild;
|
||||
tbody.removeChild(removeNode);
|
||||
}
|
||||
|
||||
function createCheckBox(methodParamModel, rows, behaviorIndex) {
|
||||
var name = methodParamModel.name;
|
||||
var label = methodParamModel.lable;
|
||||
var valueSeperator = methodParamModel.valueSeperator;
|
||||
var cb_content = rows.split(valueSeperator);
|
||||
|
||||
var result = document.createElement("div");
|
||||
var divNode = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var div = document.createElement("div");
|
||||
var br = document.createElement("br");
|
||||
var divInput = document.createElement("div");
|
||||
var labelNode = document.createTextNode(label);
|
||||
var nameNode = document.createTextNode(name);
|
||||
$(divNode).attr("class", "CheckBox sample_frame");
|
||||
$(divNode).attr("id", "checkbox_" + name + "_" + behaviorIndex);
|
||||
$(div).attr("class", "sample_sub_frame");
|
||||
$(divInput).attr("class", "sample_sub_frame");
|
||||
p.appendChild(labelNode);
|
||||
for (var i = 0; i < cb_content.length; i++) {
|
||||
var checkBoxNode = document.createElement("input");
|
||||
var brInput = document.createElement("br");
|
||||
checkBoxNode.setAttribute("type", "checkbox");
|
||||
checkBoxNode.setAttribute("name", "checkbox_" + name + "_"
|
||||
+ behaviorIndex);
|
||||
checkBoxNode.setAttribute("value", cb_content[i]);
|
||||
var checkBoxValue = document.createTextNode(cb_content[i]);
|
||||
divInput.appendChild(checkBoxNode);
|
||||
divInput.appendChild(checkBoxValue);
|
||||
divInput.appendChild(brInput);
|
||||
}
|
||||
div.appendChild(nameNode);
|
||||
div.appendChild(br);
|
||||
div.appendChild(divInput);
|
||||
divNode.appendChild(p);
|
||||
divNode.appendChild(div);
|
||||
result.appendChild(divNode);
|
||||
return $(result).html();
|
||||
|
||||
}
|
|
@ -1,279 +1,279 @@
|
|||
var pluginNameList = new Array();
|
||||
var parameters = new HashMap();
|
||||
var parameterList = new HashMap();
|
||||
var pluginName;
|
||||
function loadUsePluigns(data) {
|
||||
for (var i = 0; i < data.usePlugins.length; i++) {
|
||||
var usePlugin = data.usePlugins[i];
|
||||
pluginNameList.push(usePlugin.id);
|
||||
}
|
||||
var selectNode = document.getElementsByName("usePlugins")[0];
|
||||
for (var j = 0; j < pluginNameList.length; j++) {
|
||||
var textNode = document.createTextNode(pluginNameList[j]);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", pluginNameList[j]);
|
||||
optionNode.appendChild(textNode);
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
}
|
||||
|
||||
function choosePlugin() {
|
||||
var plugin = document.getElementById("usePlugins");
|
||||
if (plugin.options[plugin.selectedIndex].value != 0) {
|
||||
pluginName = plugin.options[plugin.selectedIndex].value;
|
||||
}
|
||||
loadBehaviors();
|
||||
}
|
||||
var clickScriptId;
|
||||
function chooseBehavior() {
|
||||
var behaviorMethod = 0;
|
||||
var behaviors = document.getElementById("behaviors");
|
||||
if (behaviors.options[behaviors.selectedIndex].value != 0) {
|
||||
behaviorMethod = behaviors.options[behaviors.selectedIndex].value;
|
||||
}
|
||||
document.getElementById("showPluginMethodForm").innerHTML = "";
|
||||
var plugin_id = behaviorMethod.split("_")[0];
|
||||
var behavior_id = behaviorMethod.split("_")[1];
|
||||
clickScriptId = plugin_id + "_" + behavior_id;
|
||||
loadFormParameters(plugin_id, behavior_id);
|
||||
|
||||
}
|
||||
|
||||
function loadBehaviors() {
|
||||
$('#behaviors').html("");
|
||||
var selectNode = document.getElementsByName("behaviors")[0];
|
||||
var text = document.createTextNode("Please choose one behavior");
|
||||
var option = document.createElement("option");
|
||||
option.appendChild(text);
|
||||
selectNode.appendChild(option);
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
var id = item.Id;
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.use == pluginName) {
|
||||
var textNode = document.createTextNode(item.use + "_" + id
|
||||
+ "." + item.name + "_" + item.id);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", id + "_" + item.id);
|
||||
optionNode.appendChild(textNode);
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadFormParameters(plugin_id, behavior_id) {
|
||||
var plugin = "", method = "";
|
||||
alert("parameters");
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
if (item.Id == plugin_id) {
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.id == behavior_id) {
|
||||
plugin = item.use;
|
||||
method = item.name;
|
||||
$.each(item.parameters, function(i, item) {
|
||||
parameters.put(item.key, item.value);
|
||||
alert("key="+item.key+",value="+item.value);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
loadMethodParameters(plugin, method, plugin_id, behavior_id);
|
||||
}
|
||||
|
||||
function loadMethodParameters(plugin, method, plugin_id, behavior_id) {
|
||||
var behaviorData = plugin + "_" + plugin_id + "." + method + "_"
|
||||
+ behavior_id;
|
||||
var behaviorIndex = /*plugin_id+"_"+*/ behavior_id;
|
||||
$
|
||||
.post(
|
||||
"loadMethodParameters",
|
||||
{
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
},
|
||||
function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
var fieldHTML = createBehaviorsForm(data, behaviorData,
|
||||
behaviorIndex);
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>"
|
||||
+ "<h2>sample:<i>"
|
||||
+ behaviorData
|
||||
+ "</i></h2></div>";
|
||||
|
||||
documentHtml = "<div id='"
|
||||
+ behaviorIndex
|
||||
+ "' class=''><p class='hide'>"
|
||||
+ behaviorData
|
||||
+ "</p><div class='span10 box' style='margin-left:15px;'>"
|
||||
+ boxHeader + "<div class='box-content'>"
|
||||
+ fieldHTML + "</div></div></div>";
|
||||
document.getElementById("showPluginMethodForm").innerHTML += documentHtml;
|
||||
createForm(behaviorIndex);
|
||||
});
|
||||
}
|
||||
|
||||
function createForm(behaviorIndex) {
|
||||
var formNode = document.getElementById(behaviorIndex);
|
||||
var contents = formNode.lastChild.lastChild.childNodes;
|
||||
var contentLength = contents.length;
|
||||
for (var j = 0; j < contentLength; j++) {
|
||||
var type = $(contents[j]).attr("class");
|
||||
if (type == "Field sample_frame") {
|
||||
var key = contents[j].lastChild.firstChild.nodeValue;
|
||||
var value = parameters.get(key);
|
||||
if (value != "" && value != null) {
|
||||
$(contents[j].lastChild.lastChild).val(value);
|
||||
}
|
||||
} else if (type == "MultiField sample_frame") {
|
||||
var key = contents[j].firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var value = parameters.get(key);
|
||||
if(value==null){
|
||||
addField(20,behaviorIndex);
|
||||
}
|
||||
else {
|
||||
value = value.split(";");
|
||||
var fieldLength = value.length;
|
||||
for (var t = 0; t < fieldLength; t++) {
|
||||
addField(20, behaviorIndex);
|
||||
$($(contents[j]).find("table").children()[t]).find("input")
|
||||
.val(value[t]);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (type == "Table sample_frame") {
|
||||
var key = contents[j].lastChild.firstChild.nodeValue;
|
||||
|
||||
/*//参数不统一
|
||||
if(key=="header"){
|
||||
key="headers";
|
||||
}*/
|
||||
var value = parameters.get(key);
|
||||
alert("key="+key+",value="+value);
|
||||
if (value != "" && value != null) {
|
||||
value = parameters.get(key).split("|;");
|
||||
var table = $(contents[j]).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = value.length - 1;
|
||||
var tbody = $(contents[j]).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
var input = value[m].split("|");
|
||||
if (m != 0) {
|
||||
var selectedNode = contents[j].lastChild.firstChild.nextSibling.nextSibling;
|
||||
addCol(selectedNode);
|
||||
}
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
$(colNode).find("input").val(input[n]);
|
||||
alert("input["+n+"]="+input[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function saveFormModification() {
|
||||
alert("saveFormModification");
|
||||
var div = document.getElementById("showPluginMethodForm").firstChild;
|
||||
var plugin_method = div.firstChild.firstChild.nodeValue.split(".");
|
||||
var pluginId = plugin_method[0].split("_")[1];
|
||||
var behaviorId = plugin_method[1].split("_")[1];
|
||||
var contents = div.lastChild.lastChild.childNodes;
|
||||
var length = contents.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var node = contents[i];
|
||||
var key = "", value = "", temp = "";
|
||||
if ($(node).attr("class") == "Field sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
temp = $(node).find("input").val();
|
||||
if (temp != "") {
|
||||
value = temp;
|
||||
}
|
||||
} else if ($(node).attr("class") == "MultiField sample_frame") {
|
||||
key = node.firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var fieldNode = $(node).find("table").children();
|
||||
var fieldLength = $(fieldNode).length;
|
||||
for (var j = 0; j < fieldLength; j++) {
|
||||
temp = $(fieldNode[j]).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp;
|
||||
}
|
||||
if (j != fieldLength - 1) {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "Table sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var table = $(node).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = table.find("tbody").children().length;
|
||||
var tbody = $(node).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
temp = $(colNode).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp + "|";
|
||||
}
|
||||
}
|
||||
if (value != "") {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "CheckBox sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var id = $(node).attr("id");
|
||||
$('input[name=' + id + ']:checked').each(function() {
|
||||
temp = $(this).val();
|
||||
if (temp != "") {
|
||||
value += temp + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
parameterList.put(key, value);
|
||||
}
|
||||
|
||||
modifyJsonData(pluginId, behaviorId);
|
||||
}
|
||||
|
||||
function modifyJsonData(pluginId, behaviorId) {
|
||||
alert("modifyJsonData");
|
||||
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
if (item.Id == pluginId) {
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.id == behaviorId) {
|
||||
$.each(item.parameters, function(i, item) {
|
||||
if(parameterList.exists(item.key)){
|
||||
item.value = parameterList.get(item.key);
|
||||
}
|
||||
});
|
||||
/*var keyList=parameterList.getKeys();
|
||||
for(var i=0;i<keyList.length;i++){
|
||||
alert("keyList is "+keyList[i]);
|
||||
var parameterModel=new ParameterModel(keyList[i],parameterList.get(keyList[i]));
|
||||
item.parameters[i] = JSON.stringify(parameterModel);
|
||||
alert("json is "+item.parameters[i]);
|
||||
}
|
||||
alert("item.parameters="+item.parameters);*/
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
var pluginNameList = new Array();
|
||||
var parameters = new HashMap();
|
||||
var parameterList = new HashMap();
|
||||
var pluginName;
|
||||
function loadUsePluigns(data) {
|
||||
for (var i = 0; i < data.usePlugins.length; i++) {
|
||||
var usePlugin = data.usePlugins[i];
|
||||
pluginNameList.push(usePlugin.id);
|
||||
}
|
||||
var selectNode = document.getElementsByName("usePlugins")[0];
|
||||
for (var j = 0; j < pluginNameList.length; j++) {
|
||||
var textNode = document.createTextNode(pluginNameList[j]);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", pluginNameList[j]);
|
||||
optionNode.appendChild(textNode);
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
}
|
||||
|
||||
function choosePlugin() {
|
||||
var plugin = document.getElementById("usePlugins");
|
||||
if (plugin.options[plugin.selectedIndex].value != 0) {
|
||||
pluginName = plugin.options[plugin.selectedIndex].value;
|
||||
}
|
||||
loadBehaviors();
|
||||
}
|
||||
var clickScriptId;
|
||||
function chooseBehavior() {
|
||||
var behaviorMethod = 0;
|
||||
var behaviors = document.getElementById("behaviors");
|
||||
if (behaviors.options[behaviors.selectedIndex].value != 0) {
|
||||
behaviorMethod = behaviors.options[behaviors.selectedIndex].value;
|
||||
}
|
||||
document.getElementById("showPluginMethodForm").innerHTML = "";
|
||||
var plugin_id = behaviorMethod.split("_")[0];
|
||||
var behavior_id = behaviorMethod.split("_")[1];
|
||||
clickScriptId = plugin_id + "_" + behavior_id;
|
||||
loadFormParameters(plugin_id, behavior_id);
|
||||
|
||||
}
|
||||
|
||||
function loadBehaviors() {
|
||||
$('#behaviors').html("");
|
||||
var selectNode = document.getElementsByName("behaviors")[0];
|
||||
var text = document.createTextNode("Please choose one behavior");
|
||||
var option = document.createElement("option");
|
||||
option.appendChild(text);
|
||||
selectNode.appendChild(option);
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
var id = item.Id;
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.use == pluginName) {
|
||||
var textNode = document.createTextNode(item.use + "_" + id
|
||||
+ "." + item.name + "_" + item.id);
|
||||
var optionNode = document.createElement("option");
|
||||
optionNode.setAttribute("value", id + "_" + item.id);
|
||||
optionNode.appendChild(textNode);
|
||||
selectNode.appendChild(optionNode);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadFormParameters(plugin_id, behavior_id) {
|
||||
var plugin = "", method = "";
|
||||
alert("parameters");
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
if (item.Id == plugin_id) {
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.id == behavior_id) {
|
||||
plugin = item.use;
|
||||
method = item.name;
|
||||
$.each(item.parameters, function(i, item) {
|
||||
parameters.put(item.key, item.value);
|
||||
alert("key="+item.key+",value="+item.value);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
loadMethodParameters(plugin, method, plugin_id, behavior_id);
|
||||
}
|
||||
|
||||
function loadMethodParameters(plugin, method, plugin_id, behavior_id) {
|
||||
var behaviorData = plugin + "_" + plugin_id + "." + method + "_"
|
||||
+ behavior_id;
|
||||
var behaviorIndex = /*plugin_id+"_"+*/ behavior_id;
|
||||
$
|
||||
.post(
|
||||
"loadMethodParameters",
|
||||
{
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
},
|
||||
function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
var fieldHTML = createBehaviorsForm(data, behaviorData,
|
||||
behaviorIndex);
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>"
|
||||
+ "<h2>sample:<i>"
|
||||
+ behaviorData
|
||||
+ "</i></h2></div>";
|
||||
|
||||
documentHtml = "<div id='"
|
||||
+ behaviorIndex
|
||||
+ "' class=''><p class='hide'>"
|
||||
+ behaviorData
|
||||
+ "</p><div class='span10 box' style='margin-left:15px;'>"
|
||||
+ boxHeader + "<div class='box-content'>"
|
||||
+ fieldHTML + "</div></div></div>";
|
||||
document.getElementById("showPluginMethodForm").innerHTML += documentHtml;
|
||||
createForm(behaviorIndex);
|
||||
});
|
||||
}
|
||||
|
||||
function createForm(behaviorIndex) {
|
||||
var formNode = document.getElementById(behaviorIndex);
|
||||
var contents = formNode.lastChild.lastChild.childNodes;
|
||||
var contentLength = contents.length;
|
||||
for (var j = 0; j < contentLength; j++) {
|
||||
var type = $(contents[j]).attr("class");
|
||||
if (type == "Field sample_frame") {
|
||||
var key = contents[j].lastChild.firstChild.nodeValue;
|
||||
var value = parameters.get(key);
|
||||
if (value != "" && value != null) {
|
||||
$(contents[j].lastChild.lastChild).val(value);
|
||||
}
|
||||
} else if (type == "MultiField sample_frame") {
|
||||
var key = contents[j].firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var value = parameters.get(key);
|
||||
if(value==null){
|
||||
addField(20,behaviorIndex);
|
||||
}
|
||||
else {
|
||||
value = value.split(";");
|
||||
var fieldLength = value.length;
|
||||
for (var t = 0; t < fieldLength; t++) {
|
||||
addField(20, behaviorIndex);
|
||||
$($(contents[j]).find("table").children()[t]).find("input")
|
||||
.val(value[t]);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (type == "Table sample_frame") {
|
||||
var key = contents[j].lastChild.firstChild.nodeValue;
|
||||
|
||||
/*//参数不统一
|
||||
if(key=="header"){
|
||||
key="headers";
|
||||
}*/
|
||||
var value = parameters.get(key);
|
||||
alert("key="+key+",value="+value);
|
||||
if (value != "" && value != null) {
|
||||
value = parameters.get(key).split("|;");
|
||||
var table = $(contents[j]).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = value.length - 1;
|
||||
var tbody = $(contents[j]).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
var input = value[m].split("|");
|
||||
if (m != 0) {
|
||||
var selectedNode = contents[j].lastChild.firstChild.nextSibling.nextSibling;
|
||||
addCol(selectedNode);
|
||||
}
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
$(colNode).find("input").val(input[n]);
|
||||
alert("input["+n+"]="+input[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function saveFormModification() {
|
||||
alert("saveFormModification");
|
||||
var div = document.getElementById("showPluginMethodForm").firstChild;
|
||||
var plugin_method = div.firstChild.firstChild.nodeValue.split(".");
|
||||
var pluginId = plugin_method[0].split("_")[1];
|
||||
var behaviorId = plugin_method[1].split("_")[1];
|
||||
var contents = div.lastChild.lastChild.childNodes;
|
||||
var length = contents.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var node = contents[i];
|
||||
var key = "", value = "", temp = "";
|
||||
if ($(node).attr("class") == "Field sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
temp = $(node).find("input").val();
|
||||
if (temp != "") {
|
||||
value = temp;
|
||||
}
|
||||
} else if ($(node).attr("class") == "MultiField sample_frame") {
|
||||
key = node.firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var fieldNode = $(node).find("table").children();
|
||||
var fieldLength = $(fieldNode).length;
|
||||
for (var j = 0; j < fieldLength; j++) {
|
||||
temp = $(fieldNode[j]).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp;
|
||||
}
|
||||
if (j != fieldLength - 1) {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "Table sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var table = $(node).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = table.find("tbody").children().length;
|
||||
var tbody = $(node).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
temp = $(colNode).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp + "|";
|
||||
}
|
||||
}
|
||||
if (value != "") {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "CheckBox sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var id = $(node).attr("id");
|
||||
$('input[name=' + id + ']:checked').each(function() {
|
||||
temp = $(this).val();
|
||||
if (temp != "") {
|
||||
value += temp + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
parameterList.put(key, value);
|
||||
}
|
||||
|
||||
modifyJsonData(pluginId, behaviorId);
|
||||
}
|
||||
|
||||
function modifyJsonData(pluginId, behaviorId) {
|
||||
alert("modifyJsonData");
|
||||
|
||||
$.each(modelData.pages, function(i, item) {
|
||||
$.each(item.batches, function(i, item) {
|
||||
if (item.Id == pluginId) {
|
||||
$.each(item.behaviors, function(i, item) {
|
||||
if (item.id == behaviorId) {
|
||||
$.each(item.parameters, function(i, item) {
|
||||
if(parameterList.exists(item.key)){
|
||||
item.value = parameterList.get(item.key);
|
||||
}
|
||||
});
|
||||
/*var keyList=parameterList.getKeys();
|
||||
for(var i=0;i<keyList.length;i++){
|
||||
alert("keyList is "+keyList[i]);
|
||||
var parameterModel=new ParameterModel(keyList[i],parameterList.get(keyList[i]));
|
||||
item.parameters[i] = JSON.stringify(parameterModel);
|
||||
alert("json is "+item.parameters[i]);
|
||||
}
|
||||
alert("item.parameters="+item.parameters);*/
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,478 +1,478 @@
|
|||
var pluginChoosedList = new Array();
|
||||
var pluginIndex = new HashMap();
|
||||
var pluginList = new Array();
|
||||
var pluginMethodList = new Array();
|
||||
var usePluginList = new Array();
|
||||
var behaviors = new Array();
|
||||
var clickPluginMethodNode = -1;
|
||||
var clickPluginChoosedNode = 0;
|
||||
var place = "";
|
||||
$(document).ready(function() {
|
||||
loadPluginList();
|
||||
|
||||
});
|
||||
|
||||
function loadPluginList() {
|
||||
$.post("loadPlugin", {}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> pluginList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
pluginList.push(data[i]);
|
||||
pluginIndex.put(data[i], 0);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getMethod(pluglin) {
|
||||
var aMethodList = "";
|
||||
$.post("loadMethod", {
|
||||
pluginName : plugin
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> methodList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
aMethodList.push(data[i]);
|
||||
}
|
||||
});
|
||||
return aMethodList;
|
||||
}
|
||||
|
||||
function addPlugin() {
|
||||
var html = "";
|
||||
for (var j = 0; j < pluginList.length; j++) {
|
||||
|
||||
html += createLineWithRadio(pluginList[j], "plugin");
|
||||
}
|
||||
$('#choosePlugin').html(html);
|
||||
$('#myModal_Plugin').modal('show');
|
||||
|
||||
$("input:radio").click(function() {
|
||||
$(this).attr("checked", "checked");
|
||||
});
|
||||
}
|
||||
|
||||
function createLineWithRadio(lineText, nameAttr) {
|
||||
var textNode = document.createTextNode(lineText);
|
||||
var divNode = document.createElement("div");
|
||||
var inputNode = document.createElement("input");
|
||||
var brNode = document.createElement("br");
|
||||
inputNode.setAttribute("type", "radio");
|
||||
inputNode.setAttribute("name", nameAttr);
|
||||
inputNode.setAttribute("class", "chooseOnePlugin");
|
||||
inputNode.setAttribute("value", lineText);
|
||||
divNode.appendChild(inputNode);
|
||||
divNode.appendChild(textNode);
|
||||
divNode.appendChild(brNode);
|
||||
return $(divNode).html() + "<br>";
|
||||
}
|
||||
|
||||
function createALine(pluginName, index, list) {
|
||||
var div = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var i = document.createElement("i");
|
||||
var textNode = document.createTextNode(pluginName);
|
||||
div.setAttribute("id", index);
|
||||
i.setAttribute("class", "icon-hand-right");
|
||||
p.setAttribute("id", index);
|
||||
p.setAttribute("class", "");
|
||||
if (list == "pluginMethodList") {
|
||||
p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
|
||||
} else if (list == "pluginChoosedList") {
|
||||
p.setAttribute("onClick", "choosePlugin(" + index + ");");
|
||||
}
|
||||
p.setAttribute("style", "cursor:pointer;width:85%");
|
||||
p.appendChild(i);
|
||||
p.appendChild(textNode);
|
||||
div.appendChild(p);
|
||||
return div;
|
||||
}
|
||||
|
||||
function choosePlugin(index) {
|
||||
clickPluginChoosedNode = index;
|
||||
var pluginChoosedNode = $('#pluginArea').children();
|
||||
var length = pluginChoosedNode.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (i == clickPluginChoosedNode) {
|
||||
$(pluginChoosedNode[i]).find("p").attr("class", "visited");
|
||||
} else {
|
||||
$(pluginChoosedNode[i]).find("p").attr("class", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pluginFinish() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
var pluginName;
|
||||
var item = $("input[type='radio']:checked").val();
|
||||
|
||||
var aPluginIndex = pluginIndex.get(item);
|
||||
pluginIndex.put(item, aPluginIndex + 1);
|
||||
pluginName = item + "_" + aPluginIndex;
|
||||
|
||||
pluginChoosedList.push(pluginName);
|
||||
createPluginChoosedLines();
|
||||
}
|
||||
|
||||
function createPluginChoosedLines() {
|
||||
document.getElementById('pluginArea').innerHTML = "";
|
||||
for (var j = 0; j < pluginChoosedList.length; j++) {
|
||||
var div = createALine(pluginChoosedList[j], j, "pluginChoosedList");
|
||||
document.getElementById('pluginArea').appendChild(div);
|
||||
}
|
||||
}
|
||||
|
||||
function removePluginByClicked() {
|
||||
var length = pluginChoosedList.length;
|
||||
for (var i = parseInt(clickPluginChoosedNode + 1); i < length; i++) {
|
||||
pluginChoosedList[i - 1] = pluginChoosedList[i];
|
||||
}
|
||||
pluginChoosedList.splice(length - 1, 1);
|
||||
createPluginChoosedLines();
|
||||
}
|
||||
|
||||
function clearPluginChoosedList() {
|
||||
pluginChoosedList.splice(0, pluginChoosedList.length);
|
||||
for (var i = 0; i < pluginList.length; i++) {
|
||||
pluginIndex.put(pluginList[i], 0);
|
||||
}
|
||||
document.getElementById('pluginArea').innerHTML = "";
|
||||
}
|
||||
|
||||
function insert() {
|
||||
place = "before";
|
||||
insertPlugin();
|
||||
}
|
||||
|
||||
function insertAfter() {
|
||||
place = "after";
|
||||
insertPlugin();
|
||||
}
|
||||
|
||||
function insertPlugin() {
|
||||
|
||||
document.getElementById("pluginMethod").innerHTML = "";
|
||||
$('#myModal_Behavior').modal('show');
|
||||
var chooesedPluginHtml = "";
|
||||
for (var i = 0; i < pluginChoosedList.length; i++) {
|
||||
chooesedPluginHtml += createLineWithRadio(pluginChoosedList[i],
|
||||
"plugin");
|
||||
}
|
||||
$("#insertPluginAreaPlugins").html(chooesedPluginHtml);
|
||||
}
|
||||
|
||||
$('#insertPluginAreaPlugins').click(function() {
|
||||
var item = $("input[type='radio']:checked").val();
|
||||
showInsertPlugin(item);
|
||||
});
|
||||
|
||||
function showInsertPlugin(pluginName) {
|
||||
getMethodList(pluginName);
|
||||
}
|
||||
|
||||
function getMethodList(methodData) {
|
||||
var methodHtml = "";
|
||||
var methodList = new Array();
|
||||
var plugin_method_List = new Array();
|
||||
|
||||
var type = methodData.split("_");
|
||||
var plugin = type[0];
|
||||
|
||||
$.post("loadMethod", {
|
||||
pluginName : plugin
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> methodList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
plugin_method_List.push(methodData + "." + data[i]);// httpPlugin_0.post
|
||||
methodList.push(data[i]);
|
||||
methodHtml += createLineWithRadio(methodList[i], "method");
|
||||
}
|
||||
document.getElementById("pluginMethod").innerHTML = methodHtml;
|
||||
});
|
||||
}
|
||||
|
||||
function behaviorFinish() {
|
||||
var plugin = $("input[name='plugin']:checked").val();
|
||||
var method = $("input[name='method']:checked").val();
|
||||
if (plugin != null && plugin != "" && method != null && method != "") {
|
||||
showPluginMethod(plugin, method);
|
||||
} else {
|
||||
alert("The plugin or the method shouldn't be null!");
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
}
|
||||
}
|
||||
|
||||
var mark;
|
||||
function showPluginMethod(plugin, method) {
|
||||
var behaviorData = plugin + "." + method;
|
||||
var length = pluginMethodList.length;
|
||||
alert("pluginMehtodList.length="+pluginMethodList.length);
|
||||
var documentChild = document.getElementById("showPluginMethod").childNodes;
|
||||
if (place == "before") {
|
||||
for (var j = length - 1; j >= clickPluginMethodNode; j--) {
|
||||
pluginMethodList[j + 1] = pluginMethodList[j];
|
||||
$(documentChild[j]).attr("id", parseInt(j + 1));
|
||||
}
|
||||
mark = clickPluginMethodNode;
|
||||
clickPluginMethodNode=parseInt(clickPluginMethodNode + 1);
|
||||
pluginMethodList[mark] = behaviorData;
|
||||
} else if (place == "after") {
|
||||
mark = parseInt(clickPluginMethodNode + 1);
|
||||
if (clickPluginMethodNode == parseInt(length - 1)
|
||||
&& clickPluginMethodNode != -1) {
|
||||
pluginMethodList.push(behaviorData);
|
||||
} else {
|
||||
for (var j = parseInt(length - 1); j >= mark; j--) {
|
||||
pluginMethodList[j + 1] = pluginMethodList[j];
|
||||
$(documentChild[j]).attr("id", parseInt(j + 1));
|
||||
}
|
||||
pluginMethodList[mark] = behaviorData;
|
||||
}
|
||||
}
|
||||
$('#insertBefore').attr("class", "show");
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
/*loadMethodParams(behaviorData,mark);*/
|
||||
createPluginMethodLines();
|
||||
}
|
||||
|
||||
function createPluginMethodLines() {
|
||||
document.getElementById("showPluginMethod").innerHTML = "";
|
||||
document.getElementById('behaviorArea').innerHTML = "";
|
||||
for (var j = 0; j < pluginMethodList.length; j++) {
|
||||
var div = createALine(pluginMethodList[j], j, "pluginMethodList");
|
||||
if(j==clickPluginMethodNode){
|
||||
$(div).find("p").attr("class","visited");
|
||||
}
|
||||
document.getElementById('behaviorArea').appendChild(div);
|
||||
loadMethodParams(pluginMethodList[j], j);
|
||||
}
|
||||
}
|
||||
|
||||
function showMethodDocument(selectedNode) {
|
||||
clickPluginMethodNode = parseInt($(selectedNode).attr("id"));
|
||||
var length = $("#showPluginMethod").children().length;
|
||||
var behaviorAreaChild = $('#behaviorArea').children();
|
||||
var div = $("#showPluginMethod").children();
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (behaviorAreaChild[i].getAttribute("id") != clickPluginMethodNode) {
|
||||
$(behaviorAreaChild[i]).find("p").attr("class", "");
|
||||
} else {
|
||||
$(behaviorAreaChild[i]).find("p").attr("class", "visited");
|
||||
}
|
||||
}
|
||||
for (var j = 0; j < length; j++) {
|
||||
if (div[j].getAttribute("id") == clickPluginMethodNode) {
|
||||
$(div[j]).show();
|
||||
} else {
|
||||
$(div[j]).hide();
|
||||
}
|
||||
}
|
||||
$('#submitBehaviors').attr("class", "show");
|
||||
}
|
||||
|
||||
function removeInsertPluginByClicked() {
|
||||
var length = $('#behaviorArea').children().length;
|
||||
var removeDocumentNode = document.getElementById("showPluginMethod").childNodes;
|
||||
for (var i = parseInt(clickPluginMethodNode + 1); i < length; i++) {
|
||||
pluginMethodList[i - 1] = pluginMethodList[i];
|
||||
}
|
||||
pluginMethodList.splice(length - 1, 1);// js Array remove element
|
||||
createPluginMethodLines();
|
||||
for (var j = 0; j < length; j++) {
|
||||
if ($(removeDocumentNode[j]).attr("id") == clickPluginMethodNode) {
|
||||
document.getElementById("showPluginMethod").removeChild(
|
||||
removeDocumentNode[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearPluginMethodList() {
|
||||
pluginMethodList.splice(0, pluginMethodList.length);
|
||||
document.getElementById('behaviorArea').innerHTML = "";
|
||||
document.getElementById("showPluginMethod").innerHTML = "";
|
||||
$('#submitBehaviors').attr("class", "hide");
|
||||
}
|
||||
|
||||
function loadMethodParams(behaviorData, behaviorIndex) {
|
||||
alert("loadMehtodParams");
|
||||
var temp = behaviorData.split('.');
|
||||
var plugin = temp[0].split('_')[0];
|
||||
var method = temp[1];
|
||||
|
||||
$.post("loadMethodParameters", {
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>" + "<h2>sample:<i>"
|
||||
+ behaviorData + "</i></h2></div>";
|
||||
var fieldHTML=createBehaviorsForm(data, behaviorData, behaviorIndex);
|
||||
documentHtml = "<div id='"
|
||||
+ behaviorIndex
|
||||
+ "' class='hide'><p class='hide'>"
|
||||
+ behaviorData
|
||||
+ "</p><div class='span12 box' style='margin-left:-2px;'>"
|
||||
+ boxHeader
|
||||
+ "<div class='box-content'>"
|
||||
+ fieldHTML
|
||||
+ "</div><div class='left table-margin'><button class='btn btn-primary btn-width' type='submit' onClick='saveBehavior(this);'>"
|
||||
+ $.i18n.prop("save")
|
||||
+ "</button>"
|
||||
+ " <button class='btn btn-primary btn-width' type='submit' onClick='cancelBehavior(this);'>"
|
||||
+ $.i18n.prop("cancel") + "</button></div></div></div>";
|
||||
|
||||
document.getElementById("showPluginMethod").innerHTML += documentHtml;
|
||||
});
|
||||
}
|
||||
function saveBehavior(selectedNode) {
|
||||
var uploadNode = selectedNode.parentNode.previousSibling;
|
||||
var div = uploadNode.childNodes;
|
||||
var length = div.length;
|
||||
var behaviorIndex = 0, use = "", name = "", type = "";
|
||||
var plugin_method = selectedNode.parentNode.parentNode.parentNode.firstChild.firstChild.nodeValue
|
||||
.split(".");
|
||||
name = plugin_method[1];
|
||||
use = plugin_method[0].split("_")[0];
|
||||
if (use == "timer") {
|
||||
type = "TIMERBEHAVIOR";
|
||||
} else if(use=="http"){
|
||||
type = "USERBEHAVIOR";
|
||||
}
|
||||
var parameters = new Array();
|
||||
for (var i = 0; i < length; i++) {
|
||||
var node = div[i];
|
||||
var nodeId = $(node).attr("id").split("_");
|
||||
behaviorIndex = nodeId[0];
|
||||
var parameterModel;
|
||||
var key = "", value = "", temp = "";
|
||||
if ($(node).attr("class") == "Field sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
temp = $(node).find("input").val();
|
||||
if (temp != "") {
|
||||
value = temp;
|
||||
}
|
||||
} else if ($(node).attr("class") == "MultiField sample_frame") {
|
||||
key = node.firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var fieldNode = $(node).find("table").children();
|
||||
var fieldLength = $(fieldNode).length;
|
||||
for (var j = 0; j < fieldLength; j++) {
|
||||
temp = $(fieldNode[j]).find("input").val();
|
||||
if(temp!=""){
|
||||
value += temp;
|
||||
}
|
||||
if (j!=fieldLength-1) {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "Table sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var table = $(node).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = table.find("tbody").children().length;
|
||||
var tbody = $(node).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
temp = $(colNode).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp + "|";
|
||||
}
|
||||
}
|
||||
if (value != "") {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "CheckBox sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var id = $(node).attr("id");
|
||||
$('input[name=' + id + ']:checked').each(function() {
|
||||
temp = $(this).val();
|
||||
if (temp != "") {
|
||||
value += temp + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
if (value != "") {
|
||||
parameterModel = new ParameterModel(key, value);
|
||||
parameters.push(parameterModel);
|
||||
}
|
||||
}
|
||||
var behaviorModel = new BehaviorModel(behaviorIndex, use, name, type,
|
||||
parameters);
|
||||
behaviors.push(behaviorModel);
|
||||
alert("save success!");
|
||||
}
|
||||
|
||||
function submitBehaviors(selectedNode) {
|
||||
var scriptName = $(selectedNode.parentNode.parentNode).find("input").val();
|
||||
if (scriptName == null || scriptName == "") {
|
||||
alert("Please input scriptName.");
|
||||
return;
|
||||
}
|
||||
if (behaviors.length == 0) {
|
||||
alert("Please save the behavior or fill in the form.");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < pluginChoosedList.length; i++) {
|
||||
var id = pluginChoosedList[i].split("_")[0];
|
||||
var name = "";
|
||||
var parameters = new Array();
|
||||
if (id == "http") {
|
||||
name = "Http";
|
||||
} else if (id == "timer") {
|
||||
name = "ConstantTimer";
|
||||
}
|
||||
var usePluginModel = new UsePluginModel(id, name, parameters);
|
||||
usePluginList.push(usePluginModel);
|
||||
}
|
||||
var scriptModel = new PluginEditScriptRequestModel(behaviors,
|
||||
usePluginList, scriptName);
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "uploadPluginEditedScript",
|
||||
contentType : "application/json",
|
||||
data : JSON.stringify(scriptModel),
|
||||
success : function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
window.location.replace("script.jsp");
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelBehavior(selectedNode) {
|
||||
var divNode = selectedNode.parentNode.parentNode.parentNode;
|
||||
$(divNode).hide();
|
||||
}
|
||||
|
||||
$('#pluginCancel').click(function() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
});
|
||||
|
||||
$('#behaviorCancel').click(function() {
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
});
|
||||
var pluginChoosedList = new Array();
|
||||
var pluginIndex = new HashMap();
|
||||
var pluginList = new Array();
|
||||
var pluginMethodList = new Array();
|
||||
var usePluginList = new Array();
|
||||
var behaviors = new Array();
|
||||
var clickPluginMethodNode = -1;
|
||||
var clickPluginChoosedNode = 0;
|
||||
var place = "";
|
||||
$(document).ready(function() {
|
||||
loadPluginList();
|
||||
|
||||
});
|
||||
|
||||
function loadPluginList() {
|
||||
$.post("loadPlugin", {}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> pluginList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
pluginList.push(data[i]);
|
||||
pluginIndex.put(data[i], 0);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getMethod(pluglin) {
|
||||
var aMethodList = "";
|
||||
$.post("loadMethod", {
|
||||
pluginName : plugin
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> methodList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
aMethodList.push(data[i]);
|
||||
}
|
||||
});
|
||||
return aMethodList;
|
||||
}
|
||||
|
||||
function addPlugin() {
|
||||
var html = "";
|
||||
for (var j = 0; j < pluginList.length; j++) {
|
||||
|
||||
html += createLineWithRadio(pluginList[j], "plugin");
|
||||
}
|
||||
$('#choosePlugin').html(html);
|
||||
$('#myModal_Plugin').modal('show');
|
||||
|
||||
$("input:radio").click(function() {
|
||||
$(this).attr("checked", "checked");
|
||||
});
|
||||
}
|
||||
|
||||
function createLineWithRadio(lineText, nameAttr) {
|
||||
var textNode = document.createTextNode(lineText);
|
||||
var divNode = document.createElement("div");
|
||||
var inputNode = document.createElement("input");
|
||||
var brNode = document.createElement("br");
|
||||
inputNode.setAttribute("type", "radio");
|
||||
inputNode.setAttribute("name", nameAttr);
|
||||
inputNode.setAttribute("class", "chooseOnePlugin");
|
||||
inputNode.setAttribute("value", lineText);
|
||||
divNode.appendChild(inputNode);
|
||||
divNode.appendChild(textNode);
|
||||
divNode.appendChild(brNode);
|
||||
return $(divNode).html() + "<br>";
|
||||
}
|
||||
|
||||
function createALine(pluginName, index, list) {
|
||||
var div = document.createElement("div");
|
||||
var p = document.createElement("p");
|
||||
var i = document.createElement("i");
|
||||
var textNode = document.createTextNode(pluginName);
|
||||
div.setAttribute("id", index);
|
||||
i.setAttribute("class", "icon-hand-right");
|
||||
p.setAttribute("id", index);
|
||||
p.setAttribute("class", "");
|
||||
if (list == "pluginMethodList") {
|
||||
p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
|
||||
} else if (list == "pluginChoosedList") {
|
||||
p.setAttribute("onClick", "choosePlugin(" + index + ");");
|
||||
}
|
||||
p.setAttribute("style", "cursor:pointer;width:85%");
|
||||
p.appendChild(i);
|
||||
p.appendChild(textNode);
|
||||
div.appendChild(p);
|
||||
return div;
|
||||
}
|
||||
|
||||
function choosePlugin(index) {
|
||||
clickPluginChoosedNode = index;
|
||||
var pluginChoosedNode = $('#pluginArea').children();
|
||||
var length = pluginChoosedNode.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (i == clickPluginChoosedNode) {
|
||||
$(pluginChoosedNode[i]).find("p").attr("class", "visited");
|
||||
} else {
|
||||
$(pluginChoosedNode[i]).find("p").attr("class", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pluginFinish() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
var pluginName;
|
||||
var item = $("input[type='radio']:checked").val();
|
||||
|
||||
var aPluginIndex = pluginIndex.get(item);
|
||||
pluginIndex.put(item, aPluginIndex + 1);
|
||||
pluginName = item + "_" + aPluginIndex;
|
||||
|
||||
pluginChoosedList.push(pluginName);
|
||||
createPluginChoosedLines();
|
||||
}
|
||||
|
||||
function createPluginChoosedLines() {
|
||||
document.getElementById('pluginArea').innerHTML = "";
|
||||
for (var j = 0; j < pluginChoosedList.length; j++) {
|
||||
var div = createALine(pluginChoosedList[j], j, "pluginChoosedList");
|
||||
document.getElementById('pluginArea').appendChild(div);
|
||||
}
|
||||
}
|
||||
|
||||
function removePluginByClicked() {
|
||||
var length = pluginChoosedList.length;
|
||||
for (var i = parseInt(clickPluginChoosedNode + 1); i < length; i++) {
|
||||
pluginChoosedList[i - 1] = pluginChoosedList[i];
|
||||
}
|
||||
pluginChoosedList.splice(length - 1, 1);
|
||||
createPluginChoosedLines();
|
||||
}
|
||||
|
||||
function clearPluginChoosedList() {
|
||||
pluginChoosedList.splice(0, pluginChoosedList.length);
|
||||
for (var i = 0; i < pluginList.length; i++) {
|
||||
pluginIndex.put(pluginList[i], 0);
|
||||
}
|
||||
document.getElementById('pluginArea').innerHTML = "";
|
||||
}
|
||||
|
||||
function insert() {
|
||||
place = "before";
|
||||
insertPlugin();
|
||||
}
|
||||
|
||||
function insertAfter() {
|
||||
place = "after";
|
||||
insertPlugin();
|
||||
}
|
||||
|
||||
function insertPlugin() {
|
||||
|
||||
document.getElementById("pluginMethod").innerHTML = "";
|
||||
$('#myModal_Behavior').modal('show');
|
||||
var chooesedPluginHtml = "";
|
||||
for (var i = 0; i < pluginChoosedList.length; i++) {
|
||||
chooesedPluginHtml += createLineWithRadio(pluginChoosedList[i],
|
||||
"plugin");
|
||||
}
|
||||
$("#insertPluginAreaPlugins").html(chooesedPluginHtml);
|
||||
}
|
||||
|
||||
$('#insertPluginAreaPlugins').click(function() {
|
||||
var item = $("input[type='radio']:checked").val();
|
||||
showInsertPlugin(item);
|
||||
});
|
||||
|
||||
function showInsertPlugin(pluginName) {
|
||||
getMethodList(pluginName);
|
||||
}
|
||||
|
||||
function getMethodList(methodData) {
|
||||
var methodHtml = "";
|
||||
var methodList = new Array();
|
||||
var plugin_method_List = new Array();
|
||||
|
||||
var type = methodData.split("_");
|
||||
var plugin = type[0];
|
||||
|
||||
$.post("loadMethod", {
|
||||
pluginName : plugin
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;// List<String> methodList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
plugin_method_List.push(methodData + "." + data[i]);// httpPlugin_0.post
|
||||
methodList.push(data[i]);
|
||||
methodHtml += createLineWithRadio(methodList[i], "method");
|
||||
}
|
||||
document.getElementById("pluginMethod").innerHTML = methodHtml;
|
||||
});
|
||||
}
|
||||
|
||||
function behaviorFinish() {
|
||||
var plugin = $("input[name='plugin']:checked").val();
|
||||
var method = $("input[name='method']:checked").val();
|
||||
if (plugin != null && plugin != "" && method != null && method != "") {
|
||||
showPluginMethod(plugin, method);
|
||||
} else {
|
||||
alert("The plugin or the method shouldn't be null!");
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
}
|
||||
}
|
||||
|
||||
var mark;
|
||||
function showPluginMethod(plugin, method) {
|
||||
var behaviorData = plugin + "." + method;
|
||||
var length = pluginMethodList.length;
|
||||
alert("pluginMehtodList.length="+pluginMethodList.length);
|
||||
var documentChild = document.getElementById("showPluginMethod").childNodes;
|
||||
if (place == "before") {
|
||||
for (var j = length - 1; j >= clickPluginMethodNode; j--) {
|
||||
pluginMethodList[j + 1] = pluginMethodList[j];
|
||||
$(documentChild[j]).attr("id", parseInt(j + 1));
|
||||
}
|
||||
mark = clickPluginMethodNode;
|
||||
clickPluginMethodNode=parseInt(clickPluginMethodNode + 1);
|
||||
pluginMethodList[mark] = behaviorData;
|
||||
} else if (place == "after") {
|
||||
mark = parseInt(clickPluginMethodNode + 1);
|
||||
if (clickPluginMethodNode == parseInt(length - 1)
|
||||
&& clickPluginMethodNode != -1) {
|
||||
pluginMethodList.push(behaviorData);
|
||||
} else {
|
||||
for (var j = parseInt(length - 1); j >= mark; j--) {
|
||||
pluginMethodList[j + 1] = pluginMethodList[j];
|
||||
$(documentChild[j]).attr("id", parseInt(j + 1));
|
||||
}
|
||||
pluginMethodList[mark] = behaviorData;
|
||||
}
|
||||
}
|
||||
$('#insertBefore').attr("class", "show");
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
/*loadMethodParams(behaviorData,mark);*/
|
||||
createPluginMethodLines();
|
||||
}
|
||||
|
||||
function createPluginMethodLines() {
|
||||
document.getElementById("showPluginMethod").innerHTML = "";
|
||||
document.getElementById('behaviorArea').innerHTML = "";
|
||||
for (var j = 0; j < pluginMethodList.length; j++) {
|
||||
var div = createALine(pluginMethodList[j], j, "pluginMethodList");
|
||||
if(j==clickPluginMethodNode){
|
||||
$(div).find("p").attr("class","visited");
|
||||
}
|
||||
document.getElementById('behaviorArea').appendChild(div);
|
||||
loadMethodParams(pluginMethodList[j], j);
|
||||
}
|
||||
}
|
||||
|
||||
function showMethodDocument(selectedNode) {
|
||||
clickPluginMethodNode = parseInt($(selectedNode).attr("id"));
|
||||
var length = $("#showPluginMethod").children().length;
|
||||
var behaviorAreaChild = $('#behaviorArea').children();
|
||||
var div = $("#showPluginMethod").children();
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (behaviorAreaChild[i].getAttribute("id") != clickPluginMethodNode) {
|
||||
$(behaviorAreaChild[i]).find("p").attr("class", "");
|
||||
} else {
|
||||
$(behaviorAreaChild[i]).find("p").attr("class", "visited");
|
||||
}
|
||||
}
|
||||
for (var j = 0; j < length; j++) {
|
||||
if (div[j].getAttribute("id") == clickPluginMethodNode) {
|
||||
$(div[j]).show();
|
||||
} else {
|
||||
$(div[j]).hide();
|
||||
}
|
||||
}
|
||||
$('#submitBehaviors').attr("class", "show");
|
||||
}
|
||||
|
||||
function removeInsertPluginByClicked() {
|
||||
var length = $('#behaviorArea').children().length;
|
||||
var removeDocumentNode = document.getElementById("showPluginMethod").childNodes;
|
||||
for (var i = parseInt(clickPluginMethodNode + 1); i < length; i++) {
|
||||
pluginMethodList[i - 1] = pluginMethodList[i];
|
||||
}
|
||||
pluginMethodList.splice(length - 1, 1);// js Array remove element
|
||||
createPluginMethodLines();
|
||||
for (var j = 0; j < length; j++) {
|
||||
if ($(removeDocumentNode[j]).attr("id") == clickPluginMethodNode) {
|
||||
document.getElementById("showPluginMethod").removeChild(
|
||||
removeDocumentNode[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearPluginMethodList() {
|
||||
pluginMethodList.splice(0, pluginMethodList.length);
|
||||
document.getElementById('behaviorArea').innerHTML = "";
|
||||
document.getElementById("showPluginMethod").innerHTML = "";
|
||||
$('#submitBehaviors').attr("class", "hide");
|
||||
}
|
||||
|
||||
function loadMethodParams(behaviorData, behaviorIndex) {
|
||||
alert("loadMehtodParams");
|
||||
var temp = behaviorData.split('.');
|
||||
var plugin = temp[0].split('_')[0];
|
||||
var method = temp[1];
|
||||
|
||||
$.post("loadMethodParameters", {
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>" + "<h2>sample:<i>"
|
||||
+ behaviorData + "</i></h2></div>";
|
||||
var fieldHTML=createBehaviorsForm(data, behaviorData, behaviorIndex);
|
||||
documentHtml = "<div id='"
|
||||
+ behaviorIndex
|
||||
+ "' class='hide'><p class='hide'>"
|
||||
+ behaviorData
|
||||
+ "</p><div class='span12 box' style='margin-left:-2px;'>"
|
||||
+ boxHeader
|
||||
+ "<div class='box-content'>"
|
||||
+ fieldHTML
|
||||
+ "</div><div class='left table-margin'><button class='btn btn-primary btn-width' type='submit' onClick='saveBehavior(this);'>"
|
||||
+ $.i18n.prop("save")
|
||||
+ "</button>"
|
||||
+ " <button class='btn btn-primary btn-width' type='submit' onClick='cancelBehavior(this);'>"
|
||||
+ $.i18n.prop("cancel") + "</button></div></div></div>";
|
||||
|
||||
document.getElementById("showPluginMethod").innerHTML += documentHtml;
|
||||
});
|
||||
}
|
||||
function saveBehavior(selectedNode) {
|
||||
var uploadNode = selectedNode.parentNode.previousSibling;
|
||||
var div = uploadNode.childNodes;
|
||||
var length = div.length;
|
||||
var behaviorIndex = 0, use = "", name = "", type = "";
|
||||
var plugin_method = selectedNode.parentNode.parentNode.parentNode.firstChild.firstChild.nodeValue
|
||||
.split(".");
|
||||
name = plugin_method[1];
|
||||
use = plugin_method[0].split("_")[0];
|
||||
if (use == "timer") {
|
||||
type = "TIMERBEHAVIOR";
|
||||
} else if(use=="http"){
|
||||
type = "USERBEHAVIOR";
|
||||
}
|
||||
var parameters = new Array();
|
||||
for (var i = 0; i < length; i++) {
|
||||
var node = div[i];
|
||||
var nodeId = $(node).attr("id").split("_");
|
||||
behaviorIndex = nodeId[0];
|
||||
var parameterModel;
|
||||
var key = "", value = "", temp = "";
|
||||
if ($(node).attr("class") == "Field sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
temp = $(node).find("input").val();
|
||||
if (temp != "") {
|
||||
value = temp;
|
||||
}
|
||||
} else if ($(node).attr("class") == "MultiField sample_frame") {
|
||||
key = node.firstChild.firstChild.nodeValue.split(":")[0];
|
||||
var fieldNode = $(node).find("table").children();
|
||||
var fieldLength = $(fieldNode).length;
|
||||
for (var j = 0; j < fieldLength; j++) {
|
||||
temp = $(fieldNode[j]).find("input").val();
|
||||
if(temp!=""){
|
||||
value += temp;
|
||||
}
|
||||
if (j!=fieldLength-1) {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "Table sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var table = $(node).find("table");
|
||||
var col = table.find("th").length;
|
||||
var row = table.find("tbody").children().length;
|
||||
var tbody = $(node).find("tbody");
|
||||
for (var m = 0; m < row; m++) {
|
||||
for (var n = 0; n < col; n++) {
|
||||
var rowNode = $(tbody).children()[m];
|
||||
var colNode = $(rowNode).children()[n];
|
||||
temp = $(colNode).find("input").val();
|
||||
if (temp != "") {
|
||||
value += temp + "|";
|
||||
}
|
||||
}
|
||||
if (value != "") {
|
||||
value += ";";
|
||||
}
|
||||
}
|
||||
} else if ($(node).attr("class") == "CheckBox sample_frame") {
|
||||
key = node.lastChild.firstChild.nodeValue;
|
||||
var id = $(node).attr("id");
|
||||
$('input[name=' + id + ']:checked').each(function() {
|
||||
temp = $(this).val();
|
||||
if (temp != "") {
|
||||
value += temp + ";";
|
||||
}
|
||||
});
|
||||
}
|
||||
if (value != "") {
|
||||
parameterModel = new ParameterModel(key, value);
|
||||
parameters.push(parameterModel);
|
||||
}
|
||||
}
|
||||
var behaviorModel = new BehaviorModel(behaviorIndex, use, name, type,
|
||||
parameters);
|
||||
behaviors.push(behaviorModel);
|
||||
alert("save success!");
|
||||
}
|
||||
|
||||
function submitBehaviors(selectedNode) {
|
||||
var scriptName = $(selectedNode.parentNode.parentNode).find("input").val();
|
||||
if (scriptName == null || scriptName == "") {
|
||||
alert("Please input scriptName.");
|
||||
return;
|
||||
}
|
||||
if (behaviors.length == 0) {
|
||||
alert("Please save the behavior or fill in the form.");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < pluginChoosedList.length; i++) {
|
||||
var id = pluginChoosedList[i].split("_")[0];
|
||||
var name = "";
|
||||
var parameters = new Array();
|
||||
if (id == "http") {
|
||||
name = "Http";
|
||||
} else if (id == "timer") {
|
||||
name = "ConstantTimer";
|
||||
}
|
||||
var usePluginModel = new UsePluginModel(id, name, parameters);
|
||||
usePluginList.push(usePluginModel);
|
||||
}
|
||||
var scriptModel = new PluginEditScriptRequestModel(behaviors,
|
||||
usePluginList, scriptName);
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "uploadPluginEditedScript",
|
||||
contentType : "application/json",
|
||||
data : JSON.stringify(scriptModel),
|
||||
success : function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
window.location.replace("script.jsp");
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelBehavior(selectedNode) {
|
||||
var divNode = selectedNode.parentNode.parentNode.parentNode;
|
||||
$(divNode).hide();
|
||||
}
|
||||
|
||||
$('#pluginCancel').click(function() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
});
|
||||
|
||||
$('#behaviorCancel').click(function() {
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
});
|
||||
|
|
|
@ -1,85 +1,85 @@
|
|||
function form_validation(name) {
|
||||
var input_value = document.getElementsByName(name)[0].value;
|
||||
var regx = /^[a-zA-Z0-9]+$/;
|
||||
if (!regx.test(input_value)) {
|
||||
alert(name + " must be number!");
|
||||
if (name == "username") {
|
||||
$('#usrmsg').show();
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('username')[0].style.border = "1px solid red";
|
||||
}
|
||||
|
||||
else if (name == "password") {
|
||||
$('#pwdmsg').show();
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('password')[0].style.border = "1px solid red";
|
||||
}
|
||||
} else {
|
||||
document.getElementsByName(name)[0].style.border = "1px solid #ddd";
|
||||
if (name == "username")
|
||||
$('#usrmsg').hide();
|
||||
else if (name == "password")
|
||||
$('#pwdmsg').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function clean() {
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('retype_pwd')[0].value = "";
|
||||
}
|
||||
function register() {
|
||||
var userName = $('#username').val();
|
||||
var password = $('#password').val();
|
||||
var rePassword = $("#retype_pwd").val();
|
||||
$.post('register', {
|
||||
userName : userName,
|
||||
password : password,
|
||||
rePassword : rePassword
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
window.location.replace("registerSuccess.jsp");
|
||||
} else {
|
||||
alert(data.failedMessage);
|
||||
// $('#registerMsg').html($.i18n.prop('msgRegister'));
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function password_validation() {
|
||||
var null_flag = 0;
|
||||
var user_name = document.getElementsByName('username')[0].value;
|
||||
var retype_pwd = document.getElementsByName('retype_pwd')[0].value;
|
||||
var input_pwd = document.getElementsByName('password')[0].value;
|
||||
|
||||
if (user_name == "") {
|
||||
$('#usrmsg').show();
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('username')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#usrmsg').hide();
|
||||
document.getElementsByName('username')[0].style.border = "";
|
||||
}
|
||||
|
||||
if (input_pwd == "") {
|
||||
$('#pwdmsg').show();
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('password')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#pwdmsg').hide();
|
||||
document.getElementsByName('password')[0].style.border = "";
|
||||
}
|
||||
if (input_pwd != retype_pwd) {
|
||||
$('#rtpmsg').show();
|
||||
document.getElementsByName('retype_pwd')[0].value = "";
|
||||
document.getElementsByName('retype_pwd')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#rtpmsg').hide();
|
||||
document.getElementsByName('retype_pwd')[0].style.border = "";
|
||||
}
|
||||
if (null_flag == 0)
|
||||
register();
|
||||
function form_validation(name) {
|
||||
var input_value = document.getElementsByName(name)[0].value;
|
||||
var regx = /^[a-zA-Z0-9]+$/;
|
||||
if (!regx.test(input_value)) {
|
||||
alert(name + " must be number!");
|
||||
if (name == "username") {
|
||||
$('#usrmsg').show();
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('username')[0].style.border = "1px solid red";
|
||||
}
|
||||
|
||||
else if (name == "password") {
|
||||
$('#pwdmsg').show();
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('password')[0].style.border = "1px solid red";
|
||||
}
|
||||
} else {
|
||||
document.getElementsByName(name)[0].style.border = "1px solid #ddd";
|
||||
if (name == "username")
|
||||
$('#usrmsg').hide();
|
||||
else if (name == "password")
|
||||
$('#pwdmsg').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function clean() {
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('retype_pwd')[0].value = "";
|
||||
}
|
||||
function register() {
|
||||
var userName = $('#username').val();
|
||||
var password = $('#password').val();
|
||||
var rePassword = $("#retype_pwd").val();
|
||||
$.post('register', {
|
||||
userName : userName,
|
||||
password : password,
|
||||
rePassword : rePassword
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
window.location.replace("registerSuccess.jsp");
|
||||
} else {
|
||||
alert(data.failedMessage);
|
||||
// $('#registerMsg').html($.i18n.prop('msgRegister'));
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function password_validation() {
|
||||
var null_flag = 0;
|
||||
var user_name = document.getElementsByName('username')[0].value;
|
||||
var retype_pwd = document.getElementsByName('retype_pwd')[0].value;
|
||||
var input_pwd = document.getElementsByName('password')[0].value;
|
||||
|
||||
if (user_name == "") {
|
||||
$('#usrmsg').show();
|
||||
document.getElementsByName('username')[0].value = "";
|
||||
document.getElementsByName('username')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#usrmsg').hide();
|
||||
document.getElementsByName('username')[0].style.border = "";
|
||||
}
|
||||
|
||||
if (input_pwd == "") {
|
||||
$('#pwdmsg').show();
|
||||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('password')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#pwdmsg').hide();
|
||||
document.getElementsByName('password')[0].style.border = "";
|
||||
}
|
||||
if (input_pwd != retype_pwd) {
|
||||
$('#rtpmsg').show();
|
||||
document.getElementsByName('retype_pwd')[0].value = "";
|
||||
document.getElementsByName('retype_pwd')[0].style.border = "1px solid red";
|
||||
null_flag = 1;
|
||||
} else {
|
||||
$('#rtpmsg').hide();
|
||||
document.getElementsByName('retype_pwd')[0].style.border = "";
|
||||
}
|
||||
if (null_flag == 0)
|
||||
register();
|
||||
}
|
|
@ -1,112 +1,112 @@
|
|||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.web.api.MonitorController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestMonitorResult extends LoginHelper {
|
||||
private MonitorController monitorController;
|
||||
private TestPlanHelper startTestPlan;
|
||||
private String accessToken;
|
||||
private String testPlanId;
|
||||
private Logger logger = Logger.getLogger(TestMonitorResult.class);
|
||||
|
||||
public MonitorController getMonitorController() {
|
||||
return monitorController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMonitorController(MonitorController monitorController) {
|
||||
this.monitorController = monitorController;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return startTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.startTestPlan = startTestPlan;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = login();
|
||||
this.getStartTestPlan().startTest(accessToken);
|
||||
this.testPlanId = this.getStartTestPlan().getTestPlanRunId();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getMemoryResult() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getMemoryStatus(accessToken, testPlanId,
|
||||
TestPlanHelper.MONITOR_IP, "5556", "pagesPerSecond",
|
||||
"0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getCpuResult() throws InterruptedException, CustomGenericException, JAXBException{
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getCpuResult(accessToken, testPlanId, TestPlanHelper.MONITOR_IP, "5556", "cpu0", "processorTimePercent", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
@Test
|
||||
public void test_getNetwork() throws InterruptedException, CustomGenericException, JAXBException{
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getCpuResult(accessToken, testPlanId, TestPlanHelper.MONITOR_IP, "5556", "cpu0", "processorTimePercent", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
private void testTestPlanStatus() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
assertNotNull(testPlanId);
|
||||
Thread.sleep(6000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.web.api.MonitorController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestMonitorResult extends LoginHelper {
|
||||
private MonitorController monitorController;
|
||||
private TestPlanHelper startTestPlan;
|
||||
private String accessToken;
|
||||
private String testPlanId;
|
||||
private Logger logger = Logger.getLogger(TestMonitorResult.class);
|
||||
|
||||
public MonitorController getMonitorController() {
|
||||
return monitorController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMonitorController(MonitorController monitorController) {
|
||||
this.monitorController = monitorController;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return startTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.startTestPlan = startTestPlan;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = login();
|
||||
this.getStartTestPlan().startTest(accessToken);
|
||||
this.testPlanId = this.getStartTestPlan().getTestPlanRunId();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getMemoryResult() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getMemoryStatus(accessToken, testPlanId,
|
||||
TestPlanHelper.MONITOR_IP, "5556", "pagesPerSecond",
|
||||
"0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getCpuResult() throws InterruptedException, CustomGenericException, JAXBException{
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getCpuResult(accessToken, testPlanId, TestPlanHelper.MONITOR_IP, "5556", "cpu0", "processorTimePercent", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
@Test
|
||||
public void test_getNetwork() throws InterruptedException, CustomGenericException, JAXBException{
|
||||
testTestPlanStatus();
|
||||
BaseResponseModel baseResponseModel = this.getMonitorController()
|
||||
.getCpuResult(accessToken, testPlanId, TestPlanHelper.MONITOR_IP, "5556", "cpu0", "processorTimePercent", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
private void testTestPlanStatus() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
assertNotNull(testPlanId);
|
||||
Thread.sleep(6000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,219 +1,219 @@
|
|||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.api.TestPlanActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.SutInfo;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestScriptResultTest extends LoginHelper {
|
||||
private TestPlanActionController testPlanActionController;
|
||||
private TestPlanHelper testPlanHelper;
|
||||
private String testPlanId;
|
||||
private String accessToken;
|
||||
private Logger logger = Logger.getLogger(TestScriptResultTest.class);
|
||||
private TestPlanService testPlanService;
|
||||
private String scriptId;
|
||||
|
||||
public TestPlanActionController getTestPlanActionController() {
|
||||
return testPlanActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanActionController(
|
||||
TestPlanActionController testPlanActionController) {
|
||||
this.testPlanActionController = testPlanActionController;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return testPlanHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.testPlanHelper = startTestPlan;
|
||||
}
|
||||
|
||||
public TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = this.login();
|
||||
this.testPlanHelper.startTest(accessToken);
|
||||
this.testPlanId = this.testPlanHelper.getTestPlanRunId();
|
||||
this.scriptId = this.getOneScriptId(testPlanId, accessToken);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void clean() throws CustomGenericException {
|
||||
this.getStartTestPlan().cleanUpTest(this.accessToken);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getReplaceList() throws CustomGenericException,
|
||||
JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getReplaceList(this.accessToken,
|
||||
this.testPlanHelper.getTestPlanRunId());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Integer> scriptIdMap = (Map<String, Integer>) baseResponseModel
|
||||
.getData();
|
||||
Assert.assertTrue(scriptIdMap.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getTestPageBriefModel() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
assertNotNull(this.testPlanId);
|
||||
assertNotNull(this.scriptId);
|
||||
Thread.sleep(3000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptPageBriefModel(
|
||||
accessToken, testPlanId, scriptId);
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = (ScriptPagesBriefModel) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(scriptPagesBriefModel));
|
||||
assertTrue(scriptPagesBriefModel.getScriptPageBriefModels().size() > 0);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getScriptBriefStatus() throws NoSuchFieldException,
|
||||
CustomGenericException, JAXBException, InterruptedException {
|
||||
Assert.assertNotNull(testPlanId);
|
||||
String scriptId = getOneScriptId(this.getStartTestPlan()
|
||||
.getTestPlanRunId(), accessToken);
|
||||
Assert.assertNotNull(scriptId);
|
||||
Thread.sleep(3000);
|
||||
BaseResponseModel baseResponseModelForTestPlan = this
|
||||
.getTestPlanActionController().queryTestPlan(accessToken,
|
||||
this.testPlanId);
|
||||
assertTrue(baseResponseModelForTestPlan.isSuccess());
|
||||
WebTestPlanResultModel webTestPlanResultModel = (WebTestPlanResultModel) baseResponseModelForTestPlan
|
||||
.getData();
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptBriefStatus(
|
||||
accessToken, this.testPlanId,
|
||||
this.getOneScriptId(this.testPlanId, accessToken),
|
||||
"averageResponseTime", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
Logger.getLogger("get result model");
|
||||
Logger.getLogger(TestScriptResultTest.class).info(
|
||||
"resultModel:" + GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getScriptBehaviorBriefModel()
|
||||
throws CustomGenericException, JAXBException, InterruptedException {
|
||||
assertNotNull(this.testPlanId);
|
||||
String scriptId = getOneScriptId(this.getStartTestPlan()
|
||||
.getTestPlanRunId(), accessToken);
|
||||
Thread.sleep(3000);
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptBehaviorBriefModel(
|
||||
accessToken, this.testPlanId, scriptId);
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = (ScriptBehaviorsBriefModel) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(scriptBehaviorsBriefModel));
|
||||
Assert.assertNotNull(scriptBehaviorsBriefModel);
|
||||
Assert.assertNotNull(scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel());
|
||||
Assert.assertTrue(scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels().size() > 0);
|
||||
}
|
||||
|
||||
private String getOneScriptId(String testPlanRunId, String accessToken) {
|
||||
try {
|
||||
|
||||
return this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanRunId, accessToken)
|
||||
.getScriptIds().get(0).toString();
|
||||
} catch (CustomGenericException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getSutInfo() throws CustomGenericException, JAXBException,
|
||||
InterruptedException {
|
||||
testTestPlanStatus();
|
||||
List<SutInfo> sutInfos = (List<SutInfo>) this
|
||||
.getTestPlanActionController()
|
||||
.getSutInfo(accessToken, testPlanId).getData();
|
||||
for (SutInfo sutInfo : sutInfos) {
|
||||
assertEquals("5556", sutInfo.getPort());
|
||||
assertEquals(TestPlanHelper.MONITOR_IP, sutInfo.getIp());
|
||||
Gson gson = new Gson();
|
||||
logger.info(gson.toJson(sutInfo));
|
||||
}
|
||||
assertEquals(1, sutInfos.size());
|
||||
}
|
||||
|
||||
private void testTestPlanStatus() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
assertNotNull(testPlanId);
|
||||
Thread.sleep(6000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.enums.master.TestPlanStatus;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.api.TestPlanActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.ResultModel;
|
||||
import org.bench4q.web.model.SutInfo;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.bench4q.web.service.TestPlanService;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestScriptResultTest extends LoginHelper {
|
||||
private TestPlanActionController testPlanActionController;
|
||||
private TestPlanHelper testPlanHelper;
|
||||
private String testPlanId;
|
||||
private String accessToken;
|
||||
private Logger logger = Logger.getLogger(TestScriptResultTest.class);
|
||||
private TestPlanService testPlanService;
|
||||
private String scriptId;
|
||||
|
||||
public TestPlanActionController getTestPlanActionController() {
|
||||
return testPlanActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanActionController(
|
||||
TestPlanActionController testPlanActionController) {
|
||||
this.testPlanActionController = testPlanActionController;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return testPlanHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.testPlanHelper = startTestPlan;
|
||||
}
|
||||
|
||||
public TestPlanService getTestPlanService() {
|
||||
return testPlanService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanService(TestPlanService testPlanService) {
|
||||
this.testPlanService = testPlanService;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = this.login();
|
||||
this.testPlanHelper.startTest(accessToken);
|
||||
this.testPlanId = this.testPlanHelper.getTestPlanRunId();
|
||||
this.scriptId = this.getOneScriptId(testPlanId, accessToken);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void clean() throws CustomGenericException {
|
||||
this.getStartTestPlan().cleanUpTest(this.accessToken);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getReplaceList() throws CustomGenericException,
|
||||
JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getReplaceList(this.accessToken,
|
||||
this.testPlanHelper.getTestPlanRunId());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Integer> scriptIdMap = (Map<String, Integer>) baseResponseModel
|
||||
.getData();
|
||||
Assert.assertTrue(scriptIdMap.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getTestPageBriefModel() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
assertNotNull(this.testPlanId);
|
||||
assertNotNull(this.scriptId);
|
||||
Thread.sleep(3000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptPageBriefModel(
|
||||
accessToken, testPlanId, scriptId);
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = (ScriptPagesBriefModel) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(scriptPagesBriefModel));
|
||||
assertTrue(scriptPagesBriefModel.getScriptPageBriefModels().size() > 0);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getScriptBriefStatus() throws NoSuchFieldException,
|
||||
CustomGenericException, JAXBException, InterruptedException {
|
||||
Assert.assertNotNull(testPlanId);
|
||||
String scriptId = getOneScriptId(this.getStartTestPlan()
|
||||
.getTestPlanRunId(), accessToken);
|
||||
Assert.assertNotNull(scriptId);
|
||||
Thread.sleep(3000);
|
||||
BaseResponseModel baseResponseModelForTestPlan = this
|
||||
.getTestPlanActionController().queryTestPlan(accessToken,
|
||||
this.testPlanId);
|
||||
assertTrue(baseResponseModelForTestPlan.isSuccess());
|
||||
WebTestPlanResultModel webTestPlanResultModel = (WebTestPlanResultModel) baseResponseModelForTestPlan
|
||||
.getData();
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptBriefStatus(
|
||||
accessToken, this.testPlanId,
|
||||
this.getOneScriptId(this.testPlanId, accessToken),
|
||||
"averageResponseTime", "0");
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
List<ResultModel> resultModels = (List<ResultModel>) baseResponseModel
|
||||
.getData();
|
||||
Logger.getLogger("get result model");
|
||||
Logger.getLogger(TestScriptResultTest.class).info(
|
||||
"resultModel:" + GsonHelper.getGson().toJson(resultModels));
|
||||
assertTrue(resultModels.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getScriptBehaviorBriefModel()
|
||||
throws CustomGenericException, JAXBException, InterruptedException {
|
||||
assertNotNull(this.testPlanId);
|
||||
String scriptId = getOneScriptId(this.getStartTestPlan()
|
||||
.getTestPlanRunId(), accessToken);
|
||||
Thread.sleep(3000);
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getTestPlanActionController().getScriptBehaviorBriefModel(
|
||||
accessToken, this.testPlanId, scriptId);
|
||||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel = (ScriptBehaviorsBriefModel) baseResponseModel
|
||||
.getData();
|
||||
logger.info(GsonHelper.getGson().toJson(scriptBehaviorsBriefModel));
|
||||
Assert.assertNotNull(scriptBehaviorsBriefModel);
|
||||
Assert.assertNotNull(scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel());
|
||||
Assert.assertTrue(scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels().size() > 0);
|
||||
}
|
||||
|
||||
private String getOneScriptId(String testPlanRunId, String accessToken) {
|
||||
try {
|
||||
|
||||
return this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanRunId, accessToken)
|
||||
.getScriptIds().get(0).toString();
|
||||
} catch (CustomGenericException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
|
||||
} catch (JAXBException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info(ExceptionLog.getStackTrace(e));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test_getSutInfo() throws CustomGenericException, JAXBException,
|
||||
InterruptedException {
|
||||
testTestPlanStatus();
|
||||
List<SutInfo> sutInfos = (List<SutInfo>) this
|
||||
.getTestPlanActionController()
|
||||
.getSutInfo(accessToken, testPlanId).getData();
|
||||
for (SutInfo sutInfo : sutInfos) {
|
||||
assertEquals("5556", sutInfo.getPort());
|
||||
assertEquals(TestPlanHelper.MONITOR_IP, sutInfo.getIp());
|
||||
Gson gson = new Gson();
|
||||
logger.info(gson.toJson(sutInfo));
|
||||
}
|
||||
assertEquals(1, sutInfos.size());
|
||||
}
|
||||
|
||||
private void testTestPlanStatus() throws InterruptedException,
|
||||
CustomGenericException, JAXBException {
|
||||
Assert.assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
assertNotNull(testPlanId);
|
||||
Thread.sleep(6000);
|
||||
WebTestPlanResultModel webTestPlanResultModel = this.getStartTestPlan()
|
||||
.queryTestPlanResultModel(testPlanId, accessToken);
|
||||
assertEquals(TestPlanStatus.InRunning,
|
||||
webTestPlanResultModel.getCurrentStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.web.api.TestPlanHistoryResult;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanListModel;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestTestHistory extends LoginHelper {
|
||||
private TestPlanHistoryResult testPlanHistoryResult;
|
||||
private String accessToken;
|
||||
private Logger logger = Logger.getLogger(TestTestHistory.class);
|
||||
|
||||
public TestPlanHistoryResult getTestPlanHistoryResult() {
|
||||
return testPlanHistoryResult;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanHistoryResult(
|
||||
TestPlanHistoryResult testPlanHistoryResult) {
|
||||
this.testPlanHistoryResult = testPlanHistoryResult;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = login();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_loadTestHistory() throws CustomGenericException {
|
||||
BaseResponseModel baseResponseModel = this.getTestPlanHistoryResult()
|
||||
.loadTestPlans(accessToken);
|
||||
logger.info(GsonHelper.getGson().toJson(baseResponseModel));
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
TestPlanListModel testPlanListModel = (TestPlanListModel) baseResponseModel
|
||||
.getData();
|
||||
assertTrue(testPlanListModel.getList().size() > 0);
|
||||
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.api.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.web.api.TestPlanHistoryResult;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.model.TestPlanListModel;
|
||||
import org.bench4q.web.tool.test.GsonHelper;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestTestHistory extends LoginHelper {
|
||||
private TestPlanHistoryResult testPlanHistoryResult;
|
||||
private String accessToken;
|
||||
private Logger logger = Logger.getLogger(TestTestHistory.class);
|
||||
|
||||
public TestPlanHistoryResult getTestPlanHistoryResult() {
|
||||
return testPlanHistoryResult;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanHistoryResult(
|
||||
TestPlanHistoryResult testPlanHistoryResult) {
|
||||
this.testPlanHistoryResult = testPlanHistoryResult;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.accessToken = login();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_loadTestHistory() throws CustomGenericException {
|
||||
BaseResponseModel baseResponseModel = this.getTestPlanHistoryResult()
|
||||
.loadTestPlans(accessToken);
|
||||
logger.info(GsonHelper.getGson().toJson(baseResponseModel));
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
TestPlanListModel testPlanListModel = (TestPlanListModel) baseResponseModel
|
||||
.getData();
|
||||
assertTrue(testPlanListModel.getList().size() > 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.bench4q.web.tool.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class GsonHelper {
|
||||
|
||||
public static Gson getGson() {
|
||||
return new Gson();
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.tool.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class GsonHelper {
|
||||
|
||||
public static Gson getGson() {
|
||||
return new Gson();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,87 +1,87 @@
|
|||
package org.bench4q.web.tool.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.api.ScriptActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestLoginHelper {
|
||||
private LoginHelper loginHelper;
|
||||
|
||||
private ScriptActionController scriptActionController;
|
||||
private TestPlanHelper startTestPlan;
|
||||
|
||||
public LoginHelper getLoginHelper() {
|
||||
return loginHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setLoginHelper(LoginHelper loginHelper) {
|
||||
this.loginHelper = loginHelper;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return startTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.startTestPlan = startTestPlan;
|
||||
}
|
||||
|
||||
public ScriptActionController getScriptActionController() {
|
||||
return scriptActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptActionController(
|
||||
ScriptActionController scriptActionController) {
|
||||
this.scriptActionController = scriptActionController;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginHelper() {
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
|
||||
assertNotNull(accessToken);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testLoginHelperRight() throws CustomGenericException {
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getScriptActionController().loadScript(accessToken);
|
||||
List<ScriptModel> scriptModels=(List<ScriptModel>)
|
||||
baseResponseModel.getData();
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
assertTrue(scriptModels.size()>0);
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testLoginInStartTest() throws CustomGenericException{
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
this.getStartTestPlan().startTest(accessToken);
|
||||
assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
|
||||
}
|
||||
@After
|
||||
public void clean() throws CustomGenericException{
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
this.getStartTestPlan().cleanUpTest(accessToken);
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.tool.test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.bench4q.web.api.ScriptActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.tool.test.LoginHelper;
|
||||
import org.bench4q.web.tool.test.TestPlanHelper;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "file:src/test/resources/bench4qweb-servlet.xml" })
|
||||
public class TestLoginHelper {
|
||||
private LoginHelper loginHelper;
|
||||
|
||||
private ScriptActionController scriptActionController;
|
||||
private TestPlanHelper startTestPlan;
|
||||
|
||||
public LoginHelper getLoginHelper() {
|
||||
return loginHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setLoginHelper(LoginHelper loginHelper) {
|
||||
this.loginHelper = loginHelper;
|
||||
}
|
||||
|
||||
public TestPlanHelper getStartTestPlan() {
|
||||
return startTestPlan;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setStartTestPlan(TestPlanHelper startTestPlan) {
|
||||
this.startTestPlan = startTestPlan;
|
||||
}
|
||||
|
||||
public ScriptActionController getScriptActionController() {
|
||||
return scriptActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptActionController(
|
||||
ScriptActionController scriptActionController) {
|
||||
this.scriptActionController = scriptActionController;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoginHelper() {
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
|
||||
assertNotNull(accessToken);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testLoginHelperRight() throws CustomGenericException {
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
BaseResponseModel baseResponseModel = this
|
||||
.getScriptActionController().loadScript(accessToken);
|
||||
List<ScriptModel> scriptModels=(List<ScriptModel>)
|
||||
baseResponseModel.getData();
|
||||
assertTrue(baseResponseModel.isSuccess());
|
||||
assertTrue(scriptModels.size()>0);
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testLoginInStartTest() throws CustomGenericException{
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
this.getStartTestPlan().startTest(accessToken);
|
||||
assertNotNull(this.getStartTestPlan().getTestPlanRunId());
|
||||
|
||||
}
|
||||
@After
|
||||
public void clean() throws CustomGenericException{
|
||||
String accessToken = this.getLoginHelper().login();
|
||||
this.getStartTestPlan().cleanUpTest(accessToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,109 +1,109 @@
|
|||
package org.bench4q.web.tool.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.web.api.TestPlanActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
@Component
|
||||
public class TestPlanHelper {
|
||||
public static final String MONITOR_IP = "133.133.12.3";
|
||||
private ScriptHelper scriptHelper;
|
||||
private TestPlanActionController testPlanActionController;
|
||||
private String testPlanRunId;
|
||||
|
||||
public TestPlanActionController getTestPlanActionController() {
|
||||
return testPlanActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanActionController(
|
||||
TestPlanActionController testPlanActionController) {
|
||||
this.testPlanActionController = testPlanActionController;
|
||||
}
|
||||
|
||||
public ScriptHelper getScriptHelper() {
|
||||
return scriptHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptHelper(ScriptHelper scriptHelper) {
|
||||
this.scriptHelper = scriptHelper;
|
||||
}
|
||||
|
||||
public String getTestPlanRunId() {
|
||||
return testPlanRunId;
|
||||
}
|
||||
|
||||
private void setTestPlanRunId(String testPlanRunId) {
|
||||
this.testPlanRunId = testPlanRunId;
|
||||
}
|
||||
|
||||
public void startTest(String accessToken) {
|
||||
try {
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) this
|
||||
.getTestPlanActionController()
|
||||
.runTestPlan(accessToken, new ModelMap(),
|
||||
createTestPlanWithMonitor(accessToken)).getData();
|
||||
|
||||
this.setTestPlanRunId(testPlanResultModel.getTestPlanId()
|
||||
.toString());
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(TestPlanHelper.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
public TestPlanRequestModel createTestPlanWithMonitor(String accessToken)
|
||||
throws JAXBException, IOException, CustomGenericException {
|
||||
List<String> ipList = new ArrayList<>();
|
||||
ipList.add(MONITOR_IP);
|
||||
TestPlanRequestModel testPlanRequestModel = new TestPlanRequestModel();
|
||||
testPlanRequestModel.setIpList(ipList);
|
||||
testPlanRequestModel.setTestPlanName("forTest");
|
||||
testPlanRequestModel
|
||||
.setScriptList(generateWebScriptModels(accessToken));
|
||||
return testPlanRequestModel;
|
||||
}
|
||||
|
||||
private List<WebScriptModel> generateWebScriptModels(String accessToken)
|
||||
throws JAXBException, IOException, CustomGenericException {
|
||||
List<WebScriptModel> scriptList = new ArrayList<WebScriptModel>();
|
||||
WebScriptModel webScriptModel = new WebScriptModel();
|
||||
webScriptModel.setCooldown(1);
|
||||
webScriptModel.setExecuteRange(50);
|
||||
webScriptModel.setId(this.getScriptHelper()
|
||||
.upLoadScriptAndGetId(accessToken).getId());
|
||||
webScriptModel.setLoad(30);
|
||||
webScriptModel.setWarmup(1);
|
||||
scriptList.add(webScriptModel);
|
||||
return scriptList;
|
||||
|
||||
}
|
||||
|
||||
public void cleanUpTest(String accessToken) throws CustomGenericException {
|
||||
/*this.getScriptHelper().deleteScript(accessToken);*/
|
||||
}
|
||||
|
||||
public WebTestPlanResultModel queryTestPlanResultModel(
|
||||
String testPlanRunId, String accessToken)
|
||||
throws CustomGenericException, JAXBException {
|
||||
WebTestPlanResultModel webTestPlanResultModel = (WebTestPlanResultModel) this
|
||||
.getTestPlanActionController()
|
||||
.queryTestPlan(accessToken, testPlanRunId).getData();
|
||||
return webTestPlanResultModel;
|
||||
}
|
||||
}
|
||||
package org.bench4q.web.tool.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.web.api.TestPlanActionController;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.TestPlanRequestModel;
|
||||
import org.bench4q.web.model.WebScriptModel;
|
||||
import org.bench4q.web.model.WebTestPlanResultModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
@Component
|
||||
public class TestPlanHelper {
|
||||
public static final String MONITOR_IP = "133.133.12.3";
|
||||
private ScriptHelper scriptHelper;
|
||||
private TestPlanActionController testPlanActionController;
|
||||
private String testPlanRunId;
|
||||
|
||||
public TestPlanActionController getTestPlanActionController() {
|
||||
return testPlanActionController;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setTestPlanActionController(
|
||||
TestPlanActionController testPlanActionController) {
|
||||
this.testPlanActionController = testPlanActionController;
|
||||
}
|
||||
|
||||
public ScriptHelper getScriptHelper() {
|
||||
return scriptHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setScriptHelper(ScriptHelper scriptHelper) {
|
||||
this.scriptHelper = scriptHelper;
|
||||
}
|
||||
|
||||
public String getTestPlanRunId() {
|
||||
return testPlanRunId;
|
||||
}
|
||||
|
||||
private void setTestPlanRunId(String testPlanRunId) {
|
||||
this.testPlanRunId = testPlanRunId;
|
||||
}
|
||||
|
||||
public void startTest(String accessToken) {
|
||||
try {
|
||||
TestPlanResultModel testPlanResultModel = (TestPlanResultModel) this
|
||||
.getTestPlanActionController()
|
||||
.runTestPlan(accessToken, new ModelMap(),
|
||||
createTestPlanWithMonitor(accessToken)).getData();
|
||||
|
||||
this.setTestPlanRunId(testPlanResultModel.getTestPlanId()
|
||||
.toString());
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(TestPlanHelper.class).info(
|
||||
ExceptionLog.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
public TestPlanRequestModel createTestPlanWithMonitor(String accessToken)
|
||||
throws JAXBException, IOException, CustomGenericException {
|
||||
List<String> ipList = new ArrayList<>();
|
||||
ipList.add(MONITOR_IP);
|
||||
TestPlanRequestModel testPlanRequestModel = new TestPlanRequestModel();
|
||||
testPlanRequestModel.setIpList(ipList);
|
||||
testPlanRequestModel.setTestPlanName("forTest");
|
||||
testPlanRequestModel
|
||||
.setScriptList(generateWebScriptModels(accessToken));
|
||||
return testPlanRequestModel;
|
||||
}
|
||||
|
||||
private List<WebScriptModel> generateWebScriptModels(String accessToken)
|
||||
throws JAXBException, IOException, CustomGenericException {
|
||||
List<WebScriptModel> scriptList = new ArrayList<WebScriptModel>();
|
||||
WebScriptModel webScriptModel = new WebScriptModel();
|
||||
webScriptModel.setCooldown(1);
|
||||
webScriptModel.setExecuteRange(50);
|
||||
webScriptModel.setId(this.getScriptHelper()
|
||||
.upLoadScriptAndGetId(accessToken).getId());
|
||||
webScriptModel.setLoad(30);
|
||||
webScriptModel.setWarmup(1);
|
||||
scriptList.add(webScriptModel);
|
||||
return scriptList;
|
||||
|
||||
}
|
||||
|
||||
public void cleanUpTest(String accessToken) throws CustomGenericException {
|
||||
/*this.getScriptHelper().deleteScript(accessToken);*/
|
||||
}
|
||||
|
||||
public WebTestPlanResultModel queryTestPlanResultModel(
|
||||
String testPlanRunId, String accessToken)
|
||||
throws CustomGenericException, JAXBException {
|
||||
WebTestPlanResultModel webTestPlanResultModel = (WebTestPlanResultModel) this
|
||||
.getTestPlanActionController()
|
||||
.queryTestPlan(accessToken, testPlanRunId).getData();
|
||||
return webTestPlanResultModel;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue