add a log when unmarshal the script

This commit is contained in:
Tienan Chen 2013-11-07 15:36:08 +08:00
parent da85792251
commit 40f530736d
4 changed files with 17 additions and 9 deletions

View File

@ -308,7 +308,7 @@ public class AgentService {
httpResponse = this.httpRequester
.sendGet(agent.getHostName() + ":" + agent.getPort()
+ "/test/brief/" + agentRunId, null, null);
if (httpResponse == null) {
if (httpResponse == null || httpResponse.getContent() == null) {
return null;
}
logger.info(httpResponse.getContent());
@ -317,6 +317,7 @@ public class AgentService {
} catch (Exception e) {
logger.error(e.toString() + " When brief the agent with hostName "
+ agent.getHostName());
e.printStackTrace();
new BriefAgentFault().doTolerance();
return null;
}

View File

@ -8,6 +8,7 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.apache.log4j.Logger;
import org.bench4q.master.communication.agent.RunScenarioModel;
import org.bench4q.master.communication.agent.UserBehaviorModel;
import org.bench4q.master.entity.db.Script;
@ -23,6 +24,7 @@ import org.springframework.stereotype.Component;
public class ScriptService {
private SessionHelper sessionHelper = new SessionHelper();
private UserService userService;
private Logger logger = Logger.getLogger(ScriptService.class);
private SessionHelper getSessionHelper() {
return sessionHelper;
@ -59,6 +61,7 @@ public class ScriptService {
return true;
} catch (Exception e) {
e.printStackTrace();
logger.info(scriptContent);
transaction.rollback();
return false;
} finally {

View File

@ -45,11 +45,15 @@ public class TestPlanContainer {
|| testPlanContext.getRunningScriptMap().size() == 0) {
}
for (RunningScriptModel model : testPlanContext.getRunningScriptMap()
.values()) {
if (!model.isFinish()) {
finish = false;
try {
for (RunningScriptModel model : testPlanContext
.getRunningScriptMap().values()) {
if (!model.isFinish()) {
finish = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return finish;
}

View File

@ -29,8 +29,8 @@ public class TestPlanTester extends TestBase {
private int scriptSumNum;
private static int SCRIPTID1 = 18;
private static int SCRIPTID2 = 2;
// private static int EACH_SCRIPT_LOAD_LargeSCALE = 12000;
private static int EACH_SCRIPT_LOAD_SMALLSCALE = 400;
private static int EACH_SCRIPT_LOAD_LargeSCALE = 12000;
// private static int EACH_SCRIPT_LOAD_SMALLSCALE = 400;
// private static int EACH_SCRIPT_LOAD_MIDDLESCALE = 800;
private static String Monitor_Host_Name = "133.133.12.3";
private static String monitor_port = "5556";
@ -147,10 +147,10 @@ public class TestPlanTester extends TestBase {
private RunningScriptModel buildScriptModel(int scriptID) {
RunningScriptModel model = new RunningScriptModel();
model.setScriptId(scriptID);
model.setRequireLoad(EACH_SCRIPT_LOAD_SMALLSCALE);
model.setRequireLoad(EACH_SCRIPT_LOAD_LargeSCALE);
TestScriptConfig config = new TestScriptConfig();
config.setWarmUp(20);
config.setExecuteRange(200);
config.setExecuteRange(600);
config.setCoolDown(10);
model.setConfig(config);
return model;