fix the project path bug ,the project path in tomcat is different with

jetty
This commit is contained in:
fanfuxiaoran 2014-01-14 14:26:20 +08:00
parent 0a97624eb8
commit ea85acfe08
17 changed files with 38 additions and 332 deletions

View File

@ -39,10 +39,10 @@ button.convert {
padding:2px
}
div.convert-right {
background:url(/images/jsoneditor-icons.png) -0 -48px
background:url(../images/jsoneditor-icons.png) -0 -48px
}
div.convert-left {
background:url(/images/jsoneditor-icons.png) -24px -48px
background:url(../images/jsoneditor-icons.png) -24px -48px
}
div.convert-left,div.convert-right {
width:24px;

View File

@ -90,12 +90,12 @@ margin-top: 5px;
#loading{
width:397px;
height:49px;
background:url(/images/bak.png) no-repeat;
background:url(../images/bak.png) no-repeat;
}
#loading div{
width:0px;
height:48px;
background:url(/images/pro.png) no-repeat;
background:url(../images/pro.png) no-repeat;
color:#fff;
text-align:center;
font-family:Tahoma;

View File

@ -33,12 +33,12 @@
}
.jsoneditor .field.empty {
background-image: url('/images/jsoneditor-icons.png');
background-image: url('../images/jsoneditor-icons.png');
background-position: 0 -144px;
}
.jsoneditor .value.empty {
background-image: url('/images/jsoneditor-icons.png');
background-image: url('../images/jsoneditor-icons.png');
background-position: -48px -144px;
}
@ -87,7 +87,7 @@
margin: 0;
border: none;
cursor: pointer;
background: transparent url('/images/jsoneditor-icons.png');
background: transparent url('../images/jsoneditor-icons.png');
}
.jsoneditor div.tree button.collapsed {
@ -188,7 +188,7 @@
}
.jsoneditor div.tree button.dragarea {
background: url('/images/jsoneditor-icons.png') -72px -72px;
background: url('../images/jsoneditor-icons.png') -72px -72px;
cursor: move;
}
@ -290,7 +290,7 @@
border: none;
padding: 0;
margin: 0;
background-image: url('/images/jsoneditor-icons.png');
background-image: url('../images/jsoneditor-icons.png');
}
.jsoneditor-contextmenu ul li button div.expand {
@ -299,7 +299,7 @@
height: 24px;
padding: 0;
margin: 0 4px 0 0;
background: url('/images/jsoneditor-icons.png') 0 -72px;
background: url('../images/jsoneditor-icons.png') 0 -72px;
opacity: 0.4;
}
@ -470,7 +470,7 @@
padding: 0;
border-radius: 2px;
border: 1px solid #D5D5D5;
background: #D5D5D5 url('/images/jsoneditor-icons.png');
background: #D5D5D5 url('../images/jsoneditor-icons.png');
color: #4D4D4D;
opacity: 0.8;
@ -591,7 +591,7 @@
padding: 0;
margin: 0;
border: none;
background: url('/images/jsoneditor-icons.png');
background: url('../images/jsoneditor-icons.png');
vertical-align: top;
}

View File

@ -33,12 +33,12 @@
}
.jsoneditor .field.empty {
background-image: url('/images/jsoneditor-icons.png');
background-image: url('images/jsoneditor-icons.png');
background-position: 0 -144px;
}
.jsoneditor .value.empty {
background-image: url('/images/jsoneditor-icons.png');
background-image: url('images/jsoneditor-icons.png');
background-position: -48px -144px;
}
@ -87,7 +87,7 @@
margin: 0;
border: none;
cursor: pointer;
background: transparent url('/images/jsoneditor-icons.png');
background: transparent url('images/jsoneditor-icons.png');
}
.jsoneditor div.tree button.collapsed {
@ -188,7 +188,7 @@
}
.jsoneditor div.tree button.dragarea {
background: url('/images/jsoneditor-icons.png') -72px -72px;
background: url('images/jsoneditor-icons.png') -72px -72px;
cursor: move;
}
@ -290,7 +290,7 @@
border: none;
padding: 0;
margin: 0;
background-image: url('/images/jsoneditor-icons.png');
background-image: url('images/jsoneditor-icons.png');
}
.jsoneditor-contextmenu ul li button div.expand {
@ -299,7 +299,7 @@
height: 24px;
padding: 0;
margin: 0 4px 0 0;
background: url('/images/jsoneditor-icons.png') 0 -72px;
background: url('images/jsoneditor-icons.png') 0 -72px;
opacity: 0.4;
}
@ -470,7 +470,7 @@
padding: 0;
border-radius: 2px;
border: 1px solid #D5D5D5;
background: #D5D5D5 url('/images/jsoneditor-icons.png');
background: #D5D5D5 url('images/jsoneditor-icons.png');
color: #4D4D4D;
opacity: 0.8;
@ -591,7 +591,7 @@
padding: 0;
margin: 0;
border: none;
background: url('/images/jsoneditor-icons.png');
background: url('images/jsoneditor-icons.png');
vertical-align: top;
}

