Browse Source

[Improvement-14457][UT] Improve the expected and actual value of Assertions (#14459)

3.2.1-prepare
Rick Cheng 1 year ago committed by GitHub
parent
commit
68a3a75211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java
  2. 2
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java
  3. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceUserMapperTest.java
  4. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/EnvironmentWorkerGroupRelationMapperTest.java
  5. 4
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapperTest.java
  6. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapperTest.java
  7. 14
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java
  8. 4
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapMapperTest.java
  9. 14
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapperTest.java
  10. 2
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapperTest.java
  11. 8
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapperTest.java
  12. 20
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java
  13. 4
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java
  14. 10
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/QueueMapperTest.java
  15. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapperTest.java
  16. 10
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapperTest.java
  17. 8
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/SessionMapperTest.java
  18. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapperTest.java
  19. 12
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java
  20. 24
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
  21. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TenantMapperTest.java
  22. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UDFUserMapperTest.java
  23. 10
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
  24. 10
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UserMapperTest.java
  25. 6
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapperTest.java
  26. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-snowflake/src/test/java/org/apache/dolphinscheduler/plugin/datasource/snowflake/param/SnowflakeDataSourceProcessorTest.java
  27. 2
      dolphinscheduler-task-plugin/dolphinscheduler-task-kubeflow/src/test/java/org/apache/dolphinscheduler/plugin/kubeflow/KubeflowTaskTest.java
  28. 10
      dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/test/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskTest.java

2
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/enums/StatusTest.java

@ -28,7 +28,7 @@ public class StatusTest {
@Test
public void testGetCode() {
Assertions.assertEquals(0, Status.SUCCESS.getCode());
Assertions.assertNotEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), 0);
Assertions.assertNotEquals(0, Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode());
}
@Test

2
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java

@ -59,7 +59,7 @@ public class AuditLogMapperTest extends BaseDaoTest {
int[] operationType = new int[0];
IPage<AuditLog> logIPage = logMapper.queryAuditLog(page, resourceType, operationType, "", null, null);
Assertions.assertNotEquals(logIPage.getTotal(), 0);
Assertions.assertNotEquals(0, logIPage.getTotal());
}
@Test

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceUserMapperTest.java

