配套云端改动,新增调度任务按不同环境执行的功能

This commit is contained in:
李基缘 2021-11-16 11:28:36 +08:00
parent 9614164e92
commit bca7fcf7a4
6 changed files with 24 additions and 1 deletions

View File

@ -40,6 +40,8 @@ public class BatchCaseExecute extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
//获取到调度任务的环境信息
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
BatchTestCaseExecution.batchCaseExecuteForTast(
String.valueOf(task.getTaskId()), batchcase);

View File

@ -39,6 +39,7 @@ public class OneCaseExecute extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskId));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskId));
ClientHandler.clientId = taskScheduling.getClientId();
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestCaseExecution testCaseExecution=new TestCaseExecution();

View File

@ -33,6 +33,7 @@ public class RunAutomationTest extends TestControl {
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
SchedulingConstants.envName=taskScheduling.getEnvName();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestControl.taskExecutionPlan(task);

View File

@ -0,0 +1,7 @@
package luckyclient.execution;
public class SchedulingConstants {
//µ÷ÈÈÎÎñ»·¾³
public static String envName = "";
}

View File

@ -1,6 +1,7 @@
package luckyclient.remote.api;
import com.alibaba.fastjson.JSONObject;
import luckyclient.execution.SchedulingConstants;
import luckyclient.execution.dispose.ParamsManageForSteps;
import luckyclient.remote.entity.*;
import luckyclient.utils.httputils.HttpRequest;
@ -99,7 +100,7 @@ public class GetServerApi {
* @return 公共参数集合
*/
public static List<ProjectCaseParams> cgetParamsByProjectid(String projectid) {
String result = HttpRequest.loadJSON(PREFIX+"/clientGetParamsByProjectId.do?projectId="+projectid);
String result = HttpRequest.loadJSON(PREFIX+"/clientGetParamsByProjectIdAndEnvName.do?projectId="+projectid+"&envName="+ SchedulingConstants.envName);
List<ProjectCaseParams> paramsList = JSONObject.parseArray(result, ProjectCaseParams.class);
//当公共参数存在内置函数时先进行数据转换
for(ProjectCaseParams pcp:paramsList){

View File

@ -28,6 +28,8 @@ public class TaskScheduling extends BaseEntity
private Integer planId;
/** 客户端ID */
private Integer clientId;
/** »·¾³ */
private String envName;
/** 邮件通知地址 */
private String emailAddress;
/** 第三方推送地址 */
@ -157,6 +159,14 @@ public class TaskScheduling extends BaseEntity
this.emailAddress = emailAddress;
}
public String getEnvName() {
return envName;
}
public void setEnvName(String envName) {
this.envName = envName;
}
public String getEmailAddress()
{
return emailAddress;
@ -252,6 +262,7 @@ public class TaskScheduling extends BaseEntity
.append("projectId", getProjectId())
.append("planId", getPlanId())
.append("clientId", getClientId())
.append("envName", getEnvName())
.append("emailAddress", getEmailAddress())
.append("pushUrl", getPushUrl())
.append("emailSendCondition", getEmailSendCondition())