View File

@ -194,7 +194,8 @@ var Model = function() {
this.time=0;
};
Model.prototype.setUrl = function(pathValue,chartSelector) {
this.url = "/"+chartSelector.allTree.root.value;
/* this.url = "/"+chartSelector.allTree.root.value;*/
this.url = chartSelector.allTree.root.value;
if (pathValue == null)
return null;
if (pathValue.length <= 0)

View File

@ -13,7 +13,7 @@ function getScriptList(testPlanId) {
var scriptList = new Array();
$.ajax({
type : "POST",
url : "/" + testPlanId + "/queryTestPlan",
url : testPlanId + "/queryTestPlan",
dataType : "json",
async : false,
success : function(data) {
@ -114,8 +114,8 @@ var BehaviorResult = function() {
this.behaviors = new Array();
this.intevalTime = 5000;
this.header = new Array("Url", "Script", "Successful", "Total");
this.actionAdd = "<img src='/images/add.png' alt='details' title='details' class='show-detail-picture'>";
this.actionDelete = "<img src='/images/add.png' alt='details' title='details' class='detail-picture'>";
this.actionAdd = "<img src='images/add.png' alt='details' title='details' class='show-detail-picture'>";
this.actionDelete = "<img src='images/add.png' alt='details' title='details' class='detail-picture'>";
this.table = $("#url").dataTable();
};
@ -151,8 +151,8 @@ BehaviorResult.prototype.getResult = function(testPlanId, scriptList) {
}
function generateUrl(urlPath) {
var url = "";
for ( var i = 0; i < urlPath.length; i++)
var url = urlPath[0];
for ( var i = 1; i < urlPath.length; i++)
url += "/" + urlPath[i];
return url;
@ -213,7 +213,7 @@ BehaviorResult.prototype.DetailAddListener = function() {
var td = $(this.parentNode);
td.html("");
td
.html('<img src="/images/delete.png" alt="details" title="details" class="delete-detail-picture">');
.html('<img src="images/delete.png" alt="details" title="details" class="delete-detail-picture">');
behaviorResult.DetailAddListener();
}
});
@ -226,7 +226,7 @@ BehaviorResult.prototype.DetailAddListener = function() {
var td = $(this.parentNode);
td.html("");
td
.html('<img src="/images/add.png" alt="details" title="details" class="show-detail-picture">');
.html('<img src="images/add.png" alt="details" title="details" class="show-detail-picture">');
behaviorResult.DetailAddListener();
}

View File

@ -9,7 +9,8 @@ function getTestBrief(testPlanId) {
},5000);
}
function showTestPlanStatusAsync(testPlanId){
var urlAddress= "/" + testPlanId + "/queryTestPlan";
/* var urlAddress= "/" + testPlanId + "/queryTestPlan";*/
var urlAddress= testPlanId + "/queryTestPlan";
$.post(urlAddress,{},function(data){
if(data==null)
return;
@ -18,7 +19,7 @@ function showTestPlanStatusAsync(testPlanId){
},"json");
}
function showTestBriefStatus(startTime){
var urlAddress= "/" + testPlanId + "/testBriefStatus"+"/"+startTime;
var urlAddress= testPlanId + "/testBriefStatus"+"/"+startTime;
$.post(urlAddress,{},function(data){
if(data==null)
return;
@ -32,7 +33,7 @@ function getTestPlanStatus(testPlanId) {
var flag = null;
$.ajax({
type : "POST",
url : "/" + testPlanId + "/queryTestPlan",
url : testPlanId + "/queryTestPlan",
dataType : "json",
async : false,
success : function(data) {

View File

@ -107,7 +107,8 @@ function createUrlReplaceArray(testPlanId) {
var replaceArray = new Array();
$.ajax({
type : "POST",
url : "/" + testPlanId + "/mapInfo",
/* url : "/" + testPlanId + "/mapInfo",*/
url :testPlanId + "/mapInfo",
dataType : "json",
async : false,
success : function(data) {

View File

@ -17,7 +17,7 @@ function createScriptResultInfoTree(testPlanId,tree){
$.ajax({
type:"POST",
url:"/"+testPlanId+"/runningScriptInfo",
url:testPlanId+"/runningScriptInfo",
dataType:"json",
async: false,
success: function(data){
@ -54,7 +54,7 @@ var SutResult=function(testPlanId){
$.ajax({
type:"POST",
url:"/"+testPlanId+"/sutInfo",
url:testPlanId+"/sutInfo",
dataType:"json",
async: false,
success: function(data){

View File

@ -146,7 +146,7 @@ body {
<td>
<a href="#"
class="button script-button" onClick="viewScript(this)"><img
src="/images/script_edit.png"
src="images/script_edit.png"
alt="Add"> View/Edit user script</a>
</td>

View File

@ -1,37 +0,0 @@
package org.bench4q.web.api.test;
import org.bench4q.share.models.master.UserModel;
import org.bench4q.web.api.AuthorizeActionController;
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 org.springframework.ui.ModelMap;
import org.springframework.util.Assert;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
public class LoginTest {
@Autowired
private AuthorizeActionController authorizeActionController;
private ModelMap model = new ModelMap();
@Test
public void loginRight() {
UserModel userRight = new UserModel();
setUser(userRight, "www", "www");
Assert.isTrue(authorizeActionController.login(userRight, model));
Assert.state(userRight.getUserName().equals(model.get("username")));
}
@Test
public void loginPassReeor(){
UserModel userError = new UserModel();
setUser(userError, "www", "123");
Assert.isTrue(!authorizeActionController.login(userError, model));
}
public void setUser(UserModel user,String name,String pass){
user.setUserName(name);
user.setPassword(pass);
}
}

View File

@ -1,62 +0,0 @@
package org.bench4q.web.api.test;
import java.util.UUID;
import org.bench4q.share.models.master.UserModel;
import org.bench4q.web.api.AuthorizeActionController;
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 org.springframework.util.Assert;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
public class RegisterTest {
@Autowired
AuthorizeActionController authorizeActionController;
@Test
public void registerError() {
UserModel userRight = new UserModel();
String username= UUID.randomUUID().toString();
setUser(userRight, username, "123");
Assert.isTrue(authorizeActionController.register(userRight));
UserModel userNameEmpty = new UserModel();
setUser(userNameEmpty ,"", "123");
Assert.isTrue(!authorizeActionController.register(userNameEmpty));
UserModel userPassEmpty = new UserModel();
setUser(userPassEmpty, "xiaohong", "");
Assert.isTrue(!authorizeActionController.register(userPassEmpty));
UserModel userNameNull = new UserModel();
setUser(userNameNull, null, "123");
Assert.isTrue(!authorizeActionController.register(userNameNull));
UserModel userPassNull = new UserModel();
setUser(userPassNull, "tom", null);
Assert.isTrue(!authorizeActionController.register(userPassNull));
}
@Test
public void rigisterExist(){
UserModel userExist = new UserModel();
setUser(userExist, "www", "www");
Assert.isTrue(!authorizeActionController.register(userExist));
}
public void setUser(UserModel user,String name,String pass){
user.setUserName(name);
user.setPassword(pass);
}
}

View File

@ -1,41 +0,0 @@
package org.bench4q.web.api.test;
import org.bench4q.web.api.TestPlanActionController;
import org.bench4q.web.model.ScriptModel;
import org.bench4q.web.model.TestPlanRequestModel;
import org.bench4q.web.test.service.TestLoginService;
import org.bench4q.web.test.service.TestScriptService;
import org.junit.Before;
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 org.springframework.ui.ModelMap;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
public class RunPlan {
@Autowired
private TestLoginService testLoginService;
@Autowired
private TestScriptService testScriptService;
@Autowired
protected TestPlanActionController testPlanActionController;
protected String accessToken;
protected String UUID;
protected TestPlanRequestModel testPlanRequestModel;
protected ScriptModel scriptRight;
protected ModelMap model = new ModelMap();
@Before
public void testBefore() {
this.accessToken=testLoginService.login();
if(this.accessToken==null)
{
System.out.println("login fail");
return;
}
}
}

View File

@ -1,80 +0,0 @@
package org.bench4q.web.api.test;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.share.models.master.UserModel;
import org.bench4q.web.api.AuthorizeActionController;
import org.bench4q.web.api.TestPlanActionController;
import org.bench4q.web.model.ScriptModel;
import org.bench4q.web.model.TestPlanRequestModel;
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 org.springframework.ui.ModelMap;
import org.springframework.util.Assert;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"file:src/main/resources/bench4qweb-servlet.xml"})
public class RunTestPlan {
@Autowired
private TestPlanActionController testPlanActionController;
@Autowired
private AuthorizeActionController authorizeActionController;
private ModelMap model=new ModelMap();
@Before
public void before(){
UserModel userModel=new UserModel();
userModel.setUserName("www");
userModel.setPassword("www");
authorizeActionController.login(userModel, model);
}
@Test
public void runTestPlan(){
String accessToken=(String)model.get("accessToken");
//one script
List<ScriptModel> scriptModels=new ArrayList<>();
List<String> ipList=new ArrayList<>();
TestPlanRequestModel testPlanRequestModel=new TestPlanRequestModel();
ScriptModel scriptRight=new ScriptModel(15,100,20,1000,30);
//ipList is empty,script in one,right
scriptModels.add(scriptRight);
testPlanRequestModel.setIpList(ipList);
testPlanRequestModel.setScriptList(scriptModels);
testPlanRequestModel.setTestPlanName("yyy");
System.out.println(model.get("username"));
Assert.isTrue(testPlanActionController.runTestPlan(accessToken, model,
testPlanRequestModel).equals("testPlanTask.jsp"));
//ipList is null,script is wrong
ScriptModel scriptErrorModel=new ScriptModel();
scriptModels.clear();
scriptModels.add(scriptErrorModel);
testPlanRequestModel.setIpList(null);
testPlanRequestModel.setScriptList(scriptModels);
testPlanRequestModel.setTestPlanName("uuu");
Assert.isTrue(testPlanActionController.runTestPlan(accessToken, model,
testPlanRequestModel).equals("bad_request.jsp"));
//testPlan name is null
scriptModels.clear();
scriptModels.add(scriptRight);
testPlanRequestModel.setIpList(null);
testPlanRequestModel.setScriptList(scriptModels);
testPlanRequestModel.setTestPlanName(null);
Assert.isTrue(testPlanActionController.runTestPlan(accessToken, model,
testPlanRequestModel).equals("testPlanTask.jsp"));
}
}

View File

@ -1,25 +0,0 @@
package org.bench4q.web.api.test;
import java.util.List;
import org.bench4q.web.model.TestPlanTaskModel;
import org.junit.Test;
import org.springframework.util.Assert;
public class TestPlanTaskListTest extends RunPlan{
@Test
public void testPlanTaskList() throws InterruptedException{
Assert.notNull(this.model.get("testPlanTaskList"));
@SuppressWarnings("unchecked")
List<TestPlanTaskModel> list = (List<TestPlanTaskModel>) this.model.get("testPlanTaskList");
Assert.isTrue(list.size()==1);
// Iterator< TestPlanTaskModel> iterator=list.iterator();
}
}

View File

@ -1,31 +0,0 @@
package org.bench4q.web.test.service;
import org.bench4q.share.models.master.UserModel;
import org.bench4q.web.api.AuthorizeActionController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.ui.ModelMap;
@Component
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
public class TestLoginService {
@Autowired
private AuthorizeActionController authorizeActionController;
public String login() {
ModelMap model = new ModelMap();
UserModel user = new UserModel();
setUser(user, "www", "www");
if (authorizeActionController.login(user, model))
return (String) model.get("accessToken");
else
return null;
}
public void setUser(UserModel user, String name, String pass) {
user.setUserName(name);
user.setPassword(pass);
}
}

View File

@ -1,21 +0,0 @@
package org.bench4q.web.test.service;
import org.bench4q.web.model.ScriptModel;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = { "file:src/main/resources/bench4qweb-servlet.xml" })
@Component
public class TestScriptService {
public ScriptModel getScriptModelRight(int id,int load,long warmup,long executeRange,long cooldown) {
ScriptModel scriptModel = new ScriptModel();
scriptModel.setId(id);
scriptModel.setCooldown(cooldown);
scriptModel.setExecuteRange(executeRange);
scriptModel.setWarmup(warmup);
scriptModel.setExecuteRange(executeRange);
return scriptModel;
}
}