6666import org .apache .dolphinscheduler .dao .entity .UserWithWorkflowDefinitionCode ;
6767import org .apache .dolphinscheduler .dao .entity .WorkflowDefinition ;
6868import org .apache .dolphinscheduler .dao .entity .WorkflowTaskRelation ;
69- import org .apache .dolphinscheduler .dao .mapper .*;
69+ import org .apache .dolphinscheduler .dao .mapper .DataSourceMapper ;
70+ import org .apache .dolphinscheduler .dao .mapper .ProjectMapper ;
71+ import org .apache .dolphinscheduler .dao .mapper .ScheduleMapper ;
72+ import org .apache .dolphinscheduler .dao .mapper .TaskDefinitionLogMapper ;
73+ import org .apache .dolphinscheduler .dao .mapper .TaskDefinitionMapper ;
74+ import org .apache .dolphinscheduler .dao .mapper .UserMapper ;
75+ import org .apache .dolphinscheduler .dao .mapper .WorkflowDefinitionLogMapper ;
76+ import org .apache .dolphinscheduler .dao .mapper .WorkflowDefinitionMapper ;
77+ import org .apache .dolphinscheduler .dao .mapper .WorkflowTaskRelationMapper ;
7078import org .apache .dolphinscheduler .dao .model .PageListingResult ;
7179import org .apache .dolphinscheduler .dao .repository .TaskDefinitionLogDao ;
7280import org .apache .dolphinscheduler .dao .repository .WorkflowDefinitionDao ;
@@ -1268,18 +1276,16 @@ private List<TaskMainInfo> getTaskMainInfo() {
12681276 }
12691277
12701278 @ Test
1271- public void testImportWorkflowDefinitionWithoutProjectAuth (){
1279+ public void testImportWorkflowDefinitionWithoutProjectAuth () {
12721280 Project project = this .getProject (projectCode );
12731281 Map <String , Object > successResult = new HashMap <>();
12741282 putMsg (successResult , Status .SUCCESS );
12751283 MultipartFile file = new MockMultipartFile (
12761284 "file" , "" , "application/json" , "" .getBytes ());
1277-
12781285 Map <String , Object > checkProjectPermResult1 = new HashMap <>();
12791286 putMsg (checkProjectPermResult1 , Status .USER_NO_OPERATION_PROJECT_PERM );
12801287 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1281- when (projectService .checkProjectAndAuth (
1282- user , project , project .getCode (), WORKFLOW_IMPORT ))
1288+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_IMPORT ))
12831289 .thenReturn (checkProjectPermResult1 );
12841290 Map <String , Object > checkProjectPermResult = processDefinitionService .importWorkflowDefinition (
12851291 user , projectCode , file );
@@ -1288,15 +1294,13 @@ public void testImportWorkflowDefinitionWithoutProjectAuth(){
12881294 }
12891295
12901296 @ Test
1291- public void testImportWorkflowDefinitionWithEmptyFileContent (){
1297+ public void testImportWorkflowDefinitionWithEmptyFileContent () {
12921298 Project project = this .getProject (projectCode );
12931299 Map <String , Object > successResult = new HashMap <>();
12941300 putMsg (successResult , Status .SUCCESS );
12951301 MultipartFile file = new MockMultipartFile ("file" , "" , "application/json" , "" .getBytes ());
1296-
12971302 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1298- when (projectService .checkProjectAndAuth (
1299- user , project , project .getCode (), WORKFLOW_IMPORT ))
1303+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_IMPORT ))
13001304 .thenReturn (successResult );
13011305 Map <String , Object > result = processDefinitionService .importWorkflowDefinition (user , projectCode , file );
13021306 Assertions .assertEquals (Status .DATA_IS_NULL , result .get (Constants .STATUS ));
@@ -1310,8 +1314,7 @@ public void testImportWorkflowDefinitionWhenMissImportanceParams() throws URISyn
13101314 // miss workflowTaskRelationList
13111315 MultipartFile checkImportanceParamsFile = createMultipartFile ("workflowImport/check_importance_params.json" );
13121316 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1313- when (projectService .checkProjectAndAuth (
1314- user , project , project .getCode (), WORKFLOW_IMPORT ))
1317+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_IMPORT ))
13151318 .thenReturn (successResult );
13161319 Map <String , Object > checkImportanceParamsResult = processDefinitionService .importWorkflowDefinition (
13171320 user , projectCode , checkImportanceParamsFile );
@@ -1327,12 +1330,10 @@ public void testImportWorkflowDefinitionWhenNameExist() throws URISyntaxExceptio
13271330 Map <String , Object > verifyNameResult = new HashMap <>();
13281331 putMsg (verifyNameResult , Status .WORKFLOW_DEFINITION_NAME_EXIST );
13291332 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1330- when (projectService .checkProjectAndAuth (
1331- user , project , project .getCode (), WORKFLOW_IMPORT ))
1333+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_IMPORT ))
13321334 .thenReturn (successResult );
13331335 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1334- when (projectService .checkProjectAndAuth (
1335- user , project , project .getCode (), WORKFLOW_CREATE ))
1336+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_CREATE ))
13361337 .thenReturn (successResult );
13371338 WorkflowDefinition workflowDefinition = new WorkflowDefinition ();
13381339 workflowDefinition .setCode (2 );
@@ -1351,12 +1352,11 @@ public void testImportWorkflowDefinitionSuccessful() throws URISyntaxException,
13511352 putMsg (successResult , Status .SUCCESS );
13521353 MultipartFile successfulFile = createMultipartFile ("workflowImport/check_successful.json" );
13531354 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1354- when (projectService .checkProjectAndAuth (
1355- user , project , project . getCode (), ApiFuncIdentificationConstant .WORKFLOW_IMPORT ))
1356- .thenReturn (successResult );
1355+ when (projectService .checkProjectAndAuth (user , project , project . getCode (),
1356+ ApiFuncIdentificationConstant .WORKFLOW_IMPORT ))
1357+ .thenReturn (successResult );
13571358 when (projectMapper .queryByCode (projectCode )).thenReturn (project );
1358- when (projectService .checkProjectAndAuth (
1359- user , project , project .getCode (), WORKFLOW_CREATE ))
1359+ when (projectService .checkProjectAndAuth (user , project , project .getCode (), WORKFLOW_CREATE ))
13601360 .thenReturn (successResult );
13611361 when (workflowDefinitionMapper .verifyByDefineName (eq (projectCode ), anyString ()))
13621362 .thenReturn (null );
@@ -1383,8 +1383,7 @@ private MultipartFile createMultipartFile(String filePath) throws URISyntaxExcep
13831383 "file" ,
13841384 "" ,
13851385 "application/json" ,
1386- content
1387- );
1386+ content );
13881387 return multipartFile ;
13891388 }
13901389}
0 commit comments