@ -81,7 +81,7 @@ public class DataSourceUserMapperTest extends BaseDaoTest {
DatasourceUser dataSourceUser = insertOne();
// query
List<DatasourceUser> dataSources = dataSourceUserMapper.selectList(null);
Assertions.assertNotEquals(dataSources.size(), 0);
Assertions.assertNotEquals(0, dataSources.size());
}
/**
@ -91,7 +91,7 @@ public class DataSourceUserMapperTest extends BaseDaoTest {
public void testDeleteByUserId() {
DatasourceUser dataSourceUser = insertOne();
int delete = dataSourceUserMapper.deleteByUserId(dataSourceUser.getUserId());
Assertions.assertNotEquals(delete, 0);
Assertions.assertNotEquals(0, delete);
}
/**
@ -101,6 +101,6 @@ public class DataSourceUserMapperTest extends BaseDaoTest {
public void testDeleteByDatasourceId() {
DatasourceUser dataSourceUser = insertOne();
int delete = dataSourceUserMapper.deleteByDatasourceId(dataSourceUser.getDatasourceId());
Assertions.assertNotEquals(delete, 0);
Assertions.assertNotEquals(0, delete);
}
}

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/EnvironmentWorkerGroupRelationMapperTest.java

@ -83,7 +83,7 @@ public class EnvironmentWorkerGroupRelationMapperTest extends BaseDaoTest {
EnvironmentWorkerGroupRelation relation = insertOne();
List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations =
environmentWorkerGroupRelationMapper.queryByEnvironmentCode(1L);
Assertions.assertNotEquals(environmentWorkerGroupRelations.size(), 0);
Assertions.assertNotEquals(0, environmentWorkerGroupRelations.size());
}
@Test
@ -91,13 +91,13 @@ public class EnvironmentWorkerGroupRelationMapperTest extends BaseDaoTest {
EnvironmentWorkerGroupRelation relation = insertOne();
List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations =
environmentWorkerGroupRelationMapper.queryByWorkerGroupName("default");
Assertions.assertNotEquals(environmentWorkerGroupRelations.size(), 0);
Assertions.assertNotEquals(0, environmentWorkerGroupRelations.size());
}
@Test
public void testDeleteByCode() {
EnvironmentWorkerGroupRelation relation = insertOne();
int i = environmentWorkerGroupRelationMapper.deleteByCode(1L, "default");
Assertions.assertNotEquals(i, 0);
Assertions.assertNotEquals(0, i);
}
}

4
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ErrorCommandMapperTest.java

@ -85,7 +85,7 @@ public class ErrorCommandMapperTest extends BaseDaoTest {
null,
projectCodeArray);
Assertions.assertNotEquals(commandCounts.size(), 0);
Assertions.assertNotEquals(commandCounts2.size(), 0);
Assertions.assertNotEquals(0, commandCounts.size());
Assertions.assertNotEquals(0, commandCounts2.size());
}
}

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapperTest.java

@ -86,7 +86,7 @@ public class ProcessDefinitionLogMapperTest extends BaseDaoTest {
@Test
public void testInsert() {
ProcessDefinitionLog processDefinitionLog = insertOne();
Assertions.assertNotEquals(processDefinitionLog.getId().intValue(), 0);
Assertions.assertNotEquals(0, processDefinitionLog.getId().intValue());
}
@Test
@ -145,7 +145,7 @@ public class ProcessDefinitionLogMapperTest extends BaseDaoTest {
Page<ProcessDefinitionLog> page = new Page(1, 3);
IPage<ProcessDefinitionLog> processDefinitionLogs =
processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, 1L, 1L);
Assertions.assertNotEquals(processDefinitionLogs.getTotal(), 0);
Assertions.assertNotEquals(0, processDefinitionLogs.getTotal());
}
@Test
@ -153,7 +153,7 @@ public class ProcessDefinitionLogMapperTest extends BaseDaoTest {
insertOne();
Page<ProcessDefinitionLog> page = new Page(1, 3);
int processDefinitionLogs = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(1L, 1);
Assertions.assertNotEquals(processDefinitionLogs, 0);
Assertions.assertNotEquals(0, processDefinitionLogs);
}
@Test

14
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java

@ -107,7 +107,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
insertOne("def 1");
// query
List<ProcessDefinition> dataSources = processDefinitionMapper.selectList(null);
Assertions.assertNotEquals(dataSources.size(), 0);
Assertions.assertNotEquals(0, dataSources.size());
}
/**
@ -146,7 +146,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
processDefinition.setUserId(user.getId());
processDefinitionMapper.insert(processDefinition);
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(10L, "xxx");
Assertions.assertEquals(definition, null);
Assertions.assertEquals(null, definition);
}
/**
@ -190,7 +190,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
processDefinitionMapper.insert(processDefinition);
ProcessDefinition processDefinition1 = processDefinitionMapper.queryByDefineName(project.getCode(), "def 1");
Assertions.assertNotEquals(processDefinition1, null);
Assertions.assertNotEquals(null, processDefinition1);
}
/**
@ -233,7 +233,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
processDefinition.setUserId(user.getId());
processDefinitionMapper.insert(processDefinition);
ProcessDefinition definition = processDefinitionMapper.queryByDefineId(333);
Assertions.assertEquals(definition, null);
Assertions.assertEquals(null, definition);
}
/**
@ -245,7 +245,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
Page<ProcessDefinition> page = new Page(1, 3);
IPage<ProcessDefinition> processDefinitionIPage =
processDefinitionMapper.queryDefineListPaging(page, "def", 101, 1010L);
Assertions.assertNotEquals(processDefinitionIPage.getTotal(), 0);
Assertions.assertNotEquals(0, processDefinitionIPage.getTotal());
}
/**
@ -255,7 +255,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
public void testQueryAllDefinitionList() {
insertOne("def 1");
List<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryAllDefinitionList(1010L);
Assertions.assertNotEquals(processDefinitionIPage.size(), 0);
Assertions.assertNotEquals(0, processDefinitionIPage.size());
}
/**
@ -300,7 +300,7 @@ public class ProcessDefinitionMapperTest extends BaseDaoTest {
projectCodes[0] = processDefinition.getProjectCode();
List<DefinitionGroupByUser> processDefinitions =
processDefinitionMapper.countDefinitionByProjectCodes(projectCodes);
Assertions.assertNotEquals(processDefinitions.size(), 0);
Assertions.assertNotEquals(0, processDefinitions.size());
}
@Test

4
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapMapperTest.java

@ -77,7 +77,7 @@ public class ProcessInstanceMapMapperTest extends BaseDaoTest {
ProcessInstanceMap processInstanceMap = insertOne();
// query
List<ProcessInstanceMap> dataSources = processInstanceMapMapper.selectList(null);
Assertions.assertNotEquals(dataSources.size(), 0);
Assertions.assertNotEquals(0, dataSources.size());
}
/**
@ -121,7 +121,7 @@ public class ProcessInstanceMapMapperTest extends BaseDaoTest {
List<Integer> subIds =
processInstanceMapMapper.querySubIdListByParentId(processInstanceMap.getParentProcessInstanceId());
Assertions.assertNotEquals(subIds.size(), 0);
Assertions.assertNotEquals(0, subIds.size());
}
}

14
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapperTest.java

@ -114,7 +114,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
ProcessInstance processInstance = insertOne();
// query
List<ProcessInstance> dataSources = processInstanceMapper.selectList(null);
Assertions.assertNotEquals(dataSources.size(), 0);
Assertions.assertNotEquals(0, dataSources.size());
processInstanceMapper.deleteById(processInstance.getId());
}
@ -148,7 +148,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
List<ProcessInstance> processInstances = processInstanceMapper.queryByHostAndStatus(null, stateArray);
processInstanceMapper.deleteById(processInstance.getId());
Assertions.assertNotEquals(processInstances.size(), 0);
Assertions.assertNotEquals(0, processInstances.size());
}
/**
@ -190,7 +190,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
processInstance.getHost(),
null,
null);
Assertions.assertNotEquals(processInstanceIPage.getTotal(), 0);
Assertions.assertNotEquals(0, processInstanceIPage.getTotal());
processDefinitionMapper.deleteById(processDefinition.getId());
processInstanceMapper.deleteById(processInstance.getId());
@ -213,7 +213,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
processInstanceMapper.updateById(processInstance);
String host = processInstance.getHost();
int update = processInstanceMapper.setFailoverByHostAndStateArray(host, stateArray);
Assertions.assertNotEquals(update, 0);
Assertions.assertNotEquals(0, update);
processInstance = processInstanceMapper.selectById(processInstance.getId());
Assertions.assertNull(processInstance.getHost());
@ -269,7 +269,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
List<ExecuteStatusCount> executeStatusCounts =
processInstanceMapper.countInstanceStateByProjectCodes(null, null, projectCodes);
Assertions.assertNotEquals(executeStatusCounts.size(), 0);
Assertions.assertNotEquals(0, executeStatusCounts.size());
projectMapper.deleteById(project.getId());
processDefinitionMapper.deleteById(processDefinition.getId());
@ -308,7 +308,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
ProcessInstance processInstance1 =
processInstanceMapper.queryLastSchedulerProcess(processInstance.getProcessDefinitionCode(), null, null,
processInstance.getTestFlag());
Assertions.assertNotEquals(processInstance1, null);
Assertions.assertNotEquals(null, processInstance1);
processInstanceMapper.deleteById(processInstance.getId());
}
@ -329,7 +329,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
.queryLastRunningProcess(processInstance.getProcessDefinitionCode(), null, null,
processInstance.getTestFlag(), stateArray);
Assertions.assertNotEquals(processInstance1, null);
Assertions.assertNotEquals(null, processInstance1);
processInstanceMapper.deleteById(processInstance.getId());
}

2
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapperTest.java

@ -57,7 +57,7 @@ public class ProcessTaskRelationLogMapperTest extends BaseDaoTest {
ProcessTaskRelationLog processTaskRelationLog = insertOne();
List<ProcessTaskRelationLog> processTaskRelationLogs = processTaskRelationLogMapper
.queryByProcessCodeAndVersion(1L, 1);
Assertions.assertNotEquals(processTaskRelationLogs.size(), 0);
Assertions.assertNotEquals(0, processTaskRelationLogs.size());
}
}

8
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapperTest.java

@ -57,14 +57,14 @@ public class ProcessTaskRelationMapperTest extends BaseDaoTest {
public void testQueryByProcessCode() {
ProcessTaskRelation processTaskRelation = insertOne();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(1L, 1L);
Assertions.assertNotEquals(processTaskRelations.size(), 0);
Assertions.assertNotEquals(0, processTaskRelations.size());
}
@Test
public void testQueryByTaskCode() {
ProcessTaskRelation processTaskRelation = insertOne();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCode(2L);
Assertions.assertNotEquals(processTaskRelations.size(), 0);
Assertions.assertNotEquals(0, processTaskRelations.size());
}
@Test
@ -73,14 +73,14 @@ public class ProcessTaskRelationMapperTest extends BaseDaoTest {
Long[] codes = Arrays.array(1L, 2L);
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCodes(codes);
Assertions.assertNotEquals(processTaskRelations.size(), 0);
Assertions.assertNotEquals(0, processTaskRelations.size());
}
@Test
public void testDeleteByCode() {
ProcessTaskRelation processTaskRelation = insertOne();
int i = processTaskRelationMapper.deleteByCode(1L, 1L);
Assertions.assertNotEquals(i, 0);
Assertions.assertNotEquals(0, i);
}
}

20
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapperTest.java

@ -91,7 +91,7 @@ public class ProjectMapperTest extends BaseDaoTest {
Project project = insertOne();
// query
List<Project> projects = projectMapper.selectList(null);
Assertions.assertNotEquals(projects.size(), 0);
Assertions.assertNotEquals(0, projects.size());
}
/**
@ -109,7 +109,7 @@ public class ProjectMapperTest extends BaseDaoTest {
projectMapper.updateById(project);
Project project1 = projectMapper.queryDetailById(project.getId());
Assertions.assertNotEquals(project1, null);
Assertions.assertNotEquals(null, project1);
Assertions.assertEquals(project1.getUserName(), user.getUserName());
}
@ -127,7 +127,7 @@ public class ProjectMapperTest extends BaseDaoTest {
projectMapper.updateById(project);
Project project1 = projectMapper.queryByName(project.getName());
Assertions.assertNotEquals(project1, null);
Assertions.assertNotEquals(null, project1);
}
/**
@ -152,8 +152,8 @@ public class ProjectMapperTest extends BaseDaoTest {
page,
null,
project.getName());
Assertions.assertEquals(projectIPage.getTotal(), 1);
Assertions.assertEquals(projectIPage1.getTotal(), 1);
Assertions.assertEquals(1, projectIPage.getTotal());
Assertions.assertEquals(1, projectIPage1.getTotal());
}
/**
@ -165,7 +165,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> projects = projectMapper.queryProjectCreatedByUser(project.getUserId());
Assertions.assertNotEquals(projects.size(), 0);
Assertions.assertNotEquals(0, projects.size());
}
@ -178,7 +178,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> projects = projectMapper.queryProjectCreatedByUser(project.getUserId());
Assertions.assertNotEquals(projects.size(), 0);
Assertions.assertNotEquals(0, projects.size());
}
/**
@ -191,7 +191,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> projects = projectMapper.queryProjectExceptUserId(
100000);
Assertions.assertNotEquals(projects.size(), 0);
Assertions.assertNotEquals(0, projects.size());
}
@Test
@ -213,7 +213,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> allProject = projectMapper.queryAllProject(user.getId());
Assertions.assertNotEquals(allProject.size(), 0);
Assertions.assertNotEquals(0, allProject.size());
}
private Project insertProject(long projectCode, String projectName, int userId) {
@ -250,7 +250,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> projects = projectMapper.listAuthorizedProjects(user.getId(), null);
Assertions.assertEquals(projects.size(), 2);
Assertions.assertEquals(2, projects.size());
}
}

4
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProjectUserMapperTest.java

@ -77,7 +77,7 @@ public class ProjectUserMapperTest extends BaseDaoTest {
ProjectUser projectUser = insertOne();
// query
List<ProjectUser> projectUsers = projectUserMapper.selectList(null);
Assertions.assertNotEquals(projectUsers.size(), 0);
Assertions.assertNotEquals(0, projectUsers.size());
}
/**
@ -100,7 +100,7 @@ public class ProjectUserMapperTest extends BaseDaoTest {
ProjectUser projectUser = insertOne();
ProjectUser projectUser1 =
projectUserMapper.queryProjectRelation(projectUser.getProjectId(), projectUser.getUserId());
Assertions.assertNotEquals(projectUser1, null);
Assertions.assertNotEquals(null, projectUser1);
}
}

10
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/QueueMapperTest.java

@ -83,7 +83,7 @@ public class QueueMapperTest extends BaseDaoTest {
Queue queue = insertOne();
// query
List<Queue> queues = queueMapper.selectList(null);
Assertions.assertNotEquals(queues.size(), 0);
Assertions.assertNotEquals(0, queues.size());
}
/**
@ -96,10 +96,10 @@ public class QueueMapperTest extends BaseDaoTest {
Page<Queue> page = new Page(1, 3);
IPage<Queue> queueIPage = queueMapper.queryQueuePaging(page, Collections.singletonList(queue.getId()), null);
Assertions.assertNotEquals(queueIPage.getTotal(), 0);
Assertions.assertNotEquals(0, queueIPage.getTotal());
queueIPage = queueMapper.queryQueuePaging(page, Collections.singletonList(queue.getId()), queue.getQueueName());
Assertions.assertNotEquals(queueIPage.getTotal(), 0);
Assertions.assertNotEquals(0, queueIPage.getTotal());
}
/**
@ -110,10 +110,10 @@ public class QueueMapperTest extends BaseDaoTest {
Queue queue = insertOne();
List<Queue> queues = queueMapper.queryAllQueueList(queue.getQueue(), null);
Assertions.assertNotEquals(queues.size(), 0);
Assertions.assertNotEquals(0, queues.size());
queues = queueMapper.queryAllQueueList(null, queue.getQueueName());
Assertions.assertNotEquals(queues.size(), 0);
Assertions.assertNotEquals(0, queues.size());
}
@Test

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ResourceUserMapperTest.java

@ -79,7 +79,7 @@ public class ResourceUserMapperTest extends BaseDaoTest {
ResourcesUser queue = insertOne();
// query
List<ResourcesUser> queues = resourceUserMapper.selectList(null);
Assertions.assertNotEquals(queues.size(), 0);
Assertions.assertNotEquals(0, queues.size());
}
/**
@ -92,7 +92,7 @@ public class ResourceUserMapperTest extends BaseDaoTest {
int delete = resourceUserMapper.deleteResourceUser(
queue.getUserId(),
queue.getResourcesId());
Assertions.assertNotEquals(delete, 0);
Assertions.assertNotEquals(0, delete);
}
/**
@ -106,6 +106,6 @@ public class ResourceUserMapperTest extends BaseDaoTest {
int delete = resourceUserMapper.deleteResourceUserArray(
resourcesUser.getUserId(),
resourceIdArray);
Assertions.assertNotEquals(delete, 0);
Assertions.assertNotEquals(0, delete);
}
}

10
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapperTest.java

@ -100,7 +100,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
Schedule schedule = insertOne();
// query
List<Schedule> schedules = scheduleMapper.selectList(null);
Assertions.assertNotEquals(schedules.size(), 0);
Assertions.assertNotEquals(0, schedules.size());
}
/**
@ -138,7 +138,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
Page<Schedule> page = new Page(1, 3);
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineCodePaging(page,
processDefinition.getCode(), "");
Assertions.assertNotEquals(scheduleIPage.getSize(), 0);
Assertions.assertNotEquals(0, scheduleIPage.getSize());
}
/**
@ -176,7 +176,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
Page<Schedule> page = new Page(1, 3);
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, project.getCode(),
processDefinition.getCode(), "");
Assertions.assertNotEquals(scheduleIPage.getSize(), 0);
Assertions.assertNotEquals(0, scheduleIPage.getSize());
}
/**
@ -215,7 +215,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(
project.getName());
Assertions.assertNotEquals(schedules.size(), 0);
Assertions.assertNotEquals(0, schedules.size());
}
/**
@ -231,7 +231,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
List<Schedule> schedules =
scheduleMapper.selectAllByProcessDefineArray(new long[]{schedule.getProcessDefinitionCode()});
Assertions.assertNotEquals(schedules.size(), 0);
Assertions.assertNotEquals(0, schedules.size());
}
/**

8
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/SessionMapperTest.java

@ -57,7 +57,7 @@ public class SessionMapperTest extends BaseDaoTest {
session.setLastLoginTime(new Date());
// update
int update = sessionMapper.updateById(session);
Assertions.assertEquals(update, 1);
Assertions.assertEquals(1, update);
}
/**
@ -67,7 +67,7 @@ public class SessionMapperTest extends BaseDaoTest {
public void testDelete() {
Session session = insertOne();
int delete = sessionMapper.deleteById(session.getId());
Assertions.assertEquals(delete, 1);
Assertions.assertEquals(1, delete);
}
/**
@ -78,7 +78,7 @@ public class SessionMapperTest extends BaseDaoTest {
Session session = insertOne();
// query
List<Session> sessions = sessionMapper.selectList(null);
Assertions.assertNotEquals(sessions.size(), 0);
Assertions.assertNotEquals(0, sessions.size());
}
/**
@ -88,7 +88,7 @@ public class SessionMapperTest extends BaseDaoTest {
public void testQueryByUserId() {
Session session = insertOne();
List<Session> sessions = sessionMapper.queryByUserId(session.getUserId());
Assertions.assertNotEquals(sessions.size(), 0);
Assertions.assertNotEquals(0, sessions.size());
}
}

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapperTest.java

@ -57,7 +57,7 @@ public class TaskDefinitionLogMapperTest extends BaseDaoTest {
@Test
public void testInsert() {
TaskDefinitionLog taskDefinitionLog = insertOne();
Assertions.assertNotEquals(taskDefinitionLog.getId().intValue(), 0);
Assertions.assertNotEquals(0, taskDefinitionLog.getId().intValue());
}
@Test
@ -65,7 +65,7 @@ public class TaskDefinitionLogMapperTest extends BaseDaoTest {
TaskDefinitionLog taskDefinitionLog = insertOne();
int version = taskDefinitionLogMapper
.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
Assertions.assertNotEquals(version, 0);
Assertions.assertNotEquals(0, version);
}
@Test
@ -91,7 +91,7 @@ public class TaskDefinitionLogMapperTest extends BaseDaoTest {
TaskDefinitionLog taskDefinitionLog = insertOne();
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions);
Assertions.assertNotEquals(taskDefinitionLogs.size(), 0);
Assertions.assertNotEquals(0, taskDefinitionLogs.size());
}
}

12
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java

@ -85,7 +85,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
@Test
public void testInsert() {
TaskDefinition taskDefinition = insertOne();
Assertions.assertNotEquals(taskDefinition.getId().intValue(), 0);
Assertions.assertNotEquals(0, taskDefinition.getId().intValue());
}
@Test
@ -111,7 +111,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
TaskDefinition taskDefinition = insertOne();
List<TaskDefinition> taskDefinitions =
taskDefinitionMapper.queryAllDefinitionList(taskDefinition.getProjectCode());
Assertions.assertNotEquals(taskDefinitions.size(), 0);
Assertions.assertNotEquals(0, taskDefinitions.size());
}
@ -125,7 +125,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
List<DefinitionGroupByUser> users =
taskDefinitionMapper.countDefinitionGroupByUser(new Long[]{taskDefinition.getProjectCode()});
Assertions.assertNotEquals(users.size(), 0);
Assertions.assertNotEquals(0, users.size());
}
@ -133,7 +133,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
public void testListResources() {
TaskDefinition taskDefinition = insertOne();
List<Map<String, Object>> maps = taskDefinitionMapper.listResources();
Assertions.assertNotEquals(maps.size(), 0);
Assertions.assertNotEquals(0, maps.size());
}
@ -146,7 +146,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
TaskDefinition taskDefinition = insertOne(un.getId());
List<Map<String, Object>> maps = taskDefinitionMapper.listResourcesByUser(taskDefinition.getUserId());
Assertions.assertNotEquals(maps.size(), 0);
Assertions.assertNotEquals(0, maps.size());
}
@ -154,7 +154,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
public void testDeleteByCode() {
TaskDefinition taskDefinition = insertOne();
int i = taskDefinitionMapper.deleteByCode(taskDefinition.getCode());
Assertions.assertNotEquals(i, 0);
Assertions.assertNotEquals(0, i);
}

24
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java

@ -137,7 +137,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
// query
List<TaskInstance> taskInstances = taskInstanceMapper.selectList(null);
taskInstanceMapper.deleteById(taskInstance.getId());
Assertions.assertNotEquals(taskInstances.size(), 0);
Assertions.assertNotEquals(0, taskInstances.size());
}
/**
@ -156,7 +156,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
task.getProcessInstanceId(),
TaskExecutionStatus.RUNNING_EXECUTION.getCode());
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstances.size(), 0);
Assertions.assertNotEquals(0, taskInstances.size());
}
/**
@ -187,8 +187,8 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
processInstance.getTestFlag());
taskInstanceMapper.deleteById(task2.getId());
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstances.size(), 0);
Assertions.assertNotEquals(taskInstances1.size(), 0);
Assertions.assertNotEquals(0, taskInstances.size());
Assertions.assertNotEquals(0, taskInstances1.size());
}
/**
@ -207,7 +207,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
List<TaskInstance> taskInstances = taskInstanceMapper.queryByHostAndStatus(
task.getHost(), new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()});
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstances.size(), 0);
Assertions.assertNotEquals(0, taskInstances.size());
}
/**
@ -228,7 +228,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()},
TaskExecutionStatus.NEED_FAULT_TOLERANCE);
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(setResult, 0);
Assertions.assertNotEquals(0, setResult);
}
/**
@ -248,7 +248,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
task.getProcessInstanceId(),
task.getName());
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstance, null);
Assertions.assertNotEquals(null, taskInstance);
}
/**
@ -268,7 +268,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
task.getProcessInstanceId(),
task.getTaskCode());
taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstance, null);
Assertions.assertNotEquals(null, taskInstance);
}
/**
@ -288,7 +288,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
Collections.singletonList(task.getProcessInstanceId()),
Collections.singletonList(task.getTaskCode()));
taskInstanceMapper.deleteById(task.getId());
Assertions.assertEquals(taskInstances.size(), 1);
Assertions.assertEquals(1, taskInstances.size());
}
/**
@ -317,8 +317,8 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
new int[]{task.getId()});
taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.getId());
Assertions.assertEquals(countTask, 0);
Assertions.assertEquals(countTask2, 0);
Assertions.assertEquals(0, countTask);
Assertions.assertEquals(0, countTask2);
}
@ -383,7 +383,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
processInstanceMapper.deleteById(processInstance.getId());
taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.getId());
Assertions.assertEquals(taskInstanceIPage.getTotal(), 0);
Assertions.assertEquals(0, taskInstanceIPage.getTotal());
}
}

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TenantMapperTest.java

@ -84,7 +84,7 @@ public class TenantMapperTest extends BaseDaoTest {
Tenant tenant = insertOne();
// query
List<Tenant> tenants = tenantMapper.selectList(null);
Assertions.assertNotEquals(tenants.size(), 0);
Assertions.assertNotEquals(0, tenants.size());
}
/**
@ -104,7 +104,7 @@ public class TenantMapperTest extends BaseDaoTest {
Tenant tenant1 = tenantMapper.queryById(tenant.getId());
Assertions.assertNotEquals(tenant1, null);
Assertions.assertNotEquals(null, tenant1);
}
/**
@ -139,7 +139,7 @@ public class TenantMapperTest extends BaseDaoTest {
IPage<Tenant> tenantIPage =
tenantMapper.queryTenantPaging(page, Collections.singletonList(tenant.getId()), tenant.getTenantCode());
Assertions.assertNotEquals(tenantIPage.getTotal(), 0);
Assertions.assertNotEquals(0, tenantIPage.getTotal());
}
public void testExistTenant() {

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UDFUserMapperTest.java

@ -148,7 +148,7 @@ public class UDFUserMapperTest extends BaseDaoTest {
UDFUser udfUser = insertOne();
// query
List<UDFUser> udfUserList = udfUserMapper.selectList(null);
Assertions.assertNotEquals(udfUserList.size(), 0);
Assertions.assertNotEquals(0, udfUserList.size());
}
/**
@ -163,7 +163,7 @@ public class UDFUserMapperTest extends BaseDaoTest {
// insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUserId(user.getId());
Assertions.assertEquals(delete, 1);
Assertions.assertEquals(1, delete);
}
@ -179,6 +179,6 @@ public class UDFUserMapperTest extends BaseDaoTest {
// insertOne
UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUdfFuncId(udfFunc.getId());
Assertions.assertEquals(delete, 1);
Assertions.assertEquals(1, delete);
}
}

10
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java

@ -181,7 +181,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
Integer[] idArray = new Integer[]{udfFunc.getId(), udfFunc1.getId()};
// queryUdfByIdStr
List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfByIdStr(idArray, "");
Assertions.assertNotEquals(udfFuncList.size(), 0);
Assertions.assertNotEquals(0, udfFuncList.size());
}
/**
@ -198,7 +198,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
IPage<UdfFunc> udfFuncIPage =
udfFuncMapper.queryUdfFuncPaging(page, Collections.singletonList(udfFunc.getId()), "");
Assertions.assertNotEquals(udfFuncIPage.getTotal(), 0);
Assertions.assertNotEquals(0, udfFuncIPage.getTotal());
}
@ -214,7 +214,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
// getUdfFuncByType
List<UdfFunc> udfFuncList =
udfFuncMapper.getUdfFuncByType(Collections.singletonList(udfFunc.getId()), udfFunc.getType().ordinal());
Assertions.assertNotEquals(udfFuncList.size(), 0);
Assertions.assertNotEquals(0, udfFuncList.size());
}
@ -230,7 +230,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
UdfFunc udfFunc1 = insertOne(user1);
UdfFunc udfFunc2 = insertOne(user2);
List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfFuncExceptUserId(user1.getId());
Assertions.assertNotEquals(udfFuncList.size(), 0);
Assertions.assertNotEquals(0, udfFuncList.size());
}
@ -249,7 +249,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
UDFUser udfUser = insertOneUDFUser(user, udfFunc);
// queryAuthedUdfFunc
List<UdfFunc> udfFuncList = udfFuncMapper.queryAuthedUdfFunc(user.getId());
Assertions.assertNotEquals(udfFuncList.size(), 0);
Assertions.assertNotEquals(0, udfFuncList.size());
}
@Test

10
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UserMapperTest.java

@ -213,7 +213,7 @@ public class UserMapperTest extends BaseDaoTest {
user.setUserName("user1_update");
user.setUserType(UserType.ADMIN_USER);
int update = userMapper.updateById(user);
Assertions.assertEquals(update, 1);
Assertions.assertEquals(1, update);
}
/**
@ -225,7 +225,7 @@ public class UserMapperTest extends BaseDaoTest {
User user = insertOne();
// delete
int delete = userMapper.deleteById(user.getId());
Assertions.assertEquals(delete, 1);
Assertions.assertEquals(1, delete);
}
/**
@ -237,7 +237,7 @@ public class UserMapperTest extends BaseDaoTest {
User user = insertOne();
// query
List<User> userList = userMapper.selectList(null);
Assertions.assertNotEquals(userList.size(), 0);
Assertions.assertNotEquals(0, userList.size());
}
/**
@ -249,7 +249,7 @@ public class UserMapperTest extends BaseDaoTest {
User user = insertOne();
// queryAllGeneralUser
List<User> userList = userMapper.queryAllGeneralUser();
Assertions.assertNotEquals(userList.size(), 0);
Assertions.assertNotEquals(0, userList.size());
}
/**
@ -266,7 +266,7 @@ public class UserMapperTest extends BaseDaoTest {
// queryUserPaging
Page<User> page = new Page(1, 3);
IPage<User> userIPage = userMapper.queryUserPaging(page, user.getUserName());
Assertions.assertNotEquals(userIPage.getTotal(), 0);
Assertions.assertNotEquals(0, userIPage.getTotal());
}
/**

6
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapperTest.java

@ -113,7 +113,7 @@ public class WorkFlowLineageMapperTest extends BaseDaoTest {
List<WorkFlowLineage> workFlowLineages = workFlowLineageMapper
.queryWorkFlowLineageByName(processDefinition.getProjectCode(), processDefinition.getName());
Assertions.assertNotEquals(workFlowLineages.size(), 0);
Assertions.assertNotEquals(0, workFlowLineages.size());
}
@Test
@ -122,7 +122,7 @@ public class WorkFlowLineageMapperTest extends BaseDaoTest {
List<ProcessLineage> workFlowLineages =
workFlowLineageMapper.queryProcessLineageByCode(processTaskRelation.getProjectCode(),
processTaskRelation.getProcessDefinitionCode());
Assertions.assertNotEquals(workFlowLineages.size(), 0);
Assertions.assertNotEquals(0, workFlowLineages.size());
}
@Test
@ -132,7 +132,7 @@ public class WorkFlowLineageMapperTest extends BaseDaoTest {
insertOneProcessTaskRelation();
List<ProcessLineage> workFlowLineages =
workFlowLineageMapper.queryProcessLineage(processDefinition.getProjectCode());
Assertions.assertNotEquals(workFlowLineages.size(), 0);
Assertions.assertNotEquals(0, workFlowLineages.size());
}
@Test

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-snowflake/src/test/java/org/apache/dolphinscheduler/plugin/datasource/snowflake/param/SnowflakeDataSourceProcessorTest.java

@ -168,8 +168,8 @@ public class SnowflakeDataSourceProcessorTest {
@Test
public void testDbType() {
Assertions.assertEquals(DbType.SNOWFLAKE.getCode(), 20);
Assertions.assertEquals(DbType.SNOWFLAKE.getDescp(), "snowflake");
Assertions.assertEquals(20, DbType.SNOWFLAKE.getCode());
Assertions.assertEquals("snowflake", DbType.SNOWFLAKE.getDescp());
Assertions.assertEquals(DbType.of(20), DbType.SNOWFLAKE);
Assertions.assertEquals(DbType.ofName("SNOWFLAKE"), DbType.SNOWFLAKE);
}

2
dolphinscheduler-task-plugin/dolphinscheduler-task-kubeflow/src/test/java/org/apache/dolphinscheduler/plugin/kubeflow/KubeflowTaskTest.java

@ -69,7 +69,7 @@ public class KubeflowTaskTest {
KubeflowTask task = Mockito.spy(createTask(kubeflowParameters));
Mockito.when(task.runCommand(Mockito.anyString())).thenReturn("test_result");
task.submitApplication();
Assertions.assertNotEquals(task.getAppIds(), null);
Assertions.assertNotEquals(null, task.getAppIds());
Assertions.assertEquals(task.getExitStatusCode(), TaskConstants.EXIT_CODE_SUCCESS);
}

10
dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/test/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskTest.java

@ -43,7 +43,7 @@ public class SparkTaskTest {
SparkTask sparkTask = Mockito.spy(new SparkTask(taskExecutionContext));
sparkTask.init();
Assertions.assertEquals(sparkTask.buildCommand(),
Assertions.assertEquals(
"${SPARK_HOME}/bin/spark-sql " +
"--master yarn " +
"--deploy-mode client " +
@ -53,7 +53,8 @@ public class SparkTaskTest {
"--conf spark.executor.cores=2 " +
"--conf spark.executor.memory=1G " +
"--name sparksql " +
"-f /tmp/5536_node.sql");
"-f /tmp/5536_node.sql",
sparkTask.buildCommand());
}
@Test
@ -66,7 +67,7 @@ public class SparkTaskTest {
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(parameters);
SparkTask sparkTask = Mockito.spy(new SparkTask(taskExecutionContext));
sparkTask.init();
Assertions.assertEquals(sparkTask.buildCommand(),
Assertions.assertEquals(
"${SPARK_HOME}/bin/spark-submit " +
"--master yarn " +
"--deploy-mode client " +
@ -77,7 +78,8 @@ public class SparkTaskTest {
"--conf spark.executor.cores=2 " +
"--conf spark.executor.memory=1G " +
"--name spark " +
"/lib/dolphinscheduler-task-spark.jar");
"/lib/dolphinscheduler-task-spark.jar",
sparkTask.buildCommand());
}
private String buildSparkParametersWithSparkSql() {

Loading…
Cancel
Save