Browse Source

[DS-15489][style]rename the vo object suffix (#15504)

- the naming suffix of the objects under the package dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo is not unified, such as AlertPluginInstanceVO and ScheduleVO, etc.
- this issue solve it, and uniformly modified to the VO suffix

Co-authored-by: fuchanghai <changhaifu@apache.org>
3.2.1-prepare
silenceland 11 months ago committed by GitHub
parent
commit
16c97ef44d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java
  2. 18
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java
  3. 36
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java
  4. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
  5. 4
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
  6. 4
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVO.java
  7. 10
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVO.java
  8. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVO.java
  9. 10
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVO.java
  10. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVO.java
  11. 12
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java
  12. 4
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java

@ -27,9 +27,9 @@ import org.apache.dolphinscheduler.api.dto.CommandStateCount;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.DataAnalysisService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.dao.entity.User;
@ -71,7 +71,7 @@ public class DataAnalysisController extends BaseController {
@GetMapping(value = "/task-state-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(TASK_INSTANCE_STATE_COUNT_ERROR)
public Result<TaskInstanceCountVo> getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<TaskInstanceCountVO> getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
@ -91,7 +91,7 @@ public class DataAnalysisController extends BaseController {
@GetMapping(value = "/process-state-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_INSTANCE_STATE_ERROR)
public Result<WorkflowInstanceCountVo> getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<WorkflowInstanceCountVO> getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
@ -109,7 +109,7 @@ public class DataAnalysisController extends BaseController {
@GetMapping(value = "/define-user-count")
@ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR)
public Result<WorkflowDefinitionCountVo> countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result<WorkflowDefinitionCountVO> countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "projectCode", required = false) Long projectCode) {
if (projectCode == null) {
return Result.success(dataAnalysisService.getAllWorkflowDefinitionCount(loginUser));

18
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java

@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.api.dto.CommandStateCount;
import org.apache.dolphinscheduler.api.dto.DefineUserDto;
import org.apache.dolphinscheduler.api.dto.TaskCountDto;
import org.apache.dolphinscheduler.api.dto.project.StatisticsStateRequest;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.List;
@ -34,27 +34,27 @@ import java.util.Map;
*/
public interface DataAnalysisService {
TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser,
TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate);
TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser,
TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser,
String startDate,
String endDate);
WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser,
WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser,
Long projectCodes,
String startDate,
String endDate);
WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser,
WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser,
String startDate,
String endDate);
WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode);
WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode);
WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser);
WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser);
/**
* statistics the workflow quantities of certain user

36
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java

@ -27,9 +27,9 @@ import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.DataAnalysisService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.CommandType;
@ -105,7 +105,7 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal
private TaskDefinitionMapper taskDefinitionMapper;
@Override
public TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser,
public TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate) {
@ -114,26 +114,26 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal
Date end = endDate == null ? null : transformDate(endDate);
List<TaskInstanceStatusCountDto> taskInstanceStatusCounts =
taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode));
return TaskInstanceCountVo.of(taskInstanceStatusCounts);
return TaskInstanceCountVO.of(taskInstanceStatusCounts);
}
@Override
public TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser,
public TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser,
String startDate,
String endDate) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return TaskInstanceCountVo.empty();
return TaskInstanceCountVO.empty();
}
Date start = startDate == null ? null : transformDate(startDate);
Date end = endDate == null ? null : transformDate(endDate);
List<TaskInstanceStatusCountDto> taskInstanceStatusCounts =
taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, projectCodes);
return TaskInstanceCountVo.of(taskInstanceStatusCounts);
return TaskInstanceCountVO.of(taskInstanceStatusCounts);
}
@Override
public WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser,
public WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser,
Long projectCode,
String startDate,
String endDate) {
@ -142,40 +142,40 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal
Date end = endDate == null ? null : transformDate(endDate);
List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos = processInstanceMapper
.countWorkflowInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode));
return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos);
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}
@Override
public WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser,
public WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser,
String startDate,
String endDate) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return WorkflowInstanceCountVo.empty();
return WorkflowInstanceCountVO.empty();
}
Date start = startDate == null ? null : transformDate(startDate);
Date end = endDate == null ? null : transformDate(endDate);
List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos =
processInstanceMapper.countWorkflowInstanceStateByProjectCodes(start, end, projectCodes);
return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos);
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}
@Override
public WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) {
public WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) {
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, PROJECT_OVERVIEW);
List<WorkflowDefinitionCountDto> workflowDefinitionCounts =
processDefinitionMapper.countDefinitionByProjectCodes(Lists.newArrayList(projectCode));
return WorkflowDefinitionCountVo.of(workflowDefinitionCounts);
return WorkflowDefinitionCountVO.of(workflowDefinitionCounts);
}
@Override
public WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser) {
public WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser) {
List<Long> projectCodes = projectService.getAuthorizedProjectCodes(loginUser);
if (CollectionUtils.isEmpty(projectCodes)) {
return WorkflowDefinitionCountVo.empty();
return WorkflowDefinitionCountVO.empty();
}
return WorkflowDefinitionCountVo.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes));
return WorkflowDefinitionCountVO.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes));
}
@Override

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java

@ -31,7 +31,7 @@ import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.ScheduleVo;
import org.apache.dolphinscheduler.api.vo.ScheduleVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
@ -462,12 +462,12 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, projectCode, processDefineCode,
searchVal);
List<ScheduleVo> scheduleList = new ArrayList<>();
List<ScheduleVO> scheduleList = new ArrayList<>();
for (Schedule schedule : schedulePage.getRecords()) {
scheduleList.add(new ScheduleVo(schedule));
scheduleList.add(new ScheduleVO(schedule));
}
PageInfo<ScheduleVo> pageInfo = new PageInfo<>(pageNo, pageSize);
PageInfo<ScheduleVO> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) schedulePage.getTotal());
pageInfo.setTotalList(scheduleList);
result.setData(pageInfo);
@ -528,9 +528,9 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
}
List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(project.getName());
List<ScheduleVo> scheduleList = new ArrayList<>();
List<ScheduleVO> scheduleList = new ArrayList<>();
for (Schedule schedule : schedules) {
scheduleList.add(new ScheduleVo(schedule));
scheduleList.add(new ScheduleVO(schedule));
}
result.put(Constants.DATA_LIST, scheduleList);

4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java

@ -39,7 +39,7 @@ import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskDefinitionVo;
import org.apache.dolphinscheduler.api.vo.TaskDefinitionVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ConditionType;
@ -1167,7 +1167,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
taskRelationList = taskRelationList.stream()
.filter(v -> v.getPreTaskCode() != 0).collect(Collectors.toList());
}
TaskDefinitionVo taskDefinitionVo = TaskDefinitionVo.fromTaskDefinition(taskDefinition);
TaskDefinitionVO taskDefinitionVo = TaskDefinitionVO.fromTaskDefinition(taskDefinition);
taskDefinitionVo.setProcessTaskRelationList(taskRelationList);
result.put(Constants.DATA_LIST, taskDefinitionVo);
putMsg(result, Status.SUCCESS);

4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVo.java → dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVO.java

@ -30,7 +30,7 @@ import java.util.Date;
import lombok.Data;
@Data
public class ScheduleVo {
public class ScheduleVO {
private int id;
@ -140,7 +140,7 @@ public class ScheduleVo {
*/
private String environmentName;
public ScheduleVo(Schedule schedule) {
public ScheduleVO(Schedule schedule) {
this.setId(schedule.getId());
this.setCrontab(schedule.getCrontab());
this.setProjectName(schedule.getProjectName());

10
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java → dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVO.java

@ -31,22 +31,22 @@ import org.springframework.beans.BeanUtils;
* @author fanwanlong
*/
@Data
public class TaskDefinitionVo extends TaskDefinition {
public class TaskDefinitionVO extends TaskDefinition {
/**
* process task related list
*/
private List<ProcessTaskRelation> processTaskRelationList;
public TaskDefinitionVo() {
public TaskDefinitionVO() {
}
public TaskDefinitionVo(List<ProcessTaskRelation> processTaskRelationList) {
public TaskDefinitionVO(List<ProcessTaskRelation> processTaskRelationList) {
this.processTaskRelationList = processTaskRelationList;
}
public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) {
TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo();
public static TaskDefinitionVO fromTaskDefinition(TaskDefinition taskDefinition) {
TaskDefinitionVO taskDefinitionVo = new TaskDefinitionVO();
BeanUtils.copyProperties(taskDefinition, taskDefinitionVo);
if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) {
taskDefinitionVo.setTimeoutNotifyStrategy(null);

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVo.java → dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVO.java

@ -34,17 +34,17 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TaskInstanceCountVo {
public class TaskInstanceCountVO {
private int totalCount;
private List<TaskInstanceStatusCountDto> taskInstanceStatusCounts;
public static TaskInstanceCountVo empty() {
public static TaskInstanceCountVO empty() {
return of(Collections.emptyList());
}
public static TaskInstanceCountVo of(List<TaskInstanceStatusCountDto> taskInstanceStatusCounts) {
public static TaskInstanceCountVO of(List<TaskInstanceStatusCountDto> taskInstanceStatusCounts) {
taskInstanceStatusCounts = new ArrayList<>(taskInstanceStatusCounts);
Map<TaskExecutionStatus, TaskInstanceStatusCountDto> taskInstanceStatusCountMap =
@ -57,7 +57,7 @@ public class TaskInstanceCountVo {
}
}
TaskInstanceCountVo taskInstanceCountVo = new TaskInstanceCountVo();
TaskInstanceCountVO taskInstanceCountVo = new TaskInstanceCountVO();
taskInstanceCountVo.setTaskInstanceStatusCounts(taskInstanceStatusCounts);
taskInstanceCountVo
.setTotalCount(taskInstanceStatusCounts.stream().mapToInt(TaskInstanceStatusCountDto::getCount).sum());

10
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVo.java → dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVO.java

@ -31,21 +31,21 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WorkflowDefinitionCountVo {
public class WorkflowDefinitionCountVO {
private int count;
private List<WorkflowDefinitionCountDto> userList;
public static WorkflowDefinitionCountVo empty() {
return new WorkflowDefinitionCountVo(0, Collections.emptyList());
public static WorkflowDefinitionCountVO empty() {
return new WorkflowDefinitionCountVO(0, Collections.emptyList());
}
public static WorkflowDefinitionCountVo of(List<WorkflowDefinitionCountDto> workflowDefinitionCounts) {
public static WorkflowDefinitionCountVO of(List<WorkflowDefinitionCountDto> workflowDefinitionCounts) {
if (CollectionUtils.isEmpty(workflowDefinitionCounts)) {
return empty();
}
WorkflowDefinitionCountVo workflowDefinitionCountVo = new WorkflowDefinitionCountVo();
WorkflowDefinitionCountVO workflowDefinitionCountVo = new WorkflowDefinitionCountVO();
workflowDefinitionCountVo.setUserList(workflowDefinitionCounts);
workflowDefinitionCountVo
.setCount(workflowDefinitionCounts.stream().mapToInt(WorkflowDefinitionCountDto::getCount).sum());

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVo.java → dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVO.java

@ -34,17 +34,17 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WorkflowInstanceCountVo {
public class WorkflowInstanceCountVO {
private int totalCount;
private List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCounts;
public static WorkflowInstanceCountVo empty() {
public static WorkflowInstanceCountVO empty() {
return of(Collections.emptyList());
}
public static WorkflowInstanceCountVo of(List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos) {
public static WorkflowInstanceCountVO of(List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos) {
workflowInstanceStatusCountDtos = new ArrayList<>(workflowInstanceStatusCountDtos);
Map<WorkflowExecutionStatus, WorkflowInstanceStatusCountDto> workflowExecutionStatusWorkflowInstanceStatusCountMap =
@ -56,7 +56,7 @@ public class WorkflowInstanceCountVo {
}
}
WorkflowInstanceCountVo workflowInstanceCountVo = new WorkflowInstanceCountVo();
WorkflowInstanceCountVO workflowInstanceCountVo = new WorkflowInstanceCountVO();
workflowInstanceCountVo.setWorkflowInstanceStatusCounts(workflowInstanceStatusCountDtos);
workflowInstanceCountVo.setTotalCount(
workflowInstanceStatusCountDtos.stream().mapToInt(WorkflowInstanceStatusCountDto::getCount).sum());

12
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java

@ -24,8 +24,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
@ -77,8 +77,8 @@ public class DataAnalysisControllerTest extends AbstractControllerTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result<TaskInstanceCountVo> result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(),
new TypeReference<Result<TaskInstanceCountVo>>() {
Result<TaskInstanceCountVO> result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(),
new TypeReference<Result<TaskInstanceCountVO>>() {
});
assertThat(result.getCode())
.isNotNull()
@ -101,8 +101,8 @@ public class DataAnalysisControllerTest extends AbstractControllerTest {
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result<WorkflowInstanceCountVo> result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(),
new TypeReference<Result<WorkflowInstanceCountVo>>() {
Result<WorkflowInstanceCountVO> result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(),
new TypeReference<Result<WorkflowInstanceCountVO>>() {
});
assertThat(result.getCode())
.isEqualTo(Status.SUCCESS.getCode());

4
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java

@ -32,7 +32,7 @@ import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService;
import org.apache.dolphinscheduler.api.service.impl.DataAnalysisServiceImpl;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo;
import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.CommandType;
@ -201,7 +201,7 @@ public class DataAnalysisServiceTest {
user.setUserType(UserType.GENERAL_USER);
when(taskInstanceMapper.countTaskInstanceStateByProjectCodes(any(), any(), any()))
.thenReturn(Collections.emptyList());
TaskInstanceCountVo taskInstanceStateCountByProject =
TaskInstanceCountVO taskInstanceStateCountByProject =
dataAnalysisServiceImpl.getTaskInstanceStateCountByProject(user, 1L, null, null);
assertThat(taskInstanceStateCountByProject).isNotNull();
}

Loading…
Cancel
Save