remove a bug when record script

This commit is contained in:
Tienan Chen 2013-10-30 14:56:26 +08:00
parent 8ab832e4ad
commit 0604f186e9
3 changed files with 35 additions and 25 deletions

View File

@ -66,11 +66,10 @@ public class ScriptCapturer {
}
private HttpCapture buildACapture(int port, String filePath, String fileName) {
return this.getHttpCaptureMap().put(
new Integer(port),
new HttpCapture(filePath, fileName, port,
HTTPCATUREGENERATOR_STRING, new JTextArea()));
HttpCapture httpCapture = new HttpCapture(filePath, fileName, port,
HTTPCATUREGENERATOR_STRING, new JTextArea());
this.getHttpCaptureMap().put(new Integer(port), httpCapture);
return httpCapture;
}
public void stopCurrentRecord(int port) {

View File

@ -1,7 +1,6 @@
package org.bench4q.master.service;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.UUID;
@ -12,6 +11,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.HttpRequester;
import org.bench4q.master.communication.HttpRequester.HttpResponse;
import org.bench4q.master.communication.monitor.LogicalDiskModel;
@ -25,6 +25,7 @@ import org.springframework.stereotype.Component;
public class MonitorService {
private HttpRequester httpRequester;
private MonitorResultService monitorResultService;
private static Logger logger = Logger.getLogger(MonitorService.class);
public HttpRequester getHttpRequester() {
return httpRequester;
@ -61,12 +62,13 @@ public class MonitorService {
saveResultRunable(LogicalDiskModel.class.getName(),
httpResponse.getContent(), testPlanRunId, hostName);
return extractLogicalDiskModel(httpResponse.getContent());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage() + "where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
} catch (JAXBException e) {
e.printStackTrace();
} catch (Throwable e) {
logger.error("connection happen at logicalDisk, where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
}
}
@ -94,7 +96,12 @@ public class MonitorService {
httpResponse.getContent(), testPlanRunId, hostName);
return extractMemoryModel(httpResponse.getContent());
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage() + "where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
} catch (Throwable e) {
logger.error("connection happen at memory, where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
}
}
@ -122,11 +129,13 @@ public class MonitorService {
saveResultRunable(ProcessorModel.class.getName(),
httpResponse.getContent(), testPlanRunId, hostName);
return extractProcessorModel(httpResponse.getContent());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage() + "where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
} catch (JAXBException e) {
e.printStackTrace();
} catch (Throwable e) {
logger.error("connection happen at processor, where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
}
@ -156,11 +165,13 @@ public class MonitorService {
changeCharsetToISO(httpResponse.getContent()),
testPlanRunId, hostName);
return extractNetworkInterfaceModel(httpResponse.getContent());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage() + "where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
} catch (JAXBException e) {
e.printStackTrace();
} catch (Throwable e) {
logger.error("connection happen at networkInterface, where testPlanRunId = "
+ testPlanRunId.toString() + " and hotsName = " + hostName);
return null;
}
}
@ -169,7 +180,6 @@ public class MonitorService {
String content) throws JAXBException, UnsupportedEncodingException {
Unmarshaller unmarshaller = JAXBContext.newInstance(
NetworkInterfaceModel.class).createUnmarshaller();
// content = changeCharsetToISO(content);
return (NetworkInterfaceModel) unmarshaller
.unmarshal(new ByteArrayInputStream(changeCharsetToISO(content)
.getBytes()));

View File

@ -29,7 +29,8 @@ public class TestPlanTester extends TestBase {
private int scriptSumNum;
private static int SCRIPTID1 = 1;
private static int SCRIPTID2 = 2;
private static String Monitor_Host_Name = "127.0.0.1";
private static int EACH_SCRIPT_LOAD = 500;
private static String Monitor_Host_Name = "133.133.12.3";
private static String monitor_port = "5556";
public TestPlanModel getTestPlan() {
@ -69,8 +70,8 @@ public class TestPlanTester extends TestBase {
while (testPlanResultModel.getCurrentStatus() != TestPlanService.TEST_PLAN_STATUS_IN_RUNNING) {
Thread.sleep(6000);
}
for (int i = 0; i < 3; i++) {
Thread.sleep(15000);
for (int i = 0; i < 20; i++) {
Thread.sleep(6000);
this.getScriptBrief(testPlanID, SCRIPTID1);
}
@ -146,7 +147,7 @@ public class TestPlanTester extends TestBase {
private RunningScriptModel buildScriptModel(int scriptID) {
RunningScriptModel model = new RunningScriptModel();
model.setScriptId(scriptID);
model.setRequireLoad(400);
model.setRequireLoad(EACH_SCRIPT_LOAD);
TestScriptConfig config = new TestScriptConfig();
config.setWarmUp(20);
config.setExecuteRange(200);