to find bug notStart
This commit is contained in:
parent
dea67a7a85
commit
efb6e56141
|
@ -85,6 +85,7 @@ public class PluginController extends BaseController {
|
|||
return pluginResponseModel;
|
||||
}
|
||||
|
||||
//need to get info from master,then insert to dataBase
|
||||
@RequestMapping(value = "/addPlugin", method = { RequestMethod.PUT })
|
||||
@ResponseBody
|
||||
public PluginResponseModel addPlugin(@RequestBody PluginGUI pluginGUI)
|
||||
|
|
|
@ -200,10 +200,6 @@ public class TestPlanFactory {
|
|||
if (testPlanInRepo == null) {
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
* testPlanInRepo.setLoadDistribute(ApplicationContextHelper.getContext()
|
||||
* .getBean(LoadDistribute.class));
|
||||
*/
|
||||
testPlanInRepo.setLoadDistribute(this.getLoadDistribute());
|
||||
for (TestPlanScript testPlanScript : testPlanInRepo
|
||||
.getTestPlanScripts()) {
|
||||
|
@ -214,7 +210,7 @@ public class TestPlanFactory {
|
|||
convertToDomain(monitor);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("convertToDomain testPlan run id:" + testPlanInRepo.getTestPlanRunId());
|
||||
return testPlanInRepo;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,10 @@ public class TestPlanRepository extends AbstractRepositoty {
|
|||
.createCriteria(TestPlan.class)
|
||||
.add(Restrictions.eq("testPlanRunId", testPlanRunId.toString()))
|
||||
.uniqueResult();
|
||||
if (result == null) {
|
||||
logger.error("can't find testplan with testPlanRunId : "
|
||||
+ testPlanRunId.toString() + " in TestPlanRepository");
|
||||
}
|
||||
releaseSession(session);
|
||||
return this.getTestPlanFactory().convertToDomain(result);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,11 @@ public class TestPlanEngine implements TaskCompleteCallback,
|
|||
|
||||
public void doRunTestPlan(final UUID testPlanId) {
|
||||
TestPlan testPlan = getTestPlanRepository().getTestPlanBy(testPlanId);
|
||||
if (testPlan == null) {
|
||||
logger.error("can't get the testplan with testPlanId:"
|
||||
+ testPlanId.toString());
|
||||
return;
|
||||
}
|
||||
TestPlanStatus returnStatus = testPlan.run();
|
||||
commitTestPlanStaus(returnStatus, testPlan);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<property name="hibernate.connection.username">root</property>
|
||||
<property name="hibernate.connection.password">123456 </property>
|
||||
<property name="hibernate.connection.pool.size">20 </property>
|
||||
<property name="hibernate.show_sql">true </property>
|
||||
<property name="hibernate.show_sql">false</property>
|
||||
<property name="format_sql">false</property>
|
||||
<property name="Connection.useUnicode">true </property>
|
||||
<property name="connection.characterEncoding">utf-8 </property>
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.bench4q.master.domain.service.TestPlanService;
|
|||
import org.bench4q.master.domain.service.UserService;
|
||||
import org.bench4q.master.domain.testplan.TestMoniorResultSave;
|
||||
import org.bench4q.master.domain.testplan.TestScriptResultSave;
|
||||
import org.bench4q.master.helper.SessionHelper;
|
||||
import org.bench4q.master.infrastructure.communication.AgentMessenger;
|
||||
import org.bench4q.master.test.controller.TestBase;
|
||||
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
|
||||
|
@ -29,6 +30,7 @@ import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class TestBase_MakeUpTestPlan extends TestBase {
|
||||
private SessionHelper sessionHelper;
|
||||
private TestPlanScriptResultService testPlanScriptResultService;
|
||||
private TestPlanScriptService testPlanScriptService;
|
||||
private TestPlanService testPlanService;
|
||||
|
@ -56,6 +58,15 @@ public class TestBase_MakeUpTestPlan extends TestBase {
|
|||
protected static final String Test_AGENT_HOSTNAME = "133.133.12.4";
|
||||
protected static final int TEST_PORT = 6565;
|
||||
|
||||
protected SessionHelper getSessionHelper() {
|
||||
return sessionHelper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
protected void setSessionHelper(SessionHelper sessionHelper) {
|
||||
this.sessionHelper = sessionHelper;
|
||||
}
|
||||
|
||||
public TestPlanScriptResultService getTestPlanScriptResultService() {
|
||||
return testPlanScriptResultService;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,19 @@ package org.bench4q.master.test.domain;
|
|||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bench4q.master.domain.entity.Monitor;
|
||||
import org.bench4q.master.domain.entity.MonitorResult;
|
||||
import org.bench4q.master.domain.entity.TestPlan;
|
||||
import org.bench4q.master.domain.factory.TestPlanFactory;
|
||||
import org.bench4q.master.domain.testplan.TestMoniorResultSave;
|
||||
import org.bench4q.master.domain.testplan.TestMonitorSampler;
|
||||
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
|
||||
import org.bench4q.share.models.monitor.MonitorMain;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -71,7 +75,7 @@ public class Test_TestMonitorResultSave extends TestBase_MakeUpTestPlan {
|
|||
public void testDoSaveResult() {
|
||||
TestPlan testPlan = fetchTestPlan();
|
||||
Monitor monitor = testPlan.getMonitors().iterator().next();
|
||||
int beforeMonitorResultSize = monitor.getResults().size();
|
||||
int beforeMonitorResultSize = loadMonitorResults(monitor).size();
|
||||
MonitorMain monitorMain = monitor.getTestMonitorSampler()
|
||||
.getMonitorResult(monitor.getHostName(), monitor.getPort());
|
||||
Assert.assertNotNull(monitorMain);
|
||||
|
@ -81,11 +85,22 @@ public class Test_TestMonitorResultSave extends TestBase_MakeUpTestPlan {
|
|||
monitor));
|
||||
testPlan = fetchTestPlan();
|
||||
monitor = testPlan.getMonitors().iterator().next();
|
||||
Assert.assertEquals(beforeMonitorResultSize + 5, monitor.getResults()
|
||||
.size());
|
||||
Assert.assertEquals(beforeMonitorResultSize + 5,
|
||||
loadMonitorResults(monitor).size());
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<MonitorResult> loadMonitorResults(Monitor monitor) {
|
||||
Session session = this.getSessionHelper().openSession();
|
||||
List<MonitorResult> results = session
|
||||
.createCriteria(MonitorResult.class)
|
||||
.add(Restrictions.eq("monitor", monitor)).list();
|
||||
|
||||
session.close();
|
||||
return results;
|
||||
}
|
||||
|
||||
@After
|
||||
public void clean() {
|
||||
cleanUpForTestPlanRunning();
|
||||
|
|
Loading…
Reference in New Issue