contact with agent complete

This commit is contained in:
coderfengyun 2013-07-17 14:41:37 +08:00
parent c7ca816c22
commit cf14a5e5ca
2 changed files with 7 additions and 10 deletions

View File

@ -119,8 +119,8 @@ public class AgentController extends BaseController {
}
}
public RunScenarioResultModel sendScriptContentToAgent(String hostNameString, int port,
String scriptContent) {
public RunScenarioResultModel sendScriptContentToAgent(
String hostNameString, int port, String scriptContent) {
RunScenarioResultModel runScenarioResultModel = new RunScenarioResultModel();
try {
HttpResponse httpResponse = httpRequester.sendPostXml(
@ -132,14 +132,10 @@ public class AgentController extends BaseController {
this.setRunId(runScenarioResultModel.getRunId());
return runScenarioResultModel;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
runScenarioResultModel.setRunId(UUID.fromString("-1"));
return runScenarioResultModel;
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
runScenarioResultModel.setRunId(UUID.fromString("-1"));
return runScenarioResultModel;
}
}
@ -177,15 +173,16 @@ public class AgentController extends BaseController {
TestBriefStatusModel resultModel = new TestBriefStatusModel();
try {
HttpResponse httpResponse = httpRequester.sendGet(hostString + ":"
+ port + "/test/brief/{" + runId + "}", null, null);
+ port + "/test/brief/" + runId, null, null);
resultModel = extractTestBriefStatusModel(httpResponse.getContent());
return resultModel;
} catch (IOException e) {
e.printStackTrace();
return resultModel;
} catch (JAXBException e) {
e.printStackTrace();
return resultModel;
}
return resultModel;
}
private TestBriefStatusModel extractTestBriefStatusModel(String content)

View File

@ -66,7 +66,7 @@ public class TestPlanController extends BaseController {
RunScenarioResultModel runScenarioResultModel = this.getAgentController().sendScriptContentToAgent(
agentInfo.getIpAdress(), agentInfo.getPort(),
scriptContentString);
if (runScenarioResultModel.getRunId() != UUID.fromString("-1")) {
if (!runScenarioResultModel.getRunId().equals(null)) {
map.put(agentInfo.getIpAdress(), runScenarioResultModel.getRunId());
}