little refa
This commit is contained in:
parent
2be8b29119
commit
49cf396f7f
|
@ -86,18 +86,6 @@ public class BusinessModelMapFactory {
|
||||||
runningScriptModel.getScriptId(),
|
runningScriptModel.getScriptId(),
|
||||||
runningScriptModel.getTestPlanID(),
|
runningScriptModel.getTestPlanID(),
|
||||||
toBusiness(runningScriptModel.getRunningAgentModels()));
|
toBusiness(runningScriptModel.getRunningAgentModels()));
|
||||||
// result.setConfig(runningScriptModel.getConfig());
|
|
||||||
// result.setFinished(runningScriptModel.isFinished());
|
|
||||||
// result.setRequireLoad(runningScriptModel.getRequireLoad());
|
|
||||||
// List<RunningAgent> runningAgents = new ArrayList<RunningAgent>();
|
|
||||||
// for (RunningAgentModel runningAgentModel : runningScriptModel
|
|
||||||
// .getRunningAgentModels()) {
|
|
||||||
// runningAgents.add(BusinessModelMapFactory
|
|
||||||
// .toBusiness(runningAgentModel));
|
|
||||||
// }
|
|
||||||
// result.setRunningAgents(runningAgents);
|
|
||||||
// result.setScriptId(runningScriptModel.getScriptId());
|
|
||||||
// result.setTestPlanID(runningScriptModel.getTestPlanID());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +186,6 @@ public class BusinessModelMapFactory {
|
||||||
ret.setFailTimes(testPlanDB.getFailTimes());
|
ret.setFailTimes(testPlanDB.getFailTimes());
|
||||||
ret.setId(testPlanDB.getId());
|
ret.setId(testPlanDB.getId());
|
||||||
ret.setName(testPlanDB.getName());
|
ret.setName(testPlanDB.getName());
|
||||||
ret.setReportCreated(testPlanDB.isReportCreated());
|
|
||||||
ret.setTestPlanModelContent(testPlanDB.getTestPlanModelContent());
|
ret.setTestPlanModelContent(testPlanDB.getTestPlanModelContent());
|
||||||
ret.setTestPlanRunId(testPlanDB.getTestPlanRunId());
|
ret.setTestPlanRunId(testPlanDB.getTestPlanRunId());
|
||||||
ret.setUserModel(toModel(testPlanDB.getUser()));
|
ret.setUserModel(toModel(testPlanDB.getUser()));
|
||||||
|
|
|
@ -22,7 +22,6 @@ public class TestPlanDB {
|
||||||
private String testPlanModelContent;
|
private String testPlanModelContent;
|
||||||
private String currentStatus;
|
private String currentStatus;
|
||||||
private int failTimes;
|
private int failTimes;
|
||||||
private boolean reportCreated;
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@ -99,13 +98,4 @@ public class TestPlanDB {
|
||||||
this.failTimes = failTimes;
|
this.failTimes = failTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "reportCreated", nullable = false)
|
|
||||||
public boolean isReportCreated() {
|
|
||||||
return reportCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReportCreated(boolean reportCreated) {
|
|
||||||
this.reportCreated = reportCreated;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveTestPlanToDB(final TestPlanInBusiness testPlanInParam,
|
public boolean saveTestPlanToDB(final TestPlanInBusiness testPlanInParam,
|
||||||
final User user, final UUID testPlanRunId,
|
final User user, final UUID testPlanRunId) {
|
||||||
final Collection<RunningScript> collection) {
|
|
||||||
Session session = this.sessionHelper.openSession();
|
Session session = this.sessionHelper.openSession();
|
||||||
Transaction transaction = session.beginTransaction();
|
Transaction transaction = session.beginTransaction();
|
||||||
TestPlanDB testPlanInSession;
|
TestPlanDB testPlanInSession;
|
||||||
|
@ -81,7 +80,7 @@ public class TestPlanService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!saveToTestPlanScriptAndScriptConfig(session,
|
if (!saveToTestPlanScriptAndScriptConfig(session,
|
||||||
testPlanInSession, collection)) {
|
testPlanInSession, testPlanInParam.getRunningScripts())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
@ -197,11 +196,6 @@ public class TestPlanService {
|
||||||
.getTestPlan(testPlanRunID).getCurrentStatus());
|
.getTestPlan(testPlanRunID).getCurrentStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanDB pickALatestPengdingWithMinimalFailTimes() {
|
|
||||||
// TODO: fulfill this
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestPlanDBModel getTestPlanDBModel(UUID runId) {
|
public TestPlanDBModel getTestPlanDBModel(UUID runId) {
|
||||||
return this.getBusinessMapFactory().toModel(
|
return this.getBusinessMapFactory().toModel(
|
||||||
this.getTestPlanRepository().getTestPlan(runId));
|
this.getTestPlanRepository().getTestPlan(runId));
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class TestPlanEngine implements TaskCompleteCallback,
|
||||||
final TestPlanContext testPlanContext = new TestPlanContext(testPlan,
|
final TestPlanContext testPlanContext = new TestPlanContext(testPlan,
|
||||||
testPlanId);
|
testPlanId);
|
||||||
if (!this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
if (!this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
||||||
testPlanId, testPlanContext.getAllScript())) {
|
testPlanId)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class TestBase_MakeUpTestPlan extends TestBase {
|
||||||
.getScriptId());
|
.getScriptId());
|
||||||
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
||||||
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
||||||
testPlanRunId, testPlan.getRunningScripts());
|
testPlanRunId);
|
||||||
this.setTestPlanRunIdUuid(testPlanRunId);
|
this.setTestPlanRunIdUuid(testPlanRunId);
|
||||||
return testPlanRunId;
|
return testPlanRunId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TestPlanScriptResultControllerTest extends TestBase_MakeUpTestPlan
|
||||||
.getScriptId());
|
.getScriptId());
|
||||||
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
||||||
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
||||||
testPlanRunId, testPlan.getRunningScripts());
|
testPlanRunId);
|
||||||
this.setTestPlanRunIdUuid(testPlanRunId);
|
this.setTestPlanRunIdUuid(testPlanRunId);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
this.getTestPlanScriptService().saveScriptBriefResult(
|
this.getTestPlanScriptService().saveScriptBriefResult(
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
|
||||||
public class Test_TestPlanScriptResultService extends TestBase_MakeUpTestPlan {
|
public class Test_TestPlanScriptResultService extends TestBase_MakeUpTestPlan {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSpecficFieldValue() throws Exception {
|
public void testGetSpecficFieldValue() throws Exception {
|
||||||
long averageResponseTime = (Long) TestHelper.invokePrivateMethod(
|
long averageResponseTime = (Long) TestHelper.invokePrivateMethod(
|
||||||
|
@ -123,7 +122,7 @@ public class Test_TestPlanScriptResultService extends TestBase_MakeUpTestPlan {
|
||||||
.getScriptId());
|
.getScriptId());
|
||||||
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
TestPlanInBusiness testPlan = BusinessModelMapFactory.toBusiness(model);
|
||||||
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
this.getTestPlanService().saveTestPlanToDB(testPlan, user,
|
||||||
testPlanRunId, testPlan.getRunningScripts());
|
testPlanRunId);
|
||||||
this.setTestPlanRunIdUuid(testPlanRunId);
|
this.setTestPlanRunIdUuid(testPlanRunId);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
this.getTestPlanScriptService().saveScriptBriefResult(
|
this.getTestPlanScriptService().saveScriptBriefResult(
|
||||||
|
|
|
@ -40,8 +40,7 @@ public class TestPlanTester extends TestBase_MakeUpTestPlan {
|
||||||
private TestPlanBusinessModel testPlanBusinessModel = new TestPlanBusinessModel();
|
private TestPlanBusinessModel testPlanBusinessModel = new TestPlanBusinessModel();
|
||||||
private String _url = TestBase.BASE_URL + "/testPlan";
|
private String _url = TestBase.BASE_URL + "/testPlan";
|
||||||
private int scriptSumNum;
|
private int scriptSumNum;
|
||||||
public static int SCRIPTID1 = 61;
|
public static int SCRIPTID1 = 78;
|
||||||
// public static int SCRIPTID1 = 1;
|
|
||||||
private static int SCRIPTID2 = 2;
|
private static int SCRIPTID2 = 2;
|
||||||
private static String Monitor_Host_Name = "133.133.12.3";
|
private static String Monitor_Host_Name = "133.133.12.3";
|
||||||
private static String monitor_port = "5556";
|
private static String monitor_port = "5556";
|
||||||
|
|
Loading…
Reference in New Issue