This commit is contained in:
coderfengyun 2014-01-06 17:16:10 +08:00
parent 4902a3a8f0
commit 33e71e078c
2 changed files with 1 additions and 82 deletions

View File

@ -1,82 +0,0 @@
package org.bench4q.master.test.controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.MonitorLogicalDiskResponseModel;
import org.bench4q.share.models.monitor.LogicalDiskModel;
import org.bench4q.share.models.monitor.LogicalDiskModelChild;
public class MonitorControllerTest extends TestBase {
public MonitorLogicalDiskResponseModel testLogicalDiskInfo(String hostName,
String port, String request) throws IOException, JAXBException {
Map<String, String> map = new HashMap<String, String>();
map.put("hostName", hostName);
map.put("port", port);
HttpResponse httpResponse = this.httpRequester.sendGet(BASE_URL
+ "/monitorController/logicDiskMonitorSUTInfo", map,
this.makeAccessTockenMap(this.getAccessTocken()));
if (httpResponse == null) {
System.out.println("HttpResponse is null!");
}
MonitorLogicalDiskResponseModel resultModel = (MonitorLogicalDiskResponseModel) MarshalHelper
.unmarshal(MonitorLogicalDiskResponseModel.class,
httpResponse.getContent());
return resultModel;
}
private void result(LogicalDiskModel logicalDiskModel) {
List<LogicalDiskModelChild> list = logicalDiskModel
.getLogicalDiskList();
Iterator<LogicalDiskModelChild> iterator = list.iterator();
while (iterator.hasNext()) {
LogicalDiskModelChild logicalDiskModelChild = iterator.next();
System.out.println(logicalDiskModelChild.getInstance());
System.out.println(logicalDiskModelChild.getFreeMegabytes());
}
}
public void testMemorySUTInfo(String hostName, int port) throws IOException {
Map<String, String> params = buildParamMap(hostName, port);
HttpResponse httpResponse = this.httpRequester.sendGet(BASE_URL
+ "/monitorController/memorySUTInfo", params,
this.makeAccessTockenMap(this.getAccessTocken()));
System.out.println(httpResponse.getContent());
}
private Map<String, String> buildParamMap(String hostName, int port) {
Map<String, String> params = new HashMap<String, String>();
params.put("hostName", hostName);
params.put("port", String.valueOf(port));
return params;
}
public void testProcessorSUTInfo(String hostName, int port)
throws IOException {
HttpResponse httpResponse = this.httpRequester.sendGet(BASE_URL
+ "/monitorController/processorSUTInfo",
buildParamMap(hostName, port),
this.makeAccessTockenMap(this.getAccessTocken()));
System.out.println(httpResponse.getContent());
}
public static void main(String[] args) throws IOException, JAXBException {
MonitorControllerTest monirotControllerTest = new MonitorControllerTest();
monirotControllerTest.setAccessTocken(monirotControllerTest.login());
MonitorLogicalDiskResponseModel responseModel = monirotControllerTest
.testLogicalDiskInfo("localhost", "5556",
"/Monitor/LogicalDisk");
monirotControllerTest.result(responseModel.getLogicalDiskModel());
monirotControllerTest.testMemorySUTInfo("localhost", 5556);
monirotControllerTest.testProcessorSUTInfo("localhost", 5556);
}
}

View File

@ -276,6 +276,7 @@ public class TestPlanTester extends TestBase_MakeUpTestPlan {
params.put("testPlanRunId", testPlanId.toString());
params.put("hostName", hostName);
params.put("port", port);
params.put("duationBegin", 0 + "");
HttpResponse httpResponse = this.httpRequester.sendGet(
TestBase.BASE_URL + relativePath, params,
this.createAccessTokenMap());