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 @Test
public void testGetCode() { public void testGetCode() {
Assertions.assertEquals(0, Status.SUCCESS.getCode()); 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 @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]; int[] operationType = new int[0];
IPage<AuditLog> logIPage = logMapper.queryAuditLog(page, resourceType, operationType, "", null, null); IPage<AuditLog> logIPage = logMapper.queryAuditLog(page, resourceType, operationType, "", null, null);
Assertions.assertNotEquals(logIPage.getTotal(), 0); Assertions.assertNotEquals(0, logIPage.getTotal());
} }
@Test @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(); DatasourceUser dataSourceUser = insertOne();
// query // query
List<DatasourceUser> dataSources = dataSourceUserMapper.selectList(null); 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() { public void testDeleteByUserId() {
DatasourceUser dataSourceUser = insertOne(); DatasourceUser dataSourceUser = insertOne();
int delete = dataSourceUserMapper.deleteByUserId(dataSourceUser.getUserId()); 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() { public void testDeleteByDatasourceId() {
DatasourceUser dataSourceUser = insertOne(); DatasourceUser dataSourceUser = insertOne();
int delete = dataSourceUserMapper.deleteByDatasourceId(dataSourceUser.getDatasourceId()); 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(); EnvironmentWorkerGroupRelation relation = insertOne();
List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations = List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations =
environmentWorkerGroupRelationMapper.queryByEnvironmentCode(1L); environmentWorkerGroupRelationMapper.queryByEnvironmentCode(1L);
Assertions.assertNotEquals(environmentWorkerGroupRelations.size(), 0); Assertions.assertNotEquals(0, environmentWorkerGroupRelations.size());
} }
@Test @Test
@ -91,13 +91,13 @@ public class EnvironmentWorkerGroupRelationMapperTest extends BaseDaoTest {
EnvironmentWorkerGroupRelation relation = insertOne(); EnvironmentWorkerGroupRelation relation = insertOne();
List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations = List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelations =
environmentWorkerGroupRelationMapper.queryByWorkerGroupName("default"); environmentWorkerGroupRelationMapper.queryByWorkerGroupName("default");
Assertions.assertNotEquals(environmentWorkerGroupRelations.size(), 0); Assertions.assertNotEquals(0, environmentWorkerGroupRelations.size());
} }
@Test @Test
public void testDeleteByCode() { public void testDeleteByCode() {
EnvironmentWorkerGroupRelation relation = insertOne(); EnvironmentWorkerGroupRelation relation = insertOne();
int i = environmentWorkerGroupRelationMapper.deleteByCode(1L, "default"); 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, null,
projectCodeArray); projectCodeArray);
Assertions.assertNotEquals(commandCounts.size(), 0); Assertions.assertNotEquals(0, commandCounts.size());
Assertions.assertNotEquals(commandCounts2.size(), 0); 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 @Test
public void testInsert() { public void testInsert() {
ProcessDefinitionLog processDefinitionLog = insertOne(); ProcessDefinitionLog processDefinitionLog = insertOne();
Assertions.assertNotEquals(processDefinitionLog.getId().intValue(), 0); Assertions.assertNotEquals(0, processDefinitionLog.getId().intValue());
} }
@Test @Test
@ -145,7 +145,7 @@ public class ProcessDefinitionLogMapperTest extends BaseDaoTest {
Page<ProcessDefinitionLog> page = new Page(1, 3); Page<ProcessDefinitionLog> page = new Page(1, 3);
IPage<ProcessDefinitionLog> processDefinitionLogs = IPage<ProcessDefinitionLog> processDefinitionLogs =
processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, 1L, 1L); processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, 1L, 1L);
Assertions.assertNotEquals(processDefinitionLogs.getTotal(), 0); Assertions.assertNotEquals(0, processDefinitionLogs.getTotal());
} }
@Test @Test
@ -153,7 +153,7 @@ public class ProcessDefinitionLogMapperTest extends BaseDaoTest {
insertOne(); insertOne();
Page<ProcessDefinitionLog> page = new Page(1, 3); Page<ProcessDefinitionLog> page = new Page(1, 3);
int processDefinitionLogs = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(1L, 1); int processDefinitionLogs = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(1L, 1);
Assertions.assertNotEquals(processDefinitionLogs, 0); Assertions.assertNotEquals(0, processDefinitionLogs);
} }
@Test @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"); insertOne("def 1");
// query // query
List<ProcessDefinition> dataSources = processDefinitionMapper.selectList(null); 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()); processDefinition.setUserId(user.getId());
processDefinitionMapper.insert(processDefinition); processDefinitionMapper.insert(processDefinition);
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(10L, "xxx"); 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); processDefinitionMapper.insert(processDefinition);
ProcessDefinition processDefinition1 = processDefinitionMapper.queryByDefineName(project.getCode(), "def 1"); 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()); processDefinition.setUserId(user.getId());
processDefinitionMapper.insert(processDefinition); processDefinitionMapper.insert(processDefinition);
ProcessDefinition definition = processDefinitionMapper.queryByDefineId(333); 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); Page<ProcessDefinition> page = new Page(1, 3);
IPage<ProcessDefinition> processDefinitionIPage = IPage<ProcessDefinition> processDefinitionIPage =
processDefinitionMapper.queryDefineListPaging(page, "def", 101, 1010L); 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() { public void testQueryAllDefinitionList() {
insertOne("def 1"); insertOne("def 1");
List<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryAllDefinitionList(1010L); 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(); projectCodes[0] = processDefinition.getProjectCode();
List<DefinitionGroupByUser> processDefinitions = List<DefinitionGroupByUser> processDefinitions =
processDefinitionMapper.countDefinitionByProjectCodes(projectCodes); processDefinitionMapper.countDefinitionByProjectCodes(projectCodes);
Assertions.assertNotEquals(processDefinitions.size(), 0); Assertions.assertNotEquals(0, processDefinitions.size());
} }
@Test @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(); ProcessInstanceMap processInstanceMap = insertOne();
// query // query
List<ProcessInstanceMap> dataSources = processInstanceMapMapper.selectList(null); 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 = List<Integer> subIds =
processInstanceMapMapper.querySubIdListByParentId(processInstanceMap.getParentProcessInstanceId()); 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(); ProcessInstance processInstance = insertOne();
// query // query
List<ProcessInstance> dataSources = processInstanceMapper.selectList(null); List<ProcessInstance> dataSources = processInstanceMapper.selectList(null);
Assertions.assertNotEquals(dataSources.size(), 0); Assertions.assertNotEquals(0, dataSources.size());
processInstanceMapper.deleteById(processInstance.getId()); processInstanceMapper.deleteById(processInstance.getId());
} }
@ -148,7 +148,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
List<ProcessInstance> processInstances = processInstanceMapper.queryByHostAndStatus(null, stateArray); List<ProcessInstance> processInstances = processInstanceMapper.queryByHostAndStatus(null, stateArray);
processInstanceMapper.deleteById(processInstance.getId()); 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(), processInstance.getHost(),
null, null,
null); null);
Assertions.assertNotEquals(processInstanceIPage.getTotal(), 0); Assertions.assertNotEquals(0, processInstanceIPage.getTotal());
processDefinitionMapper.deleteById(processDefinition.getId()); processDefinitionMapper.deleteById(processDefinition.getId());
processInstanceMapper.deleteById(processInstance.getId()); processInstanceMapper.deleteById(processInstance.getId());
@ -213,7 +213,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
processInstanceMapper.updateById(processInstance); processInstanceMapper.updateById(processInstance);
String host = processInstance.getHost(); String host = processInstance.getHost();
int update = processInstanceMapper.setFailoverByHostAndStateArray(host, stateArray); int update = processInstanceMapper.setFailoverByHostAndStateArray(host, stateArray);
Assertions.assertNotEquals(update, 0); Assertions.assertNotEquals(0, update);
processInstance = processInstanceMapper.selectById(processInstance.getId()); processInstance = processInstanceMapper.selectById(processInstance.getId());
Assertions.assertNull(processInstance.getHost()); Assertions.assertNull(processInstance.getHost());
@ -269,7 +269,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
List<ExecuteStatusCount> executeStatusCounts = List<ExecuteStatusCount> executeStatusCounts =
processInstanceMapper.countInstanceStateByProjectCodes(null, null, projectCodes); processInstanceMapper.countInstanceStateByProjectCodes(null, null, projectCodes);
Assertions.assertNotEquals(executeStatusCounts.size(), 0); Assertions.assertNotEquals(0, executeStatusCounts.size());
projectMapper.deleteById(project.getId()); projectMapper.deleteById(project.getId());
processDefinitionMapper.deleteById(processDefinition.getId()); processDefinitionMapper.deleteById(processDefinition.getId());
@ -308,7 +308,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
ProcessInstance processInstance1 = ProcessInstance processInstance1 =
processInstanceMapper.queryLastSchedulerProcess(processInstance.getProcessDefinitionCode(), null, null, processInstanceMapper.queryLastSchedulerProcess(processInstance.getProcessDefinitionCode(), null, null,
processInstance.getTestFlag()); processInstance.getTestFlag());
Assertions.assertNotEquals(processInstance1, null); Assertions.assertNotEquals(null, processInstance1);
processInstanceMapper.deleteById(processInstance.getId()); processInstanceMapper.deleteById(processInstance.getId());
} }
@ -329,7 +329,7 @@ public class ProcessInstanceMapperTest extends BaseDaoTest {
.queryLastRunningProcess(processInstance.getProcessDefinitionCode(), null, null, .queryLastRunningProcess(processInstance.getProcessDefinitionCode(), null, null,
processInstance.getTestFlag(), stateArray); processInstance.getTestFlag(), stateArray);
Assertions.assertNotEquals(processInstance1, null); Assertions.assertNotEquals(null, processInstance1);
processInstanceMapper.deleteById(processInstance.getId()); 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(); ProcessTaskRelationLog processTaskRelationLog = insertOne();
List<ProcessTaskRelationLog> processTaskRelationLogs = processTaskRelationLogMapper List<ProcessTaskRelationLog> processTaskRelationLogs = processTaskRelationLogMapper
.queryByProcessCodeAndVersion(1L, 1); .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() { public void testQueryByProcessCode() {
ProcessTaskRelation processTaskRelation = insertOne(); ProcessTaskRelation processTaskRelation = insertOne();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(1L, 1L); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(1L, 1L);
Assertions.assertNotEquals(processTaskRelations.size(), 0); Assertions.assertNotEquals(0, processTaskRelations.size());
} }
@Test @Test
public void testQueryByTaskCode() { public void testQueryByTaskCode() {
ProcessTaskRelation processTaskRelation = insertOne(); ProcessTaskRelation processTaskRelation = insertOne();
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCode(2L); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCode(2L);
Assertions.assertNotEquals(processTaskRelations.size(), 0); Assertions.assertNotEquals(0, processTaskRelations.size());
} }
@Test @Test
@ -73,14 +73,14 @@ public class ProcessTaskRelationMapperTest extends BaseDaoTest {
Long[] codes = Arrays.array(1L, 2L); Long[] codes = Arrays.array(1L, 2L);
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCodes(codes); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByTaskCodes(codes);
Assertions.assertNotEquals(processTaskRelations.size(), 0); Assertions.assertNotEquals(0, processTaskRelations.size());
} }
@Test @Test
public void testDeleteByCode() { public void testDeleteByCode() {
ProcessTaskRelation processTaskRelation = insertOne(); ProcessTaskRelation processTaskRelation = insertOne();
int i = processTaskRelationMapper.deleteByCode(1L, 1L); 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(); Project project = insertOne();
// query // query
List<Project> projects = projectMapper.selectList(null); 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); projectMapper.updateById(project);
Project project1 = projectMapper.queryDetailById(project.getId()); Project project1 = projectMapper.queryDetailById(project.getId());
Assertions.assertNotEquals(project1, null); Assertions.assertNotEquals(null, project1);
Assertions.assertEquals(project1.getUserName(), user.getUserName()); Assertions.assertEquals(project1.getUserName(), user.getUserName());
} }
@ -127,7 +127,7 @@ public class ProjectMapperTest extends BaseDaoTest {
projectMapper.updateById(project); projectMapper.updateById(project);
Project project1 = projectMapper.queryByName(project.getName()); Project project1 = projectMapper.queryByName(project.getName());
Assertions.assertNotEquals(project1, null); Assertions.assertNotEquals(null, project1);
} }
/** /**
@ -152,8 +152,8 @@ public class ProjectMapperTest extends BaseDaoTest {
page, page,
null, null,
project.getName()); project.getName());
Assertions.assertEquals(projectIPage.getTotal(), 1); Assertions.assertEquals(1, projectIPage.getTotal());
Assertions.assertEquals(projectIPage1.getTotal(), 1); Assertions.assertEquals(1, projectIPage1.getTotal());
} }
/** /**
@ -165,7 +165,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> projects = projectMapper.queryProjectCreatedByUser(project.getUserId()); 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()); 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( List<Project> projects = projectMapper.queryProjectExceptUserId(
100000); 100000);
Assertions.assertNotEquals(projects.size(), 0); Assertions.assertNotEquals(0, projects.size());
} }
@Test @Test
@ -213,7 +213,7 @@ public class ProjectMapperTest extends BaseDaoTest {
List<Project> allProject = projectMapper.queryAllProject(user.getId()); 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) { 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); 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(); ProjectUser projectUser = insertOne();
// query // query
List<ProjectUser> projectUsers = projectUserMapper.selectList(null); 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 projectUser = insertOne();
ProjectUser projectUser1 = ProjectUser projectUser1 =
projectUserMapper.queryProjectRelation(projectUser.getProjectId(), projectUser.getUserId()); 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(); Queue queue = insertOne();
// query // query
List<Queue> queues = queueMapper.selectList(null); 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); Page<Queue> page = new Page(1, 3);
IPage<Queue> queueIPage = queueMapper.queryQueuePaging(page, Collections.singletonList(queue.getId()), null); 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()); 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(); Queue queue = insertOne();
List<Queue> queues = queueMapper.queryAllQueueList(queue.getQueue(), null); List<Queue> queues = queueMapper.queryAllQueueList(queue.getQueue(), null);
Assertions.assertNotEquals(queues.size(), 0); Assertions.assertNotEquals(0, queues.size());
queues = queueMapper.queryAllQueueList(null, queue.getQueueName()); queues = queueMapper.queryAllQueueList(null, queue.getQueueName());
Assertions.assertNotEquals(queues.size(), 0); Assertions.assertNotEquals(0, queues.size());
} }
@Test @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(); ResourcesUser queue = insertOne();
// query // query
List<ResourcesUser> queues = resourceUserMapper.selectList(null); 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( int delete = resourceUserMapper.deleteResourceUser(
queue.getUserId(), queue.getUserId(),
queue.getResourcesId()); queue.getResourcesId());
Assertions.assertNotEquals(delete, 0); Assertions.assertNotEquals(0, delete);
} }
/** /**
@ -106,6 +106,6 @@ public class ResourceUserMapperTest extends BaseDaoTest {
int delete = resourceUserMapper.deleteResourceUserArray( int delete = resourceUserMapper.deleteResourceUserArray(
resourcesUser.getUserId(), resourcesUser.getUserId(),
resourceIdArray); 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(); Schedule schedule = insertOne();
// query // query
List<Schedule> schedules = scheduleMapper.selectList(null); 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); Page<Schedule> page = new Page(1, 3);
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineCodePaging(page, IPage<Schedule> scheduleIPage = scheduleMapper.queryByProcessDefineCodePaging(page,
processDefinition.getCode(), ""); 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); Page<Schedule> page = new Page(1, 3);
IPage<Schedule> scheduleIPage = scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, project.getCode(), IPage<Schedule> scheduleIPage = scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, project.getCode(),
processDefinition.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( List<Schedule> schedules = scheduleMapper.querySchedulerListByProjectName(
project.getName()); project.getName());
Assertions.assertNotEquals(schedules.size(), 0); Assertions.assertNotEquals(0, schedules.size());
} }
/** /**
@ -231,7 +231,7 @@ public class ScheduleMapperTest extends BaseDaoTest {
List<Schedule> schedules = List<Schedule> schedules =
scheduleMapper.selectAllByProcessDefineArray(new long[]{schedule.getProcessDefinitionCode()}); 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()); session.setLastLoginTime(new Date());
// update // update
int update = sessionMapper.updateById(session); 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() { public void testDelete() {
Session session = insertOne(); Session session = insertOne();
int delete = sessionMapper.deleteById(session.getId()); 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(); Session session = insertOne();
// query // query
List<Session> sessions = sessionMapper.selectList(null); 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() { public void testQueryByUserId() {
Session session = insertOne(); Session session = insertOne();
List<Session> sessions = sessionMapper.queryByUserId(session.getUserId()); 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 @Test
public void testInsert() { public void testInsert() {
TaskDefinitionLog taskDefinitionLog = insertOne(); TaskDefinitionLog taskDefinitionLog = insertOne();
Assertions.assertNotEquals(taskDefinitionLog.getId().intValue(), 0); Assertions.assertNotEquals(0, taskDefinitionLog.getId().intValue());
} }
@Test @Test
@ -65,7 +65,7 @@ public class TaskDefinitionLogMapperTest extends BaseDaoTest {
TaskDefinitionLog taskDefinitionLog = insertOne(); TaskDefinitionLog taskDefinitionLog = insertOne();
int version = taskDefinitionLogMapper int version = taskDefinitionLogMapper
.queryMaxVersionForDefinition(taskDefinitionLog.getCode()); .queryMaxVersionForDefinition(taskDefinitionLog.getCode());
Assertions.assertNotEquals(version, 0); Assertions.assertNotEquals(0, version);
} }
@Test @Test
@ -91,7 +91,7 @@ public class TaskDefinitionLogMapperTest extends BaseDaoTest {
TaskDefinitionLog taskDefinitionLog = insertOne(); TaskDefinitionLog taskDefinitionLog = insertOne();
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions); 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 @Test
public void testInsert() { public void testInsert() {
TaskDefinition taskDefinition = insertOne(); TaskDefinition taskDefinition = insertOne();
Assertions.assertNotEquals(taskDefinition.getId().intValue(), 0); Assertions.assertNotEquals(0, taskDefinition.getId().intValue());
} }
@Test @Test
@ -111,7 +111,7 @@ public class TaskDefinitionMapperTest extends BaseDaoTest {
TaskDefinition taskDefinition = insertOne(); TaskDefinition taskDefinition = insertOne();
List<TaskDefinition> taskDefinitions = List<TaskDefinition> taskDefinitions =
taskDefinitionMapper.queryAllDefinitionList(taskDefinition.getProjectCode()); 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 = List<DefinitionGroupByUser> users =
taskDefinitionMapper.countDefinitionGroupByUser(new Long[]{taskDefinition.getProjectCode()}); 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() { public void testListResources() {
TaskDefinition taskDefinition = insertOne(); TaskDefinition taskDefinition = insertOne();
List<Map<String, Object>> maps = taskDefinitionMapper.listResources(); 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()); TaskDefinition taskDefinition = insertOne(un.getId());
List<Map<String, Object>> maps = taskDefinitionMapper.listResourcesByUser(taskDefinition.getUserId()); 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() { public void testDeleteByCode() {
TaskDefinition taskDefinition = insertOne(); TaskDefinition taskDefinition = insertOne();
int i = taskDefinitionMapper.deleteByCode(taskDefinition.getCode()); 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 // query
List<TaskInstance> taskInstances = taskInstanceMapper.selectList(null); List<TaskInstance> taskInstances = taskInstanceMapper.selectList(null);
taskInstanceMapper.deleteById(taskInstance.getId()); 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(), task.getProcessInstanceId(),
TaskExecutionStatus.RUNNING_EXECUTION.getCode()); TaskExecutionStatus.RUNNING_EXECUTION.getCode());
taskInstanceMapper.deleteById(task.getId()); 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()); processInstance.getTestFlag());
taskInstanceMapper.deleteById(task2.getId()); taskInstanceMapper.deleteById(task2.getId());
taskInstanceMapper.deleteById(task.getId()); taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstances.size(), 0); Assertions.assertNotEquals(0, taskInstances.size());
Assertions.assertNotEquals(taskInstances1.size(), 0); Assertions.assertNotEquals(0, taskInstances1.size());
} }
/** /**
@ -207,7 +207,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
List<TaskInstance> taskInstances = taskInstanceMapper.queryByHostAndStatus( List<TaskInstance> taskInstances = taskInstanceMapper.queryByHostAndStatus(
task.getHost(), new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()}); task.getHost(), new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()});
taskInstanceMapper.deleteById(task.getId()); 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()}, new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()},
TaskExecutionStatus.NEED_FAULT_TOLERANCE); TaskExecutionStatus.NEED_FAULT_TOLERANCE);
taskInstanceMapper.deleteById(task.getId()); taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(setResult, 0); Assertions.assertNotEquals(0, setResult);
} }
/** /**
@ -248,7 +248,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
task.getProcessInstanceId(), task.getProcessInstanceId(),
task.getName()); task.getName());
taskInstanceMapper.deleteById(task.getId()); taskInstanceMapper.deleteById(task.getId());
Assertions.assertNotEquals(taskInstance, null); Assertions.assertNotEquals(null, taskInstance);
} }
/** /**
@ -268,7 +268,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
task.getProcessInstanceId(), task.getProcessInstanceId(),
task.getTaskCode()); task.getTaskCode());
taskInstanceMapper.deleteById(task.getId()); 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.getProcessInstanceId()),
Collections.singletonList(task.getTaskCode())); Collections.singletonList(task.getTaskCode()));
taskInstanceMapper.deleteById(task.getId()); 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()}); new int[]{task.getId()});
taskInstanceMapper.deleteById(task.getId()); taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.getId()); processDefinitionMapper.deleteById(definition.getId());
Assertions.assertEquals(countTask, 0); Assertions.assertEquals(0, countTask);
Assertions.assertEquals(countTask2, 0); Assertions.assertEquals(0, countTask2);
} }
@ -383,7 +383,7 @@ public class TaskInstanceMapperTest extends BaseDaoTest {
processInstanceMapper.deleteById(processInstance.getId()); processInstanceMapper.deleteById(processInstance.getId());
taskInstanceMapper.deleteById(task.getId()); taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.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(); Tenant tenant = insertOne();
// query // query
List<Tenant> tenants = tenantMapper.selectList(null); 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()); 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 = IPage<Tenant> tenantIPage =
tenantMapper.queryTenantPaging(page, Collections.singletonList(tenant.getId()), tenant.getTenantCode()); tenantMapper.queryTenantPaging(page, Collections.singletonList(tenant.getId()), tenant.getTenantCode());
Assertions.assertNotEquals(tenantIPage.getTotal(), 0); Assertions.assertNotEquals(0, tenantIPage.getTotal());
} }
public void testExistTenant() { 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(); UDFUser udfUser = insertOne();
// query // query
List<UDFUser> udfUserList = udfUserMapper.selectList(null); 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 // insertOne
UDFUser udfUser = insertOne(user, udfFunc); UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUserId(user.getId()); int delete = udfUserMapper.deleteByUserId(user.getId());
Assertions.assertEquals(delete, 1); Assertions.assertEquals(1, delete);
} }
@ -179,6 +179,6 @@ public class UDFUserMapperTest extends BaseDaoTest {
// insertOne // insertOne
UDFUser udfUser = insertOne(user, udfFunc); UDFUser udfUser = insertOne(user, udfFunc);
int delete = udfUserMapper.deleteByUdfFuncId(udfFunc.getId()); 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()}; Integer[] idArray = new Integer[]{udfFunc.getId(), udfFunc1.getId()};
// queryUdfByIdStr // queryUdfByIdStr
List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfByIdStr(idArray, ""); 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 = IPage<UdfFunc> udfFuncIPage =
udfFuncMapper.queryUdfFuncPaging(page, Collections.singletonList(udfFunc.getId()), ""); 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 // getUdfFuncByType
List<UdfFunc> udfFuncList = List<UdfFunc> udfFuncList =
udfFuncMapper.getUdfFuncByType(Collections.singletonList(udfFunc.getId()), udfFunc.getType().ordinal()); 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 udfFunc1 = insertOne(user1);
UdfFunc udfFunc2 = insertOne(user2); UdfFunc udfFunc2 = insertOne(user2);
List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfFuncExceptUserId(user1.getId()); 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); UDFUser udfUser = insertOneUDFUser(user, udfFunc);
// queryAuthedUdfFunc // queryAuthedUdfFunc
List<UdfFunc> udfFuncList = udfFuncMapper.queryAuthedUdfFunc(user.getId()); List<UdfFunc> udfFuncList = udfFuncMapper.queryAuthedUdfFunc(user.getId());
Assertions.assertNotEquals(udfFuncList.size(), 0); Assertions.assertNotEquals(0, udfFuncList.size());
} }
@Test @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.setUserName("user1_update");
user.setUserType(UserType.ADMIN_USER); user.setUserType(UserType.ADMIN_USER);
int update = userMapper.updateById(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(); User user = insertOne();
// delete // delete
int delete = userMapper.deleteById(user.getId()); 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(); User user = insertOne();
// query // query
List<User> userList = userMapper.selectList(null); 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(); User user = insertOne();
// queryAllGeneralUser // queryAllGeneralUser
List<User> userList = userMapper.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 // queryUserPaging
Page<User> page = new Page(1, 3); Page<User> page = new Page(1, 3);
IPage<User> userIPage = userMapper.queryUserPaging(page, user.getUserName()); 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 List<WorkFlowLineage> workFlowLineages = workFlowLineageMapper
.queryWorkFlowLineageByName(processDefinition.getProjectCode(), processDefinition.getName()); .queryWorkFlowLineageByName(processDefinition.getProjectCode(), processDefinition.getName());
Assertions.assertNotEquals(workFlowLineages.size(), 0); Assertions.assertNotEquals(0, workFlowLineages.size());
} }
@Test @Test
@ -122,7 +122,7 @@ public class WorkFlowLineageMapperTest extends BaseDaoTest {
List<ProcessLineage> workFlowLineages = List<ProcessLineage> workFlowLineages =
workFlowLineageMapper.queryProcessLineageByCode(processTaskRelation.getProjectCode(), workFlowLineageMapper.queryProcessLineageByCode(processTaskRelation.getProjectCode(),
processTaskRelation.getProcessDefinitionCode()); processTaskRelation.getProcessDefinitionCode());
Assertions.assertNotEquals(workFlowLineages.size(), 0); Assertions.assertNotEquals(0, workFlowLineages.size());
} }
@Test @Test
@ -132,7 +132,7 @@ public class WorkFlowLineageMapperTest extends BaseDaoTest {
insertOneProcessTaskRelation(); insertOneProcessTaskRelation();
List<ProcessLineage> workFlowLineages = List<ProcessLineage> workFlowLineages =
workFlowLineageMapper.queryProcessLineage(processDefinition.getProjectCode()); workFlowLineageMapper.queryProcessLineage(processDefinition.getProjectCode());
Assertions.assertNotEquals(workFlowLineages.size(), 0); Assertions.assertNotEquals(0, workFlowLineages.size());
} }
@Test @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 @Test
public void testDbType() { public void testDbType() {
Assertions.assertEquals(DbType.SNOWFLAKE.getCode(), 20); Assertions.assertEquals(20, DbType.SNOWFLAKE.getCode());
Assertions.assertEquals(DbType.SNOWFLAKE.getDescp(), "snowflake"); Assertions.assertEquals("snowflake", DbType.SNOWFLAKE.getDescp());
Assertions.assertEquals(DbType.of(20), DbType.SNOWFLAKE); Assertions.assertEquals(DbType.of(20), DbType.SNOWFLAKE);
Assertions.assertEquals(DbType.ofName("SNOWFLAKE"), 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)); KubeflowTask task = Mockito.spy(createTask(kubeflowParameters));
Mockito.when(task.runCommand(Mockito.anyString())).thenReturn("test_result"); Mockito.when(task.runCommand(Mockito.anyString())).thenReturn("test_result");
task.submitApplication(); task.submitApplication();
Assertions.assertNotEquals(task.getAppIds(), null); Assertions.assertNotEquals(null, task.getAppIds());
Assertions.assertEquals(task.getExitStatusCode(), TaskConstants.EXIT_CODE_SUCCESS); 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 sparkTask = Mockito.spy(new SparkTask(taskExecutionContext));
sparkTask.init(); sparkTask.init();
Assertions.assertEquals(sparkTask.buildCommand(), Assertions.assertEquals(
"${SPARK_HOME}/bin/spark-sql " + "${SPARK_HOME}/bin/spark-sql " +
"--master yarn " + "--master yarn " +
"--deploy-mode client " + "--deploy-mode client " +
@ -53,7 +53,8 @@ public class SparkTaskTest {
"--conf spark.executor.cores=2 " + "--conf spark.executor.cores=2 " +
"--conf spark.executor.memory=1G " + "--conf spark.executor.memory=1G " +
"--name sparksql " + "--name sparksql " +
"-f /tmp/5536_node.sql"); "-f /tmp/5536_node.sql",
sparkTask.buildCommand());
} }
@Test @Test
@ -66,7 +67,7 @@ public class SparkTaskTest {
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(parameters); Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(parameters);
SparkTask sparkTask = Mockito.spy(new SparkTask(taskExecutionContext)); SparkTask sparkTask = Mockito.spy(new SparkTask(taskExecutionContext));
sparkTask.init(); sparkTask.init();
Assertions.assertEquals(sparkTask.buildCommand(), Assertions.assertEquals(
"${SPARK_HOME}/bin/spark-submit " + "${SPARK_HOME}/bin/spark-submit " +
"--master yarn " + "--master yarn " +
"--deploy-mode client " + "--deploy-mode client " +
@ -77,7 +78,8 @@ public class SparkTaskTest {
"--conf spark.executor.cores=2 " + "--conf spark.executor.cores=2 " +
"--conf spark.executor.memory=1G " + "--conf spark.executor.memory=1G " +
"--name spark " + "--name spark " +
"/lib/dolphinscheduler-task-spark.jar"); "/lib/dolphinscheduler-task-spark.jar",
sparkTask.buildCommand());
} }
private String buildSparkParametersWithSparkSql() { private String buildSparkParametersWithSparkSql() {

Loading…
Cancel
Save