refactor the test, and pass it

This commit is contained in:
coderfengyun 2014-01-07 16:44:47 +08:00
parent 897b65ffa5
commit 260140ba04
3 changed files with 48 additions and 33 deletions

View File

@ -34,6 +34,7 @@ public class BehaviorsBriefStatistics extends ScriptStatistics {
public BehaviorsBriefStatistics() {
this.setMap(new HashMap<Integer, Map<Integer, BehaviorStatusCodeResultModel>>());
this.setIdUrlMap(new HashMap<Integer, String>());
}
public ScriptBehaviorsBriefModel getStatistics() {

View File

@ -1,41 +1,50 @@
package org.bench4q.master.test.service;
import static org.junit.Assert.*;
import java.util.List;
import java.util.UUID;
import org.bench4q.master.entity.TestPlanDB;
import org.bench4q.master.service.infrastructure.UserService;
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;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
public class Test_UserService {
// private UserService userService;
//
// private UserService getUserService() {
// return userService;
// }
//
// @Autowired
// private void setUserService(UserService userService) {
// this.userService = userService;
// }
//
// @Test
// public void test() {
// assertNotNull(this.getUserService());
// }
//
// @Test
// public void testQueryTestPlans() {
// List<TestPlanDB> testPlanDBs = this.getUserService().querytestPlans(5);
// assertNotNull(testPlanDBs);
// assertTrue(testPlanDBs.size() > 0);
// }
//
// @Test
// public void testQueryTestPlan() {
// TestPlanDB testPlan = this.getUserService().queryTestPlan(5,
// UUID.fromString("ad10a4be-e6e2-4ffc-9282-3ba5c1a1316b"));
// assertNotNull(testPlan);
// assertEquals(testPlan.getTestPlanRunId().toString(),
// "ad10a4be-e6e2-4ffc-9282-3ba5c1a1316b");
// }
private UserService userService;
private UserService getUserService() {
return userService;
}
@Autowired
private void setUserService(UserService userService) {
this.userService = userService;
}
@Test
public void test() {
assertNotNull(this.getUserService());
}
@Test
public void testQueryTestPlans() {
List<TestPlanDB> testPlanDBs = this.getUserService().querytestPlans(5);
assertNotNull(testPlanDBs);
assertTrue(testPlanDBs.size() > 0);
}
@Test
public void testQueryTestPlan() {
TestPlanDB testPlan = this.getUserService().queryTestPlan(5,
UUID.fromString("ad10a4be-e6e2-4ffc-9282-3ba5c1a1316b"));
assertNotNull(testPlan);
assertEquals(testPlan.getTestPlanRunId().toString(),
"ad10a4be-e6e2-4ffc-9282-3ba5c1a1316b");
}
}

View File

@ -260,8 +260,13 @@ public class TestPlanTester extends TestBase_MakeUpTestPlan {
private void getLogicalDiskResult(UUID testPlanID, String hostName,
String port) throws IOException {
getMonitorResult(testPlanID, hostName, port,
"/monitorController/logicDiskMonitorSUTInfo");
HttpResponse httpResponse = this.httpRequester
.sendGet(
TestBase.BASE_URL
+ "/monitorController/logicDiskMonitorSUTInfo?testPlanRunId="
+ testPlanID.toString() + "/" + hostName
+ "/6565/0", null, this.createAccessTokenMap());
System.out.println(httpResponse.getContent());
}
private void getNetworkInterfaceResult(UUID testPlanID, String hostName,